structured-spec
Skill157 starsChanged 3 months agoMITView on GitHub
Write, review, validate, or parse structured specification documents — PRDs, SDDs (design docs), implementation plans, TSDs (technical specs), BDD specs, and ADRs (architecture decision records) — using the Structured Spec standard (YAML frontmatter + Markdown narrative + HTML-comment annotations for requirement/contract/test/architecture/decision/slo + executable code contracts, with requirement-to-contract-to-test traceability). Use when asked to draft, scaffold, template, or check completeness/traceability of a spec, requirements doc, design doc, or decision record, migrate a plain-Markdown spec to this format, or slice a spec into tasks for multiple agents.
In this repository59 other files it gives its agents.
- github-pages/agents.mdAGENTS.md
- adrSkill
- agent-protocolsSkill
- angular-idiomsSkill
- api-documentationSkill
- axum-idiomsSkill
- browser-automationSkill
- chaos-testingSkill
- ci-cdSkill
- cli-developmentSkill
- code-auditSkill
- code-reviewSkill
- cpp-idiomsSkill
- csharp-idiomsSkill
- data-engineeringSkill
- debugging-protocolSkill
- django-idiomsSkill
- dotnet-idiomsSkill
- elixir-idiomsSkill
- embedded-systemsSkill
- feature-flagsSkill
- flutter-idiomsSkill
- frontend-designSkill
- git-commit-integritySkill
- go-idiomsSkill
- guardrailsSkill
- hono-idiomsSkill
- incident-responseSkill
- java-idiomsSkill
- javascript-idiomsSkill
- kotlin-idiomsSkill
- laravel-idiomsSkill
- logging-implementationSkill
- ml-engineeringSkill
- mobile-designSkill
- mobile-testingSkill
- nextjs-idiomsSkill
- parallel-dispatchSkill
- payment-integrationSkill
- perf-optimizationSkill
- php-idiomsSkill
- postgres-idiomsSkill
- python-idiomsSkill
- rails-idiomsSkill
- react-idiomsSkill
- refactoring-patternsSkill
- research-methodologySkill
- ruby-idiomsSkill
- rust-idiomsSkill
- security-auditSkill
- sequential-thinkingSkill
- spring-boot-idiomsSkill
- sql-idiomsSkill
- supply-chain-securitySkill
- swift-idiomsSkill
- testability-patternsSkill
- testing-strategySkill
- typescript-idiomsSkill
- vue-idiomsSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Very specific: line 10
Standard version 2.0.0: Every file in this directory is at 2.0.0.
- Distinctive: line 19
Not for: ordinary prose docs, READMEs, or runbooks that have no requirements to trace.
- Distinctive: line 23
Read only what the task needs.
- Very specific: line 52
If the request spans several, write separate documents and link them via dependencies.specs.
- Distinctive: line 56
Not every project needs six documents.
- Distinctive: line 64
Rule of thumb: Start with one document. Separate when a section grows past what a single reader needs to scan (typically >15 scenarios for …
- Distinctive: line 170
When the client requests the export for 2026-08-17 Then the response is CSV containing that day's rows
- Distinctive: line 177
Link once, from the child: Never mirror a link on both ends — that is what made v1 documents contradict themselves.
- Very specific: line 179
Code contracts run as written: No pseudocode, no ... elisions inside a contract's code block.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Structured Spec
Specification documents that are readable by humans, writable by agents, and parseable by machines. Standard GitHub-Flavored Markdown plus typed annotations carried in HTML comments, so renderers ignore them and parsers don't have to guess.
Standard version 2.0.0. Every file in this directory is at 2.0.0; do not mix with v1 documents (see specification.md §9 to migrate one).
Use this skill when
- Writing or reviewing a PRD, SDD, implementation plan, TSD, BDD spec, or ADR
- Validating a spec's completeness or requirement traceability
- Migrating plain Markdown into the structured format
- Slicing a spec into work packages for multiple agents
Not for: ordinary prose docs, READMEs, or runbooks that have no requirements to trace.
Where to look
Read only what the task needs. These files do not repeat each other — each fact lives in exactly one place.
| Question | File |
| Which document type do I write? | This file, next section |
| What are the annotation fields and rules? | specification.md §3–§4 |
| How does traceability work? | specification.md §5 |
| When is a spec complete? | specification.md §6 |
Which type value do I use? | taxonomy.md |
| What section order for this doc type? | profiles/<doc_type>.md |
| Is the frontmatter legal? | spec-schema.json |
| Show me a full real document | example-prd.md |
| Give me a blank starting point | template.md |
| Is this document actually valid? | Manual review against specification.md §6 completeness rules |
Pick the profile
doc_type is a closed set of seven. Choose by the question the document answers:
| The document answers | doc_type | Profile |
| WHY — business context, users, success criteria | prd | profiles/prd.md |
| HOW — architecture, components, trade-offs | sdd | profiles/sdd.md |
| WHEN and WHO — tasks, sequencing, owners | implementation-plan | profiles/implementation-plan.md |
| INTERFACE — APIs, payloads, errors, versioning | tsd | profiles/tsd.md |
| BEHAVIOR — scenarios and edge cases | bdd | profiles/bdd.md |
| DECISION — one choice, its alternatives and consequences | adr | profiles/adr.md |
| None of the above | custom | no profile; universal rules only |
If the request spans several, write separate documents and link them via dependencies.specs. Do not merge a PRD and an SDD into one file.
When to consolidate vs separate
Not every project needs six documents. Use project scale to decide:
| Scale | Guidance |
| Small (Tier 1, ≤5 files, single module) | One PRD is sufficient. Embed BDD scenarios inline (Section 7: Acceptance Tests). Embed API contracts inline. No separate SDD, TSD, or BDD document needed. |
| Medium (Tier 2, cross-module, 6+ files) | PRD + SDD. Embed decisions as inline <!-- decision --> annotations in the SDD. Separate TSD only if external consumers exist. Separate BDD only if scenario count exceeds ~15. |
| Large (Tier 3, public API, multi-service) | Full separation: PRD + SDD + TSD + BDD + Implementation Plan. Standalone ADRs for decisions that outlive the SDD. |
Rule of thumb: Start with one document. Separate when a section grows past what a single reader needs to scan (typically >15 scenarios for BDD, >10 endpoints for TSD, or when different audiences need different documents).
Phased delivery
For large features, use milestones in frontmatter and milestone fields on annotations to split delivery into phases:
- Define milestones in frontmatter:
milestones: [{name: "Phase 1: Core", target_date: "2026-09-01", status: "in-progress"}, ...] - Tag annotations with
milestone: "Phase 1: Core"— requirements, contracts, tests, and tasks - Review per phase — completeness rules (§6.5) apply per milestone. Phase 2 requirements don't block Phase 1 approval.
- Slice by milestone — orchestrators can dispatch Phase 1 tasks first, then Phase 2 after review
Annotations without a milestone field belong to all phases (backward compatible).
Document storage
Structured spec documents live under docs/ alongside other project documentation. Each document type has a prescribed location:
docs/
├── specs/ ← PRDs, SDDs, TSDs, BDD specs, Implementation Plans
│ ├── prd-billing-export.md
│ ├── sdd-payment-service.md
│ ├── tsd-billing-api.md
│ ├── bdd-checkout-flow.md
│ └── plan-v2-migration.md
├── decisions/ ← ADRs (convention from `adr` skill)
│ ├── 0001-use-postgresql.md
│ └── 0002-adopt-feature-structure.md
├── research_logs/ ← Research findings (convention from `research-methodology` skill)
├── audits/ ← Audit reports (convention from `code-review` skill)
└── debugging/ ← Debug investigations (convention from `debugging-protocol` skill)File naming for specs: {doc_type}-{short-slug}.md (e.g., prd-billing-export.md, sdd-payment-service.md). The spec_id in frontmatter is the canonical identifier; the filename is for human navigation.
ADRs stay in docs/decisions/ — the adr skill owns that convention (NNNN-short-title.md numbering). Do not move ADRs to docs/specs/.
.agentwork/ is ephemeral — scope cards, handoffs, findings, and pipeline artifacts go there. Persisted specifications always go under docs/.
Workflow
- Pick the profile from the table above. If genuinely ambiguous, ask; otherwise infer and state the choice.
- Open
profiles/<doc_type>.mdfor that profile's ID prefixes, section order, and extra rules. - Write frontmatter. Nine required fields. New documents start at
status: draft. - Write the narrative. Plain Markdown. Context and reasoning that annotations cannot carry.
- Add annotations immediately above what they describe —
specification.md§4 for fields,taxonomy.mdfortypevalues. - Link once, from the child. Contracts, tests, architecture, SLOs, and decisions name the requirements they serve. Requirements never point back; the reverse index is derived. Adding a test never means editing a requirement.
- Verify completeness against
specification.md§6. Fix gaps before raisingstatusabovedraft.
Minimum viable spec
Enough to be valid. Everything else is elaboration.
---
$schema: "https://raw.githubusercontent.com/irahardianto/awesome-agv/main/.agents/skills/structured-spec/spec-schema.json"
spec_id: "PRD-BILLING-EXPORT-V1"
title: "Billing Export"
doc_type: "prd"
status: "draft"
version: "0.1.0"
owners: ["platform-team"]
created: "2026-08-18"
modified: "2026-08-18"
---
# 1. Problem Context
Finance reconciles invoices by hand because usage data never leaves the platform.
<!-- requirement
id: REQ-001
title: Export daily usage as CSV
priority: must
category: functional
rationale: Manual reconciliation costs the finance team two days per month
-->
Exports run nightly and cover the previous UTC day.
<!-- contract
id: CT-API-001
type: api-contract
title: Usage export endpoint
stack_category: application-code
implements_requirements: [REQ-001]
-->
```yaml
paths:
/exports/usage:
get:
parameters: [{ name: date, in: query, required: true, schema: { type: string, format: date } }]
responses: { "200": { description: CSV export } }
```
<!-- test
id: TC-001
type: acceptance-test
title: Export returns the previous day's usage
verifies_requirements: [REQ-001]
-->
```gherkin
Scenario: Export returns the previous day's usage
Given usage exists for 2026-08-17
When the client requests the export for 2026-08-17
Then the response is CSV containing that day's rows
```Rules that are easy to get wrong
- Link once, from the child. Never mirror a link on both ends — that is what made v1 documents contradict themselves.
- Tests are not contracts.
acceptance-testandintegration-testaretesttypes. A Gherkin block is never a<!-- contract -->. - Code contracts run as written. No pseudocode, no
...elisions inside a contract's code block. - IDs are unique per document and never renumbered once the status is
approved— other specs cite them. - Annotations touch the content they describe, separated by at most one blank line.
draftis never blocked. Enforcement scales withstatus; seespecification.md§6.3. Do not refuse to write a rough draft because it lacks tests.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

