Specification Compilation: Hybrid Workflow
Category: Guidelines
Status: Draft (Awaiting Approval)
Scope: Standardizing how functional specifications are compiled, reviewed, and finalized.
🎯 Objective
To define a clear methodology for choosing the right specification format (Gherkin vs. Use Case) and managing the "Verification Gate" between AI/Developer interpretations and Reality.
⚖️ Format Selection Matrix
| Logic Type | Target Format | Why? |
|---|---|---|
| Hidden Logic | Gherkin (.feature) | Best for complex state transitions, math/logic calculations, and automated regression potential. |
| User Workflow | Use Case (.md) | Best for describing human interaction steps, screen navigation, and administrative procedures. |
| Logic Mapping | Mapping (.mapping.md) | Best for traceability between Gherkin scenarios and specific legacy codebase references. |
🏗️ Folder Structure
docs/architecture/specs/
├── draft/ <-- Work-in-progress, unverified files
│ └── [module]/
├── current/ <-- Verified Single Source of Truth
│ └── [module]/
│ ├── dashboard_logic/ <-- Gherkin Files
│ └── user_tasks/ <-- Use Case Files
└── proposals/ <-- Major functional changes (Drafts)
🚀 The Compilation Workflow
1. Investigation
- Analyze the codebase for a specific feature (e.g., "Student Refund").
- Identify all
Transitionstates andBusiness Rules.
2. Compilation (Draft)
- Generate the initial
.featureor.mdfile inspecs/draft/[module]/. - Mandatory Header for AI-Generated content:
[!WARNING] AI-GENERATED DRAFT This specification is an interpretation of existing code. It has not yet been verified against domain expert knowledge.
3. Review & Verification
- Domain experts (Lead Dev/Creator) review the draft.
- Discrepancies between what the code does and what the business wants are documented.
- Decision Needed: Does the code match the intent?
- Yes: Proceed to Finalization.
- No: Document as a
BugorLogic Gapin the spec.
4. Finalization
- Relocate verified files to
specs/current/[module]/. - Remove the "Draft" warning.
- Update
metadata.jsonfor discovery.
🔗 Traceability Standard
Every specification must maintain a link to its technical implementation.
- Gherkin: Use [Tags] like
@Code:OrderController:Save - Use Case: Include a
Technical Implementationsection at the end.
Reference: Functional Strategy