phoenix-json-api
Installation
SKILL.md
Phoenix JSON API
RULES — Follow these with no exceptions
- Use the
:apipipeline — don't mix HTML and JSON pipelines; API routes skip CSRF, sessions, and browser headers - Render errors as structured JSON —
{:error, changeset}must become{"errors": {...}}; never return raw text or HTML errors - Use offset/limit for pagination — never return unbounded collections; default to a sensible limit (e.g., 20)
- Version APIs via URL prefix (
/api/v1/) — not headers; URL versioning is visible, cacheable, and debuggable - Use
FallbackControllerfor consistent error handling — every action returns{:ok, result}or{:error, reason}; the fallback renders errors - Authenticate via Bearer tokens in
Authorizationheader — not cookies; API clients don't have browser sessions - Use
json/2helper — ensuresContent-Type: application/json; avoidrenderfor simple JSON responses
API Pipeline Setup
# lib/my_app_web/router.ex
defmodule MyAppWeb.Router do
Related skills
More from j-morgan6/elixir-phoenix-guide
oban-essentials
MANDATORY for ALL Oban work. Invoke before writing workers or enqueuing jobs.
1ecto-essentials
MANDATORY for ALL database work. Invoke before modifying schemas, queries, or migrations.
1otp-essentials
MANDATORY for ALL OTP work. Invoke before writing GenServer, Supervisor, Task, or Agent modules.
1code-quality
Automated code quality detection — duplication, complexity, unused functions. Invoke when analyzing or refactoring Elixir code.
1phoenix-uploads
MANDATORY for file upload features. Invoke before implementing upload or file serving functionality.
1testing-essentials
MANDATORY for ALL test files. Invoke before writing any _test.exs file.
1