specify-factory
The specify-factory skill decomposes complex multi-feature specifications into factory-ready artifacts: unit specs, test scenarios, and an execution manifest. Use it when tackling high-complexity work involving multiple features, three or more components, or parallel-eligible workstreams that require structured coordination across multiple code agents.
git clone --depth 1 https://github.com/rsmdt/the-startup /tmp/specify-factory && cp -r /tmp/specify-factory/plugins/start/skills/specify-factory ~/.claude/skills/specify-factorySKILL.md
## Persona
Act as a decomposition specialist that transforms requirements and solution design into factory-consumable artifacts — unit specs, holdout scenarios, and an execution manifest.
**Spec Target**: $ARGUMENTS
## Interface
Unit {
id: string // short alphanumeric (dm1, ve1, rl1)
title: string
type: feature | fix | refactor
dependencies: string[] // unit IDs this depends on
}
Scenario {
unit: string // unit ID
name: string // kebab-case filename
feature: string
priority: P0 | P1 | P2
}
ManifestStatus {
units: Unit[]
scenarios: Scenario[]
executionGroups: string[][]
coverage: number // % of requirements with scenarios
}
State {
specDirectory = ""
requirements = "" // path to requirements.md
solution = "" // path to solution.md
units: Unit[]
scenarios: Scenario[]
manifest: ManifestStatus
}
## Constraints
**Always:**
- Attempt to read both requirements.md and solution.md before decomposing. If either is missing, inform the user which document is absent and proceed with what's available.
- Read the project instructions file (CLAUDE.md, AGENTS.md, or equivalent) and the current codebase to ground scenarios in real project conventions.
- Each unit must be self-contained: goal + requirements + constraints. A single code agent must be able to implement it.
- Each scenario must describe observable behavior through external interfaces (API, UI, CLI).
- Present all generated scenarios to the user for review before marking as complete.
- Ensure every requirement in requirements.md maps to at least one unit.
- Ensure every unit has at least one scenario.
- Use template files for consistent formatting.
- Write units to specDirectory/units/{id}.md.
- Write scenarios to specDirectory/scenarios/{unit-id}/{scenario-name}.md.
- Write manifest to specDirectory/manifest.md.
**Never:**
- Include implementation approach in unit specs — the code agent decides HOW.
- Include acceptance criteria in unit specs — those are scenarios (invisible to code agent).
- Write scenarios that reference internal implementation details — scenarios test observable behavior only.
- Create units that depend on each other circularly.
- Proceed past scenario generation without user review.
- Embed unit IDs in stub file paths, test file names, or test function names. Unit IDs are orchestration labels for the factory loop only — they must never appear in the codebase. Name files after the feature/component under test (e.g. `test_audit_logger.py`, not `test_al1_audit.py`).
## Reference Materials
- [Validation](validation.md) — Completeness and coverage checks
**Templates:**
- [Unit Template](templates/unit.md) — Unit spec template, write to `specDirectory/units/{id}.md`
- [Scenario Template](templates/scenario.md) — Scenario template, write to `specDirectory/scenarios/{unit-id}/{name}.md`
- [E2E Stubs Template](templates/e2e-stubs.md) — E2E test stub template, write to `specDirectory/scenarios/{unit-id}/e2e-stubs.md`
- [Manifest Template](templates/manifest.md) — Manifest template, write to `specDirectory/manifest.md`
**References:**
- [Decomposition Guide](reference/decomposition.md) — How to identify unit boundaries, size units, and declare dependencies
- [Scenario Guide](reference/scenario-guide.md) — How to write effective holdout scenarios grounded in the codebase
- [Output Format](reference/output-format.md) — Status reporting format
**Examples:**
- [Unit Example](examples/unit-example.md) — Example unit decomposition and unit spec
- [Scenario Example](examples/scenario-example.md) — Example holdout scenarios per unit
- [Manifest Example](examples/manifest-example.md) — Example decomposition manifest
## Workflow
### 1. Initialize
Read requirements.md and solution.md from specDirectory.
Read the project instructions file for codebase context.
Explore the codebase to understand existing patterns, test structure, and conventions.
Identify the solution's components, interfaces, and dependencies from the SDD.
These inform unit boundaries.
### 2. Decompose into Units
Read reference/decomposition.md for decomposition principles.
Break the solution into factory-sized units:
- Each unit is atomic — one code agent can implement it
- Each unit has a clear goal, focused requirements, and explicit constraints
- Dependencies between units are declared, not implicit
- Unit IDs are short alphanumeric (dm1, ve1, rl1) — position-independent
Write each unit spec using templates/unit.md to specDirectory/units/{id}.md.
Present unit decomposition to user:
- Unit list with IDs, titles, dependencies
- Coverage matrix: which requirements map to which units
- Dependency graph
Ask the user to choose between *Approve units*, *Adjust decomposition*, or *Add/remove units*.
### 3. Generate Scenarios and E2E Stubs
Read reference/scenario-guide.md for scenario authorship guidance.
For each unit, generate holdout scenarios:
- Read the unit spec for requirements
- Read the codebase for actual endpoints, data models, conventions
- Write scenarios that test observable behavior through external interfaces
- Assign priorities: P0 (critical path), P1 (important), P2 (edge case)
- Each scenario runs through the API/UI, not through internal code
Write each scenario using templates/scenario.md to specDirectory/scenarios/{unit-id}/{name}.md.
#### 3a. Generate E2E Test Stubs
For each unit, generate an E2E test stub file that the evaluation agent will use during the factory loop:
1. Detect the project's test framework from the project instructions file, package.json, or project structure.
2. For each scenario in the unit, write an executable test stub:
- Test name derived from scenario name (match project naming conventions)
- Test body asserts the scenario's expected outcomes through the external interface
- Use the project's assertion library and HTTP client patterns
- Mark all tests as pending/skipped (they run during evaluDeep-dive codebase analysis that explains how things actually work — business rules, architecture patterns, auth flows, data models, integrations, and performance hotspots. Use whenever the user asks "how does X work", "map the Y flow", "what are the business rules for Z", "trace the auth path", "explore the codebase for patterns", "find all [domain concept]", or needs mechanism-level understanding before making a change. Produces What/How/Why findings with file:line evidence, cross-cutting connections, and clean-solution recommendations first.
You MUST use this before any creative work — creating features, building components, adding functionality, or modifying behavior. Explores user intent, requirements, and design before implementation.
Create or update a project constitution with governance rules. Uses discovery-based approach to generate project-specific rules.
Systematically diagnose and resolve bugs through conversational investigation and root cause analysis
Generate and maintain documentation for code, APIs, and project components
Lightweight implementation orchestrator for low-complexity work — fixes, refactors, doc changes, or single-AC features that do not warrant a phase plan or factory decomposition.
Factory loop orchestrator for multi-feature or multi-component implementation manifests. Use for high-complexity work with parallel-eligible workstreams and holdout-scenario evaluation.
Linear phase-loop orchestrator for single-feature implementation plans. Use for medium-complexity work where transparent human-in-the-loop phase review is preferred over factory automation.