Specification Compiler
Compile an approved requirements model into verification-ready requirements-specification/v1 artifacts. This is a compiler, not a requirements author: insufficient input becomes a GAP-*, never invented behavior.
Output language
- Produce all natural-language output in Ukrainian.
- Preserve source quotations when required for traceability.
- Preserve IDs, code, API names, file names, commands, protocols, and machine-readable values.
Inputs and artifacts
Use project-defined locations. Otherwise use:
docs/requirements/requirements.json;
docs/requirements/review.json;
docs/requirements/baseline.json;
docs/requirements/specification.json — editable source of truth;
docs/requirements/specification.md — generated view.
Read all bundled contracts before compiling:
- requirements.schema.json;
- review.schema.json;
- baseline.schema.json;
- specification.schema.json.
Entry gate
Run the deterministic gate before drafting output:
python "<skill-dir>/scripts/pipeline_artifacts.py" gate --requirements "<requirements.json>" --review "<review.json>" --baseline "<baseline.json>"
The gate must pass. It verifies supported contracts, structural and referential integrity, explicit approval, zero open blockers, no unresolved open items, matching versions, and current SHA-256 values. If it fails, stop and report every failed condition. Do not infer approval from file names, previous conversations, task completion, or the existence of artifacts.
Compilation workflow
Run the entry gate.
Calculate the requirements and baseline digests with the digest command.
Build a staged requirements-specification/v1 JSON containing those exact hashes.
Validate structure, hashes, and source requirement references:
python "<skill-dir>/scripts/pipeline_artifacts.py" validate specification "<staged-specification.json>" --requirements "<requirements.json>" --baseline "<baseline.json>"
Write it safely. An existing primary produces specification.candidate.json or the next numbered candidate.
python "<skill-dir>/scripts/pipeline_artifacts.py" safe-write specification "<staged-specification.json>" "<output-dir>/specification.json"
Validate and render the actual written file to the matching Markdown name:
python "<skill-dir>/scripts/pipeline_artifacts.py" render specification "<written-specification.json>" --requirements "<requirements.json>" --baseline "<baseline.json>" --output "<matching-specification.md>"
The renderer puts the highest-attention output types first: GAP, FAIL, INV, then AC; items are sorted by numeric ID, and traceability rows by requirement type and numeric ID. Rendering never changes JSON array order.
Report the gate result, input hashes, actual output paths, counts of INV-*, AC-*, FAIL-*, and GAP-*, and uncovered approved requirements.
Compilation rules
- Generate
INV-* only for properties that approved requirements say must always hold. Include scope, checkable condition, and violation condition.
- Generate observable
AC-*; prefer WHEN <event or condition>, THE SYSTEM SHALL <outcome> or Given/When/Then when clearer.
- Generate
FAIL-* only for failure or recovery behavior supported by approved requirements.
- Create
GAP-* when approved requirements do not support safe compilation.
- Every output item must reference one or more approved
BG-*, BR-*, FR-*, NFR-*, or CON-* IDs.
- Preserve quantifiers, values, actors, authorization, timing, ownership, states, and transitions.
- Include one traceability row for every requirement in the compilation scope, even when its only result is a gap.
Do not select test frameworks, write tests, design architecture, resolve business ambiguity, or implement production code.
Finish only when the JSON validates, Markdown is regenerated from it, all output references resolve, and the approved scope is covered by traceability rows.
1---2name: specification-compiler3description: Compile an explicitly approved requirements/v1 baseline into editable specification.json and generated specification.md with traceable invariants, acceptance criteria, failure scenarios, and gaps. Use as the third stage after requirements criticism and human approval.4---56# Specification Compiler78Compile an approved requirements model into verification-ready `requirements-specification/v1` artifacts. This is a compiler, not a requirements author: insufficient input becomes a `GAP-*`, never invented behavior.910## Output language1112- Produce all natural-language output in Ukrainian.13- Preserve source quotations when required for traceability.14- Preserve IDs, code, API names, file names, commands, protocols, and machine-readable values.1516## Inputs and artifacts1718Use project-defined locations. Otherwise use:1920- `docs/requirements/requirements.json`;21- `docs/requirements/review.json`;22- `docs/requirements/baseline.json`;23- `docs/requirements/specification.json` — editable source of truth;24- `docs/requirements/specification.md` — generated view.2526Read all bundled contracts before compiling:2728- [requirements.schema.json](references/contracts/requirements.schema.json);29- [review.schema.json](references/contracts/review.schema.json);30- [baseline.schema.json](references/contracts/baseline.schema.json);31- [specification.schema.json](references/contracts/specification.schema.json).3233## Entry gate3435Run the deterministic gate before drafting output:3637```text38python "<skill-dir>/scripts/pipeline_artifacts.py" gate --requirements "<requirements.json>" --review "<review.json>" --baseline "<baseline.json>"39```4041The gate must pass. It verifies supported contracts, structural and referential integrity, explicit approval, zero open blockers, no unresolved open items, matching versions, and current SHA-256 values. If it fails, stop and report every failed condition. Do not infer approval from file names, previous conversations, task completion, or the existence of artifacts.4243## Compilation workflow44451. Run the entry gate.462. Calculate the requirements and baseline digests with the `digest` command.473. Build a staged `requirements-specification/v1` JSON containing those exact hashes.484. Validate structure, hashes, and source requirement references:4950 ```text51 python "<skill-dir>/scripts/pipeline_artifacts.py" validate specification "<staged-specification.json>" --requirements "<requirements.json>" --baseline "<baseline.json>"52 ```53545. Write it safely. An existing primary produces `specification.candidate.json` or the next numbered candidate.5556 ```text57 python "<skill-dir>/scripts/pipeline_artifacts.py" safe-write specification "<staged-specification.json>" "<output-dir>/specification.json"58 ```59606. Validate and render the actual written file to the matching Markdown name:6162 ```text63 python "<skill-dir>/scripts/pipeline_artifacts.py" render specification "<written-specification.json>" --requirements "<requirements.json>" --baseline "<baseline.json>" --output "<matching-specification.md>"64 ```6566 The renderer puts the highest-attention output types first: `GAP`, `FAIL`, `INV`, then `AC`; items are sorted by numeric ID, and traceability rows by requirement type and numeric ID. Rendering never changes JSON array order.67687. Report the gate result, input hashes, actual output paths, counts of `INV-*`, `AC-*`, `FAIL-*`, and `GAP-*`, and uncovered approved requirements.6970## Compilation rules7172- Generate `INV-*` only for properties that approved requirements say must always hold. Include scope, checkable condition, and violation condition.73- Generate observable `AC-*`; prefer `WHEN <event or condition>, THE SYSTEM SHALL <outcome>` or Given/When/Then when clearer.74- Generate `FAIL-*` only for failure or recovery behavior supported by approved requirements.75- Create `GAP-*` when approved requirements do not support safe compilation.76- Every output item must reference one or more approved `BG-*`, `BR-*`, `FR-*`, `NFR-*`, or `CON-*` IDs.77- Preserve quantifiers, values, actors, authorization, timing, ownership, states, and transitions.78- Include one traceability row for every requirement in the compilation scope, even when its only result is a gap.7980Do not select test frameworks, write tests, design architecture, resolve business ambiguity, or implement production code.8182Finish only when the JSON validates, Markdown is regenerated from it, all output references resolve, and the approved scope is covered by traceability rows.