autoresearch
Autonomous goal-directed iteration loop: modify, verify, keep/discard against a metric or a checkable success predicate, with…
Diagnosis loop for bugs and failing behavior. Use for errors, stack traces, regressions, failed tests, issue-tracker bugs, stuck investigations after failed fixes, or asks to debug/fix a bug. Not for executing settled plans or feature work — route those to spec-work.
$ npx -y skills add leo-kuang-ai/spec-first --skill spec-debug --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/spec-debugContext preview
The summary Claude sees to decide when to auto-load this skill.
Diagnosis loop for bugs and failing behavior. Use for errors, stack traces, regressions, failed tests, issue-tracker bugs, stuck investigations after failed fixes, or asks to debug/fix a bug. Not for executing settled plans or feature work — route those to spec-work.
name: spec-debug description: 'Diagnosis loop for bugs and failing behavior. Use for errors, stack traces, regressions, failed tests, issue-tracker bugs, stuck investigations after failed fixes, or asks to debug/fix a bug. Not for executing settled plans or feature work — route those to spec-work.' argument-hint: "[issue reference, error message, test path, or description of broken behavior]"
Find root causes, then fix them. This skill investigates bugs systematically — tracing the full causal chain before proposing a fix — and optionally implements the fix with test-first discipline.
<bug_description> #<invocation arguments supplied by the current host> </bug_description>
The default mode is interactive. Investigate, present the causal chain, and use the Phase 2 fix-choice gate and Phase 4 handoff as written below.
When the invocation includes `mode:pipeline-return`, strip that token from `<bug_description>` and load `references/pipeline-return.md`. This mode is for an outer workflow such as `spec-lfg`: it replaces blocking questions with conservative defaults, applies only an inherited and explicitly authorized local convergent fix, and returns a structured envelope to the caller. The mode token does not authorize mutation, commit, push, external communication, credentials, or tracker writes.
Follows `docs/contracts/workflows/scenario-capability-matrix.md`. Overrides: high-risk
1. **Investigate before fixing.** Do not propose a fix until you can explain the full causal chain from trigger to symptom with no gaps. "Somehow X leads to Y" is a gap. 2. **Predictions for uncertain links.** When the causal chain has uncertain or non-obvious links, form a prediction — something in a different code path or scenario that must also be true. If the prediction is wrong but a fix "works," you found a symptom, not the cause. When the chain is obvious (missing import, clear null reference), the chain explanation itself is sufficient. 3. **One change at a time.** Test one hypothesis, change one thing. If you're changing multiple things to "see if it helps," stop — that is shotgun debugging. 4. **When stuck, diagnose why — don't just try harder.**
| 红旗念头 | 停下来做什么 | | --- | --- | | 「我看出 bug 了,跳过复现」 | 先建立最小复现或取得等价捕获证据;没有 red-capable loop 时只能形成 working hypothesis,不能关闭 causal chain gate。 | | 「root cause 很明显」 | 用源码、日志、测试或 runtime value 补齐从 trigger 到 symptom 的 causal chain,不把直觉当 confirmed evidence。 | | 「修完了,手测一下就行」 | 复跑 original reproducer、regression 和适用 broader checks,记录 structured summary;不能只写 freeform “tests passed”。 |
这是注意力提醒,不是 gate,也不替代 LLM 判断;最终是否停下、如何处理仍由你按当前证据决定。
| Phase | Name | Purpose | |-------|------|---------| | 0 | Triage | Parse input, fetch issue if referenced, proceed to investigation | | 1 | Investigate | Reproduce the bug, trace the code path | | 2 | Root Cause | Form hypotheses with predictions for uncertain links, test them, **causal chain gate**, smart escalation | | 3 | Fix | Only if user chose to fix. Test-first fix with workspace safety checks | | 4 | Handoff | Structured summary, then prompt the user for the next action |
Beyond the trivial-bug fast-path in Phase 0, no further phase skipping — complex bugs simply spend more time in each phase naturally. No further complexity tiers.
---
Parse the input and reach a clear problem statement.
**Repository and source boundary:** Resolve the current Git root before repo-dependent investigation. In a parent workspace, bounded read-only orientation may compare likely child repos, but require a single `target_repo` or explicit per-fix repo scope before any behavior-bearing test, instrumentation write, or fix. Do not let cwd or broad discovery choose a sibling repo. Canonical checked-in source is the fix owner; generated runtime mirrors under `.claude/`, `.codex/`, `.agents/skills/`, `.cursor/`, `.kiro/`, or `.qoder/` are not source. If runtime drift is causal, repair source/generation first and regenerate only with explicit authorization.
**If the input references an issue tracker**, fetch it:
Read the full conversation — the original descript
把 AI coding 会话变成可信、由项目拥有的变更。 spec-first 是面向 Claude Code、Codex、Kiro、Qoder、Cursor、OpenCode、ZCode 与 Pi 的仓库原生 AI Coding Harness。它把想法、需求、计划、代码、审查和知识连接成可检查的工程闭环。
Autonomous goal-directed iteration loop: modify, verify, keep/discard against a metric or a checkable success predicate, with…
Audit mobile App PRD/Figma/local-source consistency across page routes, KMP/Clean Architecture, components, analytics, i18n,…
Explore vague or ambitious ideas into a right-sized requirements-only unified plan. Use when the user wants to brainstorm, think…
Structured code review for bugs, regressions, tests, and standards. Report-only by default; apply fixes only when the current…
Internal landing helper for public workflows that already hold explicit commit and landing authorization; commits scoped changes,…
Internal commit helper for public workflows that already hold explicit commit authorization; creates scoped, value-communicating…