| name | gitignore-config |
| description | Git ignore configuration patterns for MetaSaver monorepos. Includes 10 required pattern categories (dependencies, build outputs, environment files with security-critical .env and .npmrc exclusions, logs, testing, IDE, OS, database, cache, temporary files). Use when creating or auditing .gitignore files to prevent secret leakage and repository pollution. |
Gitignore Configuration Skill
This skill provides the canonical .gitignore patterns for MetaSaver monorepos.
Required Pattern Categories
1. Dependencies
# Dependencies
node_modules
.pnpm-store
.yarn
.npm
2. Build Outputs
# Build outputs
dist
build
out
.turbo
.next
*.tsbuildinfo
3. Environment Files (CRITICAL - Security)
# Environment files - CRITICAL: prevent secret leakage
.env
.env.*
!.env.example
!.env.template
# NPM configuration - may contain auth tokens
.npmrc
!.npmrc.template
4. Logs
# Logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
5. Testing and Coverage
# Testing
coverage
.nyc_output
test-results
playwright-report
6. IDE and Editor
# IDE/Editor (note: .vscode often committed, exclude only if needed)
.idea
*.swp
*.swo
*~
*.sublime-workspace
7. Operating System
# OS files
.DS_Store
Thumbs.db
desktop.ini
8. Database (Prisma/SQLite)
# Database
*.db
*.db-journal
9. Cache
# Cache
.cache
.eslintcache
.stylelintcache
*.cache
10. Temporary Files
# Temporary
tmp
temp
*.tmp
*.temp
Complete Template
# ========================================
# Dependencies
# ========================================
node_modules
.pnpm-store
.yarn
.npm
jspm_packages
# ========================================
# Build outputs
# ========================================
dist
build
out
.turbo
.next
.nuxt
.cache
.parcel-cache
*.tsbuildinfo
# ========================================
# Environment files - SECURITY CRITICAL
# ========================================
.env
.env.*
!.env.example
!.env.template
.npmrc
!.npmrc.template
# ========================================
# Logs
# ========================================
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*
# ========================================
# Testing and coverage
# ========================================
coverage
.nyc_output
test-results
playwright-report
*.lcov
# ========================================
# IDE and editor files
# ========================================
.idea
*.swp
*.swo
*~
*.sublime-workspace
.project
.classpath
.settings
# ========================================
# Operating system files
# ========================================
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
desktop.ini
# ========================================
# Database files
# ========================================
*.db
*.db-journal
*.sqlite
*.sqlite3
# ========================================
# Cache files
# ========================================
.cache
.eslintcache
.stylelintcache
.prettiercache
*.cache
# ========================================
# Temporary files
# ========================================
tmp
temp
*.tmp
*.temp
*.bak
*.backup
*.orig
Validation Logic
const REQUIRED_PATTERNS = {
critical: [".env", ".env.*", "!.env.example", ".npmrc", "!.npmrc.template"],
high: ["node_modules", "dist", "build", ".turbo", "*.log", "coverage"],
medium: [".next", "out", ".cache", ".eslintcache", "*.tsbuildinfo"],
low: [".DS_Store", "Thumbs.db", "desktop.ini", "*.db", "tmp"],
};
function validateGitignore(content: string): ValidationResult {
const lines = content.split("\n").map((l) => l.trim());
const violations = [];
for (const [priority, patterns] of Object.entries(REQUIRED_PATTERNS)) {
for (const pattern of patterns) {
if (!lines.includes(pattern)) {
violations.push({
pattern,
priority,
message: `Missing ${priority} pattern: ${pattern}`,
});
}
}
}
return {
valid: violations.filter((v) => v.priority === "critical").length === 0,
violations,
};
}
Best Practices
- Security First: Always include .env and .npmrc exclusions with template whitelists
- Organized Structure: Group patterns by category with clear comments
- No Duplicates: Avoid redundant patterns
- Complete Coverage: Don't miss any build output directories
- Cross-Platform: Include both Unix and Windows OS-specific files
- Whitelist Templates: Use
!pattern to allow template files
Consumer vs Library Repos
Both use the same patterns. The .gitignore is repository-agnostic - all monorepos need the same exclusions.
Common Mistakes
- Forgetting .npmrc: Auth tokens can leak
- Missing .turbo: Turborepo cache pollutes repo
- No .env exclusion: Secrets in version control
- Incomplete whitelists: Template files get ignored
- Missing OS files: .DS_Store creates noise in PRs