miles-knowbl

spec

1
0
# Install this skill:
npx skills add miles-knowbl/orchestrator --skill "spec"

Install specific skill from multi-skill repository

# Description

Compile requirements into production-ready technical specifications. Transforms requirements documents into comprehensive 18-section FeatureSpecs (~2000+ lines) with full code, SQL migrations, UI components, feedback timing, and senior engineer audit. Maintains Process Map as system-of-record. The primary driver of the implementation process.

# SKILL.md


name: spec
description: "Compile requirements into production-ready technical specifications. Transforms requirements documents into comprehensive 18-section FeatureSpecs (~2000+ lines) with full code, SQL migrations, UI components, feedback timing, and senior engineer audit. Maintains Process Map as system-of-record. The primary driver of the implementation process."
phase: INIT
category: core
version: "1.0.0"
depends_on: ["architect"]
tags: [planning, specification, requirements]


Spec

Compile requirements into production-ready technical specifications.

When to Use

  • After requirements are gathered β€” Requirements doc is approved, ready for technical spec
  • Before implementation β€” Need production-ready specification with full code
  • Complex feature β€” Multiple entities, services, UI components
  • Team handoff β€” Spec becomes the implementation contract
  • When you say: "compile this spec", "write the technical spec", "create a FeatureSpec"

Reference Requirements

MUST read before applying this skill:

Reference Why Required
18-section-template.md Defines all required sections and format
capability-format.md Structure for each capability definition

Read if applicable:

Reference When Needed
feedback-framework.md For UI-heavy features requiring timing/haptics
process-map-template.md When maintaining cross-spec tracking
memory-axioms.md For state management patterns

Verification: Ensure your FeatureSpec has all 18 sections before marking complete.

Required Deliverables

Deliverable Location Condition
FEATURESPEC.md Project root Always (1500+ lines minimum)
Process Map update domain-memory/{domain}/process-map.md If Process Map exists

Core Concept

Spec compilation answers: "How exactly do we build this?"

A compiled FeatureSpec is:
- Complete β€” 18 sections covering all aspects of implementation
- Production-ready β€” Full code, not pseudocode or placeholders
- Audited β€” Senior engineer review with issues resolved
- Traceable β€” Numbered capabilities, entities, and specs

A FeatureSpec is NOT:
- Requirements (that's requirements)
- High-level architecture (that's architect)
- The actual implementation (that's implement)

The Compilation Loop

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    SPEC COMPILATION LOOP                        β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                 β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”   β”‚
β”‚   β”‚Requirements  β”‚     β”‚  Compiler    β”‚     β”‚FeatureSpec   β”‚   β”‚
β”‚   β”‚v1.0 (PM)     │────▢│  Process     │────▢│ v1.1         β”‚   β”‚
β”‚   β”‚~200-500 linesβ”‚     β”‚  (Claude)    β”‚     β”‚ ~2000+ lines β”‚   β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β”‚
β”‚                               β”‚                     β”‚           β”‚
β”‚                               β”‚                     β”‚           β”‚
β”‚                               β–Ό                     β–Ό           β”‚
β”‚                        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”‚
β”‚                        β”‚         Process Map             β”‚     β”‚
β”‚                        β”‚  β€’ Entities registry            β”‚     β”‚
β”‚                        β”‚  β€’ Coverage tracking            β”‚     β”‚
β”‚                        β”‚  β€’ Compiled specs list          β”‚     β”‚
β”‚                        β”‚  β€’ Architecture diagram         β”‚     β”‚
β”‚                        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚
β”‚                                                                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Compilation Workflow

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                  TEMPLATE-BASED COMPILATION                             β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚                                                                         β”‚
β”‚  INPUT                                                                  β”‚
β”‚  ─────                                                                  β”‚
β”‚  β€’ Requirements document (from `requirements` skill)                    β”‚
β”‚  β€’ This compilation process                                             β”‚
β”‚  β€’ Exemplar specs (previous compilations)                               β”‚
β”‚  β€’ Process Map (current version)                                        β”‚
β”‚                                                                         β”‚
β”‚                          β–Ό                                              β”‚
β”‚                                                                         β”‚
β”‚  STEP 1: Structure Against Template                                     β”‚
β”‚  ──────────────────────────────────                                     β”‚
β”‚  β€’ Create all 18 sections from template                                 β”‚
β”‚  β€’ Assign Spec ID (SPEC-###)                                            β”‚
β”‚  β€’ Number capabilities (CAP-001, CAP-002, ...)                          β”‚
β”‚  β€’ Fill header with compilation summary table                           β”‚
β”‚  β€’ Reference exemplar specs for format/style                            β”‚
β”‚                                                                         β”‚
β”‚                          β–Ό                                              β”‚
β”‚                                                                         β”‚
β”‚  STEP 2: Apply Feedback Framework                                       β”‚
β”‚  ────────────────────────────────                                       β”‚
β”‚  β€’ Add Feedback Timing Requirements section                             β”‚
β”‚  β€’ Add feedback block to each capability                                β”‚
β”‚  β€’ Add haptic patterns, timing bands, animations                        β”‚
β”‚  β€’ Implement optimistic UI in all service layer code                    β”‚
β”‚  β€’ Apply Paintbrush Test to every interaction                           β”‚
β”‚                                                                         β”‚
β”‚                          β–Ό                                              β”‚
β”‚                                                                         β”‚
β”‚  STEP 3: Apply Production Framework                                     β”‚
β”‚  ─────────────────────────────────                                      β”‚
β”‚  β€’ Senior Engineer Audit (document issues found)                        β”‚
β”‚  β€’ Integrate ALL fixes into spec (not comments)                         β”‚
β”‚  β€’ Add observability (metrics, logs, alerts)                            β”‚
β”‚  β€’ Add test scenarios (security, concurrency, failure, load)            β”‚
β”‚  β€’ Add feature flags and rollback plan                                  β”‚
β”‚                                                                         β”‚
β”‚                          β–Ό                                              β”‚
β”‚                                                                         β”‚
β”‚  STEP 4: Validate Template Compliance                                   β”‚
β”‚  ────────────────────────────────────                                   β”‚
β”‚  β€’ Check all 18 sections present                                        β”‚
β”‚  β€’ Verify minimum 1,500 lines (target 2,000+)                           β”‚
β”‚  β€’ Verify numbered capabilities with feedback                           β”‚
β”‚  β€’ Verify full code (not placeholders)                                  β”‚
β”‚  β€’ Verify complete SQL migrations                                       β”‚
β”‚  β€’ Run compatibility check against Process Map                          β”‚
β”‚                                                                         β”‚
β”‚                          β–Ό                                              β”‚
β”‚                                                                         β”‚
β”‚  STEP 5: Update Process Map                                             β”‚
β”‚  ──────────────────────────                                             β”‚
β”‚  β€’ Add to Compiled Specs Registry                                       β”‚
β”‚  β€’ Update coverage percentages                                          β”‚
β”‚  β€’ Add new entities to registry                                         β”‚
β”‚  β€’ Increment Process Map version                                        β”‚
β”‚                                                                         β”‚
β”‚  OUTPUT                                                                 β”‚
β”‚  ──────                                                                 β”‚
β”‚  β€’ Compiled FeatureSpec v1.x                                            β”‚
β”‚  β€’ Updated Process Map                                                  β”‚
β”‚                                                                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The 18 Required Sections

Every compiled spec includes:

# Section Purpose Minimum Content
1 Header Identity & summary Spec ID, version, compilation summary table
2 Feature Overview Business context User stories, scope, key principles
3 Architecture Overview System diagram Layer descriptions, data flow
4 Feedback Timing Requirements UX timing Timing bands, haptic patterns
5 Entities Database tables NEW tables + EXTENSIONS with full SQL
6 Capabilities Numbered features CAP-### with feedback specs
7 Service Layer Business logic Full code with optimistic patterns
8 UI Components Frontend code Full components with all states
9 Database Migrations Schema changes Complete SQL with indexes, triggers
10 API Layer Endpoints/functions Production-ready, not stubs
11 Authorization Permissions/policies Granular, role-based
12 Observability Monitoring Metrics, logs, alerts with runbooks
13 Feature Flags Rollout controls Flags with scope and defaults
14 Test Scenarios Quality assurance Security, concurrency, failure, load
15 Verification Checklist Implementation validation Checklist for implementers
16 Implementation Priority Phased delivery Priority order, dependencies
17 Files to Create/Modify Directory structure Full file paths
18 Compilation Summary Audit results Senior Engineer issues & resolutions

β†’ See references/18-section-template.md for detailed section guidance

Minimum Requirements

template_compliance:
  lines: 
    minimum: 1500
    target: 2000+
    exemplar: 3000+

  sections:
    required: 18
    all_present: true

  capabilities:
    numbered: true  # CAP-001, CAP-002, ...
    feedback_block: true  # Each has timing/haptic/visual/optimistic specs

  code:
    service_layer: "Full implementation, not pseudocode"
    ui_components: "Full components, not wireframes"
    migrations: "Complete SQL, not schema descriptions"
    api_layer: "Production-ready, not stubs"

  quality:
    spec_id: "SPEC-### assigned"
    compilation_summary: "Senior Engineer audit table with resolutions"
    test_scenarios: "Minimum 3 per category"

Code Completeness Rules

Never write:
- // TODO: implement
- ... rest of implementation
- Pseudocode or placeholders
- Truncated functions

Always write:
- Full, working implementations
- All edge cases handled
- Error handling included
- TypeScript/language types complete

Capability Format

Each capability MUST have:

capability: capability_name
id: CAP-###
description: What it does
actor: Who triggers it
trigger: What triggers it

input:
  field1: type
  field2: type

output:
  result: type

validation:
  - Rule 1
  - Rule 2

side_effects:
  - Effect 1
  - Effect 2

feedback:
  timing:
    input_acknowledgment: 0ms
    local_render: <50ms
    server_confirm: background
  haptic:
    on_action: light_impact
    on_error: error_pattern
  visual:
    pending: Description
    success: Description
    error: Description
  optimistic:
    strategy: Description
    rollback: Description

error_handling:
  ERROR_CODE_1: "User message"
  ERROR_CODE_2: "User message"

β†’ See references/capability-format.md for detailed examples

Feedback Framework

The Paintbrush Principle

A paintbrush feels instantaneous because feedback arrives before you consciously expect it. The brain takes ~100ms to form "did that work?" β€” anything under 50ms feels like cause-and-effect.

Goal: Every interaction should pass the Paintbrush Test.

Timing Bands

Band Target Perception Use For
0ms At input event Extension of body Haptic, press state, selection
<16ms Every frame Fluid tracking Cursor, drag, scroll
<50ms Perceived instant Cause-and-effect Optimistic UI, count update
<150ms Animated Smooth transition Dropdown, modal appear
<300ms Spring settle Physics-based Drop into place, reorder
Background Never blocks UI Invisible Network calls, sync

β†’ See references/feedback-framework.md for the Four Gaps and interaction patterns

Senior Engineer Audit

Every compiled spec includes an audit table:

| Issue | Category | Resolution |
|-------|----------|------------|
| No rate limiting | Security | Added 100 req/min limit |
| Race condition on update | Concurrency | Added optimistic locking |
| Missing index | Performance | Added composite index |

Audit Categories

Category What to Check
Security Input validation, auth checks, rate limiting, injection prevention
Concurrency Optimistic locking, idempotency, race conditions, deadlocks
Reliability Retry logic, graceful degradation, timeouts, circuit breakers
Scalability Batch processing, indexes, N+1 queries, unbounded queries
Observability Metrics, structured logging, alerts, runbooks
Data Model Constraints, triggers, soft delete, state machines

β†’ See references/senior-engineer-audit.md for full checklist

Process Map

The Process Map is the single source of truth for:
- All entities and their schemas
- All services/hooks and their purposes
- Coverage percentages per process
- Compiled specs registry

After Every Compilation

  1. Add new entities to Entity Registry
  2. Update coverage percentages
  3. Add to Compiled Specs Registry
  4. Increment version number
  5. Add changelog entry

β†’ See references/process-map-template.md for blank template

Stack Adaptation

Map generic sections to your stack:

Generic Section React/Supabase Django/Postgres Rails/Postgres
Service Layer React Hooks Services/Managers Service Objects
UI Components TSX Components Django Templates ERB Views
API Layer Edge Functions Views/Viewsets Controllers
Authorization RLS Policies Permissions Pundit Policies
Realtime Supabase Realtime Django Channels ActionCable

Output Format

Header Template

# [Feature] FeatureSpec v1.1

| Property | Value |
|----------|-------|
| **Spec ID** | SPEC-### |
| **Version** | 1.1 (Compiled) |
| **Status** | Ready for Implementation |
| **Target Project** | [Project Name] |
| **Compilation Date** | [Date] |
| **Lines** | [Count] |
| **Capabilities** | [Count] |

Compilation Summary Template

## Compilation Summary

| Pass | Focus | Key Additions |
|------|-------|---------------|
| 1 | Compatibility Alignment | Entity verification, FK references |
| 2 | Feedback Framework | Timing bands, haptic patterns, optimistic UI |
| 3 | Senior Engineer Review | Security, concurrency, reliability fixes |
| 4 | Process Map Update | Coverage %, entity registry |

### Senior Engineer Audit Results

| Category | Issues Found | Issues Resolved | Status |
|----------|--------------|-----------------|--------|
| Security | X | X | βœ… |
| Concurrency | X | X | βœ… |
| Reliability | X | X | βœ… |
| **Total** | **Y** | **Y** | βœ… |

Quality Checklist

Before presenting a compiled spec:

- [ ] Spec ID assigned (SPEC-###)
- [ ] All 18 sections present
- [ ] 1,500+ lines minimum
- [ ] All capabilities numbered (CAP-###)
- [ ] All capabilities have feedback block
- [ ] All code is complete (no TODOs)
- [ ] Senior Engineer audit table filled
- [ ] Test scenarios: 3+ per category
- [ ] Process Map updated

Relationship to Other Skills

Skill Relationship
requirements Requirements feed into spec compilation
architect Spec includes architecture; architect provides high-level design
frontend-design (Frontend systems) UI/UX section becomes DESIGN.md
implement Spec is the implementation contract
code-verification Verification checks against spec patterns
code-validation Validation checks against spec requirements
code-review Review verifies spec was implemented correctly

Key Principles

Complete, not partial. Every section is filled. Every code block works. No placeholders.

Audited, not assumed. Senior engineer review catches issues before implementation.

Traceable, not ad-hoc. Spec IDs, capability numbers, entity references create audit trail.

Living document. Specs version. Updates increment version. Old versions are preserved.

Process Map is truth. Always check it first. Always update it after.

References

  • references/18-section-template.md: Detailed section-by-section guidance
  • references/feedback-framework.md: Timing bands, haptics, optimistic UI patterns
  • references/capability-format.md: How to write capability specifications
  • references/senior-engineer-audit.md: Full audit checklist by category
  • references/process-map-template.md: Blank Process Map template
  • references/memory-axioms.md: Principles for maintaining project memory

# Supported AI Coding Agents

This skill is compatible with the SKILL.md standard and works with all major AI coding agents:

Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.