Mental debug
Skill lubochka/xiigen-mvp-engine/.agents/skills/mental-debug
Runtime debugging discipline for the XIIGen engine. 14 rules covering pattern recognition, execution tracing, boundary analysis, loop bugs, error handling gaps, and XIIGen-specific failure modes (fabric resolution, tenant scope leaks, sibling guard gaps, generated service compliance).From its SKILL.md
npx -y skills add lubochka/xiigen-mvp-engine --skill mental-debugAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
4.5 KB, ~1.0k tokens by cl100k_base, as published. Nobody here has run it
Mental Debug Skill v2.0
When to Invoke
- When a bug is observed but the root cause is unclear
- When tests fail and the failure message points to a symptom, not a cause
- When code looks correct but produces wrong output
- After
code-examination-skillhas mapped the call chain and a hypothesis is formed
The 14 Rules
| # | Rule | What it catches |
|---|---|---|
| 1 | pattern-recognition-verdicts | Misidentifying what kind of bug this is |
| 2 | contextual-gap | Missing context that the code assumes exists |
| 3 | mental-execution | Wrong mental model of how code actually runs |
| 4 | boundary-data-lifecycle | Data shape changes at component boundaries |
| 5 | boundary-message-map | Event/queue message schema mismatches |
| 6 | loop-off-by-one | Off-by-one errors in iteration |
| 7 | loop-state-delta | State mutation inside loops producing wrong accumulation |
| 8 | error-silent-catch | Errors swallowed silently, no signal to caller |
| 9 | sibling-guard-parity | Guard exists in one station/provider but not its sibling |
| 10 | _sections | Reference: debugging session structure |
| 11 | async-local-storage | AsyncLocalStorage not propagated across async boundaries |
| 12 | generated-service-audit | Generated .ts files contain DNA violations |
| 13 | fabric-resolution-trace | Wrong provider selected due to fabricType case mismatch |
| 14 | tenant-scope-leak | tenantId lost in Promise.all() or concurrent execution |
Diagnostic Routing
Apply this table when observing a symptom. Start with the first rule; if not resolved, apply the second.
| Symptom | Apply First | Then |
|---|---|---|
| Generated code has DNA violation | pattern-recognition-verdicts → contextual-gap | generated-service-audit |
| Fabric returns wrong result | boundary-data-lifecycle → fabric-resolution-trace | async-local-storage |
| Tenant isolation broken | tenant-scope-leak → boundary-data-lifecycle | loop-state-delta |
| AF pipeline quality flatlines | contextual-gap (skill blocks missing?) | mental-execution on feedback→rag chain |
| BFA false positive | boundary-message-map → loop-state-delta | sibling-guard-parity |
| Silent wrong output (no error raised) | error-silent-catch → mental-execution | contextual-gap |
| Cross-tenant data visible | tenant-scope-leak → async-local-storage | boundary-data-lifecycle |
| Provider returns wrong shape silently | fabric-resolution-trace → error-silent-catch | boundary-data-lifecycle |
Debugging Session Structure
See rules/_sections.md for the full session template.
Short form:
1. Observe: what is the actual output vs expected output?
2. Isolate: which component boundary is the divergence point?
3. Hypothesize: what assumption does the code make that is wrong?
4. Route: which mental-debug rule applies?
5. Verify: does the rule's checklist confirm the hypothesis?
6. Fix: engine-level fix (not output patch) — see retroactive-development
7. Test: 3-level verification (see bug-to-tests + three-level-verification)
XIIGen-Specific Failure Patterns
Fabric Resolution (Rule 13: fabric-resolution-trace)
The engine resolves a fabric provider by matching fabricType string against the provider registry. Case matters: "ELASTICSEARCH" does NOT match "elasticsearch". Silent fallback to in-memory provider.
Tenant Scope (Rule 14: tenant-scope-leak)
AsyncLocalStorage context does NOT propagate into Promise.all() children in Node 18.
Any concurrent operation must receive tenantId explicitly or use nestjs-cls ClsService.
Sibling Guard Parity (Rule 9)
If DNA-3 is checked in af1-genesis.ts, it must also be checked in af11-feedback.ts — they process the same task output. A guard in one station but not its sibling creates a coverage gap.
Generated Service Audit (Rule 12)
When AF-1 or AF-7 generates a TypeScript service file, run the DNA-1–9 checklist against the output before committing. Generated code has no IDE warnings.
Reference
Rules are in rules/ subdirectory. See each rule file for full checklist and worked examples.
What ships with it: 16 files
47.3 KB alongside SKILL.md
rules/
- async-local-storage.md3.5 KB
- boundary-data-lifecycle.md3.1 KB
- boundary-message-map.md2.8 KB
- contextual-gap.md2.4 KB
- error-silent-catch.md3.0 KB
- fabric-resolution-trace.md3.3 KB
- generated-service-audit.md4.1 KB
- loop-off-by-one.md2.3 KB
- loop-state-delta.md3.0 KB
- mental-execution.md2.3 KB
- pattern-recognition-verdicts.md2.6 KB
- _sections.md2.8 KB
- sibling-guard-parity.md3.0 KB
- tenant-scope-leak.md4.1 KB
- AGENTS.md4.5 KB
- skill.yaml621 B