Quality & Documentation
Testing and documentation are high-value agent use cases. Tests are self-validatingâyou immediately know if they work. Documentation is perpetually under-maintainedâagents reduce the friction dramatically.
Testing
Section titled âTestingâWhere agents excel
Section titled âWhere agents excelâUnit test generation â Given a function, agents generate comprehensive tests: happy path, edge cases (null, empty, boundaries), error conditions. This is probably the single highest-ROI application for most teams.
Test case discovery â âWhat test cases should I consider for this function? Focus on edge cases and error conditions.â Youâll often find cases you hadnât considered.
Mock and fixture generation â Test data structures, mock implementations, factory functions. Tedious setup is perfect for agents.
Regression tests â âCreate a test that would have caught this bug: [describe bug]â
What to watch for
Section titled âWhat to watch forâ- Tests that pass for wrong reasons â Tests that mock away the thing being tested, or have assertions that always pass
- Hallucinated assertions â Agents may assert behavior that doesnât match reality
- Copy-paste tests â Similar tests that donât add meaningful coverage
Always verify tests can fail when they should.
Test-first workflow
Section titled âTest-first workflowâ- Write or generate tests first: âGiven this requirement [describe], write tests that would verify correct implementation.â
- Review and refine: Ensure tests capture what you actually want.
- Generate implementation: âHere are the tests. Write code that makes them pass.â
- Verify everything: Run tests, review implementation, check for gaps.
This produces better results than implementation-first because tests define the contract.
Prompt patterns
Section titled âPrompt patternsâUnit tests:
Write unit tests for this function:[paste function]
Cover:- Normal operation- Edge cases (empty input, null, boundaries)- Error conditions
Use [test framework]. Follow conventions in [example file].Regression test:
Bug fixed: [description]Root cause: [explanation]Fix: [summary]
Write a test that would catch this bug if it returns.Documentation
Section titled âDocumentationâTypes and approaches
Section titled âTypes and approachesâCode documentation: Inline comments (explain the why), function/method docs, class/module docs. Agents excel here because they read code and infer what needs documenting.
API documentation: Endpoints, SDKs, integration guides. Generate from code, OpenAPI specs, or examples.
Architecture documentation: System overviews, decision records, diagrams. More human guidance needed, but agents help with generation.
What to watch for
Section titled âWhat to watch forâ- Hallucinated features â APIs that donât exist, parameters that donât work. Verify all claims against actual code.
- Missing context â Why decisions were made, gotchas, performance considerations. Add these manuallyâtheyâre often most valuable.
- Staleness risk â Easy to generate â easy to maintain. Build update processes, not just generation.
Prompt patterns
Section titled âPrompt patternsâREADME bootstrap:
Create a README for this project.
Project: [describe project]Tech stack: [list technologies]Target audience: [who will use this]
Include: installation, quick start, basic usage, contributing.API documentation:
Generate API documentation for this endpoint:
[paste endpoint code or OpenAPI spec]
Include: description, parameters, request/response examples, error codes.Format as Markdown.ADR:
Help me write an ADR for choosing [option].
Context: [describe situation]Decision: [what we decided]Consequences: [what this means]
Include alternatives considered.Resources
Section titled âResourcesâTesting
Section titled âTestingâ- The 3 Pillars of Autonomy â Michele Catasta, Replit - Automatic testing as foundation for agent autonomy
Documentation
Section titled âDocumentationâ- AGENTS.md - The emerging standard for agent-readable project documentation
- The New Code â Sean Grove, OpenAI - Specs as source of truth compiling to documentation