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 | Large (long-context Opus) | 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.8 (its current default model) with large context windows. Install and authenticate:
# Install Claude Code (native installer, recommended)
curl -fsSL https://claude.ai/install.sh | bash
# Or via npm (needs Node 18+)
npm install -g @anthropic-ai/claude-code
# Authenticate: run claude and follow the browser prompt
claude
# 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
Put project context in a CLAUDE.md file at your repo root. Claude Code reads it automatically at the start of every session:
# Project notes
- Language: TypeScript, formatted with Prettier
- Tests: Vitest, in tests/
- Don't touch node_modules/ or dist/Machine-readable settings (tool permissions, env vars, hooks) go in .claude/settings.json. For example, to require approval before destructive tools run, configure permissions there.
Memory and context
Persistent project context lives in CLAUDE.md files, which Claude Code loads at the start of every session, plus an auto-memory store Claude updates itself based on your corrections and preferences. To give it lasting context, edit CLAUDE.md rather than passing a one-off "Remember:" prompt:
# CLAUDE.md
This is a monorepo. Shared code lives in packages/.Use the /clear command inside a session to reset the working context.
4) 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-sideCursor 3 added an Agents Window (open it with Cmd+Shift+P then "Agents Window") that runs multiple agents in parallel across local checkouts, git worktrees, and cloud environments. The /worktree command spins each agent into its own isolated git worktree, and /best-of-n runs the same task across several models so you can compare outputs side by side.
Rules 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 documentationCoding agent (issue to pull request)
# On GitHub:
1. Open a GitHub issue
2. Assign it to "Copilot" as the assignee
3. The coding agent works in the background:
analyzes the issue, edits files, runs tests
4. It opens a pull request for your reviewThis is distinct from Copilot's in-IDE agent mode, which works synchronously alongside you in VS Code or JetBrains.
Copilot now splits its autonomous work in two: agent mode runs synchronously inside your IDE (VS Code and JetBrains), deciding which files to edit, running terminal commands, and iterating on errors; the coding agent runs asynchronously in the cloud, taking an assigned issue and delivering a pull request while you work on something else.
Inline 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 oneRelated
- Ship a web game that loads fast
- Web Workers for game logic
- Game Jams & Hackathons — AI code tools are changing what's possible in a 48-hour jam
- Web Game Engines Comparison — picking an engine that pairs well with AI-assisted workflows