oliver-kriska/claude-elixir-phoenix / targets/codex/skills/phx-init
phx-init
VerifiedInitialize plugin in a project — install Iron Laws, auto-activation; Use when setting up or updating the plugin.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 5.6 KB |
| references/codex-review-guidelines.md | markdown | 3.6 KB |
| references/injectable-template.md | markdown | 6.6 KB |
references/injectable-template.md
View on GitHub# Injectable Template for $elixir-phoenix:phx-init
This file contains the exact content to inject between markers. Replace `{PLACEHOLDER}` values with detected values.
## Full Template
~~~markdown
<!-- ELIXIR-PHOENIX-PLUGIN:START -->
<!-- Auto-generated by $elixir-phoenix:phx-init | {DATE} | Phoenix {PHOENIX_VERSION}, Ecto {ECTO_VERSION}{OPTIONAL_STACK} -->
# Elixir/Phoenix Plugin
## Routing
| Request | Path |
|---------|------|
| Bug, unexpected behavior, stack trace | `$elixir-phoenix:phx-investigate` |
| Small change (<50 lines), config, CSS tweak | `$elixir-phoenix:phx-quick` |
| Feature spanning 2+ contexts, or a new domain concept | `$elixir-phoenix:phx-plan` → `$elixir-phoenix:phx-work` → `$elixir-phoenix:phx-review` |
| Auth, sessions, tokens, payments, billing | `$elixir-phoenix:phx-plan` plus the `security-analyzer` agent — security work does not skip planning |
| Scope still unclear | `$elixir-phoenix:phx-brainstorm` |
Ask about scope, access, and rollback before building anything in the bottom three
rows. Skip the questions when the user says "quick" or "just do it".
## Running a `$elixir-phoenix:phx-*` skill
Skills are procedures — run their steps in order rather than improvising a
different workflow. Each one names an artifact file (`.claude/plans/{slug}/…`);
write it, including agent findings, before synthesizing anything from it. Chat-only
output loses the artifact the next phase reads.
Discovering the feature already exists is a finding to record in that artifact, not
a reason to exit early.
---
## IRON LAWS — STOP if violated
If code would violate ANY of these, you MUST:
1. STOP immediately
2. Show the problematic code
3. Show the correct pattern
4. Ask permission to apply the fix
**LiveView**:
1. NO DB queries in disconnected mount → use `assign_async`
2. Use streams for lists >100 items
3. Check `connected?/1` before PubSub subscribe
4. Match `{:error, %Ecto.Changeset{}}` explicitly — bare `{:error, _}` silently hides form errors
**Ecto**:
5. NO `:float` for money → `:decimal` or `:integer` (cents)
6. Pin values with `^` in queries — never interpolate
7. Separate queries for `has_many`, JOIN for `belongs_to`
**Security**:
8. NO `String.to_atom(user_input)` — atom exhaustion attack
9. AUTHORIZE every `handle_event` — mount auth is not enough
10. NO `raw/1` with untrusted content — XSS vulnerability
**OTP**:
11. NO process without runtime reason — processes are for concurrency/state/isolation
12. Mix tasks: `Mix.Task.run("app.config")` + `Application.ensure_all_started/1`, NEVER `Mix.Task.run("app.start")` (boots full tree: endpoint port, Oban consuming)
13. Capture Gettext/CLDR locale BEFORE spawning Task/GenServer — locale is process-local, spawned processes reset to default
**Code Style**:
14. Comments aren't commit messages — change reasoning (the bug, what it replaces) goes in the commit/PR, not code. No issue tags inline (`# ENA-1234`). Keep only durable facts: footguns, quirks
{OBAN_SECTION}
{OBAN_PRO_SECTION}
{ASH_SECTION}
{TIDEWAVE_SECTION}
## VERIFICATION — MANDATORY after code changes
After each code change, run this before presenting results:
```
mix compile --warnings-as-errors && mix format --check-formatted
```
Present code as complete only after verification passes.
Offer `mix test` after significant changes.
## POST-ACTION — Offer follow-ups
| After | Offer |
|-------|-------|
| Bug fix | "Capture as lesson with $elixir-phoenix:phx-learn-from-fix?" |
| Feature complete | "Quality check with $elixir-phoenix:phx-review?" |
| Migration | "Check migration safety?" |
## QUICK REFERENCE
| Want To... | Use |
|------------|-----|
| Simple feature | Describe it (auto-complexity runs) |
| Complex feature | `$elixir-phoenix:phx-plan` → `$elixir-phoenix:phx-work` → `$elixir-phoenix:phx-review` |
| Debug bug | `$elixir-phoenix:phx-investigate` |
| Review code | `$elixir-phoenix:phx-review` |
| Project health | `$elixir-phoenix:phx-audit` |
<!-- ELIXIR-PHOENIX-PLUGIN:END -->
~~~
## Conditional Sections
### OBAN_SECTION (if Oban detected, not Pro)
```markdown
## Oban — STOP if violated
- Jobs MUST be idempotent (safe to retry)
- Args MUST use STRING keys: `%{"user_id" => id}` not atoms
- NEVER store structs in args — store IDs only
```
### OBAN_PRO_SECTION (if Oban Pro detected)
```markdown
## Oban Pro — Different API
Use `process/1` NOT `perform/1`. Use `@impl Oban.Pro.Worker`.
Standard Oban patterns DO NOT apply.
```
### ASH_SECTION (if Ash detected)
```markdown
## Ash Framework — Use ash-framework skill
This project uses Ash Framework. Before writing ANY Ash code:
1. Load the `ash-framework` skill — it owns all Ash patterns and Iron Laws
2. Research: `mix usage_rules.search_docs "<topic>" -p ash -p ash_phoenix -p ash_postgres -p ash_authentication -p ash_oban`
3. Module lookup: `mix usage_rules.docs Ash.Resource`
4. Generators: `mix ash.gen.resource`, `mix ash.codegen`, `mix ash.gen.domain`
Ash is a complement to Phoenix/Ecto — LiveView, security, and OTP Iron Laws still apply. For data access, prefer Ash actions via domain code interfaces over direct `Repo` calls.
```
### TIDEWAVE_SECTION (if Tidewave detected)
```markdown
## Tidewave — Use MCP tools
PREFER these over file-based alternatives:
- `mcp__tidewave__get_docs` — Fetch docs
- `mcp__tidewave__project_eval` — Evaluate in running app
- `mcp__tidewave__execute_sql_query` — Database queries
```
## Placeholder Values
| Placeholder | Source | Example |
|-------------|--------|---------|
| `{DATE}` | Current date | 2026-02-05 |
| `{PHOENIX_VERSION}` | `grep phoenix mix.exs` | 1.8.3 |
| `{ECTO_VERSION}` | `grep ecto mix.exs` | 3.13.5 |
| `{OPTIONAL_STACK}` | Detected optional deps | , Oban, Tidewave |
| `{OBAN_SECTION}` | If oban in deps | Include Oban section |
| `{OBAN_PRO_SECTION}` | If oban_pro in deps | Include Pro warning |
| `{ASH_SECTION}` | If ash in deps | Include Ash warning |
| `{TIDEWAVE_SECTION}` | If tidewave in deps | Include Tidewave section |
## Detection Commands
```bash
# Phoenix version
grep -oP '{:phoenix.*"~> \K[0-9.]+' mix.exs 2>/dev/null || echo "?"
# Ecto version
grep -oP '{:ecto.*"~> \K[0-9.]+' mix.exs 2>/dev/null || echo "?"
# Optional dependencies
grep -q ':oban,' mix.exs && echo "oban"
grep -q ':oban_pro,' mix.exs && echo "oban_pro"
grep -q ':ash,' mix.exs && echo "ash"
grep -q ':tidewave,' mix.exs && echo "tidewave"
# Project size (for greenfield detection)
find lib -name "*.ex" 2>/dev/null | wc -l
```
## Marker Format
**Start marker**: `<!-- ELIXIR-PHOENIX-PLUGIN:START -->`
**End marker**: `<!-- ELIXIR-PHOENIX-PLUGIN:END -->`
Content between markers is fully replaceable by `--update`.
Content outside markers is NEVER modified.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |