One-click install
npx skills add https://github.com/mthli/skills --skill sparse-checkout
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sparse-checkout
Source: https://github.com/mthli/skills/tree/main/sparse-checkout
Command: npx skills add https://github.com/mthli/skills --skill sparse-checkout

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill lets you hide teammates-committed files or directories from your local working tree without changing any tracked content or your team’s .gitignore rules.

Core Features & Use Cases

  • Hide tracked paths locally: Removes specified tracked files from your working tree using git sparse-checkout so you can keep personal clutter out of view.
  • Reversible restore: Brings hidden paths back on demand, or disables sparse-checkout entirely to restore everything.
  • Safety guardrails: Refuses to hide when there are uncommitted changes to tracked files under the target path, preventing a half-applied state that could lead to silent loss of work.
  • List current hidden state: Shows which paths are currently excluded in the per-clone sparse-checkout configuration.

Use case: teammates commit personal/generated output like .claude/ or dist/, but you want them hidden only on your machine while still leaving the repo intact for everyone else.

Quick Start

Ask to hide a path locally by running: python <skill-dir>/scripts/sparse_checkout.py hide .claude/

Frequently Asked Questions about sparse-checkout

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I hide tracked files in my local Git working tree without modifying .gitignore?

To hide tracked files locally without modifying .gitignore, you can use Git sparse-checkout exclusions. This writes per-clone patterns to .git/info/sparse-checkout, removing specified files or directories from your working tree while keeping the repository intact for your teammates.

What is the best way to remove committed directories like dist or vendor from my local working tree only?

The best way to remove committed directories locally is using non-cone Git sparse-checkout patterns. This approach hides generated content or personal directories like dist/ or vendor/ on your machine without committing changes or affecting the shared repository.

How do I restore hidden files after disabling local Git sparse-checkout exclusions?

To restore hidden files after local Git sparse-checkout exclusions, you can reapply the sparse-checkout configuration on demand or disable it entirely. Disabling sparse-checkout entirely restores everything to your working tree.

Why does hiding tracked paths with sparse-checkout fail when there are uncommitted changes?

Hiding tracked paths with sparse-checkout fails when there are uncommitted changes to prevent silent loss of work. Safety guardrails refuse to hide targets with local modifications, preventing a half-applied state that could overwrite your unsaved data.

Can I list which paths are currently excluded by my per-clone sparse-checkout configuration?

Yes, you can list which paths are currently excluded by your per-clone sparse-checkout configuration. The skill provides a feature to show which tracked files or directories are currently hidden from your working tree.

Does Git sparse-checkout work with non-cone patterns for local working tree exclusions?

Yes, Git sparse-checkout works with non-cone patterns for local working tree exclusions. This skill requires non-cone sparse-checkout patterns written to .git/info/sparse-checkout and uses git reapply to manage selective local invisibility with rollback on failure.