SpecPilot: Command for Claude Code

.claude/commands/specpilot-backfill.md

specpilot-backfill is a command for Claude Code from girishr/SpecPilot. It costs 23 tokens per session (1,213 once invoked), scanned A, original, MIT.

A command that adds missing SpecPilot instruction sections to existing coding-agent rule files. It checks known sections and appends only those that are absent.

In plain words
What is it for?
Use it to add Critical Mandates, Code Philosophy, Code Rules, and Re-Anchor sections to supported IDE instruction files.
Why use it?
It updates existing instructions without overwriting their current content, while preserving rules about commits, deployments, specifications, and reading files first.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; positional $N argument.

This is girishr/SpecPilot's own configuration. It tells Claude Code how to work on SpecPilot itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything SpecPilot configures →

Reuse

Borrowing it

Nothing to install: this file belongs to girishr/SpecPilot. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/girishr/SpecPilot/main/.claude/commands/specpilot-backfill.md
Clone the repo
git clone --depth 1 https://github.com/girishr/SpecPilot

Made for: Claude Code.

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 specpilot-backfill

README.md
[![agentmods](https://agentmods.dev/badge/commands/girishr/specpilot/specpilot-backfill.svg)](https://agentmods.dev/commands/girishr/specpilot/specpilot-backfill)
Your own site
<a href="https://agentmods.dev/commands/girishr/specpilot/specpilot-backfill"><img src="https://agentmods.dev/badge/commands/girishr/specpilot/specpilot-backfill.svg" alt="Measured on agentmods" height="20"></a>
Per session 23 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,213 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00023 $0.01213
Opus 5 $0.00012 $0.00607
Sonnet 5 $0.00005 $0.00243
Haiku 4.5 $0.00002 $0.00121

Measured 8d ago against content hash 16c9c26b3e63, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

specpilot-backfill 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 8d 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.

.claude/commands/specpilot-backfill.md · 118 lines

How it starts

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

Backfill missing SpecPilot mandate sections into whichever IDE files already exist in this project. Run the script below — it checks four fingerprints per file and appends whichever are missing, append-only, never overwriting existing content.

cd "$(git rev-parse --show-toplevel 2>/dev/null || pwd)"

CANDIDATE_FILES=(
  ".github/copilot-instructions.md"
  "CLAUDE.md"
  ".cursor/rules/specpilot.mdc"
  ".windsurfrules"
  ".antigravity/rules.md"
)

has_critical() { grep -qF "Critical Mandates" "$1"; }
has_philosophy() { grep -qF "## Code Philosophy — Write Only What Needed" "$1"; }
has_rules() { grep -qF "## Code Rules" "$1"; }
has_reanchor() { grep -qF "## Re-Anchor" "$1"; }

append_critical() {
  cat <<'BLOCK' >> "$1"

## 🔴 Critical Mandates — Never violate, no exceptions

1. No commit unless asked.
2. No push unless asked.
3. No deploy/publish/release unless asked.
4. No `.specs/` structure changes — content only.
5. Update specs after change:
   - Trivial → `planning/tasks.md`
   - Feature → `project/requirements.md` + `planning/tasks.md`
   - Architectural → all affected files + `CHANGELOG.md`
6. Never reference file contents without reading first. If unread, say so.
7. Never write code or change files unless asked. Ask first.
8. Spec-first gate (scale to task size):
   - Trivial → no gate
   - Feature → read 1–2 relevant `.specs/` files before coding
   - Architectural → update all affected specs, present Spec Report, wait for `yes, proceed`
BLOCK
}

append_philosophy() {
  cat <<'BLOCK' >> "$1"

## Code Philosophy — Write Only What Needed

1. Need exist? No → skip. Say why.
2. Already in codebase? → reuse. Not rewrite.
3. Stdlib do it? → use it.
4. Native or installed dep cover it? → use. No new deps.
5. One line do it? → write that.
6. Only then: minimum code that work.
7. Never cut: validation, error handling, security, explicit requirement.
BLOCK
}

append_rules() {
  cat <<'BLOCK' >> "$1"

## Code Rules

1. No abstraction, interface, factory, or pattern unless asked.
2. No scaffold "for later". Later scaffold itself.
3. Delete before add.
4. Shortest correct diff win.
5. Fix cause, not symptom. One guard in shared function beat guard in every caller.
6. Boring over clever. Clever = 3am bug.
7. Read before write. Never reference code you haven't read.
BLOCK
}

append_reanchor() {
  cat <<'BLOCK' >> "$1"

## Re-Anchor

If you lose context mid-session, read `.specs/project/project.yaml` to restore full project context.
For a ready-made re-anchor prompt, see `.specs/development/prompts.md → ## Re-Anchor Prompt`.
BLOCK
}

for f in "${CANDIDATE_FILES[@]}"; do
  if [ ! -f "$f" ]; then
    echo "SKIPPED (not found): $f"
    continue
  fi

  added=()
  has_critical "$f" || { append_critical "$f"; added+=("Critical Mandates"); }
  has_philosophy "$f" || { append_philosophy "$f"; added+=("Code Philosophy"); }
  has_rules "$f" || { append_rules "$f"; added+=("Code Rules"); }
  has_reanchor "$f" || { append_reanchor "$f"; added+=("Re-Anchor"); }

  if [ ${#added[@]} -eq 0 ]; then
    echo "ALREADY CURRENT: $f"
  else
    echo "UPDATED: $f (added: ${added[*]})"
  fi
done

echo
echo "== team.devPrefix check =="
YAML=".specs/project/project.yaml"
if [ -f "$YAML" ] && ! grep -q "devPrefix:" "$YAML"; then
  echo "MISSING: team.devPrefix in $YAML — ask the user for a short handle (e.g. GitHub username) and add it under a team: section."
fi

After running it:

  1. Report per file: updated (with which sections were added), already-current, or skipped (file not found).
  2. If the devPrefix check printed a missing-handle line, ask the user for a short handle (their GitHub/GitLab/Bitbucket username or any short tag) and add it under a team: section in project.yaml yourself — the script only detects the gap, it does not prompt interactively.
  3. Never overwrite existing content in any file; every append goes to the end of the file.

Maintenance cost: unlike the CLI's specBackfiller.ts, this command has no shared source-of-truth constant to import — its four fingerprint blocks above are a literal copy and must be manually kept in sync whenever CLAUDE.md/copilot-instructions.md generation changes (buildCriticalMandatesMarkdown(), buildCodePhilosophyMarkdown() in ideConfigGenerator.ts). If this command's output ever looks stale, check those functions first.

Read the full file on GitHub · 118 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. 8d ago First seen · 118 lines · 23 tokens per session scan A 16c9c26b3e63

Subscribe to this mod's changes

specpilot-backfill is a command published in the GitHub repository girishr/SpecPilot (37 stars, last pushed 1mo ago), licensed MIT. It adds 23 tokens to every session and 1,213 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-30.