A formatting hook plugin for Claude Code that automatically formats files after Write/Edit operations.
See lint hook: ralph-hook-lint
- Automatic formatting: Files are formatted immediately after Write/Edit operations
- Multi-language support: JavaScript/TypeScript, Rust, Python, Java, Go
- Smart formatter detection: Automatically detects and uses the appropriate formatter for your project
- Non-blocking: Async, always continues after formatting
| Language | Formatters (Priority Order) |
|---|---|
| JavaScript/TypeScript | oxfmt > biome format > prettier > dprint |
| Rust | rustfmt (via cargo fmt) |
| Python | ruff format > black > autopep8 > yapf |
| Java | spotless (Maven/Gradle) > google-java-format > palantir-java-format |
| Go | goimports + gofumpt > gofumpt > goimports > gofmt |
| JSON/JSONC/JSON5 | oxfmt |
| YAML | oxfmt |
| TOML | oxfmt |
| HTML | oxfmt |
| Vue | oxfmt |
| CSS/SCSS/Less | oxfmt |
| Markdown/MDX | oxfmt |
| GraphQL | oxfmt |
| Handlebars | oxfmt |
claude plugin marketplace add https://github.com/chenhunghan/ralph-hook-fmt.git
claude plugin install ralph-hook-fmtclaude plugin marketplace update ralph-hook-fmt
claude plugin update ralph-hook-fmt@ralph-hook-fmtBy default, the hook runs without --debug:
"command": "${CLAUDE_PLUGIN_ROOT}/bin/ralph-hook-fmt"Without --debug, continue responses are compact ({"continue":true}) and do not include systemMessage.
To see formatter diagnostics in systemMessage (for example formatter selected/skipped/error details), manually add --debug in hooks.json:
- Open
~/.claude/plugins/ralph-hook-fmt/hooks/hooks.json - Change the command from:
to:
"command": "${CLAUDE_PLUGIN_ROOT}/bin/ralph-hook-fmt"
"command": "${CLAUDE_PLUGIN_ROOT}/bin/ralph-hook-fmt --debug"
make test
make lint
make fmt
make ciMIT