sparse-checkout
Skill19 starsChanged 3 months agoMITView on GitHub
Personally hide files or directories from a git repo's working tree via git sparse-checkout — no .gitignore changes, invisible to teammates. Use whenever the user wants to ignore team-committed paths just for themselves (e.g. .claude/, dist/, generated docs), restore a hidden path, list what's hidden, or undo all hiding. Triggers on "hide X locally", "ignore X locally", "make git stop showing X", "restore hidden files", "what did I hide". Distinct from .gitignore (committed, team-wide) — this is per-clone, reversible, stays private.
- Commits and pushes
In this repository18 other files it gives its agents.
- base-breakout-scanSkill
- commit-contextSkill
- conviction-funnelSkill
- distill-memorySkill
- distill-moduleSkill
- fable-mindSkill
- hackernewsSkill
- map-moduleSkill
- mcd-orderSkill
- mean-reversion-scanSkill
- momentum-scanSkill
- premarket-briefSkill
- regime-scanSkill
- review-iterateSkill
- snapback-scanSkill
- statusline-vocabSkill
- wallstreetbetsSkill
- yfinanceSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
14 rules. About 0 are common, 4 are distinctive, and 10 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
10
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 27
Read as: "include everything at the root, except .claude/ and docs/private/." The patterns file is .git/info/sparse-checkout.
- Very specific: line 33
Use the helper script scripts/sparse_checkout.py (relative to this SKILL.md).
- Distinctive: line 59
When the user asks to hide something:
- Distinctive: line 62
Run the safety checks above and report any findings.
- Very specific: line 63
Run the hide command.
- Distinctive: line 67
When the user asks to restore or undo:
- Very specific: line 69
Run list first if the path isn't clear, so you can show them options.
- Very specific: line 70
Run restore <path> (specific) or disable (everything).
- Very specific: line 79
Run git status --short -- .claude/ and git ls-files --others --exclude-standard -- .claude/ to check the state.
- Very specific: line 81
After confirmation, run python <skill-dir>/scripts/sparse_checkout.py hide .claude/.
- Very specific: line 89
Run ... list to show what's hidden.
- Very specific: line 91
Run ... restore docs/internal/ (or whichever).
- Very specific: line 112
Don't edit .git/info/sparse-checkout by hand from the model.
- Distinctive: line 114
Don't use this in CI / shared scripts.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
sparse-checkout
Locally hide files and directories that teammates committed, without modifying any tracked file. The exclusion lives in .git/info/sparse-checkout, which is per-clone state — your teammates never see it, and git push cannot carry it.
When to use
- Teammates committed personal config / generated output that you don't want in your tree (e.g.
.claude/,dist/,vendor/) - You want a private exclusion without proposing a
.gitignorechange to the team - The user asks to restore a previously hidden path, or to see what's currently hidden
- The user wants to undo all local hiding
Mental model
Behind the scenes this uses git sparse-checkout in non-cone mode, which accepts gitignore-style patterns. A typical patterns file looks like:
/*
!.claude/
!docs/private/Read as: "include everything at the root, except .claude/ and docs/private/." The patterns file is .git/info/sparse-checkout; it lives inside .git/, so it's never pushed and never affects anyone else.
git sparse-checkout disable blows the whole thing away and the clone behaves like a normal one again.
Operations
Use the helper script scripts/sparse_checkout.py (relative to this SKILL.md). Resolve its absolute path and run it from anywhere inside the target repo — the script discovers the repo root itself, and path arguments are interpreted relative to that root (not your cwd).
| Goal | Command |
| Hide one or more paths | python <skill-dir>/scripts/sparse_checkout.py hide <path> [path...] |
| Restore one or more paths | python <skill-dir>/scripts/sparse_checkout.py restore <path> [path...] |
| List what's hidden in this repo | python <skill-dir>/scripts/sparse_checkout.py list |
| Show status (enabled? what's hidden?) | python <skill-dir>/scripts/sparse_checkout.py status |
| Disable entirely (bring all files back) | python <skill-dir>/scripts/sparse_checkout.py disable |
The script auto-detects whether a path is a directory and appends a trailing / so the pattern unambiguously matches the whole subtree.
Safety checks — perform these BEFORE running hide
Sparse-checkout removes tracked files in the excluded paths from the working tree, but leaves untracked files alone. Both behaviors can surprise users. Walk through this checklist:
- Check for uncommitted modifications under the target path. Run
git status --short -- <path>. If anything tracked shows up (M/A/D/R), stop and report — the script enforces this and will refuse the hide. (Background:git sparse-checkout reapplyis permissive and would warn-but-succeed, leaving the dirty files on disk while the patterns file commits to hiding them — a silent half-applied state that risks losing the modifications on the next checkout. So the script does a hard pre-flight check.) Ask the user whether to commit, stash, or skip. - Note untracked personal files under the target path. Run
git ls-files --others --exclude-standard -- <path>. If anything is listed, warn the user: those files stay on disk after hiding, so the directory won't fully disappear — it will contain only their personal junk. Usually fine, but they may want to move that content out first. - Confirm it's a git repo. The script bails with a clear error if not, but it's nicer to know upfront.
For restore, no special checks are needed — restored content comes from the git index and is canonical.
Workflow
When the user asks to hide something:
- Identify the target path(s). If ambiguous (e.g. "hide the claude stuff"), confirm the exact path.
- Run the safety checks above and report any findings.
- Run the
hidecommand. - Confirm with the user by reading back the resulting state (the script prints it automatically).
- Mention the inverse command they can use to undo (
restore <path>ordisable).
When the user asks to restore or undo:
- Run
listfirst if the path isn't clear, so you can show them options. - Run
restore <path>(specific) ordisable(everything). - Confirm the new state.
Example interactions
Example 1 — hide a noisy directory
User: "hide .claude/, teammates keep committing stuff into it"
- Run
git status --short -- .claude/andgit ls-files --others --exclude-standard -- .claude/to check the state. - Report findings — e.g. "you have 2 untracked files under
.claude/(agents/my-foo.md,settings.local.json). They'll stay on disk after hiding; the directory will only contain those. Proceed?" - After confirmation, run
python <skill-dir>/scripts/sparse_checkout.py hide .claude/. - Echo the resulting hidden list.
- Mention
restore .claude/undoes it.
Example 2 — list and partial restore
User: "I hid a few directories before — list them, then restore the docs one"
- Run
... listto show what's hidden. - From the list pick the
docs/*entry the user means; if multiple, ask which. - Run
... restore docs/internal/(or whichever). - Echo the new state.
Example 3 — full undo
User: "restore everything, I don't want sparse-checkout anymore"
- Run
... disable. - Confirm it's off; all files are back.
Edge cases
- Sparse-checkout already initialized: the script reads the existing pattern file and merges new exclusions without duplicating.
- Hiding a path that's already hidden: no-op, the script reports
(already hidden: <path>). - Restoring a path that wasn't hidden: no-op, reports
(not hidden: <path>). - Restoring the last remaining exclusion: the script runs
git sparse-checkout disablefor a clean state instead of leaving a no-op patterns file. - Not a git repo: the script exits with a clear error; surface it to the user.
- Path doesn't exist in HEAD: still allow hiding — it may exist in other branches the user will check out later.
What not to do
- Don't edit
.git/info/sparse-checkoutby hand from the model. Use the script — it writes the patterns file and callsgit sparse-checkout reapply, with a rollback on failure so the patterns file never diverges from the actual working tree. - Don't propose adding the path to
.gitignoreinstead. That's a different problem (preventing new commits of the path) and affects the whole team. This skill is for the opposite case: the path is already tracked, and you personally don't want it in your tree. - Don't use this in CI / shared scripts. It's a developer-machine convenience.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

