specifying-requirements
Use when writing or updating spec.yaml files. Defines requirement format and user story structure.
What this skill does
# Specification Writing Skill
This skill defines how to write specifications that follow the project's conventions.
**CRITICAL:** Stick to the Domain Specific Language in this document. Do not add your own extra keys or structure.
## Before Writing a Spec
**CRITICAL — before adding any requirements:**
1. **Check for conflicting specs** — read any existing `spec.yaml` in the same feature area to avoid overlap
2. **Check for duplicated requirements** — if a requirement already exists in another spec (even worded differently), do not restate it
3. **Update the existing spec first** if one already covers this feature
Requirement ID uniqueness is enforced by a linter — see `scripts/check-spec-ids.sh`.
## Specification Location
**Specifications live close to the code** following the principle of locality of behavior:
- Spec filename: `spec.yaml`
- Location: In the same directory as the code it specifies, or in a feature-specific subdirectory
- Example: `src/feature/spec.yaml`
## Specification Format
Every spec.yaml file must follow this YAML structure:
```yaml
feature:
name: Brief Feature Title
user: user role
goal: goal/capability
solutions:
- Solution 1
- Solution 2
requirements:
- id: REQ-XXX-001
test: to-implement
code: to-implement
description: Specific, testable requirement
- id: REQ-XXX-002
test: to-implement
code: to-implement
description: Another specific requirement
```
### Feature Section
The `feature` section captures the user story and possible solutions.
- `name`: Brief title for the feature
- `user`: The end user role (always from the user's perspective, never a system component)
- `goal`: The goal or capability (what they want)
- `solutions`: List of possible implementation approaches
**Rationale for User Goals + Possible Solutions:**
- Focus on WHAT the user wants to achieve, not a specific HOW
- Acknowledge that multiple solutions may exist to meet the user's goal
- Solutions should be considered throughout implementation
- Design the codebase to be modular enough to swap solutions without major refactoring
- Keeps options open until implementation details are needed
### Requirements Section
**Status markers for `test` field:**
- `to-implement` = not yet implemented
- `unit` = implemented via unit test
- `acceptance` = implemented via acceptance test
- `wont-implement` = intentionally not tested
**Status markers for `code` field:**
- `to-implement` = not yet implemented
- `done` = implemented
- `wont-implement` = intentionally not implemented
**Requirements are a flat list — do NOT nest or group them.** Grouping by category creates artificial structure that encourages duplication and makes it harder to maintain sequential numbering.
**Requirement naming:**
- Use feature-specific prefix for the `id`
- Number sequentially starting from 001
- Sequentiality does not need to be enforced (reduce work renumbering)
- You can skip numbers if a requirement is removed
- Add characters if adding a requirement between other requirements
- Keep requirements atomic and testable
- One requirement per list item
**CRITICAL - Atomic Requirements:**
- Each requirement must test ONE specific thing
- If a requirement has "and" or lists multiple attributes, split it into separate requirements
- Each requirement should map to one test (or a small set of closely related tests)
**CRITICAL - User-Facing Requirements Only:**
- Requirements must describe FEATURES from the user's perspective
- Each requirement should be stated ONLY ONCE in the spec
- DO NOT create separate requirements for implementation details
**CRITICAL - No Implementation Details in Requirements:**
- Requirements must describe WHAT the system does, never HOW it does it
- DO NOT name specific libraries, frameworks, or tools in requirements
- Library/tool choices belong in the `solutions` list, not in requirements
- A requirement should remain valid even if the underlying implementation is swapped
**CRITICAL - Do Not Duplicate Existing Functionality:**
- Before writing any requirement, check whether the behavior is already implemented and tested in an existing module
- If the feature reuses existing infrastructure do NOT add requirements for that infrastructure
- Only specify behavior that is NEW to this feature
**Before adding a requirement, ask:**
1. Is this something the user directly experiences or cares about?
2. Have I already stated this requirement elsewhere in the spec or in another spec file?
3. Is this describing WHAT the system does for the user, or HOW it does it internally?
4. Is this behavior already implemented and tested in an existing module that this feature will reuse?
### Scenarios Section (Optional)
**Use the `acceptance-test` skill for writing scenarios and acceptance tests.**
Scenarios are only needed when the feature requires end-to-end testing across multiple modules. Ask the user if scenarios apply before adding them.
## Integration with STDD Workflow
This spec skill is **STEP 1** of the spec-test-driven development workflow:
1. **Write Spec** ← (this skill)
2. Write Tests (based on spec requirements)
3. Implement Code (to pass tests)
After completing the spec:
1. Get user approval
2. Proceed to writing tests based on requirements using TDD
3. Follow stdd skill for remaining steps
Related in Writing & Docs
jax-development
IncludedUse this skill when the user is writing, debugging, profiling, refactoring, reviewing, benchmarking, parallelising, exporting, or explaining JAX code, or when they mention JAX, jax.numpy, jit, grad, value_and_grad, vmap, scan, lax, random keys, pytrees, jax.Array, sharding, Mesh, PartitionSpec, NamedSharding, pmap, shard_map, Pallas, XLA, StableHLO, checkify, profiler, or the JAX repo. It helps turn NumPy or PyTorch-style code into pure functional JAX, fix tracer/control-flow/shape/PRNG bugs, remove recompiles and host-device syncs, choose transforms and sharding strategies, inspect jaxpr/lowering/IR, and benchmark compiled code correctly.
nature-article-writer
IncludedDrafts, rewrites, diagnostically critiques, and style-calibrates primary research manuscripts for Nature and Nature Portfolio journals. Use when the user wants a Nature-style title, summary paragraph or abstract, introduction, results, discussion, methods, figure legends, presubmission enquiry, cover letter, reviewer response, or when a scientific draft sounds generic, jargon-heavy, structurally weak, or AI-ish and needs precise, broad-reader-friendly prose without inventing data, analyses, or references. Best for primary research articles and letters rather than reviews or press releases unless explicitly adapting one.
deckrd
IncludedDocument-driven framework that derives requirements, specifications, implementation plans, and executable tasks from goals through structured AI dialogue. Use when user says "write requirements", "create spec", "plan implementation", "derive tasks", "structure this feature", "break down into tasks", or "document this module". Also use for reverse engineering existing code into docs (/deckrd rev). Do NOT use for direct code writing — use /deckrd-coder after tasks are generated. Do NOT use when the user only wants to run or fix existing code without planning.
clinical-decision-support
IncludedGenerate professional clinical decision support (CDS) documents for pharmaceutical and clinical research settings, including patient cohort analyses (biomarker-stratified with outcomes) and treatment recommendation reports (evidence-based guidelines with decision algorithms). Supports GRADE evidence grading, statistical analysis (hazard ratios, survival curves, waterfall plots), biomarker integration, and regulatory compliance. Outputs publication-ready LaTeX/PDF format optimized for drug development, clinical research, and evidence synthesis.
handling-sf-data
IncludedSalesforce data operations with 130-point scoring. Use this skill to create, update, delete, bulk import/export, generate test data, and clean up org records using sf CLI and anonymous Apex. TRIGGER when: user creates test data, performs bulk import/export, uses sf data CLI commands, needs data factory patterns for Apex tests, or needs to seed/clean records in a Salesforce org. DO NOT TRIGGER when: SOQL query writing only (use querying-soql), Apex test execution (use running-apex-tests), or metadata deployment (use deploying-metadata).
accelint-ac-to-playwright
IncludedConvert and validate acceptance criteria for Playwright test automation. Use when user asks to (1) review/evaluate/check if AC are ready for automation, (2) assess if AC can be converted as-is, (3) validate AC quality for Playwright, (4) turn AC into tests, (5) generate tests from acceptance criteria, (6) convert .md bullets or .feature Gherkin files to Playwright specs, (7) create test automation from requirements. Handles both bullet-style markdown and Gherkin syntax with JSON test plan generation and validation.