command-failure-diagnoser
Skill0 starsChanged 2 months agoMITView on GitHub
Diagnoses a failed terminal command or build process from its exit code and error logs to pinpoint root cause and remediation.
- Deletes or force-pushes
In this repository49 other files it gives its agents.
- bug-reproducerSkill
- claim-checkerSkill
- config-risk-reviewerSkill
- csv-validatorSkill
- deployment-checklist-makerSkill
- diff-reviewerSkill
- factual-summarizerSkill
- field-extractorSkill
- api-contract-testerSkill
- database-migration-helperSkill
- security-vulnerability-fixerSkill
- git-commit-stagerSkill
- git-conflict-resolverSkill
- github-actions-debuggerSkill
- github-issue-triagerSkill
- github-pr-creatorSkill
- github-pr-reviewerSkill
- go-code-qualitySkill
- go-lint-and-vetSkill
- go-testingSkill
- json-schema-converterSkill
- lint-and-typecheckSkill
- meaning-preserving-editorSkill
- meeting-notes-to-actionsSkill
- minimal-bug-fixSkill
- option-comparatorSkill
- py-code-qualitySkill
- py-lint-and-typecheckSkill
- py-testingSkill
- readme-writerSkill
- regression-test-writerSkill
- release-notes-drafterSkill
- repo-inspectorSkill
- research-briefSkill
- reversible-cleanup-plannerSkill
- rust-clippy-checkSkill
- rust-code-qualitySkill
- rust-testingSkill
- small-refactorSkill
- status-updateSkill
- step-by-step-tutorialSkill
- step-decomposerSkill
- tabular-analyzerSkill
- task-briefSkill
- test-runner-debuggerSkill
- ts-code-qualitySkill
- ts-lint-and-typecheckSkill
- ts-testingSkill
- skill-templateSkill
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 3 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- could be automatic: a setting could enforce it
- Distinctive: line 14
Use this skill when:
- Very specific: line 20
Do not use to isolate logic bugs in application code.
- Very specific: line 21
Do not use to clean up disk space.
- Very specific: line 29
If exit_code is missing: infer from logs if visible (e.g.
- Very specific: line 30
If log_output is truncated: ask for the first 20 lines of the error stack trace.
- Very specific: line 31
Never recommend destructive commands like rm -rf / or disabling security checks as a "fix".
- Distinctive: line 34
Follow these numbered actions:
- Very specific: line 49
If exit code is 137: root cause is Out of Memory (OOM Killer).
- Very specific: line 50
If permission denied: do not recommend sudo chmod -R 777.
- Distinctive: line 88
Stop and ask the user when:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Command Failure Diagnoser
Analyzes failed terminal executions, compilation errors, and nonzero exit codes. Separates root cause from cascading error noise and prescribes exact corrective commands.
1. Purpose
Turn cryptic terminal stack traces into an immediate root cause and fix. An "Exit Code" indicates process termination status (0 = success, 1+ = error, 127 = command not found, 137 = out of memory).
2. When to Use
Use this skill when:
- A build, install, test, or deployment command fails in terminal.
- CI/CD job fails with exit code != 0.
- User asks: "Why did
npm run buildfail?" or pastes terminal stderr.
3. When Not to Use
- Do not use to isolate logic bugs in application code; use
bug-reproducer. - Do not use to clean up disk space; use
reversible-cleanup-planner.
4. Required Inputs
failed_command: The command string executed.exit_code: Numeric exit code (e.g. 1, 127, 137).log_output: Terminal stdout and stderr text.
5. Missing-Input Behavior
- If
exit_codeis missing: infer from logs if visible (e.g.exited with code 127). - If
log_outputis truncated: ask for the first 20 lines of the error stack trace. - Never recommend destructive commands like
rm -rf /or disabling security checks as a "fix".
6. Procedure
Follow these numbered actions:
- Action 1: Classify Failure Mechanism
Missing Tool / Command: Exit 127 (command not found).Permissions: Exit 126 orEACCES/Permission denied.Resource Exhaustion: Exit 137 (SIGKILL/ Out of memory).Compilation / Syntax: Compiler error with file and line.Dependency Missing:Cannot find module,No such file or directory.
- Action 2: Isolate Root Cause Line
- Find the earliest fatal error in log, ignoring downstream cascades.
- Action 3: Prescribe Targeted Corrective Command
- Provide the exact shell command to cure the root cause.
- Action 4: Emit Diagnosis Report
- Format per Section 8.
7. Decision Rules
- If exit code is 137: root cause is Out of Memory (OOM Killer). Prescribe increasing RAM or reducing build concurrency (
--max-workers=2). - If permission denied: do not recommend
sudo chmod -R 777. Recommend appropriate user-level permissions orchown.
8. Output Format
Emit the diagnosis using this template:
### Command Failure Diagnosis
- **Failed Command**: `[command]`
- **Exit Code**: [Code, e.g. 127]
- **Category**: [Missing Dependency | Syntax Error | OOM | Permissions | Configuration]
#### Root Cause Analysis
[1-2 sentences identifying the exact error line and why it happened.]
#### Offending Log Line
```text
[Exact log excerpt containing the fatal error]Corrective Action
[Exact command to resolve the issue]
## 9. Verification Checklist
- [ ] Root cause identified from earliest fatal log line.
- [ ] Corrective command is safe and non-destructive.
- [ ] Exit code semantics are accurately interpreted.
- [ ] No generic "reboot your computer" advice.
## 10. Common Failures and Recovery
| Failure Symptom | Cause | Recovery Action |
| :--- | :--- | :--- |
| Diagnosing downstream crash | Focusing on last line of log | Scroll up to find the initial fatal error. |
| Insecure recommendation | Suggesting `chmod 777` | Recommend user ownership change `chown -R $USER`. |
## 11. Stop or Escalation Conditions
Stop and ask the user when:
- Error indicates hardware failure, disk corruption, or cloud outage.
## 12. Examples
### Example 1: Successful Execution
**Input:**
```text
Command: npx vitest
Exit code: 127
Log: /bin/sh: line 1: npx: command not foundOutput:
### Command Failure Diagnosis
- **Failed Command**: `npx vitest`
- **Exit Code**: 127
- **Category**: Missing Tool / Environment
#### Root Cause Analysis
Exit code 127 indicates that the executable `npx` was not found in the current shell `$PATH`. Node.js/npm is either not installed or not loaded into the active environment.
#### Offending Log Line
```text
/bin/sh: line 1: npx: command not foundCorrective Action
Ensure Node.js is installed and loaded:
source ~/.nvm/nvm.sh && which npx
### Example 2: Ambiguous or Missing Input
**Input:**
```text
Command: make
Exit code: 2
Log: (Empty)Output:
### Command Failure Diagnosis: Insufficient Error Log
- **Failed Command**: `make`
- **Exit Code**: 2
- **Status**: Halted
Exit code 2 indicates a general Make error, but no terminal log was provided. Please paste the terminal output printed before the command exited.Example 3: Expected Final Output
Output:
### Command Failure Diagnosis
- **Failed Command**: `npm run build`
- **Exit Code**: 137
- **Category**: Resource Exhaustion (OOM)
#### Root Cause Analysis
Exit code 137 indicates process terminated by Linux kernel OOM (Out Of Memory) Killer (SIGKILL, signal 9 + 128). Node process exceeded container RAM.
#### Offending Log Line
```text
Killed
npm ERR! Lifecycle script `build` failed with error: 137Corrective Action
Increase Node memory limit:
NODE_OPTIONS="--max-old-space-size=4096" npm run buildDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

