phoenix
Skill91 starsChanged 4 months agoApache-2.0View on GitHub
Ankole-specific Phoenix control-plane guidance. Use when editing app/control_plane web routes, controllers, plugs, OpenAPI, session handling, Phoenix/Vite shell integration, or Phoenix tests.
- Reads credentials
3 other projects use a version of this.
Adopted by
Most recently taken up by
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- BadBeta/elixir-phase-skillstheir own version, first seen May 12, 2026
- Mindrally/skillstheir own version, first seen Jan 23, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- Mindrally/skills★ 266same name
- BadBeta/elixir-phase-skills★ 4same name
- conjure-3301/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- elixirSkill
- rust-nifSkill
- port-deep-research-playbookSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
35 rules. 0 are common, 14 are distinctive, and 21 are very specific to this project.
0
Common
Most of the 3 edited versions we read keep these.
14
Distinctive
This author's own choices. Worth a look.
21
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 31
Do not use this skill as a reason to add LiveView, Phoenix Tailwind/esbuild assets, Absinthe, generated auth scaffolding, Presence, …
- Distinctive: line 38
Do the requested change. Do not broaden it into a Phoenix cleanup.
- Very specific: line 40
Keep the web layer thin: controllers/plugs authenticate, validate, translate params, and call Ankole contexts.
- Very specific: line 42
Do not call Repo directly from controllers or plugs.
- Very specific: line 43
Use verified routes ~p for internal browser redirects and paths.
- Distinctive: line 44
Keep session and CSRF behavior in Phoenix.
- Distinctive: line 46
Keep API response envelopes consistent with nearby controllers.
- Distinctive: line 47
Prefer small explicit plugs over hidden controller-side conditionals when a route group owns the concern.
- Very specific: line 49
Prefer explicit controller actions over Phoenix generators.
- Very specific: line 65
Keep setup/auth mutation endpoints on :session_api unless there is a clear reason to make them stateless.
- Very specific: line 67
Keep console REST endpoints on :console_api and document them through OpenApiSpex.
- Very specific: line 69
Do not move SPA route guards into React.
- Very specific: line 71
Keep catch-all SPA routes narrow (/console/*path, /setup/*path, /auth/*path) and route them to the correct shell action.
- Distinctive: line 73
Avoid route namespace duplication.
- Distinctive: line 82
Keep the shell as simple iodata or an equally thin template.
- Very specific: line 89
Do not add phoenix_vite as a dependency just to copy its integration shape.
- Very specific: line 91
Do not reintroduce Phoenix esbuild or Phoenix Tailwind watchers.
- Very specific: line 93
If Vite behavior looks stale, check for an old process holding port 3035 before rewriting integration code.
- Very specific: line 100
Use with for chained context calls and a private error/2 or error/5 helper for controller-local translation.
- Very specific: line 102
Keep plug modules small. Implement @behaviour Plug, init/1, and call/2 with @impl.
- Very specific: line 104
If a plug rejects a request, set the status, return the existing JSON/HTML shape, and halt/1.
- Very specific: line 106
Do not put durable domain behavior in AnkoleWeb.*.
- Very specific: line 117
Keep OpenApiSpex.Plug.CastAndValidate close to the controller that owns the API action and use AnkoleWeb.OpenApiValidationErrorRenderer for …
- Distinctive: line 120
When changing console API routes or response schemas, update the OpenAPI spec and regenerate/check the webapp client if the frontend …
- Very specific: line 133
Never use String.to_atom/1 on request data.
- Very specific: line 134
Never use raw/1 or unescaped iodata with untrusted user content.
- Distinctive: line 135
Keep production secrets in runtime configuration and fail loudly when required env vars are missing.
- Distinctive: line 143
Keep Phoenix text minimal.
- Very specific: line 164
If mix phx.server fails early, check the local Postgres database and the kiex Elixir environment before assuming Phoenix code is broken.
- Very specific: line 169
Use existing ConnCase and DataCase support.
- Distinctive: line 170
Test route behavior through controllers/plugs rather than private helpers.
- Very specific: line 173
Use the SQL sandbox patterns already in test/support.
- Distinctive: line 174
Keep tests focused on the changed route, plug, controller, or shell behavior.
- Distinctive: line 197
Use the smallest validation set that proves the changed surface.
- Distinctive: line 202
Do not read these by default.
“Common” is measured: kept by at least 6 in 10 of the 3 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Ankole Phoenix Skill
This is a project-local Phoenix guide. It is intentionally not a full Phoenix manual. Read the live code first, then use this file to keep changes inside the control-plane shape Ankole has already chosen.
Current Shape
- The Phoenix app lives in
app/control_plane. - Phoenix owns browser routing, sessions, CSRF, setup/auth gates, JSON APIs, OpenAPI specs, static serving, and the HTML shell.
- React/Vite owns the application screens under
app/webapps. libs/uikitowns reusable frontend UI. Do not move UI concerns into Phoenix.- Phoenix is not API-only, and it is not LiveView-driven. It renders thin HTML shell responses for SPA entrypoints.
- The endpoint uses Bandit, custom
AnkoleWeb.SessionCookieStore, andAnkole.JSONas the configured Phoenix JSON library. - The current named SPA entries are
auth,console, andsetup.
Use With Other Skills
- Load the
elixirskill for Ecto, OTP, Oban, context, or general Elixir code. - Load Context7 when changing Phoenix/OpenApiSpex/Plug/Vite API usage or CLI syntax.
- Do not use this skill as a reason to add LiveView, Phoenix Tailwind/esbuild assets, Absinthe, generated auth scaffolding, Presence, Channels, or generic deployment machinery unless the user explicitly asks or the dependency already exists in the touched package.
Local Rules
- Do the requested change. Do not broaden it into a Phoenix cleanup.
- Preserve
app/control_planeas the single Phoenix home. - Keep the web layer thin: controllers/plugs authenticate, validate, translate params, and call Ankole contexts.
- Do not call
Repodirectly from controllers or plugs. Use context modules. - Use verified routes
~pfor internal browser redirects and paths. - Keep session and CSRF behavior in Phoenix. Do not push auth/session gates into Vite or static files.
- Keep API response envelopes consistent with nearby controllers.
- Prefer small explicit plugs over hidden controller-side conditionals when a route group owns the concern.
- Prefer explicit controller actions over Phoenix generators. Generators are allowed for migrations/schemas when they match the existing package shape, but do not accept generated LiveView/Tailwind/template scaffolding by default.
Router and Pipelines
The router currently has four important surfaces:
:browser: HTML shell routes with session, flash, CSRF, and secure headers.:session_api: JSON-shaped setup/auth endpoints that still use browser session and CSRF protection.:openapi: OpenAPI rendering under/api/openapi.json.:console_api: stateless console REST API authenticated by bearer token.
Rules:
- Keep setup/auth mutation endpoints on
:session_apiunless there is a clear reason to make them stateless. - Keep console REST endpoints on
:console_apiand document them through OpenApiSpex. - Do not move SPA route guards into React.
SpaControllerdecides whether the operator sees setup, auth, or console. - Keep catch-all SPA routes narrow (
/console/*path,/setup/*path,/auth/*path) and route them to the correct shell action. - Avoid route namespace duplication. A scoped alias should own the module prefix.
SPA Shell and Vite Assets
AnkoleWeb.SpaController returns the server-owned HTML shell. AnkoleWeb.Assets
resolves the Vite entry tags.
- Preserve the Phoenix-owned shell:
<!doctype>,<html lang>, CSRF meta tag, title, Vite tags, and#ankole-app. - Keep the shell as simple iodata or an equally thin template. Do not rebuild a server-rendered UI layer.
AnkoleWeb.Assetsswitches between dev-server URLs and the production Vite manifest. Keep this as the single Phoenix asset resolver.- In dev, React Refresh preamble must be emitted before
@vite/clientand the entry module. Otherwise backend-served shells can hit the Vite React "can't detect preamble" failure. - Do not add
phoenix_viteas a dependency just to copy its integration shape; use it only as reference if needed. - Do not reintroduce Phoenix esbuild or Phoenix Tailwind watchers. Vite is
started through the
app/webappswatcher. - If Vite behavior looks stale, check for an old process holding port
3035before rewriting integration code.
Controllers and Plugs
- Controllers should be direct and boring: authorize, parse params, call a
context, return
html/2,json/2, redirect, or an error envelope. - Use
withfor chained context calls and a privateerror/2orerror/5helper for controller-local translation. - Keep plug modules small. Implement
@behaviour Plug,init/1, andcall/2with@impl. - If a plug rejects a request, set the status, return the existing JSON/HTML
shape, and
halt/1. - Do not put durable domain behavior in
AnkoleWeb.*. - For browser redirects after login/setup, call
delete_csrf_token/0or reuse the local session helper when rotating session state.
JSON and OpenAPI
- Phoenix JSON goes through
Ankole.JSON, not Jason. - External JSON request bodies and generated API clients use string-keyed maps at the boundary. Convert deliberately before calling domain code.
- OpenAPI endpoints should use
OpenApiSpex.ControllerSpecsand the schema modules underAnkoleWeb.Schemas. - Keep
OpenApiSpex.Plug.CastAndValidateclose to the controller that owns the API action and useAnkoleWeb.OpenApiValidationErrorRendererfor validation errors. - When changing console API routes or response schemas, update the OpenAPI spec and regenerate/check the webapp client if the frontend consumes it.
Sessions, Auth, and Security
- Browser session state lives in the custom cookie store. Preserve
same_site,http_only,secure, andmax_agesemantics. - Setup/auth JSON endpoints are not public stateless APIs just because they return JSON. They still rely on browser session and CSRF.
- Console REST API requests use bearer access tokens through
AnkoleWeb.Plugs.RequireConsoleAccessToken. - Validate return URLs with
AnkoleWeb.Session.safe_return_to/1; do not trust arbitraryreturn_tovalues. - Never use
String.to_atom/1on request data. - Never use
raw/1or unescaped iodata with untrusted user content. - Keep production secrets in runtime configuration and fail loudly when required env vars are missing.
I18n and HTML
- Server-rendered shell text should go through the local Ankole I18n helpers, not Gettext.
- Preserve
<html lang>behavior from the active Ankole locale. - Keep Phoenix text minimal; application copy belongs mostly in the webapps.
Ecto and Oban From Phoenix
- Controllers should call contexts such as
Ankole.AppConfigure,Ankole.AdminAuth, or other domain modules. They should not assemble queries. - For DB changes, use the
elixirskill's Ecto rules and existing context patterns (Repo.transact, constraints, upserts, migrations). - Oban workers belong in domain code, not controllers. Route actions enqueue or call contexts; they do not perform long blocking work inline.
Configuration
config/config.exsowns compile-time defaults and should keepconfig :phoenix, :json_library, Ankole.JSON.dev.exsstarts Vite through the watcher and configuresAnkoleWeb.Assetswithhttp://127.0.0.1:3035.test.exspointsAnkoleWeb.Assetsathttp://assets.test.runtime.exsruns in every environment. Keep global runtime settings deliberate and narrow; guard prod-only Repo, endpoint, and secret config withif config_env() == :prod.- If
mix phx.serverfails early, check the local Postgres database and the kiex Elixir environment before assuming Phoenix code is broken.
Testing
- Use existing
ConnCaseandDataCasesupport. - Test route behavior through controllers/plugs rather than private helpers.
- For session/API boundaries, assert status, response envelope, redirects, session changes, and CSRF-sensitive behavior where relevant.
- Use the SQL sandbox patterns already in
test/support. - Keep tests focused on the changed route, plug, controller, or shell behavior.
- For generated OpenAPI/client changes, also validate the relevant webapp type-check or client generation path.
Validation Commands
From app/control_plane:
source ~/.kiex/elixirs/elixir-1.20.1-29.env
mix format
MIX_ENV=test mix compile --warnings-as-errors
MIX_ENV=test mix testFrom the repo root when frontend/OpenAPI/Vite integration is touched:
bun run --filter @ankole/webapps openapi:generate
bun run --filter @ankole/webapps type-check
bun run --filter @ankole/webapps buildUse the smallest validation set that proves the changed surface. For docs-only
or skill-only edits, git diff --check is enough.
Optional Reference Files
Do not read these by default. Open the smallest relevant file only when needed:
reference.md: Plug.Conn helpers, router DSL, session config, component attrs.examples.md: larger controller/plug/context/security examples.
Most LiveView, Tailwind, GraphQL, Presence, Channels, and deployment examples from generic Phoenix guides are intentionally absent here. Reintroduce them only after the project actually adopts that surface or the user asks for it.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

