claude-tab-fix — Claude Code plugin for indentation issues
The claude-tab-fix hook helps Claude Code handle tab-indented files without confusing line-number separators with file content. It targets failed edits and accidental mixing of tabs and spaces.
no license ★ 17 updated 2026-09-06
/plugin marketplace add anthropics/claude-plugins-community
/plugin install claude-tab-fix@claude-communityWhat claude-tab-fix does
Claude Code's Read output places a tab between each line number and its content. In files that also use tabs for indentation, those characters can be hard to tell apart, leading Claude to construct an old_string that does not match the file. claude-tab-fix adds context to help Claude preserve the actual indentation when editing Go, Rust, Templ, Makefiles, and other tab-indented files.
The plugin registers hooks for Read, Bash, and Write. After reading a tab-indented file, it explains how to interpret the line prefix. Before shell commands that edit such files, it advises using Edit instead. Before Write overwrites a file, it checks whether the proposed indentation style differs from the existing one. The hook cannot repair an invalid old_string itself, since Claude Code validates that value before PreToolUse hooks run.
Install the Go binary first, then add the plugin through the Claude Code marketplace commands. The executable must be available on PATH for the hook command to run by name. Manual setup is also possible by adding the hook configuration to .claude/settings.json in a project or to ~/.claude/settings.json for a global setup.
What it helps with
- Recover from Edit failures caused by incorrect tab indentation
- Distinguish line-number separators from tabs inside file content
- Flag writes that would combine spaces with existing tab indentation
- Steer shell-based edits toward the Edit tool
- Enable indentation warnings across Claude Code projects
Example prompts for the agent
- Edit this Go file while preserving its existing tab indentation.
- Change the function in this Templ file without mixing tabs and spaces.
- Investigate why Edit cannot match the old text in this tab-indented file, then retry with the correct indentation.
How to install claude-tab-fix
Plugin marketplace
/plugin marketplace add anthropics/claude-plugins-community/plugin install claude-tab-fix@claude-communityStep by step, with commands for each platform: Claude Code plugins: marketplaces, installing, and building your own
Questions about claude-tab-fix
How do I install claude-tab-fix in Claude Code?
Install the binary first with go install github.com/WithHolm/claude-tab-fix@latest. Then add the marketplace using /plugin marketplace add anthropics/claude-plugins-community, followed by /plugin install claude-tab-fix@claude-community.
What does claude-tab-fix do?
It gives Claude Code extra guidance when reading and modifying files indented with tabs. The warnings help prevent failed Edit operations and writes that introduce mixed indentation.
Can the hook correct an indentation mismatch automatically?
No. Claude Code validates old_string before running PreToolUse hooks, so the hook can warn about a mismatch but cannot fix it directly. Claude must adjust the text used for the edit.