audit-skill-by-derailment
Use if hardening a SKILL.md by running a fresh subagent on a real task and fixing where it snags.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use if hardening a SKILL.md by running a fresh subagent on a real task and fixing where it snags.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use skill if you are exhaustively testing or release-gating martool CLI commands in a source checkout or deployed Coolify container over SSH, without local Docker or provider spend.
Use if driving agent-browser for Chrome/CDP automation, @ref snapshots, tabs, or verification.
Use if testing or debugging an iOS app via agent-device CLI — simulator flows, evidence, bug triage.
Use if supervising Jean agents through MCP and Computer Use for monitoring, recovery, or closure.
Use if auditing or designing a CLI for agent/LLM use — JSON output, exit codes, non-interactive.
Use if auditing or designing an MCP server for agent-readiness — framework, security, context.
| name | audit-skill-by-derailment |
| description | Use if hardening a SKILL.md by running a fresh subagent on a real task and fixing where it snags. |
Improve a skill by making a subagent use it on a real task, reading the execution trace for friction, and fixing the skill text where it broke.
Use this skill if you are:
Do NOT use this skill if you are:
build-skillUse these inline tables for fast triage. Load the reference files for full criteria.
| Symptom in trace | Severity | Typical root cause | Fix family |
|---|---|---|---|
[STUCK] — executor cannot continue | P0 | S1 missing prerequisite, S2 contradiction, M2 unstated location | Prerequisite Surfacing, Workflow Path Reconciliation, Output Location Specification |
[BROKE] — command from skill failed | P0 / P1 | O1 silent failure, O5 stale flag/version | Error Recovery Addition, Format Alignment |
[GUESSED] — subagent invented a decision | P1 | M1 ambiguous threshold, M5 assumed knowledge | Threshold Concretization, Scaling Guidance |
| Re-read same file 2+ times | P1 | S3 scattered info, M3 format inconsistency | Schema Duplication at Point of Use |
| Skipped a step | P1 | M4 missing execution method, M6 vague verb | Execution Method Specification |
[NICE] — skill prevented a mistake | Keep | Load-bearing line | Do not weaken or rewrite this text |
3+ P1s in one workflow step = compound P0. Fix the source paragraph first; do not pile warnings beside bad text.
Local skill (user says "test run-github-scout"):
ls ~/.claude/skills/{name}/
cat ~/.claude/skills/{name}/SKILL.md
ls ~/.claude/skills/{name}/references/
Remote skill (user provides owner/repo or GitHub URL):
mkdir -p /tmp/skill-test/references
gh api repos/{owner}/{repo}/contents/SKILL.md --jq '.content' | base64 -d > /tmp/skill-test/SKILL.md
gh api repos/{owner}/{repo}/contents/references --jq '.[].name' | while read f; do
gh api repos/{owner}/{repo}/contents/references/$f --jq '.content' | base64 -d > /tmp/skill-test/references/$f
done
No name given: Ask the user which skill to test before touching anything.
Read SKILL.md and every reference file. While reading, hold these in mind:
| Skill type | Bad test (clinical) | Good test (real user energy) |
|---|---|---|
| Code search | "Search for repos matching 'react'" | "Find me all the self-hosted Notion alternatives with real-time collab" |
| Code review | "Review file X" | "I just rewrote our auth middleware, can you check it before I merge?" |
| Deployment | "Deploy service A" | "Push this to staging, but our Redis is on a separate VPC so watch for that" |
Pick the nastiest realistic task:
Read like an editor, not just an operator. Find the paragraph, example, missing precondition, or routing cue that would send the executor down the wrong path.
Launch one fresh-context subagent. The prompt reads like a real user request, not an experiment.
Prompt template:
I need help with: {TASK_IN_PLAIN_LANGUAGE}
There's a skill for this at {SKILL_PATH}. Read the SKILL.md and the
reference files it points to, then follow the workflow to do what I asked.
As you work, only flag moments where the skill text changes your path:
- [STUCK] if the skill leaves you unable to continue; name the missing or conflicting instruction
- [GUESSED] if you had to invent a decision the skill should have made explicit; point to the section that should have answered it
- [BROKE] if following the skill led you to a command or pattern that failed; include the command and the instruction that led you there
- [NICE] if a specific sentence, example, or routing cue saved you from a mistake
Valid marker shapes the subagent should produce:
| Marker | Example shape |
|---|---|
[STUCK] | [STUCK] references/fix-patterns.md says to run X, but no install step or fallback exists. |
[GUESSED] | [GUESSED] Step 2 says "large skill" but gives no threshold; I chose 10 files. |
[BROKE] | [BROKE] Command from Step 4 failed: ...; the documented output path did not exist. |
[NICE] | [NICE] The routing table sent me to friction-classification.md before editing. |
Dispatch protocol:
Optional helper: scripts/launch-derailment.sh renders this prompt, optionally pipes it to a runtime-neutral agent command, and tees output to a trace file. See scripts/launch-derailment.sh.md for arguments and exit codes.
When the subagent completes, its output is at the path shown in the launch response (typically JSONL).
Preferred extraction:
bash {SKILL_PATH}/scripts/parse-derailment-trace.sh AGENT_OUTPUT_PATH
See scripts/parse-derailment-trace.sh.md for output format and --context N flag.
Fallback extraction (if the script is unavailable):
python3 -c "
import json
with open('AGENT_OUTPUT_PATH') as f:
for line in f:
if not line.strip(): continue
obj = json.loads(line)
if obj.get('type') != 'assistant': continue
for c in obj.get('message',{}).get('content',[]):
if c.get('type') == 'text':
print(c['text'][:500]); print('---')
elif c.get('type') == 'tool_use':
print(f'TOOL: {c[\"name\"]} | {str(c.get(\"input\",{}))[:120]}')
" 2>/dev/null | head -200
What the trace shows:
| Signal | What it means | Where to look |
|---|---|---|
[STUCK] tag | Subagent hit a wall — P0 | Source paragraph the tag points to |
[GUESSED] tag | Skill didn't say; subagent improvised — P1 | The decision the skill should have made |
[BROKE] tag | Command from skill failed — P0/P1 | The exact command + the instruction that led there |
[NICE] tag | Skill prevented a mistake | Mark as load-bearing — do not break |
| Re-read same file 2+ times | Confusing instructions — P1 | The file the executor kept reopening |
| Tried, errored, switched approach | Silent failure — P1 | The first command and what it returned |
| Skipped a step | Step seemed optional or unclear — P1 | Step heading, conditional gating |
For each cluster, use references/friction-classification.md to assign severity, then references/root-cause-taxonomy.md to tag the WHY (S/M/O code).
For each root-cause cluster, highest severity first:
references/fix-patterns.md.No output files. Edit the skill. That is the deliverable.
Do not preserve bad text and add a warning beside it. Do not weaken [NICE] lines while fixing — they're load-bearing. Do not let test-harness constraints become product docs (see Harness Alignment in references/fix-patterns.md).
# Every reference file must be linked from SKILL.md
for f in $(find {SKILL_PATH}/references -name '*.md' -type f); do
grep -q "$(basename $f)" {SKILL_PATH}/SKILL.md || echo "ORPHAN: $f"
done
# SKILL.md must stay under 500 lines
wc -l {SKILL_PATH}/SKILL.md
Run the repo's validator if the skill lives in this repo:
python3 scripts/validate-skills.py
If round 1 found any P0, launch another subagent with a different task in a different domain.
Decision rule:
build-skill for redesign — do not keep piling warnings into a structurally weak skill.The report is chat output, not a repo artifact. Report in this order:
[STUCK], [GUESSED], [BROKE], [NICE].Scripts are resolved relative to the skill directory root.
| Script | Use |
|---|---|
scripts/launch-derailment.sh | Render the Step 3 prompt, optionally pipe it to a runtime-neutral agent command, and tee output to a trace. See scripts/launch-derailment.sh.md. |
scripts/parse-derailment-trace.sh | Parse a saved JSONL or plain-text trace into marker counts, marker context, and tool/failure snippets. See scripts/parse-derailment-trace.sh.md. |
Load only what the current step needs.
| File | Read when |
|---|---|
references/friction-classification.md | Step 4 — assigning P0/P1/P2 severity to trace symptoms |
references/root-cause-taxonomy.md | Step 4 — tagging WHY each cluster broke (S/M/O codes) |
references/fix-patterns.md | Step 5 — matching root cause to a proven fix pattern |
[NICE] moments while fixing.