Agentic Workflows
Shift from line-by-line coding to system design while AI handles implementation.
What you'll accomplish
Understand how to effectively delegate implementation to AI while maintaining quality and control.
Prerequisites
- Understanding of context preservation tools
- Experience with spec-driven development
The Role Shift
Traditional coding: You write every line. AI assists with suggestions.
Agentic coding: You design systems. AI writes the implementation.
Traditional Agentic
─────────────────────────────────────────────────────────
You: Write code You: Define intent
AI: Autocomplete AI: Write code
You: Debug You: Verify correctness
AI: Suggest fixes AI: Fix issues
You: Run tests You: Review results
AI: — AI: Run tests, iterate
You: 100% implementation You: 20% design, 80% review
This isn't about abandoning control. It's about investing attention where it matters.
The Agentic Workflow
┌─────────────────────────────────────────────────────────────┐
│ │
│ 1. Define Intent │
│ Clear description of what should happen │
│ ↓ │
│ 2. Provide Context │
│ Specs, examples, constraints │
│ ↓ │
│ 3. Delegate Execution │
│ Let AI implement with autonomy │
│ ↓ │
│ 4. Verify Correctness │
│ Review, test, accept or iterate │
│ ↓ │
│ 5. Refine │
│ Fix issues, improve, repeat │
│ │
└─────────────────────────────────────────────────────────────┘
Step 1: Define Intent
Good intent statements are:
- Specific: What exactly should happen
- Bounded: Clear scope of work
- Testable: How to verify success
Bad intent:
Make the API better
Good intent:
Add rate limiting to the /api/messages endpoint:
- 100 requests per minute per user
- 10 requests per minute for anonymous
- Return 429 with Retry-After header when exceeded
- Log rate limit events to our analytics
Intent Templates
New Feature:
Implement [feature] that allows [users] to [action].
Behavior:
- When [trigger], [result]
- Edge case: [condition] → [handling]
Technical:
- Add to [location]
- Use [pattern/library]
- Follow [existing example]
Bug Fix:
Fix [issue] where [symptom].
Root cause: [explanation]
Expected: [correct behavior]
Actual: [current behavior]
Fix by: [approach]
Verify with: [test case]
Refactor:
Refactor [component] to [improvement].
Current: [description]
Target: [description]
Constraints: [what must not change]
Break into:
1. [step]
2. [step]
3. [step]
Step 2: Provide Context
The AI needs to understand:
- What exists (codebase, patterns, conventions)
- What to produce (specs, examples, constraints)
- What to avoid (anti-patterns, gotchas)
Context Layering
┌─────────────────────────────────────────────────────────────┐
│ Layer 1: Project Context (always present) │
│ AGENTS.md, architecture, conventions │
├─────────────────────────────────────────────────────────────┤
│ Layer 2: Task Context (per task) │
│ Relevant specs, related code, examples │
├─────────────────────────────────────────────────────────────┤
│ Layer 3: Execution Context (during work) │
│ Current file, test results, error messages │
└─────────────────────────────────────────────────────────────┘
Example prompt with layered context:
Implement the cart checkout feature per CHECKOUT_SPEC.md.
Project context:
- See AGENTS.md for conventions
- Follow patterns from /src/services/orderService.ts
- Use our existing Stripe integration in /src/lib/stripe
Task context:
- Cart state is in Zustand store (see /src/stores/cart.ts)
- Checkout flow diagram in /docs/ARCHITECTURE.md
- Price calculations in /src/services/pricingService.ts
Start with the API endpoint, then the service layer.
Step 3: Delegate Execution
Let the AI work autonomously. This means:
- Giving it permission to read files
- Allowing it to run commands
- Trusting it to make implementation decisions
Note
Autonomy doesn't mean absence of boundaries. Your specs and AGENTS.md define the boundaries. Within those, the AI operates freely.
Effective Delegation
Do:
Implement the user profile page. Read the existing
ProfileSettings component for patterns. Run tests
after implementation. Fix any linting errors.
Don't:
First read this file. Now read this one. Okay,
create a new file. Add this import. Now add this
function. Now add this line...
The first delegates. The second micromanages.
When to Intervene
Intervene when:
- The AI is heading in a wrong architectural direction
- Security concerns arise
- The approach conflicts with unstated constraints
- You spot a fundamental misunderstanding
Don't intervene for:
- Stylistic differences you can live with
- Approaches that work but differ from your mental model
- Issues the AI will catch when running tests
Step 4: Verify Correctness
Your primary job in agentic workflows: verify the output is correct.
Verification Checklist
Functional:
- Does it meet the spec requirements?
- Do edge cases work?
- Are errors handled correctly?
Technical:
- Does it follow project conventions?
- Is the code maintainable?
- Are there performance concerns?
Security:
- No exposed secrets?
- Input validated?
- Authorization checked?
Reading AI-Generated Code
Don't read line-by-line. Read strategically:
- Structure first: How is it organized?
- Public interface: What does it expose?
- Key logic: Where are the decisions?
- Edge cases: How are errors handled?
- Tests: What's being verified?
As you work with AI on a codebase:
Early sessions: Verify thoroughly. The AI doesn't know your patterns.
After context is established: Spot-check. Focus on novel parts.
With comprehensive specs: Trust the implementation, verify the tests.
Trust increases as context quality improves. This is intentional—your investment in specs and documentation pays off as reduced verification overhead.
Step 5: Refine
When issues arise:
Be specific about what's wrong:
# Bad
This doesn't work
# Good
The checkout fails when the cart has items
with quantity > 10. Error: "Invalid quantity"
from /src/services/cartService.ts:145
Provide debugging context:
The test at /tests/checkout.test.ts:89 fails.
Output: expected 200, got 400
Request payload was: { items: [...], coupon: "SAVE20" }
Suggest direction if you have one:
I think the issue is that the coupon validation
runs before the cart total is calculated.
Try reordering the operations in processCheckout().
Practical Patterns
Pattern 1: Spec-Execute-Verify
1. Write spec (20 min)
2. Ask AI to implement (5 min wait)
3. Review implementation (10 min)
4. Run tests, fix issues (10 min)
5. Done (45 min total)
Traditional: 3-4 hours for same feature
Pattern 2: Test-First Agentic
1. Write test cases (what should happen)
2. Ask AI to implement until tests pass
3. Review the implementation
4. Adjust tests or implementation as needed
The AI iterates on implementation until tests are green.
Pattern 3: Iterative Refinement
Session 1: Rough implementation
Session 2: Edge cases and error handling
Session 3: Performance optimization
Session 4: Final polish and documentation
Each session builds on the previous. Context compounds.
Pattern 4: Parallel Exploration
"Implement this feature two ways:
1. Using the existing Redux store
2. Using React Query
I want to compare approaches before committing."
Let the AI explore options. You make architectural decisions.
What You Focus On
With agentic workflows, your attention shifts:
| From | To |
|---|---|
| Writing syntax | Designing systems |
| Debugging typos | Verifying correctness |
| Remembering APIs | Defining contracts |
| Mechanical work | Creative decisions |
The New Developer Workflow
Morning:
- Review what was built yesterday
- Identify today's features
- Write specs for each
Midday:
- Delegate implementations
- Review as they complete
- Provide refinement feedback
Afternoon:
- Integration and testing
- Plan tomorrow's work
- Update system documents
You become an architect, reviewer, and technical director rather than a typist.
Common Mistakes
Frequently Asked Questions
This indicates missing context. If you're rewriting:
- Update AGENTS.md with the conventions the AI missed
- Provide clearer specs next time
- Reference existing code as examples
The goal: teach once, not repeatedly.
Architectural decisions belong to you. Either:
- Specify architecture in the spec upfront
- Intervene early when you see the wrong direction
- Add architectural constraints to AGENTS.md
Don't wait until implementation is complete to raise architectural concerns.
Start with read-only operations. Build trust incrementally:
- Read files only
- Run tests (safe)
- Run linting (safe)
- Run builds (mostly safe)
- File modifications (with review)
Most fears are unfounded after experiencing safe execution.
Initially, yes. The investment is:
- Upfront: Writing specs takes time
- Ongoing: Context documents need maintenance
- Learning: New workflow requires adjustment
The payoff comes from:
- Consistency across sessions
- Reduced re-explanation
- Parallel execution (AI works while you think)
- Compounding context
Track Complete!
You've completed the Best Practices track if you can:
Next: See these practices in action with real production systems.