luongnv89/asm/skill-shortener
Claude Code and agent skill by luongnv89/asm
- community
Checking that the SKILL.md file is still in the repository.
Refactor a too-long SKILL.md by progressive disclosure: measure token cost, classify every section KEEP/CUT/MOVE, shorten the body into references/ and scripts/, verify nothing was lost. Don't use for authoring new skills, eval retrofits, or prose.
Install
npx vskill@latest install luongnv89/asm/skill-shortenerSKILL.md
The same SKILL.md was published earlier as luongnv89/asm/skill-shortener.
Skill Shortener
Shrink an over-long SKILL.md by progressive disclosure: what the agent needs on _every_ activation stays in the body, everything else moves behind a pointer that says when to load it — or is cut outright.
Three load layers decide where a piece of content belongs:
| Layer | Holds | Costs | |
|---|---|---|---|
| always-loaded | frontmatter name + description | every turn | |
| on-trigger | the SKILL.md body | every activation | |
| on-demand | references/, scripts/, assets/ | only when read |
The bar is behavior-preserving: the shortened skill drives the same process as the long one. Line count is the score, not the goal — a run that reaches 400 lines by deleting a loop's stop condition has failed, however good the number looks.
Two modes
Pick one before Phase 0; they diverge at Phase 2.
- Mode 1 — shorten (default). Phases 0–4: measure, classify, plan, apply on approval, verify. Every "shorten this", "this SKILL.md is too long", "cut its token cost", "apply progressive disclosure" request is Mode 1.
- Mode 2 — audit only. Phases 0–2, then stop and hand over the plan. Nothing outside the workdir is written, so the repo sync and snapshot in Phase 0 are skipped. Use when the user wants to know what _would_ move, or will apply the split themselves.
Run variables
Every snippet below uses these four. Bash tool calls do not share shell state, so re-declare them at the top of each call that needs them — an empty $SKILL_PATH turns cp -R "$SKILL_PATH/." into a copy of the filesystem root. Capture RUN_EPOCH once and reuse the _number_; never re-stamp it.
Dependency Preflight (mandatory)
This skill invokes skill-creator, declared in frontmatter dependencies: it runs that skill's quick_validate.py as the Phase 4 frontmatter gate. Run this first, in both modes:
Mode 1 only, before the snapshot below — the first step that changes anything — the main agent acquires the dependency. Phase 4 always needs it, and a miss found after Phase 3 would strand a half-applied split:
Set QV to scripts/quick_validate.py under the directory holding the returned skillMdPath, and reuse that literal path. If the acquire fails, stop before the snapshot and report its error — never continue with a partial run. Mode 2 never acquires.
The main agent releases the lease from its own finally/shutdown handling — after Phase 4, or at any earlier stop:
Snapshot and Repo Sync Before Edits (mandatory)
Always snapshot first. The most common target — ~/.claude/skills/<name>/ — is _not_ a git repository, so git is not a guaranteed undo path, and this skill rewrites a whole directory rather than one file:
Then sync only if the target directory itself is a git work tree root — rev-parse --git-dir succeeds for any nested path inside a larger repo, and must not trigger fetch/pull of that tree:
If tracked files are modified (git -C "$SKILL_PATH" status --porcelain --untracked-files=no prints anything): git -C "$SKILL_PATH" stash push without -u, sync, then git -C "$SKILL_PATH" stash pop. Untracked files stay in place; other sessions may own them. If origin is missing or the pull conflicts, stop and ask the user — never skip or force the sync. In a git repo, suggest adding .skill-shortener/ to .gitignore.
The three dispositions
Every section of the body gets exactly one, and each has one reference behind it. Read the reference for the disposition you are about to assign — not all three up front.
| Disposition | Means | Read before assigning it | |
|---|---|---|---|
| KEEP | needed on every activation; stays in the body | read references/behavior-preservation.md before assigning it | |
| CUT | deleted; the model already knows it or it changes no behavior | read references/cut-list.md before assigning it | |
| MOVE | relocated to references/, scripts/, or assets/, with a pointer | read references/split-patterns.md before assigning it |
Workflow
Phase 0 — Baseline
Mode 2 — skip snapshot and git sync. Audit-only must not reach fetch / pull --rebase. Run the preflight and the two measure_skill.py commands below, then continue to Phase 1. Do not acquire skill-creator, do not create $SNAP, and do not run the repo-sync block.
Mode 1. Run the preflight, acquire skill-creator, take the snapshot, sync only when $SKILL_PATH is itself the git work tree root (see above), then measure:
The section table, largest first, is where the fat is — read it before reading the body.
Early exit. If the verdict is WITHIN_CAP, stop: print the current footprint and say no shortening is warranted — splitting a body that already fits costs a pointer hop for no saving. The one exception is an existing references/ tree that is chained or orphaned; see _Edge cases_. The user can override.
Done when: .skill-shortener/baseline.json exists with a non-empty sections array, and the verdict is recorded.
Phase 1 — Classify every section (the manifest)
Read the body, then assign every heading from baseline.json exactly one disposition. Write .skill-shortener/manifest.json:
destination may be a string or a list. load_condition is the clause that goes into the pointer, so write it as the agent will read it: "when X", "before Y", "if Z".
The manifest is the loss-prevention record. Nothing is verified as preserved except through it, so an unclassified section is an unaudited deletion waiting to happen.
Done when: every heading in baseline.json appears in the manifest exactly once; every CUT carries a reason; every MOVE carries a destination and a load_condition. scripts/verify_shorten.py checks all four in Phase 4 — do not defer them.
Phase 2 — Plan and approve
Present the plan as a table — heading, disposition, destination, lines saved — plus the projected body size against both caps and the always-loaded/on-demand split. Name the biggest three savings first.
Expected output — the plan, before any file is touched:
Mode 2 ends here. In Mode 1, stop and wait for an explicit go-ahead. A split is a judgment call and the user is the one who has to live with the result.
Done when: the user has approved the plan, or asked for changes that are folded back into the manifest.
Phase 3 — Apply
- Write each
MOVEdestination. The moved material must be self-contained — a reader arriving with only the pointer's context can act on it. Add a one-line contents map at the top of any reference over 300 lines. - Rewrite the body: delete
CUTsections, replace eachMOVEsection with a pointer carrying itsload_condition("Readreferences/<topic>.mdwhen the API returns a non-200"). A bare "seereferences/<topic>.md" is relocation, not disclosure, and Phase 4 fails it. - Keep references one level deep. A reference that points to another reference is a chain — inline it or promote it to a sibling.
- Bump
metadata.version: minor for pure relocation, major if anyCUTremoved an instruction or the step sequence changed.
When the plan extracts three or more reference files and the Agent tool is available, hand each one to its own worker: the worker's Input is references/split-patterns.md plus that section's text, and it returns the finished file. The body rewrite stays with the main agent, which is the only step that needs the whole picture.
Done when: every MOVE destination exists and is non-empty, the body contains a conditional pointer to each, and the version is bumped.
Phase 4 — Verify
Then do the read-back, which no script can do for you: open every file the plan created and confirm the material arrived complete and reads as instructions rather than as an excerpt. The script proves the manifest is exhaustive and the wiring is sound; only the read-back proves the content survived the move.
On a failure, fix and re-run — up to 3 rounds, then report what still fails instead of looping. If the result is worse than the original, restore — guarding both variables, because an empty $SNAP leaves a deleted skill and nothing to put back:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 91 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/skill-shortener/SKILL.md
Popularity
- Repository stars
- 947
- Repository forks
- 83
- 7-day trend score
- 34
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/luongnv89/asm/skill-shortener)