spec-refine

spec-refine is a command for coding agents from Habib0x0/spec-driven-plugin. It costs 13 tokens per session (577 once invoked), scanned A, original, MIT.

A command for improving the requirements and technical design written for an existing software feature.

In plain words
What is it for?
Use it to revise a feature specification, including its requirements, components, and interfaces.
Why use it?
It helps resolve unclear, missing, changed, or conflicting details before implementation begins.

Command

Part of the spec-driven plugin — 1 skill, 19 commands, 12 agents shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/habib0x0/spec-driven-plugin/spec-refine
Clone the repo
git clone --depth 1 https://github.com/Habib0x0/spec-driven-plugin

Or install spec-driven, the plugin that ships this one along with the rest of its 1 skill, 19 commands, 12 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for spec-refine

README.md
[![agentmods](https://agentmods.dev/badge/commands/habib0x0/spec-driven-plugin/spec-refine.svg)](https://agentmods.dev/commands/habib0x0/spec-driven-plugin/spec-refine)
Your own site
<a href="https://agentmods.dev/commands/habib0x0/spec-driven-plugin/spec-refine"><img src="https://agentmods.dev/badge/commands/habib0x0/spec-driven-plugin/spec-refine.svg" alt="Measured on agentmods" height="20"></a>
Per session 13 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 577 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00013 $0.00577
Opus 5 $0.00006 $0.00289
Sonnet 5 $0.00003 $0.00115
Haiku 4.5 $0.00001 $0.00058

Measured 3d ago against content hash 7ae6d6936a7a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

spec-refine scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

commands/spec-refine.md · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.

/spec-refine Command

Update requirements or design for an existing spec.

Model Override

When this command delegates to agents via the Task tool, check the relevant SPEC_MODEL_* environment variable and pass its value as the model: parameter when set and non-empty. When unset, omit model: and the agent uses its frontmatter default tier.

Env var Agent Default tier Used in
SPEC_MODEL_PLANNER spec-planner reasoning Requirements / design refinement (steps 4, 5)
SPEC_MODEL_TASKER spec-tasker standard Task regeneration cascade (step 6)

Workflow

1. Identify Current Spec

Look for existing specs in .claude/specs/:

ls .claude/specs/

If multiple specs exist, ask which one to refine. If only one exists, use it automatically.

2. Read Current Spec

Read the current requirements.md and design.md:

.claude/specs/<feature-name>/requirements.md
.claude/specs/<feature-name>/design.md

3. Gather Refinements

Ask the user what needs to change:

  1. New requirements to add?
  2. Requirements to modify?
  3. Requirements to remove?
  4. Design changes needed?
  5. New components or APIs?

4. Update Requirements (if changed)

If requirements changed:

  1. Add new user stories with EARS acceptance criteria
  2. Update existing stories as needed
  3. Mark removed requirements as deprecated (don't delete history)
  4. Update non-functional requirements
  5. Update out-of-scope section

5. Update Design (if needed)

If requirements changed or design needs updates:

  1. Review impacted components
  2. Update architecture diagrams
  3. Modify data models
  4. Update API specifications
  5. Revise sequence diagrams
  6. Update security/performance considerations

6. Cascade to Tasks

After refining requirements or design:

  1. Inform user that tasks may need updating
  2. Suggest running /spec-tasks to regenerate tasks
  3. Note which existing tasks might be affected

Example Usage

Read the full file on GitHub · 100 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 100 lines · 13 tokens per session scan A 7ae6d6936a7a

Subscribe to this mod's changes

spec-refine is a command published in the GitHub repository Habib0x0/spec-driven-plugin (10 stars, last pushed 3mo ago), licensed MIT. It adds 13 tokens to every session and 577 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.