Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c7fac3686 | ||
|
|
cba0fe4337 | ||
|
|
06592805b6 |
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "skills",
|
||||
"description": "Mathias's engineering skills library, plus the hooks and MCP servers that make it enforceable: TDD, clean code, debugging, specs, discovery, CI, and secret hygiene.",
|
||||
"version": "0.14.0",
|
||||
"version": "0.15.0",
|
||||
"author": {
|
||||
"name": "Mathias",
|
||||
"url": "https://git.d-ma.be/mathias"
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ the SKILL.md, not the table.
|
||||
| `clean-code` | Clean code principles with Go adaptation | Code review, refactoring, new code | claude-code, library |
|
||||
| `code-review` | Code smell detection + Go-specific checklist | Pre-merge review | claude-code, library |
|
||||
| `cognitive-load` | Cognitive complexity analysis (CLI score) | Identifying hotspots, before refactoring | claude-code, library |
|
||||
| `debug` | Hypothesis-first debugging discipline | Any test failure or bug whose cause is not immediately obvious | claude-code, library |
|
||||
| `debug` | Hypothesis-first debugging discipline | Any test failure or bug whose cause is not immediately obvious — or a bug report with no failure text, which this skill refuses rather than guesses at | claude-code, library |
|
||||
| `discovery-framing` | Problem-before-solution discovery/framing method | Framing/validating a problem before any solution; opportunity sizing | claude-code, library |
|
||||
| `dream` | Reflective consolidation pass over an agent's memory directory | Pruning/merging memory files, rebuilding a memory index | claude-code, library, chat |
|
||||
| `experiment-spec` | Rigorous experiment spec — falsifiable hypothesis, quantitative acceptance, null-result protocol | Scoping a research/ML phase instead of a feature | claude-code, library |
|
||||
|
||||
+60
-15
@@ -2,8 +2,8 @@
|
||||
name: debug
|
||||
surfaces: [claude-code, library]
|
||||
summary: "Hypothesis-first debugging discipline"
|
||||
use_when: "Any test failure or bug whose cause is not immediately obvious"
|
||||
description: Systematic hypothesis-first debugging. Generate 3-5 ranked hypotheses with verification steps before suggesting any fix. Use when encountering a bug, test failure, or unexpected behavior.
|
||||
use_when: "Any test failure or bug whose cause is not immediately obvious — or a bug report with no failure text, which this skill refuses rather than guesses at"
|
||||
description: Systematic hypothesis-first debugging. Requires the failure itself — error text, stack, run id or log — and names what it needs and stops if the report has none, rather than hypothesising into a vacuum. Given evidence, generates 3-5 ranked, falsifiable hypotheses with verification steps before suggesting any fix. Use when encountering a bug, test failure, or unexpected behavior.
|
||||
---
|
||||
|
||||
# Debug
|
||||
@@ -12,7 +12,7 @@ description: Systematic hypothesis-first debugging. Generate 3-5 ranked hypothes
|
||||
|
||||
Debugging is hypothesis generation, not fix generation. The first instinct — "try this and see if it works" — wastes time and teaches nothing. A disciplined debug session produces a small set of ranked, falsifiable hypotheses, each with a concrete verification command. The fix comes after one hypothesis is confirmed, not before.
|
||||
|
||||
**Core principle:** A hypothesis you cannot verify in one command is not a hypothesis — it is a guess.
|
||||
**Core principle:** A hypothesis you cannot verify with a single bounded, decisive observation is not a hypothesis — it is a guess. In a repo that observation is usually one command. Above one it may be an instrumented run, or partitioning the last twenty CI runs by trigger type; what makes it a hypothesis is that the observation *discriminates*, not that it fits on one line.
|
||||
|
||||
## When to Use
|
||||
|
||||
@@ -25,6 +25,27 @@ Debugging is hypothesis generation, not fix generation. The first instinct — "
|
||||
- Compile errors with clear messages (just fix the typo)
|
||||
- Already-diagnosed bugs where you know the cause (go straight to TDD with a regression test)
|
||||
|
||||
### Is it actually diagnosed?
|
||||
|
||||
That last exclusion is the one people get wrong, because a confident wrong diagnosis feels
|
||||
exactly like a right one. It is diagnosed if you can state the mechanism *and* name the
|
||||
observation that would have proved it wrong. If the evidence is "we changed X and it got
|
||||
better", that is correlation with a deployment, and this skill applies.
|
||||
|
||||
The strongest tell is a run of failed fixes — see below. Three plausible fixes that did
|
||||
not eliminate the symptom is not bad luck, it is the diagnosis being wrong.
|
||||
|
||||
### Intake: what you need before hypothesising
|
||||
|
||||
Before generating anything, confirm you have the failure itself — the error text, the
|
||||
stack, the failing run's id, the log. If the report is "it's flaky again" with no
|
||||
artifact, **name the specific thing you need and stop**. Iron Law 1 forbids "try X and
|
||||
see"; hypothesising into a vacuum is the same failure with better grammar, and it is
|
||||
worse because the output looks like analysis.
|
||||
|
||||
This is the rule `cad-babysit` already enforces from the other side: read the issue's own
|
||||
comments and the job log *first*.
|
||||
|
||||
## Iron Laws
|
||||
|
||||
1. **Never suggest "try X and see what happens."** Every hypothesis must have a specific expected outcome if correct.
|
||||
@@ -36,8 +57,9 @@ Debugging is hypothesis generation, not fix generation. The first instinct — "
|
||||
A system with boundaries (CI → build → signing, API → service → database) hides the
|
||||
question "which component is wrong?" behind the question "why is the output wrong?".
|
||||
Specify, as a pre-step, what to log entering and leaving **each** boundary, plus
|
||||
whether config and environment actually propagated. One run of that narrows the search
|
||||
to a single component.
|
||||
whether config and environment actually propagated. One run *that reproduces the failure* narrows the search to a
|
||||
single component. On an intermittent fault a passing run narrows nothing, so leave the
|
||||
instrumentation in across several runs rather than concluding from one.
|
||||
|
||||
This does not suspend Iron Law 2. Still emit 3-5 hypotheses — the boundary spec comes
|
||||
first in the output, and each hypothesis says which boundary observation would kill it.
|
||||
@@ -53,6 +75,10 @@ than fixes that partially worked.) Each one has been narrowing a window rather t
|
||||
closing it, and a fourth guess buys another tenth of the rate plus a layer of
|
||||
interacting guards nobody can reason about.
|
||||
|
||||
Intake still gates this section. A report of three failed fixes with no artifacts fires
|
||||
both rules at once, and intake wins: you cannot aim hypotheses at a premise you have no
|
||||
evidence about either. Ask for the log, then aim.
|
||||
|
||||
Say that explicitly — the refusal is the finding, not a preamble to it. Then aim the
|
||||
hypotheses one level up: the premise those fixes share is itself the thing to falsify.
|
||||
This is not an exemption from the output format. It is the format, pointed at the
|
||||
@@ -76,18 +102,28 @@ For each hypothesis, capture three things:
|
||||
- **Verification:** the single command or file inspection that confirms or denies it
|
||||
- **Expected outcome if correct:** the specific output you would see
|
||||
|
||||
Order by likelihood. The most likely cause is hypothesis 1.
|
||||
Order by likelihood, most likely first. **The ordering is the ranking — do not also
|
||||
attach `high`/`medium`/`low` labels.** With five slots and three labels the labels stop
|
||||
discriminating (two hypotheses are genuinely both "high" and the label cannot say which
|
||||
comes first), and a reader then has two orderings that can disagree. Position already
|
||||
carries it.
|
||||
|
||||
Where you can say *why* one outranks another — a prior brain entry, a matching symptom,
|
||||
a recent change in that area — say that instead of a label. That is information; a label
|
||||
is a restatement of the order it sits next to.
|
||||
|
||||
### Step 3: Output
|
||||
|
||||
Use this format:
|
||||
|
||||
```
|
||||
HYPOTHESIS 1 (likelihood: high): <mechanism in one sentence>
|
||||
VERIFY: <exact command or file:line to inspect>
|
||||
HYPOTHESIS 1: <mechanism in one sentence>
|
||||
WHY FIRST: <what makes it likeliest — a matching symptom, a recent change, a brain entry>
|
||||
VERIFY: <exact command, or the bounded observation that discriminates>
|
||||
EXPECTED IF CORRECT: <specific output, value, or condition>
|
||||
|
||||
HYPOTHESIS 2 (likelihood: medium): <mechanism>
|
||||
HYPOTHESIS 2: <mechanism>
|
||||
WHY FIRST: <or why it ranks here rather than first>
|
||||
VERIFY: <exact command>
|
||||
EXPECTED IF CORRECT: <specific output>
|
||||
|
||||
@@ -109,15 +145,15 @@ End with the recommendation, not a fix.
|
||||
**Output:**
|
||||
|
||||
```
|
||||
HYPOTHESIS 1 (likelihood: high): parser indexes into pages[0] before checking len(pages) > 0; empty PDFs produce a zero-page document
|
||||
HYPOTHESIS 1: parser indexes into pages[0] before checking len(pages) > 0; empty PDFs produce a zero-page document
|
||||
VERIFY: rg -n 'pages\[0\]' internal/parser/
|
||||
EXPECTED IF CORRECT: at least one site reads pages[0] without a preceding length check
|
||||
|
||||
HYPOTHESIS 2 (likelihood: medium): the test fixture is a zero-byte file rather than a valid empty PDF; pdf library returns nil pages slice instead of empty
|
||||
HYPOTHESIS 2: the test fixture is a zero-byte file rather than a valid empty PDF; pdf library returns nil pages slice instead of empty
|
||||
VERIFY: ls -la testdata/empty.pdf && file testdata/empty.pdf
|
||||
EXPECTED IF CORRECT: file size 0 bytes or "data" rather than "PDF document"
|
||||
|
||||
HYPOTHESIS 3 (likelihood: low): a recently changed dependency reordered the page-extraction API; pages[0] now refers to metadata, not content
|
||||
HYPOTHESIS 3: a recently changed dependency reordered the page-extraction API; pages[0] now refers to metadata, not content
|
||||
VERIFY: git log --oneline -10 -- go.sum | grep -i pdf
|
||||
EXPECTED IF CORRECT: a pdf-library bump in the last few commits
|
||||
|
||||
@@ -131,6 +167,7 @@ RECOMMENDED NEXT STEP: Run VERIFY for hypothesis 1 first.
|
||||
| "Maybe try restarting the service" | Not a mechanism. Not falsifiable. Teaches nothing if it works. |
|
||||
| "Could be a race condition" | Mechanism without specifics. Which two operations race? On what state? |
|
||||
| "Let me add some print statements and see" | Skips hypothesis generation. Generates noise, not understanding. |
|
||||
| Answering "what's the fix?" from a report with no artifact | Hypothesising into a vacuum. The output looks like analysis, which is what makes it worse than saying "I need the log". |
|
||||
| Single hypothesis presented as fact | If you are sure, write the regression test, do not run a debug skill. |
|
||||
| Mixing hypotheses with fix suggestions | The skill is diagnose-only. The fix is a TDD task on its hypothesis. |
|
||||
|
||||
@@ -139,7 +176,8 @@ RECOMMENDED NEXT STEP: Run VERIFY for hypothesis 1 first.
|
||||
The brain holds prior debug sessions across the project. Use it to skip rediscovering known failure modes.
|
||||
|
||||
**At debug start:**
|
||||
- Run `brain_query` with the error message snippet + the package name. Past sessions may have logged identical or similar failures with their resolved hypotheses.
|
||||
- Run `brain_query` with the error message snippet + the package name. On an intake stop you have neither — query the symptom and the component instead ("signed artifact missing CI"), which is worth doing precisely because it may name the artifact to ask for. Past sessions may have logged identical or similar failures with their resolved hypotheses.
|
||||
- **A hit is evidence, so cite it inline in the hypothesis it informs** — `(brain: <entry-name>)` — rather than mentioning it once at the top. If a prior entry is why a hypothesis ranks first, the reader needs that at the hypothesis, not in a preamble. If a prior entry contradicts your ranking, say so and rank it anyway if the evidence here is better; the brain records what was true then.
|
||||
|
||||
**After a hypothesis is confirmed:**
|
||||
- Run `brain_write` with the failure signature → confirmed mechanism. Future debug sessions on the same area get the answer immediately.
|
||||
@@ -156,7 +194,12 @@ treats `pass` as success, `fail` as failure, `skip` as neither.
|
||||
**At end of each phase:**
|
||||
- `session_log` with `{session_id: "<this session's id>", skill: "debug", phase: "<phase-name>", final_status: "pass" | "fail" | "skip", message: "<one-line summary>", project_root: "<absolute path>"}`
|
||||
|
||||
**Phases for this skill:** read-failure, generate-hypotheses, output
|
||||
**Phases for this skill:** intake, read-failure, generate-hypotheses, output
|
||||
|
||||
`intake` exists so that refusing correctly is recordable. A run that stops for want of a
|
||||
run id has done the right thing and logs `intake` / `pass`; without that phase the
|
||||
refusal logs as a failed `read-failure`, and a metric that penalises the skill's best
|
||||
behaviour teaches the next model to hypothesise into the vacuum instead.
|
||||
|
||||
**Status semantics:**
|
||||
- `pass` — the phase's intended outcome was reached.
|
||||
@@ -179,7 +222,9 @@ Techniques kept in `debug/references/`, inherited from the deleted
|
||||
- `defense-in-depth.md` — load after a root cause is confirmed, to decide which layers
|
||||
should have caught it.
|
||||
- `condition-based-waiting.md` — load whenever a timeout appears anywhere in the report,
|
||||
including as one of the fixes already tried. A bumped timeout is a symptom.
|
||||
including as one of the fixes already tried. A bumped timeout is a symptom. Not during an
|
||||
intake stop: if you are not analysing yet, a symptom-analysis reference is on the wrong
|
||||
side of the gate.
|
||||
- `find-polluter.sh` — run when a test passes alone and fails in the suite, or when
|
||||
something in the tree appears that no test admits to creating.
|
||||
|
||||
|
||||
+2
-2
@@ -365,7 +365,7 @@ Before marking work complete:
|
||||
- [ ] Tests use real code (mocks only if crossing a system boundary)
|
||||
- [ ] Edge cases and errors covered
|
||||
|
||||
Can't check all boxes? You skipped TDD. Start over.
|
||||
Can't check **or deliberately strike** all boxes? You skipped TDD. Start over. A box struck with a stated reason is answered; a box left hanging is not.
|
||||
|
||||
## When Stuck
|
||||
|
||||
@@ -374,7 +374,7 @@ Can't check all boxes? You skipped TDD. Start over.
|
||||
| Don't know how to test | Write wished-for API. Write assertion first. Ask Mathias. |
|
||||
| Test too complicated | Design too complicated. Simplify interface. |
|
||||
| Must mock everything | Code too coupled. Use dependency injection. |
|
||||
| Test setup huge | Extract helpers with `t.Helper()`. Still complex? Simplify design. |
|
||||
| Test setup huge | Extract helpers (`t.Helper()` in Go, a local `__tracebackhide__ = True` in Python). Still complex? Simplify design. |
|
||||
|
||||
## Debugging Integration
|
||||
|
||||
|
||||
Reference in New Issue
Block a user