erbfmt

AI reference

Commands

Rails ERB templateを扱うAI agent、editor integration、script向けの安定したcommand例です。

Hosted commands.md

machine-readableなcommand referenceはMarkdownとして配布します。

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

Codex Skills、Claude Code Skills、editor integration、project固有のagent instructionsからこのURLを参照できます。Markdownは短く、command中心に保っています。

推奨workflow

Rails projectに Gemfile がある場合は、projectでpinされたBundler commandを優先します。

bundle exec erbfmt --version

Rails viewsを編集した後は、machine-readable outputでlint diagnosticsを確認します。

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

fileを変更せずformat状態を確認します。

bundle exec erbfmt --check app/views

format変更を書き込むのは、userがformatを求めたか、formatterによる編集を承認した場合だけにします。

bundle exec erbfmt --write app/views

JSON lint output

--lint-format json はprocessed fileごとに1つのJSON objectを出力します。directoryやmulti-file runでもstream処理しやすい形式です。

{
  "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
      }
    }
  ]
}

file-level diagnosticでは locationnull になることがあります。

Agent向けの安全ルール