Skip to content
gitignore-hygiene logo

Gitignore Hygiene

gitignore-hygiene

Automatic gitignore maintenance and cleanup. Use when: (1) after commits, (2) new file types appear in project, (3) build artifacts get committed, (4) before pushing to remote. Scans for unwanted files and suggests gitignore additions.

SKILL.md

Full skill instructions

Gitignore Hygiene

Maintains gitignore patterns and cleans cached files from git tracking.

Trigger Conditions

Invoke when:

  • After making commits
  • New file types appear (build artifacts, logs)
  • Before pushing to remote
  • User says "check gitignore", "clean git"

Also invoke explicitly with:

  • /​gitignore-hygiene
  • "clean up gitignore"
  • "check for unwanted files"

Procedure

Step 1: Scan for Unwanted Files

Check for common patterns that should be ignored:

# Check for tracked files that should be ignored
git ls-files | grep -E '\.(log|env|pem|key)$'
git ls-files | grep -E '^(node_modules|dist|build|coverage)/'

Step 2: Check Current Gitignore

Read .gitignore and identify missing patterns:

CategoryPatterns to Check
Dependenciesnode_modules/, .pnpm-store/, vendor/
Builddist/, build/, .svelte-kit/, .next/, .nuxt/
Testcoverage/, test-results/, playwright-report/
IDE.idea/, .vscode/, *.swp
OS.DS_Store, Thumbs.db
Environment.env, .env.local, .env.*.local
Logs.log, npm-debug.log
Cache.cache/, .turbo/, .eslintcache
Credentials*.pem, *.key, credentials.json

Step 3: Detect Project Type

Adjust patterns based on detected stack:

Node.js / TypeScript:

node_modules/
dist/
.turbo/

Svelte / SvelteKit:

.svelte-kit/
build/

Next.js:

.next/
out/

Python:

__pycache__/
*.pyc
.venv/
.pytest_cache/

Rust:

target/
Cargo.lock  # for libraries

Step 4: Report Findings

If issues found:

Gitignore hygiene check:

Missing patterns:
  + coverage/          (test artifacts)
  + playwright-report/ (test artifacts)
  + .turbo/            (cache)

Tracked files that should be ignored:
  - coverage/​lcov.info
  - test-results/​results.xml

Recommended actions:
1. Add missing patterns to .gitignore
2. Remove cached files from tracking

Run: git rm -r --cached coverage/ test-results/

If no issues:

Gitignore hygiene check: All clear

No unwanted files tracked.
All common patterns present.

Step 5: Apply Fixes (With Confirmation)

Add missing patterns:

echo "coverage/" >> .gitignore
echo "test-results/" >> .gitignore

Remove cached files:

git rm -r --cached coverage/
git rm -r --cached test-results/

Commit the cleanup:

git add .gitignore
git commit -m "chore: update gitignore patterns

Added:
- coverage/
- test-results/
- playwright-report/

Removed from tracking:
- coverage/​lcov.info
- test-results/​results.xml

Co-Authored-By: Claude <[email protected]>"

Pattern Categories

Always Include

These patterns should be in every project:

# OS files
.DS_Store
Thumbs.db

# IDE
.idea/
.vscode/
*.swp
*.swo

# Environment
.env
.env.local
.env.*.local

# Logs
*.log

Language-Specific

Node.js:

node_modules/
.pnpm-store/
npm-debug.log*
yarn-debug.log*
yarn-error.log*

TypeScript:

dist/
*.tsbuildinfo

Testing:

coverage/
.nyc_output/
test-results/
playwright-report/

Framework-Specific

SvelteKit:

.svelte-kit/
build/

Next.js:

.next/
out/

Vite:

dist/
.vite/

Dangerous Patterns

Never ignore these (warn if present):

PatternRisk
src/Ignoring source code
*.tsIgnoring all TypeScript
package.jsonIgnoring manifest
.gitignoreRecursive ignore

Skill Chaining

After Commits

Run hygiene check after commits to catch:

  • Accidentally committed build artifacts
  • Missing patterns for new file types

Before Push

Run hygiene check before pushing:

  • Ensure no credentials are tracked
  • Verify build artifacts are ignored

With project-init

project-init creates comprehensive .gitignore. This skill maintains it over time.

Terminal Chain

After any commit session: repo-hygiene (final cleanup)

Rationalizations (Do Not Skip)

RationalizationWhy It's WrongRequired Action
"Just one file"One file becomes manyAdd pattern
"I'll clean later"Later is neverClean now
"It's not sensitive"Build artifacts bloat repoRemove from tracking
"Gitignore is fine"Projects evolveVerify regularly

Example Session

/​gitignore-hygiene

Scanning project...

Found issues:

1. Missing patterns:
   + .turbo/           (detected turbo usage)
   + playwright-report/ (detected playwright)

2. Tracked files to remove:
   - .turbo/​cache/​abc123
   - playwright-report/​index.html

Actions:
[1] Add patterns to .gitignore
[2] Remove cached files
[3] Skip

> 1

Updated .gitignore with:
  + .turbo/
  + playwright-report/

> 2

Removed from tracking:
  - .turbo/​cache/ (42 files)
  - playwright-report/ (15 files)

Ready to commit? [y/​n]

Notes

  • Never modifies .git directory
  • Preserves existing .gitignore structure
  • Warns about potentially dangerous patterns
  • Creates backup before modifying
  • Works with both root and package gitignores in monorepos

More skills from majiayu000

xiaohongshu logo
majiayu000/claude-arsenal

xiaohongshu

xiaohongshu

286 148
View
agent-task-conductor logo
majiayu000/claude-skill-registry

agent-task-conductor

Conduct multi-agent task orchestration and workflow coordination.

663 1
View
conductor-setup logo
majiayu000/claude-skill-registry

conductor-setup

Initialize project with Conductor artifacts (product definition,

663 1
View
animation-designer logo
majiayu000/claude-skill-registry

animation-designer

Expert in web animations, transitions, and motion design using Framer Motion and CSS

663 1
View
diagramming logo
majiayu000/claude-skill-registry

diagramming

Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...

663 1
View
h3-pg logo
majiayu000/claude-skill-registry-data

h3-pg

PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.

23 1
View
conductor-development logo
majiayu000/claude-skill-registry

conductor-development

Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...

663 1
View
conductor-status logo
majiayu000/claude-skill-registry

conductor-status

Display project status, active tracks, and next actions

663 1
View
dockerization logo
majiayu000/claude-skill-registry

dockerization

Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.

663 1
View

Popular AI tools

Kaiber logo
Video

Kaiber

Generate, edit, and beat-sync AI video with leading models in one workspace.

Paid
View
Vimcal logo
Productivity

Vimcal

The world's fastest calendar for remote work

Free
View

Transform Your Design with AI Designer by ImgCreator.ai

Freemium
View
Akool AI logo
Content & writing

Akool AI

Revolutionizing Video Production with AI-Powered Creativity

Paid
View

Extend an image past the frame and let AI fill the new aspect ratio.

Freemium
View
StarByFace logo
Security

StarByFace

Discover your celebrity doppelgänger with StarByFace!

Free
View
C

ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.

Freemium
View
Opus Clip logo
Coding & apps

Opus Clip

Opus.ai: Revolutionize Your Web Experience

Free
View