/spec:researchfrom spec
Researches a change by mapping the codebase status quo and optionally dispatching a web-survey sub-agent for external decisions. Maintains a single research.md with Practices, Constraints, Open TBDs, and Decided items, plus a discarded-draft pile on direction changes.
Ships in spec. Installing the plugin adds it to Claude Code.
Research direction: $ARGUMENTS
View shorthand: a leading view or --view token is stripped from the arguments (the rest stays free text) and, after this command's own work is done, /spec:view research renders the HTML view. Echo the split on the first output line — view: on · direction: <rest> — so a direction that merely starts with the English word "view" is caught at a glance (quote it and re-run).
spec/changes/<name>/
├── research.md ← current research (single file: Practices + Constraints + Open[TBD] + Decided)
├── index.md ← requirement & asset index (R-N verbatim quotes + A-N assets + E-N exemplars — built HERE at first source contact; see references/index-spec.md)
└── research/ ← discarded-draft pile for this proposal (optional; only created on direction change)
└── <title>-research.md ← full snapshot of an abandoned research.md; no labels, no links, resurrectable
## Open [TBD] / ## Decided are maintained the same way as before.# Research: <change-name>
## Practices
- Option A: implementation highlights / performance / integration cost / known issues | why it's a candidate (under what constraints it's worth considering)
- Option B: ...
Key references: <URL>
## Constraints
- <constraint>: compatibility / performance target / dependency version / security requirement | consequence of violating it (a constraint you can't name consequences for is probably redundant)
## Open [TBD]
- [TBD-1] <preference-driven decision point> | candidates: <A> (evidence: Practices/Constraints line or status-quo observation) / <B> (…) / skip-or-minimal | select: one|several
## Decided
(Moved here from Open after interrogation. Format: [DEC-N] <decision> | source [TBD-N] | rationale)
Write external information only (see SKILL "Stage Responsibility Matrix"): architecture / interfaces / schema belong in design; the list of changed files belongs in proposal ## What — do not write these into research. Raw search process notes do not belong in the body (move them to the research/ discarded-draft pile when changing direction). ## Decided DEC-N entries are decision records (conclusion + one-line rationale) — they are not the single source of truth for deep argumentation (deep argumentation covers only 1–2 contested decisions, in design ## Key Decisions). proposal ## How MUST forward-pass the conclusion + one-line rationale to apply (apply does not read research), so the implementer is never left with an empty pointer like "see DEC-N".
spec/changes/<kebab-name>/, deriving the name from the user's description, and write the current pointer (spec/changes/.current ← the new name — gates target it even when other changes coexist); active change with a matching direction → append to research.md. Old-change triage (one question round, then proceed): creating a new change while OTHER active changes exist → before diving into research, surface them in ONE structured question (delivered per /spec:ask's question rules — structured tool first, plain-text fallback) and let the user disposition each — a change whose verify.md concludes pass gets archive (recommended); an unfinished one gets stash or keep parallel (legal under the pointer — the new change is already targeted). Never present this as an error: the new change proceeds regardless of the answer; the question exists so forgotten changes get closed instead of accumulating. Chosen archives/stashes execute right after the question, before step 2. spec/ is created at the project root the session was launched from — NEVER inside a subproject directory, and NEVER in another spec tree: the gate hooks resolve spec/ at that root only, and a spec tree anywhere else is invisible to them (apply/ship/archive would block with "no spec/changes/ directory"). Working on a monorepo subproject → keep spec/ at the launch root (prefix the change name with the subproject if helpful), or have the user relaunch the session inside the subproject. A git worktree session roots spec/ in THAT worktree — do not follow .git/gitdir back to the main repository. Path self-check (mandatory): right after creating the directory, confirm its absolute path is <launch root>/spec/changes/<name>/ — a change created in any other tree makes every later gate block with misleading messages (the gate names whatever unrelated change its own tree holds).@researcher sub-agent to research and write into research.md. @researcher does not ship with sdd — when the roster lacks it, dispatch the general-purpose agent with the role inline in the brief ("web-research specialist: survey practices, cite URLs, no fabrication"):
## Practices## Constraintsspec/knowledge.md (the index) and open only the subdocs whose tag+hook match this change's domain (legacy flat file → read whole, declare; format → references/knowledge-spec.md); don't re-derive or re-Grep what's already recorded there (a fact carrying | suspect: is re-checked before you rely on it — its evidence anchor is gone) — then Grep / Glob relevant modules to map existing call chains / constraints (write into ## Constraints — this is "understanding the status quo", not "designing new architecture"; new architecture belongs in design). A knowledge.md fact contradicted by what you find → note the correction in research (订正/corrected: ...); the fix to knowledge.md itself lands at archive time.spec/changes/<name>/index.md (mandatory for new changes; format → references/index-spec.md) at first contact with the requirement source: extract R-N verbatim quotes of behavioral clauses only (validation / required fields / value ranges / permissions / display mappings / state rules — descriptive narrative is not indexed); from the status-quo mapping, inventory the A-N assets this change's domain touches (use: reuse / extend / pattern / rejected: <reason>) and designate E-N exemplars for each new page/module (1–2 existing ones as the master template). Two hard rules ride the A-N inventory: ① an A-N row marked extend or modify MUST carry an impact enumeration — the callers / consumers / live-data constraints of the touched surface (Grep-evidenced), landed in ## Constraints; this enumeration is what lets the manual flow run without a compat critic — skip it and the change's blast radius surfaces only at delivery. ② every planned new artifact (entity / utility / component / dependency) gets a project-wide equivalent search (not just this change's domain — an equivalent living in another module still counts), result recorded on its A-N row: found → reuse candidate; empty-handed → the search scope recorded (the reuse lens verifies these claims later with its own codebase access); map the C-N Carriers from the same status-quo pass — every requirement noun that will need a data/API carrier (field / method / endpoint / parameter) gets a row mapping it to its EXISTING carrier (e.g. 单据类型 → is_device); no existing carrier found → record the responsibility-search (where you looked) and mark the row minting required (it rides the HARD GATE for approval). Requirement nouns are not entitled to new code entities — the map is what stops 1:1 noun-to-entity minting. One extraction — propose freezes the index; later stages append new IDs only, never renumber. No prototype/document → the user's task statement IS the source: quote its sentences (a few lines; mandatory does not mean heavy).## Constraints): verify the test runner actually executes tests (a skipTests-style config makes every later "build passed" claim vacuous — name the config if found) and the commit/deploy path works; each anomaly is a Constraint with its consequence stated.## Open:
[TBD] for /spec:ask[TBD]. Sole exception: the codebase shows an established convention with ≥2 consistent occurrences and zero counter-examples, each cited by file → decide from status quo, and the decision MUST surface on the gate's Decided without asking line (a misjudged convention is overturnable there, never silent)| candidates: <option> (evidence: <Practices/Constraints line or status-quo observation>) / … / skip-or-minimal | select: one|several — /spec:ask derives its question options from these citations ("options are citations, not inventions"); a decision point whose candidates you cannot yet name needs more research, not a bare TBD## Open AND the gate pre-flight: end the research turn by reporting the Open [TBD] state and the matching next step — ## Open holds [TBD-N] items → the next command is /spec:ask (name the open TBD-N ids so the user knows what will be asked); ## Open empty → /spec:propose only after the target pre-flight passes (SKILL § Gate-aware next steps: current pointer set or exactly one active — research writes the pointer at dir creation, so this normally holds; ambiguous anyway → recommend /spec:resume <this change> and list the other actives with archive candidates flagged). NEVER recommend a command whose gate you can see will bounce it — a wrong recommendation sends the user straight into the wall.Hard steps — order MUST NOT be reversed — research.md will be overwritten; skipping the snapshot loses the old direction permanently:
research/<old-direction-title>-research.md (create research/ if it doesn't exist)## Open / ## Decided to reflect current thinking on the new directionresearch/<title>-research.md back into research.md## Open / ## Decided as neededLoad the corresponding reference only when writing Practices that involve a specific tech stack (all files below live under ${CLAUDE_PLUGIN_ROOT}/skills/core/references/):
${CLAUDE_PLUGIN_ROOT}/skills/core/references/alibaba-java.md + java-conventions.mdvue-style.md + vue-patterns.md + js-style.md + css-style.md (add uniapp-miniprogram.md for uni-app)bulletproof-react.md + react-patterns.mdgoogle-ts-style.md + ts-conventions.mdpython-conventions.md; PHP → php-conventions.md; Flutter → flutter-conventions.md/spec:research does not force-load references (saves tokens); load them on demand only when writing a specific decision.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub effinrich/spec-stack --plugin spec21 commands in this plugin
/apply/spec:applyImplement the code, advancing by proposal/tasks. A pre-command hook checks that proposal.md carries the APPROVED marker. Verification model: cheap self-run working checks per node while implementing; ONE independent spec-verifier pass at the end (never dispatch verification subagents mid-implementation)/archive/spec:archiveArchives the current change to spec/archive/YYYY-MM-DD-<name>/. Only invoked when the user explicitly says "archive". Writes an archive-stage retrospect, mines the change for recurring lessons (fresh-context spec-reflector agent) and applies the ones the user selects to project skills / rules files, sediments the knowledge base, checks for uncommitted code, and is guarded by the check-archive hook./ask/spec:askInterrogates preference-driven decision points. Derives questions from the candidate sets research minted into each [TBD] (options are citations, not inventions), asks via AskUserQuestion (multiSelect for pick-several), and moves answered items to/chat/spec:chatDiscussion mode. Everything said during this mode is treated as thinking material only — no documents are touched. Use for brainstorming directions, or to talk through concerns about a proposal before deciding how to change it./design/spec:designTechnical design elaboration. Trigger on demand — use when the architecture is complex, there are more than 3 interfaces, sequence/data-flow diagrams are needed, or a decision requires more than 300 words of deep argumentation. Produces design.md./fix/spec:fixStreaming light tier for bug fixes and small changes (user-explicit only, never model-initiated). Appends F-N entries to today's daily batch under spec/changes/fixes/<date>/ — locate & confirm before touching code, fix directly when confident or research candidates when not, self-check evidence per entry; the ONE independent audit happens at /spec:ship.2 plugins ship this exact command · first indexed Nov 13, 2026
Other plugins' commands for the same job