Agent skill
gitignore-scaffold
Gitignore pattern setup and directory scaffolding — covers negation patterns, .gitkeep tracking, and git check-ignore verification workflows
Install this agent skill to your Project
npx add-skill https://github.com/vamseeachanta/workspace-hub/tree/main/.claude/skills/development/gitignore-scaffold
SKILL.md
gitignore-scaffold
Quick Start
When adding directories that must exist in git but whose contents should be ignored,
use the directory/* pattern (not directory/) combined with .gitkeep negation.
data/standards/promoted/* # ignore contents
!data/standards/promoted/.gitkeep # but track .gitkeep
When to Use
- Setting up empty directory structures that must persist in version control
- Adding gitignore rules for data directories, build outputs, or cache folders
- Troubleshooting why
.gitkeepfiles are not being tracked
Workflow
1. Create directory structure
mkdir -p data/standards/promoted
2. Add .gitkeep to empty directories
touch data/standards/promoted/.gitkeep
3. Add gitignore patterns
Use directory/* form — never directory/ when .gitkeep must be tracked.
data/standards/promoted/*
!data/standards/promoted/.gitkeep
4. Verify with git check-ignore
# Should be ignored (exit 0):
git check-ignore -q "data/standards/promoted/example.csv"
# Should NOT be ignored (exit 1):
git check-ignore -q "data/standards/promoted/.gitkeep"
5. Regression-test existing patterns
After modifying .gitignore, confirm pre-existing patterns still work:
git check-ignore -q "path/to/known-ignored-file"
Pattern Types — Critical Distinction
| Pattern | Ignores | Negation works? |
|---|---|---|
directory/ |
Directory AND everything inside | No — git skips the entire tree |
directory/* |
Only the contents | Yes — individual files can be negated |
Rule: Always use directory/* when you need to negate specific files inside.
Common Gotchas
directory/kills negation — the most common mistake. Git never looks inside a fully-ignored directory, so!directory/.gitkeephas no effect.- Order matters — the negation line (
!) must appear after the ignore line. - Nested negation — for deeply nested paths, every ancestor directory must use
the
/*form, not the/form. - Cached files — if a file was already tracked before the ignore rule was added,
git rm --cached <file>is required to stop tracking it. - Always verify — never trust visual inspection of
.gitignore; rungit check-ignore -qto confirm behavior programmatically.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
gsd-complete-milestone
Archive completed milestone and prepare for next version
gsd-reapply-patches
Reapply local modifications after a GSD update
gsd-verify-work
Validate built features through conversational UAT
gsd-thread
Manage persistent context threads for cross-session work
clinical-trial-protocol
Generate clinical trial protocols for medical devices or drugs through a modular, waypoint-based architecture with research-only and full protocol modes.
single-cell-rna-qc
Performs quality control on single-cell RNA-seq data (.h5ad or .h5 files) using scverse best practices with MAD-based filtering and comprehensive visualizations.
Didn't find tool you were looking for?