Working with Agents
The biggest mistake new agentic engineers make: asking for too much at once.
Why decomposition matters
Section titled âWhy decomposition mattersâAgents work best with bounded, clear tasks. When you ask for too much:
- Context overflows and early details get lost
- Errors compound as later steps build on earlier mistakes
- Recovery from failures wastes everything before
Small tasks mean faster feedback, easier debugging, better results.
The three-part rule
Section titled âThe three-part ruleâBefore prompting, ask: Can I describe this in three parts?
- What â The specific outcome I want
- Where â Which files/functions to touch
- Constraints â What not to change
If you canât articulate all three, the task is probably too big.
Decomposition strategies
Section titled âDecomposition strategiesâVertical slicing
Section titled âVertical slicingâCut by feature path, not technical layer.
Instead of:
- âCreate the database schemaâ
- âBuild the API endpointsâ
- âCreate the frontend formsâ
Try:
- âCreate user creation flow: schema, endpoint, and basic formâ
- âAdd user editing: update endpoint and formâ
- âAdd user deletion: endpoint with confirmationâ
Each slice is complete and testable.
Dependency ordering
Section titled âDependency orderingâWhen tasks have dependencies, make them explicit:
- Define the data model types (no external deps)
- Build the storage layer (depends on types)
- Create the API (depends on storage)
- Build the UI (depends on API)
Each step should work in isolation before moving on.
Sizing tasks
Section titled âSizing tasksâToo small: âAdd a semicolon to line 47â â faster to do yourself
Too big: âBuild the authentication systemâ â too many decisions
Just right: âCreate a login form that posts to /api/auth/login and stores the token in localStorageâ â clear scope, testable result
The prompt template
Section titled âThe prompt templateâTask: [What you want done]
Context:- [Relevant background]- [Related files or patterns to follow]
Constraints:- [What not to change]- [Patterns to follow]
Success criteria:- [How you'll know it's done]Validating output
Section titled âValidating outputâAgent output looks plausible. Thatâs the danger. Treat agent code like code from a talented junior: probably works for the happy path, might miss edge cases, may not follow your conventions.
Validation checklist
Section titled âValidation checklistâ1. Does it solve the problem? Read the codeâdonât just run it. Does it address the actual requirement, not just the prompt?
2. Check the edges:
- Empty inputs
- Null/undefined values
- Boundary conditions (off-by-one, max values)
- Error cases
- Concurrent access
3. Look for hallucinations:
- API methods that donât exist
- Parameters that donât work as assumed
- Functions called with wrong signatures
If somethingâs unfamiliar, verify it exists.
4. Security review:
- Input validation present?
- No SQL/command injection?
- Auth/authorization checked?
- Sensitive data not logged?
- No hardcoded secrets?
5. Style and conventions:
- Follows existing patterns?
- Names clear and consistent?
- Error messages helpful?
When to reject
Section titled âWhen to rejectâReject when:
- Approach is fundamentally wrong (even if it works)
- Too much refactoring needed to meet standards
- Security issues requiring redesign
Accept with modifications when:
- Logic sound but style needs adjustment
- Minor edge case handling needed
Accept as-is when:
- Meets requirements, handles edges, follows conventions, passes security check
Resources
Section titled âResourcesâEssential
Section titled âEssentialâ- Embracing the parallel coding agent lifestyle - Running multiple agents simultaneously
- Spec-Driven Development â Al Harris, Amazon Kiro - How specs enable reproducible AI delivery
- Your job is to deliver code you have proven to work - Why testing AI code is non-negotiable
Deep dives
Section titled âDeep divesâ- Spec Kit - GitHubâs framework for spec-driven development
- âI shipped code I donât understandâ â Jake Nations, Netflix - Three-phase methodology to avoid âvibecoding to disasterâ
- No Vibes Allowed â Dex Horthy, HumanLayer - Frequent intentional compaction for large codebases