跪拜 Guibai
← All articles
GitHub

Agent Skills Fail at Five Stages: A Marker Test for Claude Code's Skill Pipeline

By 秋千易 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

If you build Agent Skills, you now know that loading a Skill is not enough: references and scripts are separate layers that may never enter context or run. A few markers can tell you exactly which stage failed, saving you hours of guessing whether the model 'followed instructions'.

Summary

A local test with a mock model on Windows 11 exposes how Claude Code's Agent Skills really load. When a plain prompt asks the agent to say hi, the request contains 96,871 characters: the skill list includes the name and description, but the SKILL.md body never appears. An explicit /oversize-test call brings the body in, pushing the request to 108,008 characters, but references/note.md and scripts/probe.py still don't show their markers. The difference is 11,137 characters, roughly the size of the 152-line SKILL.md plus JSON overhead.

The root cause is a five-stage chain: discovery, trigger, loading, execution, and verification. Each stage has an observable exit, and any broken link makes the skill appear unused. The article provides a marker-based smoke test: add unique markers to SKILL.md, references, and scripts, then run an explicit call and check which markers appear. If only the body marker shows, the skill loaded but didn't execute references or scripts. The test also notes Claude Code's compression keeps only the last 5,000 tokens per skill (shared 25,000 token pool), and the skill list gets 1% of the context window with a 1,536-character description cap.

This method doesn't just diagnose; it prescribes fixes. Keep SKILL.md under 500 lines, put key references early, and separate deterministic scripts from judgment logic. Verify outputs with git diff or file existence, not with the model's claim. The author tested only one skill and one entry point, so the results don't cover multi-skill contention or real model behavior, but the five-stage check gives a practical debugging template for any skill.

Takeaways
— In a plain prompt, a Skill's description appears but its SKILL.md body does not; the request JSON is 96,871 characters.
— Explicit invocation /skill-name loads the body, increasing the request to 108,008 characters, but references and scripts remain absent.
— The five stages of a Skill's active use are discovery, trigger, loading, execution, and verification.
— Claude Code's automatic compression keeps only the last 5,000 tokens per Skill (25,000 shared) and can drop entire older Skills.
— Skill list descriptions are subject to a 1% context-window budget and a 1,536-character cap.
— A smoke test with unique markers in SKILL.md, references, and scripts reveals which stage fails.
— The test only covers one Skill and one entry point; multi-skill contention and real-model behavior remain untested.
Conclusions

The test isolates client-side behavior: a mock model means we see exactly what the client puts into the request, not what a real model would decide to do.

The 11,137-character difference between the two calls is almost exactly the SKILL.md's 10,832 characters plus JSON overhead, proving the body is loaded but nothing else is.

The five-stage chain is a useful debugging model, but the article stops at probe coverage: it doesn't inject failures in later stages, so claims about execution and verification are only assertions.

Character count and token count are easily conflated; the author carefully distinguishes them, a discipline many troubleshooting posts lack.

Concepts & terms
Agent Skill
A packaged set of instructions and resources (SKILL.md, references, scripts) that an agent can load and use, as defined in Claude Code's Agent Skills system.
Marker
A unique string placed in a file to verify whether that content was loaded into context or processed, used to probe what the agent actually sees.
References
External files (like markdown notes) that a Skill can point to; they are loaded only when the model reads them, not automatically with SKILL.md.
Scripts
Executable code that runs via Bash; only its output (stdout/stderr) enters the context, not the script body itself.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗