Technical Spec & Design SOP
Produce a concise, implementable design with explicit contracts, failure modes, and verifiable acceptance criteria before writing production code.
Preconditions
- Target problem, user goal, or feature request is identified.
- Relevant repository files or system boundaries can be inspected.
Workflow
-
Ground in existing architecture first
- Inspect existing modules, schemas, APIs, configuration, and patterns in the codebase before proposing new abstractions.
- Reuse existing primitives and conventions unless a documented limitation requires introducing a new one.
-
Separate facts, assumptions, and open decisions
- List confirmed constraints vs. assumptions.
- Ask the user for clarification only when ambiguity materially changes behavior, external contracts, data models, or irreversible choices; otherwise record the chosen default and proceed.
-
Define explicit contracts and boundaries
- Specify inputs, outputs, data models/schemas, state transitions, and error semantics (status codes, error types, user-facing messages).
- Identify trust boundaries: authentication, authorization, input validation, rate limits, and sensitive data handling.
-
Enumerate edge cases and operational risks
- Address empty/null/boundary inputs, partial failures, timeouts, retries, idempotency, and concurrency races.
- For persistent state or public API changes, define backward compatibility, migration steps, and a rollback path.
-
Lock verifiable acceptance criteria and test plan
- Write concrete, testable acceptance criteria (not vague goals).
- Map each criterion and major failure mode to the test level that will verify it (unit, integration, end-to-end, or manual check).
-
Keep the spec proportional to scope
- A focused feature needs a short design note (interfaces, edge cases, acceptance criteria); reserve full architecture docs for cross-cutting or irreversible changes.
Load On Demand
Read Technical Spec & Risk Checklist when designing public APIs, persistent schema changes, concurrency/idempotency rules, or migration/rollback plans.
Verification Gate (Definition of Done)
- Design references real existing files, symbols, or boundaries rather than unverified assumptions.
- Public interfaces, data changes, and error behavior are unambiguous enough to implement without guessing.
- Key edge cases, security/data boundaries, and rollback considerations are explicitly covered.
- Every acceptance criterion is paired with a concrete verification method.
Failure Modes to Avoid
- Designing in a vacuum without reading the existing codebase first.
- Specifying only the happy path while ignoring error handling, retries, and migration/rollback.
- Over-engineering speculative abstractions for hypothetical future requirements.
- Starting implementation on ambiguous or irreversible decisions instead of resolving them upfront.