Generic specification template
Use this as a starting structure. Keep sections that apply, and mark non-applicable ones as N/A with a short rationale.
Document header
# <Spec title>
> **Document ID:** <SPEC-XXX or equivalent>
> **Version:** <major.minor.patch>
> **Last Updated:** <YYYY-MM-DD>
> **Status:** <Planned | Active | In Progress | Deprecated>
> **Parent/Owner:** <optional>1. Objective and context
- Problem statement.
- User/business outcome.
- Success criteria.
2. Scope
- In scope.
- Out of scope / non-goals.
- Assumptions and constraints.
3. Requirements
- Functional requirements with IDs (
REQ-001, etc.). - Edge cases and failure behavior.
- Acceptance criteria per requirement.
4. Interfaces and contracts
- API/interface definitions.
- Request/response/event schemas.
- Error contract and retry behavior.
- Versioning and backward compatibility.
Machine-checkable contract block
Use this subsection for external, generated, AI-facing, or verifier-owned contracts.
- Canonical tokens/enums/identifiers/versions.
- Predicate or mapping tables.
- App-owned envelope versus model/user/service/generated output.
- Validator order, fail-closed behavior, retry/idempotency, and forbidden silent discard.
- Redaction and observability rules for logs, traces, QA artifacts, and analytics.
- Publication gates and rollout state.
- Exact boundary-proof cases.
5. Data and state
- Data entities and relationships.
- State machine or lifecycle transitions.
- Retention, consistency, and deletion rules.
6. Non-functional requirements
- Performance targets.
- Reliability/SLA/SLO expectations.
- Scalability limits.
- Observability (logs, metrics, traces, alerts).
7. Security, privacy, and compliance
- AuthN/AuthZ model.
- Secret handling.
- PII/data classification and minimization.
- Regulatory/compliance requirements.
8. Implementation status and plan
- Implemented / in progress / planned breakdown.
- Implementation map naming the canonical files or directories to edit and adjacent paths that must remain untouched when work spans existing code.
- Dependencies and sequencing.
- Rollout and rollback strategy.
9. Verification and completion
- Verification playbook (commands and manual checks).
- Requirement-to-test mapping table.
- Requirement-to-verifier binding table with stable IDs.
- Completion criteria with pass/fail outcomes.
10. Risks and open questions
- Known risks with mitigation.
- Open questions with decision owner and due date.
Document history
| Version | Date | Author | Changes |
|---|---|---|---|
| 0.1.0 | YYYY-MM-DD | <name> | Initial draft |
Related documents
- Links to upstream specs, ADRs, operational runbooks, and tickets.