Skip to content

Iron Laws

The phxagents plugin enforces 22 Iron Laws — non-negotiable patterns extracted from production Phoenix codebases. Each rule prevents a class of bugs that tests rarely catch.

When code would violate a law, the plugin stops and explains before proceeding.

Iron Laws are defined in CLAUDE.md and inlined into every relevant skill so agents see them at decision time.

After multi-agent port Phase 2D, they migrate to plugins/elixir-phoenix/iron-laws/laws.yaml as the single source of truth across Claude Code, Codex, OpenCode, and Pi.

  • LiveView — mount lifecycle, async data, streams, PubSub subscription guards
  • Ecto — money types, query interpolation, joins, preloads, deduplication
  • Oban — idempotency, arg shapes, struct hygiene
  • Security — atom exhaustion, authorization, raw HTML
  • OTP — process discipline, supervision
  • Verification — never claim done without proof

Each Iron Law has:

  1. A detection pattern (regex or AST match) hooked into PostToolUse
  2. A fix template showing the correct pattern
  3. A stop directive that interrupts the agent before the violation lands

The full list is the canonical CLAUDE.md section. A site-rendered aggregator with each law’s source skill and detection pattern lands in the next site update.

phxagents · v2.8.8 · GitHub · llms.txt · llms-full.txt

Community plugin. Not affiliated with Phoenix Framework or phoenix.new.