Saturngod-Inspired Repository Guide
A reusable pattern for a project-level AGENTS.md. Adapt it to facts in the repository and delete irrelevant sections. Precision matters more than length.
Principles
- Declare the source of truth for product scope and acceptance.
- Explain architecture and dependency direction concisely.
- Name trust boundaries and non-negotiable invariants.
- Provide exact setup, focused-check, full-check, and release commands.
- Separate handwritten, generated, migrated, and vendored code.
- State where tests belong and which contracts need regression coverage.
- Keep subsystem traps in scoped guides near their code.
- Require evidence before declaring completion.
Template
# Repository Guide
## Product and source of truth
- Purpose and users:
- Scope/plan:
- Definition of done:
- Progress tracker rule:
## Architecture
- Runtime/application shell:
- Modules and responsibilities:
- Dependency direction:
- Public API:
- Authoritative data/contracts:
## Trust boundaries and invariants
- Untrusted inputs:
- Authentication/authorization:
- Tenant/workspace isolation:
- Cross-process schemas:
- Secret/redaction policy:
- Forbidden generic capabilities:
- Values mirrored across services:
## Project structure
- Production code:
- UI/application shell:
- Tests:
- Resources:
- Generated code—do not hand-edit:
- Migrations/data:
## Commands
- Setup:
- Development:
- Focused test:
- Full tests:
- Format/lint/typecheck:
- Complete verification:
- Package/release:
## Coding conventions
- Language/framework idioms:
- Naming/formatting:
- Error handling:
- Concurrency/isolation:
- Reuse existing components and services before adding new ones.
## Testing
- Framework/location:
- Name tests after behavior.
- Add regression coverage for contracts, parsers/codecs, state transitions, controllers, and security changes.
- Visual behavior requires browser/device evidence.
## Generated code and migrations
- Regeneration command:
- Never hand-edit generated paths.
- Never modify an applied migration; append a forward migration.
## Operations
- Long-running processes:
- Configuration precedence:
- Retry/cleanup/observability:
- Deployment and rollback:
## Things an agent might get wrong
- [Non-obvious invariant and why]
- [Historical regression to avoid]
- [Plan statement differing from executable behavior]
## Completion report
Return the user-visible outcome, changed files, exact verification, boundary confirmation, generation/migration actions, compatibility impact, and remaining risks. Never commit, push, release, weaken permissions, or expose credentials unless explicitly authorized.Preferred dependency shape
flowchart LR
UI[Thin UI or application shell] --> API[Typed narrow boundary]
API --> DOMAIN[Domain/application logic]
DOMAIN --> PORTS[Interfaces and contracts]
PORTS --> ADAPTERS[External adapters]
ADAPTERS --> EXT[Database, provider, OS, network]
TESTS[Contract and regression tests] --> DOMAIN
Do not create these layers for a small script without real change pressure.
Verification ladder
- Smallest relevant test while iterating
- Formatter/linter/typecheck for touched languages
- Repository combined check
- Platform, E2E, or package check when crossing that boundary
- Browser/device/screenshot evidence for visual behavior
Scoped instruction files
Add a nested guide when a subsystem has an independent runtime, language, deployment, generated surface, security boundary, or dangerous gotchas. Link to root guidance and document only narrower facts.