# auto-format Auto-format files after Claude Code writes or edits them. Dispatches to the correct formatter based on file extension. ## Required tools `jq` (parses hook input JSON). ## Supported formats | Extension | Formatter | Nixpkgs | | :--------------------------- | :----------------- | :---------------------- | | `.css`, `.html`, `.scss` | `prettier` | `prettier` | | `.go` | `goimports` | `gotools` | | `.json` | `jq` | `jq` | | `.md` | `prettier` | `prettier` | | `.nix` | `alejandra` | `alejandra` | | `.py` | `ruff format` | `ruff` | | `.rb` | `standardrb --fix` | `rubyPackages.standard` | | `.rs` | `rustfmt` | `rustfmt` | | `.sh`, `.bash` | `shfmt` | `shfmt` | | `.toml` | `taplo format` | `taplo` | | `.ts`, `.tsx`, `.js`, `.jsx` | `prettier` | `prettier` | | `.yaml`, `.yml` | `prettier` | `prettier` | Formatters are optional. If a formatter is not in PATH, the file is left as-is for that extension. ## Project-specific configuration Create `.auto-tools.json` at the root of your project to override the built-in formatter for a file extension, or to disable formatting for a language: ```json { "format": { ".rs": "cargo fmt", ".nix": "nix fmt {}", ".md": null } } ``` - `{}` in the command is replaced with the absolute path to the edited file. - `null` disables formatting for that extension. - An absent key falls through to the built-in default. `auto-tools` discovers `.auto-tools.json` by walking up from the edited file's directory to the filesystem root. The innermost config file wins. > **Trust model:** `.auto-tools.json` is executed as code. Review it before using this plugin in untrusted repositories. ## Installation ```bash /plugin install auto-format@jcmuller-plugins ```