Guardrail v1.0.0
format-on-edit
Formats and lints each file Claude writes or edits with the tools the project already has.
Install
/plugin install format-on-edit --marketplace rezk2ll/skills What it does
Formats and lints every file Claude writes or edits, with the tools the project already has. Lint errors left after autofix go back to Claude, so it can fix them in the same turn.
When to use it
- You want Claude's edits to match your formatter without asking for it.
- You want lint errors caught at edit time, not in CI.
How it works
- Runs after
WriteandEdit, only on files inside a git repo. - Looks for
prettierandeslintin the nearestnode_modules/.bin, walking up from the file, so each sub-project of a monorepo uses its own version. - Prettier formats JS, TS, Svelte, Vue, JSON, CSS, Markdown and YAML. ESLint runs with
--fixon JS, TS, Svelte and Vue. - Python uses
ruff formatandruff check --fix, Go usesgofmt, Rust usesrustfmt, PHP usesvendor/bin/php-cs-fixer, when they are installed. - Errors left after the fix make the hook exit 2 with the list, so Claude sees them.
Requirements
jqandgit. The formatters and linters are optional: a missing tool is skipped.
Source
{
"hooks": {
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "\"${CLAUDE_PLUGIN_ROOT}\"/scripts/format-edited.sh",
"timeout": 60,
"statusMessage": "Formatting and linting..."
}
],
"matcher": "Write|Edit"
}
]
}
}