cd /news/ai-agents/i-hid-a-secret-in-my-claude-code-ski… · home › topics › ai-agents › article
[ARTICLE · art-182427] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

I hid a secret in my Claude Code skill's script. Claude never read it

A developer restructured a 263-line Claude Code release-notes skill into a 9-line entry point by exploiting Anthropic's progressive-disclosure loading model, where only a skill's name and description load at startup, the main file loads on trigger, and reference files and scripts load only when the main file points to them. In a test skill, a passphrase planted inside a script's comments never appeared in Claude's context because scripts are executed rather than read, with only their output entering context. The developer now sorts skill content into scripts/ for deterministic processing, references/ for conditionally loaded knowledge, and the main file for steps requiring judgment.

recommendation

Move deterministic processing into scripts/ and conditionally needed knowledge into references/ linked with an explicit trigger condition, keeping only judgment-dependent steps in the main skill file.

more in playbook: Designing agent systems
read6 min views4 publishedDec 5, 2026

My release-notes skill had grown to 263 lines. After one experiment with a planted passphrase, the main file is 9.

Every time a skill misbehaved, I added a line. "Also check this." "Never do that." "Here is the format, in full." A few months later my release-notes skill was 263 lines long, with a chunk of Python pasted right in the middle.

It still worked. Mostly. But every time it ran, Claude had to read all 263 lines, including the parts that only matter once a month. And the longer it got, the more often it skipped a step I cared about.

Then I went back to the official docs and noticed something I had skimmed past: a skill is a folder. The main file is only the entry point. Everything else is supposed to live next to it and be loaded only when needed.

So I ran an experiment to see how literally Claude takes that. I hid a passphrase inside one of the skill's scripts and waited to see if Claude would ever repeat it. It never did, and that one result changed how I write every skill.

Short on time? The walkthrough below is free. If you'd rather skip the setup, I packaged it as a ready-to-use skill: skill-folderize on Gumroad.

Anthropic calls this progressive disclosure. There are three stages.

Stage 1: the description. At startup, Claude only sees each skill's name and description. That's how it decides whether to use the skill at all.

Stage 2: the main file. When the skill is triggered, Claude reads the body of the main file.

Stage 3: everything else. Reference files and scripts in the folder are touched only if the main file points to them, and only when the situation calls for it. Scripts are executed, not read. Only their output enters the context.

That last part is the interesting one. If a script is executed but never read, its code costs you nothing.

I built a tiny test skill with three parts:

guide.md reference file, linked with a condition: "read this only when the input has headings"count.sh script that counts characters and headings in a file Inside count.sh, I planted a comment: a random phrase about a purple penguin. If Claude ever read the script, that phrase would be in its context, and I could ask about it.

Then I ran the skill on a plain text file. Claude ran count.sh and got back two numbers: 94 characters, 2 headings. The penguin phrase never appeared anywhere in what Claude saw. And guide.md was opened only when I gave it input that matched the condition.

So the script's code never entered the context. Only its one-line output did. And the reference stayed closed until it was actually needed.

That changed how I think about skills. The main file is the part you pay for every time. Everything else can be as long as it needs to be, for free, as long as it's in the right place.

Once you see it that way, rebuilding a skill becomes a sorting job. For every paragraph, ask these questions in order, and stop at the first yes.

1. Is it processing? Move it to scripts/. Input and output are fixed, and the result is the same every time. Counting, formatting JSON, converting to a fixed template, mechanically checking a list of rules.

A code block longer than 30 lines sitting in your main file is almost always this. Claude doesn't need to understand it. It only needs the result.

2. Is it reference? Move it to references/. Knowledge you don't need every time, but do need in specific situations. API details, a table of fixes per error, detailed style rules, templates, past examples.

One topic per file, and link it from the main file together with the condition: "When the release includes breaking changes, read references/breaking.md."

3. Everything else is steps. It stays. Things done every single time, or that require judgment. The order of work, when to check with the user, what not to do, what "done" looks like.

When I can't decide, I ask: "If I deleted this paragraph, would every run get worse?" If yes, it's a step. If no, it's reference.

The Claude Code docs line up with the sorting rule.

The description rule was the first thing that bit me. My old description said what the skill did, but not when to use it, so Claude sometimes ignored it entirely.

The second one: when I asked Claude to do the split for me, it did a decent job, with one problem. It rewrote every script call with the absolute path on my machine.

It works on my Mac. It breaks on anyone else's, and it breaks on mine the moment I move the folder.

The fix is the variable Claude Code provides: ${CLAUDE_SKILL_DIR} always points to the skill's own folder. Script calls should look like this, in the body and in allowed-tools:

allowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/count.sh *)

Run ${CLAUDE_SKILL_DIR}/scripts/count.sh <file> (no need to read it)

Now I tell Claude explicitly: copy this pattern, never expand the variable.

I applied the sorting rule to the 263-line release-notes skill. The main file is now 9 lines of steps. Next to it sit two reference files, each linked with when to read it, and one script for the formatting that used to be a pasted Python snippet.

Then I checked it against the rules above (length, description, links, paths, script permissions): 0 errors, 0 warnings. And Claude now reads 9 lines on every run instead of 263.

What I'd keep from all this:

If you have a skill that keeps growing, it probably doesn't need fewer words. It needs a folder.

Over to you: how long is your longest skill or instruction file right now? Drop the line count in the comments. I suspect mine wasn't the worst.

Thanks for reading this far! If you're itching to shrink your own skills, I turned this whole process into a skill.

The rule above is simple, but doing it by hand means a lot of small checks: is the description saying when to use it, are any links broken, did a path get hardcoded, are the scripts executable, does any reference link to another reference. The skill handles all of it, and it checks its own work before it tells you it's done.

CLAUDE.md that you want to turn into a skill If your skills are all under 50 lines and you never paste code into them, you don't need it.

👉 Get the skill: https://pastereadyengineer.gumroad.com/l/skill-folderize

📦 skill-folderize is also part of the Claude Code Workflow Kit: 5 Claude Code skills (claude-org, scout, local-worker, skill-folderize, split-commits) for $29 instead of $45.

🧰 Want all of them? The Claude Code Complete Kit has all 26 skills I tested for $59 instead of $234.

🎁 New here? Start with my free skill: mcp-key-check finds the API keys your MCP setup left in plain text and prints the commands to fix them. Pay what you want, $0 is fine.

If this was useful, a ❤️ and a follow would mean a lot. I write about practical ways to put AI to work in indie development.

── more in #ai-agents 4 stories · sorted by recency
── more on @anthropic 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/i-hid-a-secret-in-my…] indexed:0 read:6min 2026-12-05 · —