spec-driven-claude-code: Command for Claude Code

.claude/commands/debug.md

debug is a command for Claude Code from dinhnguyenngoc/spec-driven-claude-code. It costs 15 tokens per session (3,186 once invoked), scanned A, original, MIT.

A systematic debugging command for investigating errors and recovering safely. It pauses feature work, preserves evidence, traces the underlying cause, adds protections, and then helps resume development.

In plain words
What is it for?
Use it when an API, service, database, background job, interface, build, or deployment fails. It helps identify the failing layer, reproduce the issue, fix the cause, and verify the result.
Why use it?
It prevents repeated symptom-fixes that leave the real problem in place. The guidance covers different parts of an application and maps checks to the project's technology stack.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: mentions CLAUDE.md; mentions subagents.

This is dinhnguyenngoc/spec-driven-claude-code's own configuration. It tells Claude Code how to work on spec-driven-claude-code 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 spec-driven-claude-code configures →

Reuse

Borrowing it

Nothing to install: this file belongs to dinhnguyenngoc/spec-driven-claude-code. 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/dinhnguyenngoc/spec-driven-claude-code/main/.claude/commands/debug.md
Clone the repo
git clone --depth 1 https://github.com/dinhnguyenngoc/spec-driven-claude-code

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 debug

README.md
[![agentmods](https://agentmods.dev/badge/commands/dinhnguyenngoc/spec-driven-claude-code/debug/github.svg)](https://agentmods.dev/commands/dinhnguyenngoc/spec-driven-claude-code/debug)
Your own site
<a href="https://agentmods.dev/commands/dinhnguyenngoc/spec-driven-claude-code/debug"><img src="https://agentmods.dev/badge/commands/dinhnguyenngoc/spec-driven-claude-code/debug/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for debug

Your own site · 80×15
<a href="https://agentmods.dev/commands/dinhnguyenngoc/spec-driven-claude-code/debug"><img src="https://agentmods.dev/badge/commands/dinhnguyenngoc/spec-driven-claude-code/debug.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 15 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,186 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.00015 $0.03186
Opus 5.5 $0.00006 $0.01274
Sonnet 5.5 $0.00003 $0.00637
Haiku 4.5 $0.00002 $0.00319

Measured 1mo ago against content hash 2fbd768286ee, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

debug 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 1mo 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/debug.md · 395 lines

How it starts

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

/debug — Debugging & Error Recovery

"Fix root causes, not symptoms."

Purpose

Systematically diagnose and fix errors. Stop feature work, preserve evidence, find root cause, add guards, then resume.

Workspace Mode: if the session root declares Mode: workspace → resolve the target repo per CLAUDE.md §Workspace Mode before anything else; every path, probe, and gate below is relative to the target repo, and the workspace disk-check applies at the gate.

Stack Profile note: the dotnet commands, triage trees, error catalog, and §Debugging Tools below use the default profile. Core = Node.js → map accordingly (npm test / npx vitest --reporter=verbose, node --inspect, Prisma log: ['query'] instead of EF Core logging) — the .NET error catalog is default-stack illustration only. Core = PHP → php artisan test / vendor/bin/pest --filter <name>, Xdebug for step-debugging, DB::enableQueryLog() / Laravel Telescope instead of EF Core query logging (rules/overrides/lang-php.md idioms apply).

Agent

Invoke based on the layer where the error occurs:

Error Layer Agent
API, service, DB, background job 🔧 Backend Developer
Component, page, routing, UI 🖥️ Frontend Developer
Test failure (flaky, intermittent) 🧪 Test Engineer
Security-related error 🔒 Security Auditor

Sub-agent prompt MUST include: "Output language: <declared language — resolve from Project Profile → Output Language> for prose/artifacts, English for code and technical identifiers (see .claude/CLAUDE.md → Output Language)."

Sub-agent prompt MUST also include: "Ambiguity policy: implementation details → decide per rules, never ask; non-blocking behavior/contract gaps → implement the most conservative interpretation and add an Assumptions-log entry (A-xx — when a /build phase is running it joins that phase's log, dispositioned at Gate 5; with no running phase — standalone debug, or a /test//review context — the user dispositions it before this debug closes, same mechanism as /fix-issue); blocking or expensive-if-wrong gaps → stop and return early with the question (see rules/principles-and-practices.md §2.5). Return every A-xx entry (or 'Assumptions: none') in your completion report — the orchestrator routes it: into the running /build phase's log (Gate 5), or to the user's immediate disposition when no phase is running."

Read the full file on GitHub · 395 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. 1mo ago First seen · 395 lines · 15 tokens per session scan A 2fbd768286ee

Subscribe to this mod's changes

debug is a command published in the GitHub repository dinhnguyenngoc/spec-driven-claude-code (21 stars, last pushed 2mo ago), licensed MIT. It adds 15 tokens to every session and 3,186 once invoked, about $0.0001 per session on Opus 5.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.