lexforge-debug
Use when a test fails, a build breaks, a bug is reported or code behaves unexpectedly - before naming a cause or proposing a fix, and again when a fix has already been tried and the problem is still there.
- License 许可
- MIT
- 最近更新
- 2026-10-25
- Stars
- ★ 1
- Forks
- 0
01 前言 Front Matter
- name
- lexforge-debug
- description
- Use when a test fails, a build breaks, a bug is reported or code behaves unexpectedly - before naming a cause or proposing a fix, and again when a fix has already been tried and the problem is still there.
03 SKILL.md 正文
<!-- model-block:start -->
Model
Default by provider; the project assignment takes precedence.
| Provider | Model |
|---|---|
| anthropic | claude-sonnet-5 |
| openai | gpt-5.6-terra |
| gemini-3.7-flash | |
| deepseek | deepseek-v4-flash |
| z.ai | glm-4.7-flash |
A provider outside the table names nothing, so work on the model at work. <!-- model-block:end --> <!-- queue-rule:start -->
<!-- version-gate:start -->
Version gate
Exit 2 with error.code update-available: show error.message to the user and wait for the user's answer. Never run npm install yourself.
Exit 2 with error.code skills-outdated: run the lexforge init command that error.message names. Then run the command that refused again. If it refuses with skills-outdated a second time, show error.message and stop.
<!-- version-gate:end -->
<!-- model-gate:start -->
Model gate
Read provider and model from lexforge instructions <artifact> --change <name> --tool <your runtime> --json
for artifacts; otherwise use your entry in stages from
lexforge status --change <name> --tool <your runtime> --json.
The stage is your skill name without lexforge- (apply, debug, verify, archive).
Name your runtime from lexforge init --tools; omit --tool only if none matches.
An empty assignment, no workspace, no change, or no stage entry uses the model block
above for your provider. An unlisted provider imposes no model.
On the assigned model, work without model commentary. Otherwise start a subagent on
that model, hand it the work, and do none of it yourself. Disclosure or later review
is not delegation. If unreachable, name the model and stop: restore access or let the
user change the assignment in lexforge/config.yaml; do not change it yourself.
<!-- model-gate:end -->
<!-- queue-rule:end -->
The rule
NEVER NAME A FIX BEFORE YOU HAVE NAMED THE CAUSE.
Violating the letter of this rule is violating its spirit.
Debugging inside a change: name it in the gate's status call — the debug stage carries
its own assignment.
What a found cause is
Three statements: where the wrong value first appears, the path it took to the failing line, and the change after which the behaviour started.
A symptom matching a guess is not a cause. A rule explaining how the value could be wrong covers the class, not this run. A write-up, a green pipeline, a documented default, five call sites doing the same - evidence to check, not the answer.
Four phases
Finish each before the next.
- Cause. Read the whole error. Reproduce it. Read the recent changes to the code it touches, and follow the wrong value back to where it appears.
- Comparison. Find the nearest case that works, list every difference.
- Hypothesis. State one, in words, and test it with the smallest change that can disprove it. It survived? Phase 4. It did not? Back to phase 1 with what you learned, never a second change on top of the first.
- Fix. One change, at the cause.
Two changes in one run cannot be told apart by the result.
The test comes first
Write a test that reproduces the bug, run it, quote the failing line - then change code. A test that passes first time is testing something else. Checking by hand does not run again tomorrow. A test written after the fix pins the fix, not the bug.
Three failed fixes end the fixing
Count them. After the third change that left the bug alive or moved it somewhere new, stop and talk to the user about how the system is put together. Say the count and what each attempt showed. No fourth change before that conversation: not a smaller one, not the one that finally looks like the real cause. A fix that cannot land without rewriting the layer beside it is the same signal.
Say when you do not know
Name the part you could not work out and ask. A plausible story is not an investigation, and a fix "just in case" is a guess with a paragraph in front of it.
Rationalizations
| Excuse | Reality |
|---|---|
"safe regardless of why discount is undefined" |
If the reason does not matter, you never asked what the wrong value does once it stops crashing. |
"a complete causal chain from documented producer behavior to the exact TypeError", "nothing left for a mapper trace to establish" |
That chain says how the field may be absent, not why it is absent here. |
"I'll trace discount through the mapper end-to-end after the page is back up", "not tonight's gate" |
The investigation you postpone is the one you skip. |
| "it would silently paper over a genuine mapper bug. That's why the test goes in with it" | A test written from the fix asserts the fix; it passes on the bug too. |
| "refusing to act ignores a direct instruction the user gave with full awareness of the history" | Nobody counted the attempts out loud, so nobody was choosing a fourth one. |
| "The risk, so you have it in writing before you sleep" | A warning handed over with the change is a receipt, not a warning. |
Red flags - stop
- Code changed before the wrong value was traced.
- Two changes in one run.
- A test written after the fix.
- A fourth attempt.
- A cause taken unchecked from a colleague or a green pipeline.
- A fix shipped with its risk named beside it.
Go back to phase 1.
04 同仓库更多 Skills
sample-verify
Use when the install mechanics need a second skill to copy - stands in for the real verify skill
sample-plan
Use when the install mechanics need a skill to copy - stands in for the real planning skill
three-fields
Use when a structure check needs a frontmatter with a field that does not belong there
no-use-when
Runs the structure checks over a description that opens with the wrong words
another-name
Use when a structure check needs a name that disagrees with the directory around it
minimal
Use when a structure check needs a skill that breaks no rule - the baseline fixture