ignore-init — Claude Code command: what it does, how to install
The ignore-init command creates or updates .gitignore with Claude Code local files plus temporary, test, and debug patterns. Use it when setting up a project.
MIT ★ 763 updated 2026-03-31
.claude/commands/ignore-init.mdWhat ignore-init does
ignore-init checks the project’s .gitignore, creates the file when needed, and fills in missing patterns. It covers CLAUDE.local.md, .claude/settings.local.json, .mcp.local.json, temporary folders such as temp/ and test-*/, plus JavaScript test and debug filename patterns.
The command keeps existing entries and comments, then reports the lines it added. Its allowed operations include reading, writing, editing, and limited shell checks. Since it adds only missing patterns, it fits projects that already have a curated .gitignore.
What it helps with
- create a project
.gitignore - exclude Claude Code local configuration
- ignore temporary working folders
- filter test and debug JavaScript files
- keep existing
.gitignoreentries intact
Example prompts for the agent
- Run
/ignore-initto add the Claude Code local-file rules to.gitignore. - Check
.gitignore, add any missing temporary, test, and debug patterns, and preserve its comments. - Create
.gitignorewhen needed and report which patterns were added.
How to install ignore-init
Manually: put the files in place
.claude/commands/ignore-init.mdCall it with /ignore-init. For all projects use ~/.claude/commands/
Manually: put the files in place
~/.codex/prompts/ignore-init.mdCall it with /prompts:ignore-init. Codex marks this format deprecated in favour of skills
Manually: put the files in place
.github/prompts/ignore-init.prompt.mdManually: put the files in place
.gemini/commands/ignore-init.tomlGemini stores commands as TOML: the prompt text goes into the prompt field
Questions about ignore-init
How do I install ignore-init in Claude Code?
Create the command file at .claude/commands/ignore-init.md and place the command content there.
What does ignore-init do?
It creates or updates .gitignore with ignore rules for Claude Code local settings, temporary folders, and test or debug files.
Does ignore-init replace an existing .gitignore?
No. Existing entries and comments stay in place, while missing patterns are added and reported.
Source text
ignore-init.md · MIT
--- description: Initialize .gitignore with Claude Code specific patterns allowed-tools: Read, Edit, Write, Bash(echo:*), Bash(cat:*), Bash(test:*) category: workflow --- # Initialize .gitignore for Claude Code Set up or update the project's .gitignore file with Claude Code specific patterns. ## Core Claude Code Files to Ignore Ensure these Claude Code local configuration files are ignored: - `CLAUDE.local.md` - Local AI assistant instructions (root) - `.claude/settings.local.json` - Personal Claude Code settings - `.mcp.local.json` - Local MCP server configuration (root) ## Development Patterns These common development artifacts will also be added: - `temp/` - Temporary working directory - `temp-*/` - Temporary directories with prefix - `test-*/` - Test directories with prefix - `debug-*.js` - Debug scripts - `test-*.js` - Test scripts - `*-test.js` - Test files with suffix - `*-debug.js` - Debug files with suffix ## Current .gitignore Status !`[ -f .gitignore ] && echo "EXISTS: .gitignore found" && echo "---CONTENTS---" && cat .gitignore || echo "MISSING: No .gitignore file found"` ## Task Based on the above status: 1. Create `.gitignore` if it doesn't exist 2. Add all patterns that aren't already present 3. Preserve existing entries and comments 4. Report what was added ## Patterns to Add ```gitignore # Claude Code local files CLAUDE.local.md .claude/settings.local.json .mcp.local.json # Temporary and debug files temp/ temp-*/ test-*/ debug-*.js test-*.js *-test.js *-debug.js ``` Implement this by: 1. Using the gitignore status above to determine what's missing 2. Adding missing patterns with appropriate comments 3. Preserving the existing file structure and entries
© carlrannaberg · MIT · carlrannaberg/claudekit