erbfmt

AI reference

Commands

Stable command examples for AI agents, editor integrations, and scripts that work with Rails ERB templates.

Hosted commands.md

The canonical machine-readable command reference is distributed as Markdown:

https://hinamimi.github.io/erbfmt/commands.md

Use this URL from Codex Skills, Claude Code Skills, editor integrations, or project-specific agent instructions. The Markdown file is intentionally short and command-focused.

Recommended workflow

Prefer the project-pinned Bundler command when a Rails project has a Gemfile.

bundle exec erbfmt --version

After editing Rails views, run lint diagnostics with machine-readable output:

bundle exec erbfmt --lint --lint-format json app/views

Check formatting without modifying files:

bundle exec erbfmt --check app/views

Only write formatting changes when the user asks for formatting or accepts a formatter-driven edit:

bundle exec erbfmt --write app/views

JSON lint output

--lint-format json emits one JSON object per processed file. This makes directory and multi-file runs easy to stream and parse.

{
  "file": "app/views/users/show.html.erb",
  "summary": {
    "issues": 1,
    "errors": 1,
    "warnings": 0
  },
  "diagnostics": [
    {
      "severity": "error",
      "message": "duplicate HTML attribute `class`",
      "location": {
        "line": 1,
        "column": 32
      }
    }
  ]
}

location may be null for file-level diagnostics.

Safety rules for agents