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