Repository Hygiene Audit
Essential Files Checklist
| File |
Purpose |
Why It Matters |
README.md |
Project overview, quick start |
First impression, onboarding |
LICENSE |
Legal terms for use |
Without one, code is "all rights reserved" by default |
.gitignore |
Files to exclude from git |
Prevents committing secrets, build artifacts |
.env.example |
Template for env vars |
Shows structure without revealing secrets |
CONTRIBUTING.md |
How to contribute |
Reduces friction for contributors |
CHANGELOG.md |
Version history |
Users track what changed |
CODE_OF_CONDUCT.md |
Community expectations |
Required for many registries |
.gitignore Essentials
Minimum patterns for any repo:
# Secrets
.env
.env.local
.env.*.local
# OS
.DS_Store
Thumbs.db
desktop.ini
# Editors
.vscode/
.idea/
*.swp
*.swo
*~
# Logs
*.log
logs/
# Dependencies (language-specific)
node_modules/
__pycache__/
*.pyc
.venv/
venv/
target/
vendor/
# Build artifacts
dist/
build/
out/
*.egg-info/
# Coverage
coverage/
.coverage
htmlcov/
Language additions:
- Node:
node_modules/, dist/, .next/, .turbo/
- Python:
__pycache__/, *.pyc, .venv/, venv/, .pytest_cache/, .mypy_cache/
- Rust:
target/, Cargo.lock (for libs, commit for bins)
- Go:
vendor/, bin/
- Terraform:
.terraform/, *.tfstate*, *.tfvars (if contains secrets)
- Java:
target/, .gradle/, *.class
README Essentials
Minimum sections:
# Project Name
One-line tagline.
## Why
What problem does this solve?
## Install
Exact commands to install.
## Quick Start
Minimal working example.
## Usage
Common use cases with code examples.
## License
License name with link to LICENSE file.
Nice to have:
- Badges (build status, version, license)
- Screenshots/GIFs for visual tools
- Link to docs site
- Contributing section (even if just linking CONTRIBUTING.md)
- Acknowledgments / credits
.env.example Pattern
# Database
DATABASE_URL=postgresql://user:password@localhost:5432/dbname
# Auth
JWT_SECRET=change-me-to-a-long-random-string
OAUTH_CLIENT_ID=your-oauth-client-id
OAUTH_CLIENT_SECRET=your-oauth-client-secret
# External APIs
OPENAI_API_KEY=sk-...
AWS_REGION=us-east-1
# Feature flags
ENABLE_BETA_FEATURES=false
Rules:
- Every variable the app reads at runtime
- Placeholder values that look like the real thing (so users know the format)
- Comments grouping related vars
- Never real credentials
Secret Scanning
Before publishing a repo publicly, scan for leaked secrets:
# Check git history for common patterns
git log -p | grep -iE 'api[_-]?key|secret|password|token|bearer' | grep -v example
# Dedicated tools
gitleaks detect --source=. --verbose
trufflehog git file://. --only-verified
# GitHub's own scanner runs automatically on public repos
If secrets are found in history:
- Rotate them immediately
- Use
git filter-repo or BFG to remove from history
- Force-push cleaned history
- Enable GitHub secret scanning for the repo going forward
LICENSE Choice
| License |
When to Use |
| MIT |
Permissive, short, widely used. Best default for most projects |
| Apache 2.0 |
Like MIT but with patent protection. Larger projects, corporate use |
| GPL-3.0 |
Copyleft -- derivatives must also be GPL. Strong software freedom |
| BSD-3-Clause |
Very permissive, slightly different from MIT |
| Unlicense / CC0 |
Public domain, no restrictions |
| Proprietary |
Internal/commercial code. No file = "all rights reserved" |
Generate: https://choosealicense.com
Config File Hygiene
- Commit:
package.json, requirements.txt, Dockerfile, tsconfig.json
- Commit with placeholders:
.env.example, config.example.yml
- Do NOT commit:
.env, config.yml (with real values), node_modules/, build artifacts
- Lock files (
package-lock.json, yarn.lock, Cargo.lock, poetry.lock): commit for apps, skip for libs
Auditing an Existing Repo
1. Check for .gitignore -- does it cover your stack?
2. Check for README -- is it accurate and useful?
3. Check for LICENSE -- is there one?
4. Check for .env.example -- if app uses env vars
5. Scan for committed secrets (gitleaks)
6. Check for outdated dependencies
7. Check CI status -- is it green?
8. Check stale branches -- prune or merge
9. Check for TODO/FIXME density -- tech debt signal
10. Check commit message quality -- conventional commits?
Anti-Patterns
| Anti-Pattern |
Problem |
Do Instead |
| No README |
Users can't onboard |
Even a 5-line README helps |
| README listing what code does |
Duplicates the code |
Focus on WHY and HOW TO USE |
| No LICENSE |
"All rights reserved" by default -- users can't legally use it |
Pick one from choosealicense.com |
Committing .env |
Secrets leaked forever |
Use .env.example, add .env to .gitignore |
| Broken links in README |
Unprofessional, frustrating |
Test links periodically |
| Outdated dependencies with CVEs |
Security risk |
Automated updates (Renovate, Dependabot) |
| Empty CONTRIBUTING.md |
Signals unmaintained |
Either write one or remove file |
1---2name: audit3description: Use when setting up a new repo, auditing an existing one for hygiene issues, or before publishing a project. Covers .gitignore, .env.example, README, LICENSE, CONTRIBUTING, and detecting committed secrets.4---56# Repository Hygiene Audit78## Essential Files Checklist910| File | Purpose | Why It Matters |11|------|---------|----------------|12| `README.md` | Project overview, quick start | First impression, onboarding |13| `LICENSE` | Legal terms for use | Without one, code is "all rights reserved" by default |14| `.gitignore` | Files to exclude from git | Prevents committing secrets, build artifacts |15| `.env.example` | Template for env vars | Shows structure without revealing secrets |16| `CONTRIBUTING.md` | How to contribute | Reduces friction for contributors |17| `CHANGELOG.md` | Version history | Users track what changed |18| `CODE_OF_CONDUCT.md` | Community expectations | Required for many registries |1920## .gitignore Essentials2122Minimum patterns for any repo:23```gitignore24# Secrets25.env26.env.local27.env.*.local2829# OS30.DS_Store31Thumbs.db32desktop.ini3334# Editors35.vscode/36.idea/37*.swp38*.swo39*~4041# Logs42*.log43logs/4445# Dependencies (language-specific)46node_modules/47__pycache__/48*.pyc49.venv/50venv/51target/52vendor/5354# Build artifacts55dist/56build/57out/58*.egg-info/5960# Coverage61coverage/62.coverage63htmlcov/64```6566Language additions:67- **Node**: `node_modules/`, `dist/`, `.next/`, `.turbo/`68- **Python**: `__pycache__/`, `*.pyc`, `.venv/`, `venv/`, `.pytest_cache/`, `.mypy_cache/`69- **Rust**: `target/`, `Cargo.lock` (for libs, commit for bins)70- **Go**: `vendor/`, `bin/`71- **Terraform**: `.terraform/`, `*.tfstate*`, `*.tfvars` (if contains secrets)72- **Java**: `target/`, `.gradle/`, `*.class`7374## README Essentials7576Minimum sections:77```markdown78# Project Name7980One-line tagline.8182## Why83What problem does this solve?8485## Install86Exact commands to install.8788## Quick Start89Minimal working example.9091## Usage92Common use cases with code examples.9394## License95License name with link to LICENSE file.96```9798Nice to have:99- Badges (build status, version, license)100- Screenshots/GIFs for visual tools101- Link to docs site102- Contributing section (even if just linking CONTRIBUTING.md)103- Acknowledgments / credits104105## .env.example Pattern106107```bash108# Database109DATABASE_URL=postgresql://user:password@localhost:5432/dbname110111# Auth112JWT_SECRET=change-me-to-a-long-random-string113OAUTH_CLIENT_ID=your-oauth-client-id114OAUTH_CLIENT_SECRET=your-oauth-client-secret115116# External APIs117OPENAI_API_KEY=sk-...118AWS_REGION=us-east-1119120# Feature flags121ENABLE_BETA_FEATURES=false122```123124Rules:125- Every variable the app reads at runtime126- Placeholder values that look like the real thing (so users know the format)127- Comments grouping related vars128- Never real credentials129130## Secret Scanning131132Before publishing a repo publicly, scan for leaked secrets:133134```bash135# Check git history for common patterns136git log -p | grep -iE 'api[_-]?key|secret|password|token|bearer' | grep -v example137138# Dedicated tools139gitleaks detect --source=. --verbose140trufflehog git file://. --only-verified141142# GitHub's own scanner runs automatically on public repos143```144145If secrets are found in history:1461. Rotate them immediately1472. Use `git filter-repo` or BFG to remove from history1483. Force-push cleaned history1494. Enable GitHub secret scanning for the repo going forward150151## LICENSE Choice152153| License | When to Use |154|---------|-------------|155| **MIT** | Permissive, short, widely used. Best default for most projects |156| **Apache 2.0** | Like MIT but with patent protection. Larger projects, corporate use |157| **GPL-3.0** | Copyleft -- derivatives must also be GPL. Strong software freedom |158| **BSD-3-Clause** | Very permissive, slightly different from MIT |159| **Unlicense** / CC0 | Public domain, no restrictions |160| **Proprietary** | Internal/commercial code. No file = "all rights reserved" |161162Generate: https://choosealicense.com163164## Config File Hygiene165166- Commit: `package.json`, `requirements.txt`, `Dockerfile`, `tsconfig.json`167- Commit with placeholders: `.env.example`, `config.example.yml`168- Do NOT commit: `.env`, `config.yml` (with real values), `node_modules/`, build artifacts169- Lock files (`package-lock.json`, `yarn.lock`, `Cargo.lock`, `poetry.lock`): commit for apps, skip for libs170171## Auditing an Existing Repo172173```1741. Check for .gitignore -- does it cover your stack?1752. Check for README -- is it accurate and useful?1763. Check for LICENSE -- is there one?1774. Check for .env.example -- if app uses env vars1785. Scan for committed secrets (gitleaks)1796. Check for outdated dependencies1807. Check CI status -- is it green?1818. Check stale branches -- prune or merge1829. Check for TODO/FIXME density -- tech debt signal18310. Check commit message quality -- conventional commits?184```185186## Anti-Patterns187188| Anti-Pattern | Problem | Do Instead |189|-------------|---------|-----------|190| No README | Users can't onboard | Even a 5-line README helps |191| README listing what code does | Duplicates the code | Focus on WHY and HOW TO USE |192| No LICENSE | "All rights reserved" by default -- users can't legally use it | Pick one from choosealicense.com |193| Committing `.env` | Secrets leaked forever | Use `.env.example`, add `.env` to `.gitignore` |194| Broken links in README | Unprofessional, frustrating | Test links periodically |195| Outdated dependencies with CVEs | Security risk | Automated updates (Renovate, Dependabot) |196| Empty CONTRIBUTING.md | Signals unmaintained | Either write one or remove file |