Agentic Coding
Let AI autonomously plan, write, test, and iterate on multi-file tasks
What Is Agentic Coding?
Traditional AI assistance is reactive — you prompt, it responds. Agentic coding flips that model: you describe a goal, and the AI agent autonomously plans steps, reads files, writes code, runs tests, and iterates until the task is done.
Claude Code, Cursor Composer, and Copilot Workspace all implement agentic coding with different strengths. Claude Code is the most powerful for terminal-native workflows.
Claude Code Agent Mode
Claude Code can autonomously explore your codebase, make multi-file edits, run shell commands, and iterate based on test output — all in one session.
# In your project directory: claude # Then describe the task: "Add a rate limiting middleware to the Express API. It should limit to 100 requests per IP per 15 minutes, return 429 with a Retry-After header when exceeded, and use Redis for distributed tracking across instances. Add unit tests for the middleware."
Claude Code reads your existing middleware files, package.json, and test structure before writing anything. It proposes a plan — you can approve or redirect.
# Claude Code shows each file change with a diff: # Created: src/middleware/rateLimiter.ts # Modified: src/app.ts (added middleware) # Created: tests/middleware/rateLimiter.test.ts # It then runs: npm test # If tests fail, it reads the error and iterates automatically
Use y to accept changes, n to reject, or type a correction to redirect the agent mid-task.
Cursor Composer for Multi-File Tasks
Cursor Composer (Cmd+I) is Cursor's agentic mode. It operates across multiple files and is excellent for UI-heavy tasks where you want to see changes in context.
# Example Composer prompts: "Create a settings page with tabs for Profile, Notifications, and Security. Each tab should load lazily. Use our existing Button and Input components from src/components/ui/" "Refactor the authentication flow to use React Query instead of local useState. Update all 4 auth-related components." "Add dark mode support. Create a ThemeContext, update globals.css with CSS variables, and add a toggle to the navbar."
Writing Effective Agent Prompts
Agentic tasks need more structure than chat prompts. Include:
# Template for effective agent prompts: "[TASK]: What to build or change [CONTEXT]: Relevant files, existing patterns, constraints [REQUIREMENTS]: Specific behavior, edge cases to handle [OUTPUT]: Where to put files, naming conventions, tests needed [DO NOT]: Things to avoid or leave unchanged" # Example: "TASK: Add CSV export to the user reports table CONTEXT: See src/components/ReportsTable.tsx for the table structure. Data comes from /api/reports endpoint returning UserReport[] REQUIREMENTS: - Export current filtered view (not full dataset) - Show download progress for large exports - Filename: reports_YYYY-MM-DD.csv OUTPUT: Add ExportButton component in src/components/ Add /api/reports/export endpoint in src/api/ Unit test for the endpoint DO NOT: Modify the existing table component"
Agentic Task Patterns That Work Well
Some task types are especially well-suited for agentic coding:
"Create a new blog module with model, API routes, and CRUD operations following the pattern in the existing products module."
"Migrate all API calls from the old axios wrapper to our new fetch client. Update all 12 service files."
"Add structured logging to every API route. Use the existing logger from src/lib/logger.ts. Log request method, path, status, and duration."
"Write comprehensive tests for every public function in src/utils/. Aim for 100% branch coverage. Use vitest, follow patterns in existing tests."
Staying in Control of Agents
Agentic AI is powerful but can go in unintended directions. Stay in control:
# Best practices for agentic workflows: # 1. Always start in a clean git state git status # should be clean before starting an agent task git checkout -b feat/ai-rate-limiter # work on a branch # 2. Review every file change before accepting # Never blindly 'accept all' without reading the diffs # 3. Run your own tests after the agent finishes npm test # verify nothing is broken beyond the target area # 4. Set scope boundaries in your prompt "Only modify files in src/middleware/. Do not change app.ts." # 5. Use checkpoints — commit working states git commit -m "chore: checkpoint before AI refactor"
Copilot Workspace (GitHub)
Copilot Workspace takes agentic coding to the PR level. From a GitHub Issue, it plans, implements, and opens a PR — all from the browser.
# Workflow: 1. Open a GitHub Issue describing the feature or bug 2. Click "Open in Copilot Workspace" 3. Copilot generates a plan (files to change, approach) 4. Review and edit the plan before execution 5. Copilot implements the changes across the repo 6. You review the diff and open a PR directly # Best for: # - Well-defined issues with clear acceptance criteria # - Teams using GitHub Issues as the source of truth # - Changes confined to a specific module or feature area
Describe a goal; AI plans, writes, runs tests, and iterates autonomously
Run claude in project dir, describe task — it reads files and makes multi-file edits
Cmd+I for multi-file agentic tasks; use @filename for context
TASK + CONTEXT + REQUIREMENTS + OUTPUT + DO NOT
Scaffolding, large refactors, cross-cutting concerns, bulk test generation
Clean git state, work on branch, review every diff, run tests yourself
GitHub Issues → plan → implement → PR, all in the browser