/cstk:bugfix [description of the bug, error message, or screenshot path]from cstk
Multi-layer bug investigation and fix that traces data flow across services before patching. Stack-agnostic, adapts to any project.
Ships in cstk. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Structured bug fix protocol designed to eliminate cascading fix-reveal-fix cycles by mapping the full data flow before touching any layer. Stack-agnostic — adapt the commands and layer names to the project you are working in.
$ARGUMENTS should describe the bug: error message, observed behavior, expected behavior, or path to a screenshot.
Assess bug scope before starting:
| Complexity | Signals | Approach |
|---|---|---|
| Single-layer | Error in one file, one service | Sequential trace (Steps 1-8) |
| Multi-service | DTOs, enums, or events cross service boundaries | Parallel agent investigation (Step 3b) |
| Ghost bug | "Works on my machine", intermittent, post-deploy | Stale artifact focus (Step 2) |
For multi-service bugs, create tasks to track progress across services.
Before any debugging, eliminate ghost bugs. Use the commands appropriate to the project stack — the pattern is "force rebuild + verify source matches running":
# Force rebuild (stack-specific)
# Examples:
# Go: go build ./...
# Node: rm -rf node_modules/.cache && npm run build
# Rust: cargo clean && cargo build
# Java/JVM: mvn clean compile
# Python: rm -rf __pycache__ dist build *.egg-info
# Verify dependencies haven't drifted
# Examples: go mod verify, npm ls, pip freeze, cargo tree
# Always check git state regardless of stack
git status --short
git log --oneline -3
# For production bugs, confirm deployed commit matches source
If stale artifacts found, warn the user before proceeding.
CRITICAL: Do NOT fix any single layer yet. Map the complete path first.
For each affected entity/endpoint, trace through ALL layers. Adapt the layer names to the stack in use — the principle is "follow the data end-to-end":
For complex bugs spanning 2+ services, launch parallel agents:
Agent 1: Backend contract audit
- Read handlers, DTOs, migrations, enum CHECK constraints
- List all field names and types at each boundary
Agent 2: Frontend contract audit
- Read API service files, hooks, component types
- List all field names and expected shapes
Agent 3: Event/messaging audit (if events involved)
- Read publishers, consumers, event models
- Verify routing keys and payload shapes
Synthesize findings from all agents BEFORE making any edits.
Create a list of every discrepancy found. Common categories (adapt to stack):
full_name vs fullName vs FullName)Present the complete fix plan to the user BEFORE implementing:
Apply changes in dependency order:
STOP-AND-REMAP RULE: If implementing a fix reveals a new issue in another layer, STOP immediately. Do not chase the new issue. Go back to Step 3, re-map all remaining layers, update the fix plan, then continue. This prevents the cascading fix-reveal-fix cycle that wastes the most time.
After implementing, run the stack-appropriate verification chain:
# Build (stack-specific)
# Go: go build ./...
# Node: npm run build (or tsc --noEmit for TS)
# Rust: cargo build
# Python: python -m compileall .
# Tests (stack-specific)
# Go: go test ./... -count=1
# Node: npm test
# Rust: cargo test
# Python: pytest
# Lint / static analysis (stack-specific)
# Go: golangci-lint run ./... && go vet ./...
# Node: npm run lint && tsc --noEmit
# Rust: cargo clippy -- -D warnings
# Python: ruff check . && mypy .
# Grep for residual references to old code (any stack)
# Use Grep tool with the old identifier and appropriate file filter
When the bug is subtle or has regressed before:
## Bug Fix Summary
**Bug**: {description}
**Root cause**: {what was actually wrong}
**Services affected**: {list}
### Changes
| File | Change |
|------|--------|
| path/to/file.go | Fixed field name from X to Y |
| ... | ... |
### Verify after deploy
- [ ] {what to check in staging/production}
If implementing a fix surfaces a problem in another layer, STOP. Do not chase the new issue. Go back to Step 3, re-map remaining layers, update the plan, then continue. Chasing emergent issues without remapping is the #1 cause of fix-reveal-fix cycles that burn hours.
The temptation is strong: one edit in the handler, tests green, ship. But the bug almost always crosses layers. Always trace the full path (request → persistence → response) before declaring the fix complete.
The most common wrong approach: user reports "form shows wrong value", dev fixes client. Actual root cause: server response has wrong field name. Always ask "which layer owns this responsibility?" before editing.
The old name lives in a config file, a comment, a test fixture, a generated type you forgot. Run a grep with the old identifier across the entire repo — not just the language you edited.
Showing the SQL and waiting for explicit "go" is non-negotiable. Even in dev environments. A forgotten WHERE clause or a wrong schema name wipes data. The skill shows, approves, then runs — never the reverse.
Server defines status = "ACTIVE", database CHECK constraint allows "active", client type uses "Active". None throws a compile error, all three mismatch at runtime. When reviewing a bug that involves a state field, check all three spellings explicitly.
In many routers (Chi, Fiber, Express), static routes must be registered before dynamic-param routes — otherwise /users/me gets captured by /users/:id. If debugging a 404 on what should be a static route, check the registration order.
When editing, preserve existing code. Rewriting a 500-line handler with a 20-line stub "to simplify" destroys context the bug fix depends on. Use Edit for surgical changes; reserve Write for truly new files.
A struct with 8 fields scanning a 10-column row will bind only 8 and silently drop the other 2. The bug is invisible until a user notices missing data. Verify field-to-column alignment in scan/bind sites.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
bug-fix, debugging, troubleshooting, multi-layer, stack-agnostic
npx claudepluginhub jotjunior/cstk --plugin cstk24 skills in this plugin
/advisorStrategic critique of an idea/plan/decision. Triggers: "me aconselhe", "critique meu plano", "avalie minha ideia", "feedback estrategico", "advisor". Skip for technical tasks (use bugfix/execute-task)./agente-00c-runtimeInternal POSIX runtime helpers for agente-00c/feature-00c orchestrators (state, lock, validation, hashes, secrets filter). NOT user-invocable./analyzeCross-artifact SDD consistency analysis (spec/plan/tasks/constitution) — read-only. Triggers: "analyze", "cross-check", "auditar artefatos", "validar spec vs tasks". Skip for single-document validation (use validate-documentation).Other plugins' skills for the same job