Agentic AI code tools
AI coding assistants have evolved from simple autocomplete to autonomous agents that can plan, edit multiple files, run tests, and create pull requests. This tutorial covers the three major tools: Claude Code, Cursor, and GitHub Copilot.
1) What makes a tool "agentic"?
Traditional AI code completion suggests the next few lines. Agentic tools go further:
| Capability | Autocomplete | Agentic |
|---|---|---|
| Scope | Current line/function | Entire codebase |
| Planning | None | Multi-step reasoning |
| Execution | Suggestions only | Can edit files, run commands |
| Context | Current file | Full repo understanding |
| Workflow | Reactive | Autonomous task completion |
Agentic tools can understand your entire project structure, plan changes across multiple files, execute those changes, run tests, and iterate until the task is complete.
2) Quick comparison: Claude Code vs Cursor vs Copilot
| Feature | Claude Code | Cursor | GitHub Copilot |
|---|---|---|---|
| Interface | CLI, web, IDE plugins | Full IDE (VS Code fork) | IDE extensions |
| Context window | ~200K tokens | Full repo indexing | Smaller, improving |
| Multi-file edits | Strong | Excellent | Improving |
| Plan mode | Yes | Yes | Yes (newer) |
| Pricing | Pro/Max tiers | Credits + subscription | Subscription |
| Best for | Architecture, large refactors | Interactive development | Inline coding |
3) Claude Code fundamentals
Claude Code runs on Opus 4.5 with massive context windows. Install and authenticate:
# Install Claude Code CLI
npm install -g @anthropic/claude-code
# Authenticate
claude login
# Start in your project
cd your-project
claudeBasic commands
# Ask about your codebase
claude "How is authentication implemented here?"
# Generate code
claude "Add a rate limiter middleware"
# Multi-file refactor
claude "Rename UserService to AuthService across the codebase"
# Create a PR
claude "Create a PR that adds input validation to all API endpoints"Project configuration
Create .claude/config.json to set defaults:
{
"style": {
"language": "typescript",
"formatting": "prettier",
"testFramework": "vitest"
},
"context": {
"include": ["src/**/*", "tests/**/*"],
"exclude": ["node_modules", "dist"]
},
"safety": {
"requireApproval": ["delete", "git push"],
"dryRun": false
}
}Memory and context
Claude Code remembers across sessions. Use this effectively:
# Add project context
claude "Remember: this project uses a monorepo structure with packages/ for shared code"
# Reference previous work
claude "Continue the refactor we started yesterday"
# Clear context when switching projects
claude --clear-memory4) Cursor IDE agentic features
Cursor is built around agentic workflows. Key features:
Agent mode
Press Cmd+Shift+I (Mac) or Ctrl+Shift+I (Windows/Linux) to open Composer in Agent mode:
Agent mode workflow:
1. Describe your task
2. Agent creates a plan
3. You approve or modify
4. Agent executes changes
5. Review and iteratePlan mode
For complex tasks, explicitly use Plan mode:
@plan Add user authentication with:
- JWT tokens
- Refresh token rotation
- Password hashing with bcrypt
- Rate limiting on login attemptsThe agent will:
- Research your existing code
- Create a detailed implementation plan
- Wait for your approval
- Execute step-by-step
Context injection
Use @ to add specific context:
@file src/api/auth.ts
@folder src/middleware
@docs https://jwt.io/introduction
Implement JWT verification middleware following these patternsParallel agents
Run multiple agents simultaneously on different branches:
# In Cursor:
1. Open Command Palette
2. "Cursor: New Agent in Worktree"
3. Each agent works in isolation
4. Compare results side-by-sideRules for consistency
Create .cursor/rules/project.mdc:
# Project Rules
## Code Style
- Use TypeScript strict mode
- Prefer functional components
- Use named exports, not default
## Testing
- Every feature needs tests
- Use describe/it blocks
- Mock external services
## Security
- Never commit secrets
- Validate all user input
- Use parameterized queries5) GitHub Copilot agentic features
Copilot has evolved beyond autocomplete:
Copilot Chat
Open chat panel and use slash commands:
/explain - Explain selected code
/fix - Fix issues in selection
/tests - Generate tests
/doc - Add documentationAgent mode (Copilot Workspace)
# In VS Code with Copilot:
1. Open GitHub issue
2. Click "Open in Workspace"
3. Copilot analyzes the issue
4. Generates implementation plan
5. Creates code changes
6. Opens as PR draftInline suggestions with context
Copilot reads your codebase. Help it with comments:
// Authentication middleware that:
// - Extracts JWT from Authorization header
// - Validates token signature
// - Attaches user to request
// - Returns 401 if invalid
export function authMiddleware(req, res, next) {
// Copilot generates the implementation
}6) Best practices for all tools
Write clear prompts
❌ Bad: "Fix the bug"
✅ Good: "Fix the null pointer exception in UserService.getById
when the user doesn't exist. Return null instead of throwing."
❌ Bad: "Add tests"
✅ Good: "Add unit tests for the CartService covering:
- Adding items to empty cart
- Removing items
- Calculating totals with discounts
- Edge case: negative quantities"Use plan mode for complex tasks
For any task touching 3+ files, always:
1. Ask for a plan first
2. Review the plan
3. Approve or modify
4. Let the agent execute
5. Review changes before committingProvide architectural context
Before major work, brief the agent:
"This is a microservices architecture:
- api-gateway: Routes requests
- auth-service: JWT, sessions
- user-service: User CRUD
- notification-service: Email, push
Services communicate via Redis pub/sub.
Database is PostgreSQL with Prisma ORM."Test-driven development with agents
1. Write failing test first:
"Write a test for user registration that expects email validation"
2. Let agent see the failing test:
"Implement registration to make this test pass"
3. Iterate until green:
"Fix the remaining test failures"7) Security considerations
Agentic tools have real power. Set boundaries:
Approval gates
// .claude/config.json
{
"safety": {
"requireApproval": [
"rm",
"git push",
"npm publish",
"database migrations",
"env file changes"
]
}
}Sandboxing
# Run agents in isolated environments
docker run -v $(pwd):/workspace -it claude-sandbox
# Or use git worktrees for isolation
git worktree add ../feature-branch feature-branchSensitive files
# .cursorignore / .claudeignore
.env
.env.*
secrets/
credentials/
*.pem
*.keyReview all changes
# Before accepting agent changes:
git diff --stat
git diff
# Use interactive staging
git add -p
# Never auto-merge without review8) Workflow patterns that work
Pattern 1: Explore, Plan, Execute
Session 1: "How does the payment system work?"
→ Agent explores, you learn
Session 2: "What would it take to add Stripe?"
→ Agent creates plan
Session 3: "Implement the Stripe integration"
→ Agent executes planPattern 2: Parallel exploration
# In Cursor with parallel agents:
Agent 1: "Implement caching with Redis"
Agent 2: "Implement caching with Memcached"
Agent 3: "Implement caching with in-memory LRU"
→ Compare implementations, pick best approachPattern 3: Incremental migration
Step 1: "Identify all uses of deprecated API"
Step 2: "Create adapter for new API"
Step 3: "Migrate module A to use adapter"
Step 4: "Migrate module B..."
...
Step N: "Remove adapter, use new API directly"Pattern 4: Test-first feature development
1. "Write acceptance tests for user profile editing"
2. "Write unit tests for profile validation"
3. "Implement to pass the tests"
4. "Add integration tests"
5. "Refactor for clarity"9) When to use which tool
| Situation | Recommended Tool |
|---|---|
| Real-time coding, inline help | GitHub Copilot |
| Large refactors, architecture | Claude Code |
| Full development session | Cursor |
| Quick questions about code | Any chat interface |
| Creating PRs from issues | Copilot Workspace |
| Complex multi-file changes | Cursor Agent |
| API design, documentation | Claude Code |
| Learning new codebase | Cursor or Claude Code |
10) Measuring effectiveness
Track these metrics to evaluate agentic tools:
const metrics = {
// Productivity
suggestionsAccepted: 'percentage of suggestions you kept',
timeToFeature: 'hours from start to merged PR',
linesPerHour: 'code velocity (use carefully)',
// Quality
bugsIntroduced: 'defects traced to AI-generated code',
testCoverage: 'coverage of AI-generated code',
reviewChanges: 'how much you modify AI suggestions',
// Cost
apiCosts: 'monthly spend on AI tools',
creditsUsed: 'Cursor credits consumed',
// Learning
newPatternsLearned: 'techniques you picked up from AI',
codebaseUnderstanding: 'how well AI helped you learn',
}11) Common pitfalls
Over-trusting the agent
❌ Accepting large changes without review
❌ Letting agents run destructive commands
❌ Not understanding the code before shipping
✅ Review every change
✅ Understand what you ship
✅ Use agents as collaborators, not replacementsContext pollution
❌ Huge prompts with irrelevant context
❌ Not clearing context between unrelated tasks
❌ Including generated files in context
✅ Keep prompts focused
✅ Use specific @file references
✅ Exclude build artifactsPrompt ambiguity
❌ "Make it better"
❌ "Fix the issues"
❌ "Add some tests"
✅ "Reduce time complexity from O(n²) to O(n log n)"
✅ "Handle the null case on line 45 by returning early"
✅ "Add tests for edge cases: empty input, max length, unicode"12) Getting started checklist
## Setup Checklist
### Claude Code
- [ ] Install CLI: `npm install -g @anthropic/claude-code`
- [ ] Authenticate: `claude login`
- [ ] Create `.claude/config.json`
- [ ] Add `.claudeignore` for sensitive files
### Cursor
- [ ] Download from cursor.com
- [ ] Import VS Code settings
- [ ] Configure `.cursor/rules/`
- [ ] Learn `Cmd+Shift+I` for Agent mode
### GitHub Copilot
- [ ] Install extension in your IDE
- [ ] Enable Copilot Chat
- [ ] Try Copilot Workspace for issues
- [ ] Configure `.github/copilot-instructions.md`
### All Tools
- [ ] Set up approval gates for destructive operations
- [ ] Create ignore files for secrets
- [ ] Establish review workflow
- [ ] Track metrics from day one