Exhaustive Specification Writing
Write exhaustive specifications for autonomous AI systems that leave nothing to chance. Create specs so detailed that a blind person could visualize the entire system. Uses _prompt.md for consistency and _index.md for tracking - context can be lost and restored without losing spec direction.
When to use me
Use this skill when:
- You need specifications for autonomous AI agents to build complete systems without human intervention
- Current AI-generated specs are insufficiently detailed and leave critical aspects ambiguous
- You're building complex systems where every detail matters
- You want specs that survive context loss through
_prompt.md and _index.md
- You need to map out ALL spec types before writing begins
Core Architecture
flowchart TB
subgraph "Initialization"
START[Start Project] --> MAP[Map Spec Types]
MAP --> PROMPT[Create _prompt.md]
MAP --> INDEX[Create _index.md]
MAP --> TEMPLATES[Create Templates]
end
subgraph "Specification Files"
PROMPT --> |"Defines Detail Level"| SPECS[Spec Files]
INDEX --> |"Tracks Progress"| SPECS
TEMPLATES --> |"Provides Structure"| SPECS
end
subgraph "Context Recovery"
LOST[Context Lost] --> READ[Read _prompt.md]
READ --> READ2[Read _index.md]
READ2 --> RESUME[Resume Writing]
end
Three Core Files
1. _prompt.md - The Base Prompt
The canonical prompt that defines the level of detail for ALL specs. Every spec generated uses this as the foundation.
Location: specs/_prompt.md
Purpose:
- Ensures consistent detail level across all specs
- Survives context loss - new sessions read this to maintain quality
- Defines the "exhaustive standard" for the project
# Exhaustive Specification Prompt
## Detail Level Standard
**BLIND-PERSON VISUALIZATION**: Write specs so detailed that someone who cannot see can fully visualize the system. Every UI element, animation, color, interaction must be described in prose.
**NO ASSUMPTIONS**: Every decision must be explicit. Never write "as discussed" or "standard practice". Define everything.
**EXHAUSTIVE COVERAGE**:
- Happy path + ALL error paths
- All edge cases enumerated
- All timing, sizing, spacing specified
- All states and transitions documented
- All data transformations explained
## Writing Standards
### For UI/UX Specs
- Exact pixel dimensions, colors (hex codes), fonts
- Animation timing (ms), easing functions
- Responsive breakpoints
- Accessibility requirements (WCAG level)
- Error states, loading states, empty states
### For API Specs
- Request/response schemas with examples
- All error codes with causes and resolutions
- Rate limits, timeouts, retry behavior
- Authentication/authorization for each endpoint
- Idempotency requirements
### For Database Specs
- Complete schema with constraints
- Index strategy and rationale
- Query patterns with example queries
- Migration strategies
- Backup/recovery procedures
### For Logic Specs
- Step-by-step algorithms
- Decision trees for all branches
- Input validation at each step
- State machines with all transitions
- Error handling at each step
## Structure Template
Every spec follows this structure:
1. **Overview** - What this component does
2. **Dependencies** - What it requires
3. **Interface** - How it interacts with other components
4. **Behavior** - Detailed logic (happy path + error paths)
5. **Data** - Data structures, schemas
6. **States** - All possible states and transitions
7. **Errors** - All error conditions and handling
8. **Testing** - Test cases to validate
9. **Security** - Security considerations
10. **Performance** - Performance requirements
## Quality Gates
Before marking any spec complete:
- [ ] Can a blind person visualize this from the description?
- [ ] Is every assumption explicitly stated?
- [ ] Are all error paths documented?
- [ ] Are all edge cases enumerated?
- [ ] Is there an example for every data structure?
- [ ] Are all timings/sizings specified with units?
2. _index.md - The Spec Index
Tracks all specs in the system with status, dependencies, and completeness.
Location: specs/_index.md
Purpose:
- Single source of truth for what specs exist
- Tracks completion status
- Maps dependencies between specs
- Enables context recovery - know exactly what to continue
# Specification Index
**Project**: [Project Name]
**Last Updated**: YYYY-MM-DD
**Total Specs**: 12
**Completed**: 8
**In Progress**: 2
**Pending**: 2
## Spec Registry
| ID | Spec File | Category | Status | Dependencies | Lines | Last Modified |
|----|-----------|----------|--------|--------------|-------|---------------|
| S01 | 01-system-overview.md | Core | ✅ Complete | None | 1,234 | 2026-03-24 |
| S02 | 02-ui-main.md | UI | ✅ Complete | S01 | 3,456 | 2026-03-24 |
| S03 | 03-ui-modals.md | UI | 🔄 In Progress | S01, S02 | 892 | 2026-03-24 |
| S04 | 04-api-auth.md | API | ✅ Complete | S01 | 2,345 | 2026-03-23 |
| S05 | 05-api-users.md | API | ✅ Complete | S01, S04 | 1,876 | 2026-03-23 |
| S06 | 06-api-orders.md | API | 🔄 In Progress | S01, S05 | 456 | 2026-03-24 |
| S07 | 07-database-schema.md | Database | ✅ Complete | S01 | 2,789 | 2026-03-22 |
| S08 | 08-database-migrations.md | Database | ✅ Complete | S07 | 987 | 2026-03-22 |
| S09 | 09-security.md | Security | ✅ Complete | S01, S04, S07 | 1,567 | 2026-03-21 |
| S10 | 10-deployment.md | Operations | ⏳ Pending | All | 0 | - |
| S11 | 11-performance.md | Operations | ⏳ Pending | S02, S05, S07 | 0 | - |
| S12 | 12-testing.md | QA | ✅ Complete | All | 4,567 | 2026-03-24 |
## Dependency Graph
S01 (Overview)
├── S02 (UI Main) ──┬── S03 (UI Modals)
│ │
├── S04 (API Auth) ─┼── S05 (API Users) ──┬── S06 (API Orders)
│ │ │
├── S07 (DB Schema) ─┼── S08 (DB Migrations)
│ │
├── S09 (Security) ─┘
│
└── S10 (Deployment) [needs all]
└── S11 (Performance) [needs S02, S05, S07]
S12 (Testing) [needs all]
## Categories
### Core (1 spec)
- [x] S01: System Overview
### UI (2 specs)
- [x] S02: Main UI
- [ ] S03: Modal Components (in progress)
### API (3 specs)
- [x] S04: Authentication API
- [x] S05: Users API
- [ ] S06: Orders API (in progress)
### Database (2 specs)
- [x] S07: Database Schema
- [x] S08: Migrations
### Security (1 spec)
- [x] S09: Security Specification
### Operations (2 specs)
- [ ] S10: Deployment (pending)
- [ ] S11: Performance (pending)
### QA (1 spec)
- [x] S12: Testing Strategy
## Next Actions
1. Complete S03: UI Modals (blocking: S03)
2. Complete S06: Orders API (blocking: S06)
3. Start S10: Deployment (blocked by: S03, S06)
4. Start S11: Performance (blocked by: S03, S06)
5. Update S12: Testing after all specs complete
## Notes
- S03 blocked on modal animation specs
- S06 needs error handling for order states
- S12 needs to be updated after S10, S11 complete
3. Spec Type Templates
Pre-defined templates for each spec type ensure nothing is missed.
Spec Type Mapping
Tier 1: Foundation Specs (Start Here)
| ID |
Spec Type |
Purpose |
Template File |
| S01 |
System Overview |
Project purpose, architecture, success criteria |
templates/01-system-overview.md |
| S02 |
Domain Model |
Entities, value objects, aggregates |
templates/02-domain-model.md |
| S03 |
Glossary |
Terms, definitions, domain language |
templates/03-glossary.md |
Tier 2: UI/UX Specs
| ID |
Spec Type |
Purpose |
Template File |
| U01 |
UI Layout |
Page layouts, components, responsive |
templates/u01-ui-layout.md |
| U02 |
UI Flows |
User journeys, state transitions |
templates/u02-ui-flows.md |
| U03 |
UI Components |
Buttons, forms, modals, cards |
templates/u03-ui-components.md |
| U04 |
UI Animations |
Transitions, micro-interactions |
templates/u04-ui-animations.md |
| U05 |
UI Accessibility |
ARIA, keyboard nav, screen readers |
templates/u05-ui-accessibility.md |
| U06 |
UI Error States |
Validation, error messages, recovery |
templates/u06-ui-error-states.md |
Tier 3: API Specs
| ID |
Spec Type |
Purpose |
Template File |
| A01 |
API Overview |
Endpoints summary, versioning, authentication |
templates/a01-api-overview.md |
| A02 |
API Authentication |
Auth flows, token management |
templates/a02-api-auth.md |
| A03 |
API Resources |
CRUD endpoints for each resource |
templates/a03-api-resources.md |
| A04 |
API Errors |
Error codes, messages, recovery |
templates/a04-api-errors.md |
| A05 |
API Rate Limiting |
Throttling, quotas, backoff |
templates/a05-api-rate-limiting.md |
| A06 |
API Webhooks |
Events, payloads, retry logic |
templates/a06-api-webhooks.md |
Tier 4: Data Specs
| ID |
Spec Type |
Purpose |
Template File |
| D01 |
Database Schema |
Tables, columns, constraints, indexes |
templates/d01-database-schema.md |
| D02 |
Database Queries |
Query patterns, optimization |
templates/d02-database-queries.md |
| D03 |
Database Migrations |
Version history, upgrade paths |
templates/d03-database-migrations.md |
| D04 |
Data Validation |
Input validation, sanitization |
templates/d04-data-validation.md |
| D05 |
Data Retention |
Archival, deletion, compliance |
templates/d05-data-retention.md |
Tier 5: Business Logic Specs
| ID |
Spec Type |
Purpose |
Template File |
| B01 |
Business Rules |
Invariants, constraints, calculations |
templates/b01-business-rules.md |
| B02 |
State Machines |
Entity states, transitions, guards |
templates/b02-state-machines.md |
| B03 |
Workflows |
Multi-step processes, orchestration |
templates/b03-workflows.md |
| B04 |
Calculations |
Formulas, algorithms, rounding |
templates/b04-calculations.md |
| B05 |
Notifications |
Email, push, in-app alerts |
templates/b05-notifications.md |
Tier 6: Cross-Cutting Specs
| ID |
Spec Type |
Purpose |
Template File |
| X01 |
Security |
AuthZ, encryption, vulnerabilities |
templates/x01-security.md |
| X02 |
Logging |
Events, levels, formats, retention |
templates/x02-logging.md |
| X03 |
Monitoring |
Metrics, dashboards, alerts |
templates/x03-monitoring.md |
| X04 |
Error Handling |
Global error handling, recovery |
templates/x04-error-handling.md |
| X05 |
Configuration |
Env vars, feature flags, secrets |
templates/x05-configuration.md |
Tier 7: Operations Specs
| ID |
Spec Type |
Purpose |
Template File |
| O01 |
Deployment |
CI/CD, environments, rollbacks |
templates/o01-deployment.md |
| O02 |
Infrastructure |
Servers, containers, networking |
templates/o02-infrastructure.md |
| O03 |
Performance |
Benchmarks, load testing, SLAs |
templates/o03-performance.md |
| O04 |
Backup & Recovery |
Backups, disaster recovery |
templates/o04-backup-recovery.md |
| O05 |
Runbooks |
Incident response, maintenance |
templates/o05-runbooks.md |
Tier 8: Quality Specs
| ID |
Spec Type |
Purpose |
Template File |
| Q01 |
Test Strategy |
Coverage, types, automation |
templates/q01-test-strategy.md |
| Q02 |
Test Cases |
Specific test scenarios |
templates/q02-test-cases.md |
| Q03 |
Acceptance Criteria |
Definition of done |
templates/q03-acceptance-criteria.md |
| Q04 |
Quality Gates |
Review checkpoints |
templates/q04-quality-gates.md |
Tier 9: Integration Specs
| ID |
Spec Type |
Purpose |
Template File |
| I01 |
Third-Party Integrations |
External service contracts, SLAs |
templates/i01-integrations.md |
| I02 |
API Versioning |
Version strategy, deprecation policy |
templates/i02-api-versioning.md |
| I03 |
Feature Flags |
Rollout strategies, kill switches |
templates/i03-feature-flags.md |
| I04 |
Webhook Receivers |
Inbound webhooks, verification |
templates/i04-webhook-receivers.md |
| I05 |
Event Schema Registry |
Event schemas, versioning |
templates/i05-event-schema.md |
Tier 10: Mobile Specs
| ID |
Spec Type |
Purpose |
Template File |
| M01 |
Mobile Overview |
Platform-specific considerations |
templates/m01-mobile-overview.md |
| M02 |
Mobile Navigation |
Screen flows, gestures |
templates/m02-mobile-navigation.md |
| M03 |
Mobile Components |
Native UI components |
templates/m03-mobile-components.md |
| M04 |
Mobile Offline |
Sync strategies, conflict resolution |
templates/m04-mobile-offline.md |
| M05 |
Push Notifications |
Push specs, delivery handling |
templates/m05-push-notifications.md |
Tier 11: AI/ML Specs
| ID |
Spec Type |
Purpose |
Template File |
| AI01 |
Model Cards |
Model purpose, limitations, biases |
templates/ai01-model-cards.md |
| AI02 |
Training Pipelines |
Data ingestion, preprocessing |
templates/ai02-training-pipelines.md |
| AI03 |
Model Serving |
Inference endpoints, versioning |
templates/ai03-model-serving.md |
| AI04 |
Feature Engineering |
Feature definitions, transformations |
templates/ai04-feature-engineering.md |
| AI05 |
Model Monitoring |
Drift detection, retraining triggers |
templates/ai05-model-monitoring.md |
Tier 12: DevOps/SRE Specs
| ID |
Spec Type |
Purpose |
Template File |
| SRE01 |
SLIs/SLOs/SLAs |
Service level definitions |
templates/sre01-slo.md |
| SRE02 |
Incident Management |
Incident response procedures |
templates/sre02-incidents.md |
| SRE03 |
On-Call Procedures |
On-call rotation, escalation |
templates/sre03-oncall.md |
| SRE04 |
Chaos Engineering |
Failure injection, resilience tests |
templates/sre04-chaos.md |
| SRE05 |
Capacity Planning |
Growth projections, scaling |
templates/sre05-capacity.md |
Tier 13: Localization Specs
| ID |
Spec Type |
Purpose |
Template File |
| L01 |
Locale Support |
Supported locales, fallback chains |
templates/l01-locale-support.md |
| L02 |
String Management |
Translation keys, placeholders |
templates/l02-string-management.md |
| L03 |
Cultural Adaptation |
Date/time formats, RTL support |
templates/l03-cultural-adaptation.md |
| L04 |
Content Localization |
Images, colors, cultural considerations |
templates/l04-content-localization.md |
Tier 14: Data Engineering Specs
| ID |
Spec Type |
Purpose |
Template File |
| DE01 |
Data Pipelines |
ETL/ELT workflows |
templates/de01-data-pipelines.md |
| DE02 |
Data Quality |
Validation, cleansing, profiling |
templates/de02-data-quality.md |
| DE03 |
Data Lineage |
Source tracking, impact analysis |
templates/de03-data-lineage.md |
| DE04 |
Data Governance |
Data catalog, ownership, retention |
templates/de04-data-governance.md |
| DE05 |
Caching Strategy |
Cache levels, invalidation, TTL |
templates/de05-caching-strategy.md |
Tier 15: Real-Time Specs
| ID |
Spec Type |
Purpose |
Template File |
| RT01 |
WebSocket Connections |
Connection lifecycle, auth |
templates/rt01-websockets.md |
| RT02 |
Real-Time Events |
Event types, subscriptions |
templates/rt02-realtime-events.md |
| RT03 |
Presence & Status |
Online/offline, typing indicators |
templates/rt03-presence.md |
| RT04 |
Collaboration |
Concurrent editing, conflict resolution |
templates/rt04-collaboration.md |
Tier 16: Analytics Specs
| ID |
Spec Type |
Purpose |
Template File |
| AN01 |
Event Tracking |
User events, metrics definition |
templates/an01-event-tracking.md |
| AN02 |
User Analytics |
Behavior tracking, funnels |
templates/an02-user-analytics.md |
| AN03 |
Business Metrics |
KPIs, reporting requirements |
templates/an03-business-metrics.md |
| AN04 |
Dashboards |
Metric visualization, alerts |
templates/an04-dashboards.md |
Tier 17: Security Enhanced Specs
| ID |
Spec Type |
Purpose |
Template File |
| SEC01 |
Threat Modeling |
STRIDE analysis, attack surfaces |
templates/sec01-threat-modeling.md |
| SEC02 |
Secrets Management |
Key rotation, scope, storage |
templates/sec02-secrets-management.md |
| SEC03 |
Compliance Mapping |
GDPR, HIPAA, SOC 2 requirements |
templates/sec03-compliance.md |
| SEC04 |
Audit Trail |
Immutable logs, retention |
templates/sec04-audit-trail.md |
Workflow
Phase 1: Initialize
# Create directory structure and core files
bash scripts/init-specs-structure.sh --project "My Project"
# Creates:
# - specs/_prompt.md (base prompt)
# - specs/_index.md (spec index)
# - specs/templates/ (all templates)
# - specs/01-system-overview.md (start with this)
Phase 2: Map Specs
# Analyze project and determine which specs are needed
bash scripts/map-required-specs.sh --analyze
# Output: List of required specs based on project type
# - Required: S01, A01, D01, Q01
# - Recommended: U01, X01, O01
# - Optional: U04, A06, O05
Phase 3: Generate Specs
# Generate spec from template
bash scripts/generate-spec.sh --spec-id S01 --from-template
# Generate all pending specs
bash scripts/generate-spec.sh --all-pending
Phase 4: Validate
# Validate spec completeness
bash scripts/validate-spec.sh --spec-id S01
# Validate all specs
bash scripts/validate-spec.sh --all
# Update index
bash scripts/update-index.sh
Context Recovery
When context is lost, restore by:
sequenceDiagram
participant AI as AI Agent
participant FS as File System
participant WORK as Work Resume
Note over AI,WORK: Context Lost
AI->>FS: Read specs/_prompt.md
FS-->>AI: Base prompt standard
AI->>FS: Read specs/_index.md
FS-->>AI: All specs + status
AI->>FS: Read in-progress spec
FS-->>AI: Current spec content
AI->>WORK: Resume writing
- Read
specs/_prompt.md → Know the detail standard
- Read
specs/_index.md → Know what exists and what's pending
- Read the in-progress spec → Continue where left off
- Resume writing with full context
Scripts
| Script |
Purpose |
init-specs-structure.sh |
Create directory and core files |
map-required-specs.sh |
Analyze what specs are needed |
generate-spec.sh |
Generate spec from template |
validate-spec.sh |
Validate spec completeness |
update-index.sh |
Update the spec index |
run-adversarial-refinement.sh |
Apply adversarial patterns |
Integration with Other Skills
- @skills/adversarial-thinking: Refinement patterns
- @skills/notebooklm-federated-specs: Storage and querying
- @skills/data-flow-architect: Data flow documentation
- @skills/api-documentation: API specs
Notes
- _prompt.md is sacred: Defines quality standard
- _index.md is truth: Single source of spec status
- Templates ensure completeness: Never miss a spec type
- Context recovery is built-in: Read two files, resume work
- Map before writing: Know all specs needed before starting
1---2name: exhaustive-specification3description: Write exhaustive specifications for autonomous AI systems that leave nothing to chance, covering every detail from UI to database schemas with adversarial refinement4license: MIT5compatibility: opencode6metadata:7 audience: ai-engineers, system-architects, product-managers8 category: documentation9---1011# Exhaustive Specification Writing1213Write exhaustive specifications for autonomous AI systems that leave nothing to chance. Create specs so detailed that a blind person could visualize the entire system. Uses `_prompt.md` for consistency and `_index.md` for tracking - context can be lost and restored without losing spec direction.1415## When to use me1617Use this skill when:18- You need specifications for autonomous AI agents to build complete systems without human intervention19- Current AI-generated specs are insufficiently detailed and leave critical aspects ambiguous20- You're building complex systems where every detail matters21- You want specs that survive context loss through `_prompt.md` and `_index.md`22- You need to map out ALL spec types before writing begins2324## Core Architecture2526```mermaid27flowchart TB28 subgraph "Initialization"29 START[Start Project] --> MAP[Map Spec Types]30 MAP --> PROMPT[Create _prompt.md]31 MAP --> INDEX[Create _index.md]32 MAP --> TEMPLATES[Create Templates]33 end34 35 subgraph "Specification Files"36 PROMPT --> |"Defines Detail Level"| SPECS[Spec Files]37 INDEX --> |"Tracks Progress"| SPECS38 TEMPLATES --> |"Provides Structure"| SPECS39 end40 41 subgraph "Context Recovery"42 LOST[Context Lost] --> READ[Read _prompt.md]43 READ --> READ2[Read _index.md]44 READ2 --> RESUME[Resume Writing]45 end46```4748## Three Core Files4950### 1. `_prompt.md` - The Base Prompt5152The canonical prompt that defines the level of detail for ALL specs. Every spec generated uses this as the foundation.5354**Location**: `specs/_prompt.md`5556**Purpose**:57- Ensures consistent detail level across all specs58- Survives context loss - new sessions read this to maintain quality59- Defines the "exhaustive standard" for the project6061```markdown62# Exhaustive Specification Prompt6364## Detail Level Standard6566**BLIND-PERSON VISUALIZATION**: Write specs so detailed that someone who cannot see can fully visualize the system. Every UI element, animation, color, interaction must be described in prose.6768**NO ASSUMPTIONS**: Every decision must be explicit. Never write "as discussed" or "standard practice". Define everything.6970**EXHAUSTIVE COVERAGE**: 71- Happy path + ALL error paths72- All edge cases enumerated73- All timing, sizing, spacing specified74- All states and transitions documented75- All data transformations explained7677## Writing Standards7879### For UI/UX Specs80- Exact pixel dimensions, colors (hex codes), fonts81- Animation timing (ms), easing functions82- Responsive breakpoints83- Accessibility requirements (WCAG level)84- Error states, loading states, empty states8586### For API Specs 87- Request/response schemas with examples88- All error codes with causes and resolutions89- Rate limits, timeouts, retry behavior90- Authentication/authorization for each endpoint91- Idempotency requirements9293### For Database Specs94- Complete schema with constraints95- Index strategy and rationale96- Query patterns with example queries97- Migration strategies98- Backup/recovery procedures99100### For Logic Specs101- Step-by-step algorithms102- Decision trees for all branches103- Input validation at each step104- State machines with all transitions105- Error handling at each step106107## Structure Template108109Every spec follows this structure:1101111. **Overview** - What this component does1122. **Dependencies** - What it requires1133. **Interface** - How it interacts with other components1144. **Behavior** - Detailed logic (happy path + error paths)1155. **Data** - Data structures, schemas1166. **States** - All possible states and transitions1177. **Errors** - All error conditions and handling1188. **Testing** - Test cases to validate1199. **Security** - Security considerations12010. **Performance** - Performance requirements121122## Quality Gates123124Before marking any spec complete:125- [ ] Can a blind person visualize this from the description?126- [ ] Is every assumption explicitly stated?127- [ ] Are all error paths documented?128- [ ] Are all edge cases enumerated?129- [ ] Is there an example for every data structure?130- [ ] Are all timings/sizings specified with units?131```132133### 2. `_index.md` - The Spec Index134135Tracks all specs in the system with status, dependencies, and completeness.136137**Location**: `specs/_index.md`138139**Purpose**:140- Single source of truth for what specs exist141- Tracks completion status142- Maps dependencies between specs143- Enables context recovery - know exactly what to continue144145```markdown146# Specification Index147148**Project**: [Project Name]149**Last Updated**: YYYY-MM-DD150**Total Specs**: 12151**Completed**: 8152**In Progress**: 2153**Pending**: 2154155## Spec Registry156157| ID | Spec File | Category | Status | Dependencies | Lines | Last Modified |158|----|-----------|----------|--------|--------------|-------|---------------|159| S01 | 01-system-overview.md | Core | ✅ Complete | None | 1,234 | 2026-03-24 |160| S02 | 02-ui-main.md | UI | ✅ Complete | S01 | 3,456 | 2026-03-24 |161| S03 | 03-ui-modals.md | UI | 🔄 In Progress | S01, S02 | 892 | 2026-03-24 |162| S04 | 04-api-auth.md | API | ✅ Complete | S01 | 2,345 | 2026-03-23 |163| S05 | 05-api-users.md | API | ✅ Complete | S01, S04 | 1,876 | 2026-03-23 |164| S06 | 06-api-orders.md | API | 🔄 In Progress | S01, S05 | 456 | 2026-03-24 |165| S07 | 07-database-schema.md | Database | ✅ Complete | S01 | 2,789 | 2026-03-22 |166| S08 | 08-database-migrations.md | Database | ✅ Complete | S07 | 987 | 2026-03-22 |167| S09 | 09-security.md | Security | ✅ Complete | S01, S04, S07 | 1,567 | 2026-03-21 |168| S10 | 10-deployment.md | Operations | ⏳ Pending | All | 0 | - |169| S11 | 11-performance.md | Operations | ⏳ Pending | S02, S05, S07 | 0 | - |170| S12 | 12-testing.md | QA | ✅ Complete | All | 4,567 | 2026-03-24 |171172## Dependency Graph173174```175S01 (Overview)176├── S02 (UI Main) ──┬── S03 (UI Modals)177│ │178├── S04 (API Auth) ─┼── S05 (API Users) ──┬── S06 (API Orders)179│ │ │180├── S07 (DB Schema) ─┼── S08 (DB Migrations)181│ │182├── S09 (Security) ─┘183│184└── S10 (Deployment) [needs all]185 └── S11 (Performance) [needs S02, S05, S07]186 187S12 (Testing) [needs all]188```189190## Categories191192### Core (1 spec)193- [x] S01: System Overview194195### UI (2 specs)196- [x] S02: Main UI197- [ ] S03: Modal Components (in progress)198199### API (3 specs)200- [x] S04: Authentication API201- [x] S05: Users API202- [ ] S06: Orders API (in progress)203204### Database (2 specs)205- [x] S07: Database Schema206- [x] S08: Migrations207208### Security (1 spec)209- [x] S09: Security Specification210211### Operations (2 specs)212- [ ] S10: Deployment (pending)213- [ ] S11: Performance (pending)214215### QA (1 spec)216- [x] S12: Testing Strategy217218## Next Actions2192201. Complete S03: UI Modals (blocking: S03)2212. Complete S06: Orders API (blocking: S06)2223. Start S10: Deployment (blocked by: S03, S06)2234. Start S11: Performance (blocked by: S03, S06)2245. Update S12: Testing after all specs complete225226## Notes227228- S03 blocked on modal animation specs229- S06 needs error handling for order states230- S12 needs to be updated after S10, S11 complete231```232233### 3. Spec Type Templates234235Pre-defined templates for each spec type ensure nothing is missed.236237## Spec Type Mapping238239### Tier 1: Foundation Specs (Start Here)240241| ID | Spec Type | Purpose | Template File |242|----|-----------|---------|---------------|243| S01 | System Overview | Project purpose, architecture, success criteria | `templates/01-system-overview.md` |244| S02 | Domain Model | Entities, value objects, aggregates | `templates/02-domain-model.md` |245| S03 | Glossary | Terms, definitions, domain language | `templates/03-glossary.md` |246247### Tier 2: UI/UX Specs248249| ID | Spec Type | Purpose | Template File |250|----|-----------|---------|---------------|251| U01 | UI Layout | Page layouts, components, responsive | `templates/u01-ui-layout.md` |252| U02 | UI Flows | User journeys, state transitions | `templates/u02-ui-flows.md` |253| U03 | UI Components | Buttons, forms, modals, cards | `templates/u03-ui-components.md` |254| U04 | UI Animations | Transitions, micro-interactions | `templates/u04-ui-animations.md` |255| U05 | UI Accessibility | ARIA, keyboard nav, screen readers | `templates/u05-ui-accessibility.md` |256| U06 | UI Error States | Validation, error messages, recovery | `templates/u06-ui-error-states.md` |257258### Tier 3: API Specs259260| ID | Spec Type | Purpose | Template File |261|----|-----------|---------|---------------|262| A01 | API Overview | Endpoints summary, versioning, authentication | `templates/a01-api-overview.md` |263| A02 | API Authentication | Auth flows, token management | `templates/a02-api-auth.md` |264| A03 | API Resources | CRUD endpoints for each resource | `templates/a03-api-resources.md` |265| A04 | API Errors | Error codes, messages, recovery | `templates/a04-api-errors.md` |266| A05 | API Rate Limiting | Throttling, quotas, backoff | `templates/a05-api-rate-limiting.md` |267| A06 | API Webhooks | Events, payloads, retry logic | `templates/a06-api-webhooks.md` |268269### Tier 4: Data Specs270271| ID | Spec Type | Purpose | Template File |272|----|-----------|---------|---------------|273| D01 | Database Schema | Tables, columns, constraints, indexes | `templates/d01-database-schema.md` |274| D02 | Database Queries | Query patterns, optimization | `templates/d02-database-queries.md` |275| D03 | Database Migrations | Version history, upgrade paths | `templates/d03-database-migrations.md` |276| D04 | Data Validation | Input validation, sanitization | `templates/d04-data-validation.md` |277| D05 | Data Retention | Archival, deletion, compliance | `templates/d05-data-retention.md` |278279### Tier 5: Business Logic Specs280281| ID | Spec Type | Purpose | Template File |282|----|-----------|---------|---------------|283| B01 | Business Rules | Invariants, constraints, calculations | `templates/b01-business-rules.md` |284| B02 | State Machines | Entity states, transitions, guards | `templates/b02-state-machines.md` |285| B03 | Workflows | Multi-step processes, orchestration | `templates/b03-workflows.md` |286| B04 | Calculations | Formulas, algorithms, rounding | `templates/b04-calculations.md` |287| B05 | Notifications | Email, push, in-app alerts | `templates/b05-notifications.md` |288289### Tier 6: Cross-Cutting Specs290291| ID | Spec Type | Purpose | Template File |292|----|-----------|---------|---------------|293| X01 | Security | AuthZ, encryption, vulnerabilities | `templates/x01-security.md` |294| X02 | Logging | Events, levels, formats, retention | `templates/x02-logging.md` |295| X03 | Monitoring | Metrics, dashboards, alerts | `templates/x03-monitoring.md` |296| X04 | Error Handling | Global error handling, recovery | `templates/x04-error-handling.md` |297| X05 | Configuration | Env vars, feature flags, secrets | `templates/x05-configuration.md` |298299### Tier 7: Operations Specs300301| ID | Spec Type | Purpose | Template File |302|----|-----------|---------|---------------|303| O01 | Deployment | CI/CD, environments, rollbacks | `templates/o01-deployment.md` |304| O02 | Infrastructure | Servers, containers, networking | `templates/o02-infrastructure.md` |305| O03 | Performance | Benchmarks, load testing, SLAs | `templates/o03-performance.md` |306| O04 | Backup & Recovery | Backups, disaster recovery | `templates/o04-backup-recovery.md` |307| O05 | Runbooks | Incident response, maintenance | `templates/o05-runbooks.md` |308309### Tier 8: Quality Specs310311| ID | Spec Type | Purpose | Template File |312|----|-----------|---------|---------------|313| Q01 | Test Strategy | Coverage, types, automation | `templates/q01-test-strategy.md` |314| Q02 | Test Cases | Specific test scenarios | `templates/q02-test-cases.md` |315| Q03 | Acceptance Criteria | Definition of done | `templates/q03-acceptance-criteria.md` |316| Q04 | Quality Gates | Review checkpoints | `templates/q04-quality-gates.md` |317318### Tier 9: Integration Specs319320| ID | Spec Type | Purpose | Template File |321|----|-----------|---------|---------------|322| I01 | Third-Party Integrations | External service contracts, SLAs | `templates/i01-integrations.md` |323| I02 | API Versioning | Version strategy, deprecation policy | `templates/i02-api-versioning.md` |324| I03 | Feature Flags | Rollout strategies, kill switches | `templates/i03-feature-flags.md` |325| I04 | Webhook Receivers | Inbound webhooks, verification | `templates/i04-webhook-receivers.md` |326| I05 | Event Schema Registry | Event schemas, versioning | `templates/i05-event-schema.md` |327328### Tier 10: Mobile Specs329330| ID | Spec Type | Purpose | Template File |331|----|-----------|---------|---------------|332| M01 | Mobile Overview | Platform-specific considerations | `templates/m01-mobile-overview.md` |333| M02 | Mobile Navigation | Screen flows, gestures | `templates/m02-mobile-navigation.md` |334| M03 | Mobile Components | Native UI components | `templates/m03-mobile-components.md` |335| M04 | Mobile Offline | Sync strategies, conflict resolution | `templates/m04-mobile-offline.md` |336| M05 | Push Notifications | Push specs, delivery handling | `templates/m05-push-notifications.md` |337338### Tier 11: AI/ML Specs339340| ID | Spec Type | Purpose | Template File |341|----|-----------|---------|---------------|342| AI01 | Model Cards | Model purpose, limitations, biases | `templates/ai01-model-cards.md` |343| AI02 | Training Pipelines | Data ingestion, preprocessing | `templates/ai02-training-pipelines.md` |344| AI03 | Model Serving | Inference endpoints, versioning | `templates/ai03-model-serving.md` |345| AI04 | Feature Engineering | Feature definitions, transformations | `templates/ai04-feature-engineering.md` |346| AI05 | Model Monitoring | Drift detection, retraining triggers | `templates/ai05-model-monitoring.md` |347348### Tier 12: DevOps/SRE Specs349350| ID | Spec Type | Purpose | Template File |351|----|-----------|---------|---------------|352| SRE01 | SLIs/SLOs/SLAs | Service level definitions | `templates/sre01-slo.md` |353| SRE02 | Incident Management | Incident response procedures | `templates/sre02-incidents.md` |354| SRE03 | On-Call Procedures | On-call rotation, escalation | `templates/sre03-oncall.md` |355| SRE04 | Chaos Engineering | Failure injection, resilience tests | `templates/sre04-chaos.md` |356| SRE05 | Capacity Planning | Growth projections, scaling | `templates/sre05-capacity.md` |357358### Tier 13: Localization Specs359360| ID | Spec Type | Purpose | Template File |361|----|-----------|---------|---------------|362| L01 | Locale Support | Supported locales, fallback chains | `templates/l01-locale-support.md` |363| L02 | String Management | Translation keys, placeholders | `templates/l02-string-management.md` |364| L03 | Cultural Adaptation | Date/time formats, RTL support | `templates/l03-cultural-adaptation.md` |365| L04 | Content Localization | Images, colors, cultural considerations | `templates/l04-content-localization.md` |366367### Tier 14: Data Engineering Specs368369| ID | Spec Type | Purpose | Template File |370|----|-----------|---------|---------------|371| DE01 | Data Pipelines | ETL/ELT workflows | `templates/de01-data-pipelines.md` |372| DE02 | Data Quality | Validation, cleansing, profiling | `templates/de02-data-quality.md` |373| DE03 | Data Lineage | Source tracking, impact analysis | `templates/de03-data-lineage.md` |374| DE04 | Data Governance | Data catalog, ownership, retention | `templates/de04-data-governance.md` |375| DE05 | Caching Strategy | Cache levels, invalidation, TTL | `templates/de05-caching-strategy.md` |376377### Tier 15: Real-Time Specs378379| ID | Spec Type | Purpose | Template File |380|----|-----------|---------|---------------|381| RT01 | WebSocket Connections | Connection lifecycle, auth | `templates/rt01-websockets.md` |382| RT02 | Real-Time Events | Event types, subscriptions | `templates/rt02-realtime-events.md` |383| RT03 | Presence & Status | Online/offline, typing indicators | `templates/rt03-presence.md` |384| RT04 | Collaboration | Concurrent editing, conflict resolution | `templates/rt04-collaboration.md` |385386### Tier 16: Analytics Specs387388| ID | Spec Type | Purpose | Template File |389|----|-----------|---------|---------------|390| AN01 | Event Tracking | User events, metrics definition | `templates/an01-event-tracking.md` |391| AN02 | User Analytics | Behavior tracking, funnels | `templates/an02-user-analytics.md` |392| AN03 | Business Metrics | KPIs, reporting requirements | `templates/an03-business-metrics.md` |393| AN04 | Dashboards | Metric visualization, alerts | `templates/an04-dashboards.md` |394395### Tier 17: Security Enhanced Specs396397| ID | Spec Type | Purpose | Template File |398|----|-----------|---------|---------------|399| SEC01 | Threat Modeling | STRIDE analysis, attack surfaces | `templates/sec01-threat-modeling.md` |400| SEC02 | Secrets Management | Key rotation, scope, storage | `templates/sec02-secrets-management.md` |401| SEC03 | Compliance Mapping | GDPR, HIPAA, SOC 2 requirements | `templates/sec03-compliance.md` |402| SEC04 | Audit Trail | Immutable logs, retention | `templates/sec04-audit-trail.md` |403404## Workflow405406### Phase 1: Initialize407408```bash409# Create directory structure and core files410bash scripts/init-specs-structure.sh --project "My Project"411412# Creates:413# - specs/_prompt.md (base prompt)414# - specs/_index.md (spec index)415# - specs/templates/ (all templates)416# - specs/01-system-overview.md (start with this)417```418419### Phase 2: Map Specs420421```bash422# Analyze project and determine which specs are needed423bash scripts/map-required-specs.sh --analyze424425# Output: List of required specs based on project type426# - Required: S01, A01, D01, Q01427# - Recommended: U01, X01, O01428# - Optional: U04, A06, O05429```430431### Phase 3: Generate Specs432433```bash434# Generate spec from template435bash scripts/generate-spec.sh --spec-id S01 --from-template436437# Generate all pending specs438bash scripts/generate-spec.sh --all-pending439```440441### Phase 4: Validate442443```bash444# Validate spec completeness445bash scripts/validate-spec.sh --spec-id S01446447# Validate all specs448bash scripts/validate-spec.sh --all449450# Update index451bash scripts/update-index.sh452```453454## Context Recovery455456When context is lost, restore by:457458```mermaid459sequenceDiagram460 participant AI as AI Agent461 participant FS as File System462 participant WORK as Work Resume463 464 Note over AI,WORK: Context Lost465 AI->>FS: Read specs/_prompt.md466 FS-->>AI: Base prompt standard467 AI->>FS: Read specs/_index.md468 FS-->>AI: All specs + status469 AI->>FS: Read in-progress spec470 FS-->>AI: Current spec content471 AI->>WORK: Resume writing472```4734741. Read `specs/_prompt.md` → Know the detail standard4752. Read `specs/_index.md` → Know what exists and what's pending4763. Read the in-progress spec → Continue where left off4774. Resume writing with full context478479## Scripts480481| Script | Purpose |482|--------|---------|483| `init-specs-structure.sh` | Create directory and core files |484| `map-required-specs.sh` | Analyze what specs are needed |485| `generate-spec.sh` | Generate spec from template |486| `validate-spec.sh` | Validate spec completeness |487| `update-index.sh` | Update the spec index |488| `run-adversarial-refinement.sh` | Apply adversarial patterns |489490## Integration with Other Skills491492- **@skills/adversarial-thinking**: Refinement patterns493- **@skills/notebooklm-federated-specs**: Storage and querying494- **@skills/data-flow-architect**: Data flow documentation495- **@skills/api-documentation**: API specs496497## Notes498499- **_prompt.md is sacred**: Defines quality standard500- **_index.md is truth**: Single source of spec status501- **Templates ensure completeness**: Never miss a spec type502- **Context recovery is built-in**: Read two files, resume work503- **Map before writing**: Know all specs needed before starting