From mk
Diagnoses and fixes bugs, type errors, lint failures, CI/CD issues, and runtime errors through root-cause-first investigation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/mk:fix [issue] --auto|--review|--quick|--parallel|--tddWhen to use
Use when fixing a runtime bug or applying a known fix pattern. NOT for build/compile errors (see mk:build-fix) or architectural debugging (see mk:investigate).
[issue] --auto|--review|--quick|--parallel|--tddThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Unified skill for fixing issues of any complexity with structured diagnosis.
references/complexity-assessment.mdreferences/diagnosis-protocol.mdreferences/gotchas.mdreferences/mode-selection.mdreferences/parallel-exploration.mdreferences/prevention-gate.mdreferences/review-cycle.mdreferences/skill-activation-matrix.mdreferences/task-orchestration.mdreferences/workflow-ci.mdreferences/workflow-deep.mdreferences/workflow-logs.mdreferences/workflow-quick.mdreferences/workflow-standard.mdreferences/workflow-test.mdreferences/workflow-types.mdreferences/workflow-ui.mdUnified skill for fixing issues of any complexity with structured diagnosis.
Bug → Mode Select → Check Memory → Scout (MANDATORY) → Diagnose
→ [investigate → sequential-thinking → root cause?]
→ yes → Root-Cause Proof (6 fields, HARD GATE) → Complexity → Fix ROOT CAUSE → Verify+Prevent (MANDATORY)
→ pass → Finalize + Write to Memory
→ fail <3 → re-diagnose | fail 3+ → STOP
This flow is authoritative. If prose conflicts, follow the flow.
HARD GATE
Do NOT propose or implement fixes before completing Steps 1-2 (Scout + Diagnose).
Symptom fixes are failure. Find the cause first through structured analysis, NEVER guessing.
If 3+ fix attempts fail, STOP and question the architecture — discuss with user.
Override: --quick allows fast scout→diagnose→fix for trivial issues (lint, type errors).
--auto — Autonomous mode (default). Auto-fixes blocking issues up to the cycle limit, then stops at ready for user approval. Never self-approves; score is advisory display only.--review — Human-in-the-loop. Pause at each step.--quick — Fast cycle for trivial bugs.--parallel — Parallel developer agents per independent issue.--tdd — Force regression test BEFORE the fix (writes the .claude/session-state/tdd-mode sentinel). Without --tdd, regression tests are recommended but not gated. Useful for security-sensitive fixes where you want to prove the bug first.For moderate/complex bugs:
mk:investigate to confirm root causemk:plan-creator --type bugfixSkip: --quick mode (single file, clear cause).
If no mode flag: use AskUserQuestion (Autonomous / HITL / Quick). See references/mode-selection.md.
Read .claude/memory/fixes.json — it is the canonical, schema-validated store of prior fix patterns. See the source-of-truth rule in .claude/rules/memory-read-rules.md.
This turns repeated bugs into instant fixes. Skip only if .claude/memory/ doesn't exist.
Activate mk:scout to map affected codebase BEFORE any diagnosis:
git log).claude/rules/risk-checklist.md (the 9 IDs only — do not invent flags) and hold matchedFlags for the evidence index. If any of AUTH / AUTHZ / DATA_MODEL / AUDIT_SEC / EXT_SYSTEM / PUBLIC_CONTRACT / WEAK_PROOF matches, set risk.requiresHumanApproval = true — auto mode cannot finalize silently (see references/review-cycle.md).Why mandatory: Without codebase context, diagnosis guesses instead of reasons from evidence.
Capture pre-fix state first: exact error messages, failing test output, stack traces.
Then structured diagnosis using two skills:
Load references/diagnosis-protocol.md for the 5-phase protocol: Observe → Hypothesize → Test → Trace → Escalate.
Output: confirmed root cause (not symptom) with evidence chain + confidence level.
BLOCK: If confidence < medium → gather more evidence before fixing. Never fix a "maybe."
Operationalizes .claude/rules/core-behaviors.md Rule 6 ("Verify, Don't Assume"). The six fields are the named output of the Step 2 diagnosis (references/diagnosis-protocol.md Phase 4). Do NOT start Step 4 (Fix) until all six are populated — empty fields mean the diagnosis is not yet proven.
Standard/Complex/Parallel — all six required:
file:line — the specific source location, traced backward from the symptom (never the symptom site).--quick compact form (still non-empty — one phrase each):
exact compiler/lint error · file · direct cause · command-before · command-after · impacted area.
If any field cannot be filled, return to Step 2 and gather more evidence. Do not substitute a guess.
Write evidence (init): emit workflow-evidence.json with skill: mk:fix, mode, task, planPath (if the fix escalated to a plan), phase, risk (from Step 1), and fixDiagnosis (the six fields above; compact form for --quick). See the Workflow Evidence Index section below for path + schema.
Classify before routing. See references/complexity-assessment.md.
| Level | Indicators | Workflow |
|---|---|---|
| Simple | Single file, clear error | references/workflow-quick.md |
| Moderate | Multi-file, root cause multi-step | references/workflow-standard.md |
| Complex | System-wide, architecture impact | references/workflow-deep.md |
| Parallel | 2+ independent issues | Parallel agents per issue |
Task orchestration (Moderate+): references/task-orchestration.md.
references/prevention-gate.md — consider entry validation, business logic guards, error handling, type safety.If verify fails: loop to Step 2. After 3 failures → STOP, question architecture.
Update evidence: write verification.commands (the re-run commands) and verification.overall (pass/fail) to workflow-evidence.json.
Report: confidence, root cause, changes, files, prevention measures.
Write to memory via direct Edit calls — capture the fix pattern for future sessions. Read .claude/memory/fixes.json first to match the live schema, then add/update the canonical JSON store only.
.claude/memory/fixes.json — under patterns, add or update:
{
"id": "<kebab-slug>",
"type": "failure",
"category": "bug-class",
"severity": "low|medium|high|critical",
"domain": ["<area1>", "<area2>"],
"applicable_when": "<one line>",
"context": "<one line>",
"pattern": "<one line — what to do or avoid>",
"frequency": 1,
"lastSeen": "<YYYY-MM-DD>"
}
If the same id already exists, increment frequency and update lastSeen. Do not duplicate entries.
DO NOT use ##pattern:bug-class prefixes. That is a user-typed keyboard shortcut; the handler (hooks/handlers/immediate-capture-handler.cjs) only fires on UserPromptSubmit — the human typing the prefix at the start of a message. Agent-emitted ##pattern: text is invisible to the handler. Always call Edit directly. See .claude/skills/memory/references/capture-architecture.md.
Scrub secrets / tokens / PII before writing. Edit is not secret-scrubbed; you are responsible.
Inside /mk:cook full pipeline: Phase 6 / mk:memory session-capture covers this — do NOT double-write here. Standalone /mk:fix runs OWN the write themselves.
Skip when /mk:fix --no-capture was passed.
Delegate to project-manager (Moderate/Complex/Parallel ONLY) per .claude/rules/post-phase-delegation.md Rule 1 (background — include "Run in the background" in the prompt). Skip for Simple complexity — Gate 1 bypass path means no plan to track. Also skipped when MEOWKIT_PM_AUTO=off.
documenter agent → update ./docs.
Ask user about commit.
Contract: .claude/rules-conditional/workflow-evidence-rules.md. The index records pointers + summaries of this run; it never approves anything (Gate 2 / ship stay human authority) and carries no score. Generated for standalone Standard/Complex/Parallel fixes; --quick writes the compact form; Simple fixes may skip it.
Storage path: .claude/session-state/evidence/<YYMMDD-HHMM-slug>/workflow-evidence.json (framework-internal state per skill-authoring-rules.md Rule 2). For a fix that escalated to a plan, use tasks/plans/<plan>/reports/evidence/workflow-evidence.json instead.
Write points: Step 2.5 (init: skill, mode, task, planPath, phase, risk, fixDiagnosis) → Step 5 (verification) → Step 6 finalize (approvals.gate2/ship as required|not_applicable, memory.fixPatternWritten).
Validate before approval: run node .claude/scripts/validate-workflow-evidence.cjs <path> --phase fix before the user-approval prompt (Step 6 item 5). Surface any EVIDENCE_BLOCKED:<reasons> and fill the missing fields — do not present for approval on a blocked index. A high-risk flag (risk.requiresHumanApproval) forces explicit human approval before finalize regardless of mode.
Evidence ≠ memory: the evidence file is one-run proof; .claude/memory/fixes.json is the durable pattern store. Keep them separate — standalone /mk:fix owns its evidence write; inside /mk:cook the pipeline (Phase 6) owns the evidence write, so do NOT double-write. Scrub secrets / tokens / PII and store pointers/summaries only — never raw command logs.
Always: mk:scout (Step 1) + mk:investigate (Step 2) + mk:sequential-thinking (Step 2)
Conditional: mk:brainstorming (complex, multiple approaches) | mk:docs-finder (unfamiliar APIs)
Full list: references/gotchas.md (update when Claude produces wrong fix patterns)
references/mode-selection.md — AskUserQuestion formatreferences/diagnosis-protocol.md — 5-phase structured diagnosisreferences/prevention-gate.md — defense-in-depth + verification checklistreferences/complexity-assessment.md — Simple/Moderate/Complex/Parallelreferences/task-orchestration.md — Task patterns for moderate+references/workflow-quick.md | workflow-standard.md | workflow-deep.mdreferences/review-cycle.md — Autonomous/HITL/Quick reviewreferences/skill-activation-matrix.md — When to activate each skillreferences/workflow-ci.md | workflow-logs.md | workflow-test.md | workflow-types.md | workflow-ui.mdreferences/parallel-exploration.md — Parallel investigation strategy for multi-hypothesis diagnosisnpx claudepluginhub ngocsangyem/meowkit --plugin mkCoordinates diagnosis, test-driven reproduction, root-cause analysis, and targeted fixes for bugs with regression testing.
Root cause based one-shot bug fix. Runs a full investigation pipeline: debugger diagnosis, gap analysis, requirements generation, execution, and verification. Includes QA suggestions after successful fix.