How Do Modular Multi-File Claude Skills Protect the Context Window?
Modular multi-file Claude skills protect the agent context window by confining startup discovery to a compact YAML header (~100 tokens) and keeping large templates, schemas, and helper scripts on disk until an execution branch explicitly loads them. Instead of dumping 8,000 to 15,000 tokens of rubrics and examples into every turn, SKILL.md acts as a lean router that pulls supporting files on demand.
According to the Claude Code documentation and the Agent Skills open specification, a portable skill directory requires SKILL.md (with a lowercase hyphenated name up to 64 characters and a description up to 1,024 characters) and optionally includes scripts/, references/, and assets/ subdirectories. For folder precedence across personal versus repository scopes, read our guide to Claude skills across projects and folders or audit per-turn bloat in token context overhead in agent skills.
Prompttly is a skill manager for AI agents — one library for your skills and prompts that syncs into Claude Code, Codex, ChatGPT, and Claude and is one hotkey away on your Mac, so your setup follows you across every machine, repo, and tool.
When Is One SKILL.md File Enough vs. a Multi-File Package?
A single SKILL.md file is enough when the entire operating procedure fits in fewer than 80 lines without external templates, schemas, or multi-step scripts. Upgrade a skill to a multi-file package only when supporting assets would clutter the main instructions, force duplicate copies across teams, or burn unnecessary context tokens on runs that never need those assets.
| Supporting Material | Keep in SKILL.md | Move to Supporting Subfolder |
|---|---|---|
| Examples | One short before-and-after snippet (under 15 lines). | Multiple edge-case payloads or language-specific fixtures in examples/. |
| Templates | A minimal 4-bullet response outline. | Full PR checklists, release-note skeletons, or JSON schemas in templates/. |
| Policy & Rules | Five to ten non-negotiable guardrails. | Long compliance rubrics, brand voice guides, or SQL style specs in references/. |
| Automation | A single one-line CLI invocation. | Deterministic Python or Bash validators in scripts/ executed as black boxes. |
If you are still designing your first skill entrypoint, start with the agent skills and SKILL.md architecture guide before splitting assets into subfolders.
How Do Claude Code, Codex, Antigravity, and Cursor Load Multi-File Skills?
Claude Code, OpenAI Codex CLI, and Google Antigravity natively resolve multi-file SKILL.md directories using progressive disclosure, whereas Cursor IDE relies on single-file .cursor/rules/*.mdc definitions without nested asset folders. Packaging reusable assets inside standard scripts/ and references/ subdirectories lets one canonical skill bundle run unchanged across all three directory-based agents.
| Coding Agent | Personal Path | Project Path | Asset Subfolders | Runtime Loading Behavior |
|---|---|---|---|---|
| Claude Code | ~/.claude/skills/<skill>/ | .claude/skills/<skill>/ | scripts/, references/, templates/, examples/ | Loads name + description at startup (~100 tokens); reads supporting files on demand. |
| OpenAI Codex CLI | ~/.codex/skills/<skill>/ | .agents/skills/<skill>/ | scripts/, references/, assets/ | Progressive disclosure via SKILL.md manifest; scripts execute without dumping source into context. |
| Google Antigravity | ~/.gemini/config/skills/<skill>/ | .agents/skills/<skill>/ (legacy .agent/skills/) | scripts/, examples/, resources/ | Indexes metadata on every turn; resolves relative paths on local disk or remote SSH host. |
| Cursor IDE | User settings / Prompttly sync | .cursor/rules/*.mdc | No native skill asset folder; uses glob-scoped .mdc rules | Injects full .mdc rule body when globs match or alwaysApply: true is set. |
When running Google Antigravity on remote Linux machines over SSH, those personal and project paths resolve on the remote devbox rather than your laptop—see our walkthrough on Google Antigravity remote SSH workspaces and container sync to keep multi-file packages available across cloud hosts.
What Folder Structure Should Every Multi-File Skill Use?
Every multi-file Claude Skill should place SKILL.md at the folder root and organize supporting assets by execution role—templates/, examples/, references/, and scripts/. Naming folders consistently allows both human reviewers and autonomous agents across Claude Code, Codex, and Antigravity to predict where validation logic or schemas live.
~/.claude/skills/release-notes/
SKILL.md
templates/
release-notes.md
customer-email.md
examples/
small-fix.md
major-launch.md
references/
voice-guide.md
changelog-rubric.md
scripts/
collect-merged-prs.shUse the exact same directory layout for a repository-scoped skill shared via Git inside .claude/skills/ or .agents/skills/:
.claude/skills/release-check/
SKILL.md
references/
release-gates.md
rollback-policy.md
templates/
release-summary.mdA multi-file skill folder is an atomic package. Copying only SKILL.md between repositories or machines leaves dangling relative file pointers that silently degrade agent output.
How Should SKILL.md Point to Supporting Files Without Token Bloat?
Your SKILL.md entrypoint should act as a decision map that names each supporting file alongside the exact condition under which the agent should read or execute it. Explicitly instructing the agent to run scripts via --help or read references/ files only for specific branches prevents unnecessary file reads on standard tasks.
---
name: release-notes
description: Use when turning merged PRs, changelog notes, or release tickets into customer-facing release notes and launch communication.
---
# Release Notes
Use this skill when the user asks for release notes, a launch summary, or a
customer-facing update based on completed product work.
## Required process
1. Run scripts/collect-merged-prs.sh --help first, then collect merged commits for the target tag.
2. Separate shipped changes, fixes, known limitations, and follow-up work.
3. Read templates/release-notes.md for the public release note structure.
4. Read references/voice-guide.md for banned claims and formatting rules.
5. Read examples/major-launch.md only when the release introduces a net-new feature.
## Output
- Release summary
- Customer-facing notes
- Internal caveats
- Follow-up questions
Do not invent shipped work, dates, customer commitments, or metrics.By conditioning examples/major-launch.md on net-new features, minor bugfix releases skip reading that example file altogether and preserve context budget.
How to Build a Multi-File Claude Skill Step by Step
Build a multi-file Claude Skill incrementally by starting with a working SKILL.md procedure and extracting templates, examples, references, and scripts one subfolder at a time. Prematurely splitting an unproven workflow creates folder churn without improving output consistency.
- Name one repeatable job: Assign a lowercase hyphenated directory name under 64 characters such as
release-notes,brand-review, orsupport-escalation. - Choose personal or project scope: Place personal workflows in
~/.claude/skills/and team repository workflows in.claude/skills/or.agents/skills/. - Write a trigger-focused description: Include explicit activation verbs and scenarios in the YAML
descriptionfield (up to 1,024 characters). - Author the minimal core process: Keep core safety constraints and output steps directly inside
SKILL.md. - Extract one asset type at a time: Move reusable output skeletons to
templates/, realistic fixtures toexamples/, long policies toreferences/, and deterministic helpers toscripts/. - Annotate why each file exists: Pair every relative path in
SKILL.mdwith the condition that requires loading it. - Verify with realistic inputs: Invoke the skill in Claude Code or Codex CLI and confirm the agent reads the right supporting files without over-reading unused references.
mkdir -p ~/.claude/skills/release-notes/{templates,examples,references,scripts}
touch ~/.claude/skills/release-notes/SKILL.md
touch ~/.claude/skills/release-notes/templates/release-notes.md
touch ~/.claude/skills/release-notes/examples/major-launch.md
touch ~/.claude/skills/release-notes/references/voice-guide.mdIf you are starting from an existing chat prompt rather than building from scratch, follow how to convert prompts to skills first, then split supporting assets into folders once the instructions stabilize.
Example: Turning a Monolithic Review Prompt Into a Multi-File Package
Refactoring a monolithic brand or code review prompt into a lean SKILL.md plus dedicated reference files cuts maintenance friction and keeps per-invocation context lean. Instead of editing a 400-line prompt whenever one compliance rule changes, you update a single file inside references/.
Weak monolithic package
One 450-line SKILL.md embedding brand rules, 6 full examples, landing-page checklist, email checklist, and deprecated launch notes—burning 11,000+ tokens on every run.
Strong modular package
A 45-line SKILL.md routing to references/voice.md, references/banned-claims.md, templates/landing-page-review.md, and examples/strong-before-after.md only when matched.
The Sprawl Moment: When Half a Skill Folder Stays on the Old Laptop
A staff engineer spends Friday packaging a 4-file database-migration skill on their work MacBook Pro—putting the core checklist in SKILL.md, Postgres lock-timeout rules in references/locking.md, and a dry-run analyzer in scripts/check-locks.sh. Over the weekend, they copy-paste the contents of SKILL.md into a new project repo on their personal Linux workstation and run Claude Code before an emergency schema patch. Five minutes into the session, the agent hallucinates an outdated lock-timeout check because references/locking.md never left the work laptop, and scripts/check-locks.sh fails silently with a missing-file error while the engineer scrambles to recreate the missing subfolder from memory.
How Do You Test, Sync, and Avoid Common Multi-File Skill Mistakes?
Testing and maintaining a multi-file skill requires verifying selection triggers, reference-file resolution, boundary conditions, and atomic folder synchronization across every machine you use. Most multi-file failures occur when teams either hide critical always-on rules deep in references/ or sync only SKILL.md across laptops and repositories.
- Selection test: Ask for the workflow naturally without naming the skill and confirm Claude Code or Codex selects the package from its frontmatter description.
- Reference test: Supply an input that requires a specific template or rubric and verify the output reflects that exact file.
- Boundary test: Send an adjacent task and confirm the skill does not over-apply or waste tokens reading unrelated reference files.
- Portability test: Sync the complete folder to a second machine or remote SSH host using multi-machine skill sync so
scripts/andreferences/never stay behind.
Mistake 1: Making Every Skill Multi-File Too Early
Adding subfolders before a workflow stabilizes slows peer review and introduces unnecessary path hops. Keep simple procedures in a single SKILL.md until templates or scripts earn their own files.
Mistake 2: Hiding Mandatory Rules in Reference Files
Always-required safety constraints belong directly inside SKILL.md. Only optional, branch-specific, or lengthy material should sit in references/.
Mistake 3: Copying SKILL.md Without Its Subfolders
A multi-file skill breaks the moment its supporting assets remain on another laptop or in another repository. Always version and sync the full skill folder atomically.
FAQ: Multi-File Claude Skills
Can Claude Skills have multiple files?
Yes. A Claude Skill requires a SKILL.md entrypoint, and the skill folder can also bundle templates, examples, checklists, scripts, schemas, and reference documents under subdirectories such as scripts/, references/, and assets/ when the workflow exceeds compact instructions.
What goes in SKILL.md versus supporting files?
Keep SKILL.md focused on the YAML frontmatter trigger, core workflow steps, output contract, and pointers to supporting files. Move long examples, reusable templates, rubrics, JSON schemas, and detailed references into separate files so they stay unloaded until required.
Where do I put files for a multi-file Claude Skill?
Put supporting files inside the same skill directory as SKILL.md—typically in ~/.claude/skills/<skill-name>/ for personal scope or .claude/skills/<skill-name>/ for repository scope—organized into subfolders like scripts/, references/, templates/, and examples/.
Should every Claude Skill be multi-file?
No. Use a single SKILL.md file for simple workflows under roughly 80 lines. Make a skill multi-file only when supporting assets, schemas, or executable scripts would inflate SKILL.md and waste startup or activation tokens.
How do I share a multi-file skill across laptops and remote devboxes?
Share or sync the entire skill directory, never just SKILL.md in isolation. Keeping the full folder inside Git or syncing it through a skill manager like Prompttly guarantees that templates, scripts, and references stay aligned across macOS, Linux SSH devboxes, Claude Code, Codex, and Antigravity.
Where to Go Next
Browse the resources hub for the full skills series. Read Google Antigravity remote workspaces over SSH and container sync, audit context usage with token context overhead in agent skills, use sync Claude skills across computers to move complete folders safely, check how to update Claude skills without breaking workflows, review Claude skills across projects and directory scopes, and open the free Claude Skill Creator to scaffold your next package.
Related Prompt Resources
Build and sync the full skill package once
Use Prompttly to keep multi-file skills in one cloud library, track version history, and sync complete skill folders across Claude Code, Codex, ChatGPT, and your Mac hotkey palette.