# .claudeignore Template (Context Optimization Edition)

> From NerdSmith Founder Track -- Module 0, Lesson 2: Context Window Management
> This version focuses on maximizing context efficiency. Tuned for founders who need every token to count.

---

## Why This Matters for Context

Every file Claude reads eats tokens from your 200K context window. A single unfiltered project folder can burn 25-50% of your budget before you type a word.

The .claudeignore file is your first line of defense. Get it right and you'll have 2-3x more context for actual work.

---

## Instructions

1. Create `.claudeignore` in your project root
2. Start with the Aggressive preset below
3. Selectively remove lines for file types you actually need Claude to read
4. Test: ask Claude "List all files you can see" and verify

---

## Preset: Aggressive (Recommended for Founders)

Use this if your project is mostly Markdown specs, research docs, and text files. This excludes everything Claude can't meaningfully parse.

```
# ============================================
# .claudeignore — Context Optimization Preset
# ============================================
# Goal: Maximize available context for real work.
# Every excluded file = more tokens for your tasks.

# ---- High-Impact Exclusions ----
# These are the biggest context wasters

node_modules/          # 10,000+ files, 50K-100K tokens
.next/                 # Build output, not useful
dist/                  # Compiled code
build/                 # Compiled code
.cache/                # Temporary files
.vercel/               # Deploy config
__pycache__/           # Python cache
.git/                  # Git internals
.turbo/                # Turbo cache

# ---- Binary Files (Claude can't read these) ----
*.jpg
*.jpeg
*.png
*.gif
*.webp
*.svg
*.ico
*.bmp
*.tiff
*.mp4
*.mp3
*.wav
*.mov
*.avi
*.mkv
*.zip
*.rar
*.tar
*.gz
*.7z
*.woff
*.woff2
*.ttf
*.eot

# ---- Documents Claude Parses Poorly ----
*.pdf
*.docx
*.xlsx
*.pptx
*.doc
*.xls
*.ppt

# ---- Archives & Old Work ----
_archive/
.archive/
old/
deprecated/
backup/
drafts/old-*
*.bak
*.orig

# ---- System Junk ----
.DS_Store
Thumbs.db
desktop.ini
*.tmp
*.swp
*.swo
*~
*.log

# ---- Config Bloat (usually not relevant) ----
package-lock.json      # 5,000-20,000 tokens alone
yarn.lock              # Same issue
pnpm-lock.yaml         # Same issue
*.lock

# ---- Env & Secrets (security) ----
.env
.env.local
.env.production
*.pem
*.key
credentials.json
```

---

## Preset: Moderate (For Mixed Projects)

Use this if you have code + content and need Claude to see some config files.

```
# .claudeignore — Moderate Preset

# Exclude build artifacts and dependencies
node_modules/
.next/
dist/
build/
.cache/

# Exclude binary files
*.jpg
*.jpeg
*.png
*.gif
*.mp4
*.mp3
*.zip

# Exclude archives
_archive/
old/

# Exclude system files
.DS_Store
Thumbs.db
*.tmp
*.log

# Exclude lock files (big context cost)
package-lock.json
yarn.lock
pnpm-lock.yaml

# Exclude secrets
.env
.env.local
```

---

## Context Savings by Pattern

These numbers show roughly how many tokens you save by excluding common items:

| Pattern | Files Excluded | Tokens Saved |
|---------|---------------|--------------|
| `node_modules/` | 5,000-50,000 files | 50,000-200,000 |
| `package-lock.json` | 1 file | 5,000-20,000 |
| `*.pdf` (10 reports) | 10 files | 10,000-50,000 |
| `_archive/` (old drafts) | varies | 5,000-30,000 |
| `*.jpg/*.png` (images) | varies | 0 (can't read anyway, but skips scan) |
| `.next/` or `dist/` | 100-1,000 files | 10,000-50,000 |

---

## How to Decide What to Exclude

Ask yourself for each file type:

1. **Can Claude read it?** (No for images, audio, video, zip) -- Exclude.
2. **Will I ask Claude about it in this session?** (No for old drafts) -- Exclude.
3. **Is it large and not relevant to my tasks?** (Lock files, build output) -- Exclude.
4. **Is it sensitive?** (.env, credentials) -- Exclude.

If the answer to any of these is yes, add it to .claudeignore.

---

## Testing Your .claudeignore

After creating the file, run this in Claude Code:

```
How many files can you see in this project? List them.
```

Compare against your actual file count. The difference is your context savings.

---

*NerdSmith Founder Track -- Module 0: Claude Code Bootcamp*
*Download: .claudeignore Template (Context Optimization Edition)*
