Skip to content
FunCoding

create-spec

Write a technical design spec, RFC, PRD, or detailed implementation plan for a feature or refactor, shaped around the program's entrypoints (the doors that carry domain intent) and grounded in existing codebase research. Apply proactively before implementing non-trivial features, refactors, or boundary changes whenever a written design or spec belongs under specs/.

Star
886
Last commit
Dec 1, 2026

packages/subagents/skills/create-spec/SKILL.md

View on GitHub

Create a technical spec

Write a design-only specification under specs/YYYY-MM-DD-<kebab-case-topic>.md (using today's date) by grounding the design in existing research and the live codebase. Treat the program's entrypoints — its doors — as the spine of the spec so a reviewer can reconstruct what the system is for from the boundary alone before reading any mechanism.

Do not implement code during this skill; the deliverable is the reviewed spec in specs/.

Research inputs

Look for prior research in $ARGUMENTS, or across the whole research/ directory when no path is given. Read research from research/ (not specs/, which holds design outputs rather than neutral codebase findings). Delegate discovery and extraction to codebase-research-locator and codebase-research-analyzer when the directory has multiple documents, and cite the relevant research documents throughout the spec so decisions trace back to evidence.

Before drafting

1. Settle the compatibility posture

Identify whether the project preserves backward compatibility for existing downstream users:

  • Breaking changes allowed: the user explicitly permits breaking changes, public API cleanup, or confirms there are no downstream users. Document legacy shims, flags, and APIs as current state rather than preservation constraints unless explicitly requested.
  • Backward compatibility required: the user mentions production users, published APIs, downstream callers, or migration safety. Document compatibility-sensitive surfaces, migration constraints, and behavior future work must preserve.
  • Unclear: ask once using ask_user_question before decomposing the spec. Carry the agreed posture into the spec plan, document frontmatter, and a ## Backwards Compatibility section.

2. Choose Path A or Path B

Inspect the conversation, requested research path, research/ documents, local docs, and codebase first. Whenever the codebase can answer a question directly, inspect it instead of asking the user.

  • Path A (convert context to spec): available context already establishes the problem, constraints, affected code, and acceptance criteria. Draft the spec directly.
  • Path B (clarify first): the problem, constraints, design direction, affected code, or acceptance criteria are still unclear. Do not invent architectural decisions. State what is missing, resolve the gaps using ask_user_question with contrastive options (2–3 concrete choices with trade-offs and a recommendation), then run Path A.

Path A sequence

Work in this order and map the results into references/spec-template.md:

  1. Load local conventions. Inspect existing module layout, domain vocabulary, error families, adapters, observability, runtime patterns, and test style before introducing new ones. Ground findings in §2.1 and existing door names.
  2. Define the problem. Capture current state, callers, pain points, goals, non-goals, invariants, affected systems, risks, and open questions (§2, §3, §9). Keep unknowns explicit in §9 rather than guessing.
  3. Compare materially different alternatives. Evaluate distinct interface shapes, seam placements, ownership boundaries, call stacks, and module layouts — not just naming tweaks — and record the comparison in §6 before locking the design.
  4. Design typed contracts. Define the doors, signatures, named failures, and type-level refusals in §5.1–§5.3, auditing each against the door rubric below.
  5. Trace control and data flow. Show current and proposed paths, failure modes, retries, cancellation, and idempotency in §5.4 using the smallest clear visual.
  6. Map file ownership. List every file to add, change, delete, or test with its single responsibility in §4.3.
  7. Plan vertical TDD slices. Structure §8 as vertical red-green-refactor slices through public doors (one failing behavior test, minimal green implementation, behavior-preserving refactor), not a horizontal all-tests-first batch. Use explicit phases (Phase 1, Phase 2) rather than calendar dates or time estimates.
  8. Write the spec. Load references/spec-template.md and write specs/YYYY-MM-DD-<topic>.md.

Designing around doors

Everything behind an entrypoint is mechanism (how); only at the boundary does code state meaning (what and why). Because untrusted input enters and irreversible effects happen at these boundaries, designing the door set first prevents leaking intent into internal plumbing.

Five principles

  1. Name a joint, not a tool. Name each door for a domain boundary a non-engineer recognizes (authorize_charge, settle_payment, revoke_access, publish_draft), never for an internal mechanism (run_query, call_service, update_row).
  2. Compress honestly. A door's name must promise exactly what its body delivers — hiding no danger or partial behavior, implying no guarantee it does not keep. Encode cost, allocation, and irreversibility in the vocabulary.
  3. Express intent in refusals. Prefer making illegal states unrepresentable via types (newtypes like AccountId, sum types over independent booleans, capability types like AuthorizedCharge minted only by authorize_charge) rather than relying on runtime checks callers can forget.
  4. Write for a stranger across time. A future engineer reading only the entrypoint names and signatures should reconstruct what the system is for and what each door owes without reading any implementation body.
  5. Funnel irreversible effects through one chokepoint. Every irreversible action (moving money, granting access, deleting data, minting keys, broadcasting) passes through one honestly named door so invariants have a single home.

Door rubric

Audit every non-trivial entrypoint forward (checking your draft) and backward (checking whether every obligation has a home). Any item you cannot answer cleanly becomes a constraint in §5 or an open question in §9:

  1. Joint, not tool: domain verb rather than implementation step.
  2. Single declarative sentence: states its guarantee with no "and" (otherwise split a fused door or define a vague one).
  3. Honest name: lists and eliminates any way the name could mislead a caller.
  4. Obligations discharged: preconditions, invariants, postconditions, and never guarantees each map to a concrete design step.
  5. Every exit keeps the promise: errors, retries, timeouts, partial writes, concurrent callers, and replays preserve the guarantee.
  6. Real refusals: illegal states are unrepresentable where practical, not merely checked.
  7. Singular trust transition: untrusted-to-trusted promotion or privilege elevation happens at one explicit edge.
  8. Single chokepoint: irreversible effects have no back door.
  9. Airlock at the boundary: validation, auth, conversion, and error translation sit at the edge so the core trusts its invariants.
  10. Stranger test: name and signature alone convey purpose and obligations.

Wire parity

An in-process function, REST route, and RPC/gRPC method are one door across transports and should share one joint name. On HTTP, let verbs express safety (GET safe, PUT/DELETE idempotent, POST carrying Idempotency-Key when needed) and status codes report honest exits (201, 204, 409, 412) rather than wrapping errors in 200 OK.

Shape-first visuals

Keep prose short and pair it with the smallest visual that makes the shape clear:

  • Indented text pseudocode for logic or algorithms.
  • Indented call tree for runtime control flow.
  • tsx component tree for UI structure and state boundaries.
  • Shallow text file tree for module ownership or refactors.
  • Mermaid diagrams for cross-component interaction or data flow.
  • Topic-matched diff when modifying an existing shape; full blocks when most of the shape is new.

When a UI layout or dense state comparison genuinely benefits from a browser view, you may generate one focused show-me-<description>.html artifact alongside the Markdown spec and open it portably via bash (open on macOS, xdg-open on Linux, or print the path otherwise).

Review and refinement

When the spec includes review or release gates (opening a PR, tagging, deploying, publishing), separate review acceptance from authorization to act. For any work delegated to subagents, give each child a concrete action, explicit scope, and the evidence it needs.

After generating the draft:

  1. Walk through ## 9. Open Questions / Unresolved Issues with the user using ask_user_question (one question or logical group at a time). Use contrastive clarification: present 2–3 concrete options with explicit trade-offs and your recommended choice, paying special attention to disagreements over door boundaries, refusals, or irreversible chokepoints.
  2. Update the spec in place with each answer until open questions are settled.
  3. Finish with an executive summary containing the specs/ file path, the door set listed by name alone (calling out irreversible doors), and an invitation for final feedback.

Bundled reference

  • references/spec-template.md — full numbered RFC/spec template (§1–§9) with section guidance and examples. Read this before writing the spec file.

Similar Skills

wayfinder

MAmattpocock/skills336k4,217 new stars in the last 7 days

grill-with-docs

MAmattpocock/skills336k4,217 new stars in the last 7 days

to-tickets

MAmattpocock/skills336k4,217 new stars in the last 7 days

to-spec

MAmattpocock/skills336k4,217 new stars in the last 7 days

loop-me

MAmattpocock/skills336k4,217 new stars in the last 7 days

implement-spec

MAmattpocock/skills336k4,217 new stars in the last 7 days