phoenix-patterns

Enforce Phoenix context design, controller patterns, and plug pipelines.

187|20|Updated Nov 20, 2025
One-click install
npx skills add https://github.com/TheBushidoCollective/han --skill phoenix-patterns
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phoenix-patterns
Source: https://github.com/TheBushidoCollective/han/tree/main/jutsu/jutsu-phoenix/skills/phoenix-patterns
Command: npx skills add https://github.com/TheBushidoCollective/han --skill phoenix-patterns

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill teaches Phoenix Framework patterns to create maintainable, scalable web applications with clear contexts and routing.

Core Features & Use Cases

  • Context Design: Boundary-driven architecture for domains.
  • Controller Patterns: Clean separation of concerns.
  • Pipelines & Routing: RESTful routing and plug pipelines.

Quick Start

Scaffold a Phoenix context with a simple controller and route.

Frequently Asked Questions about phoenix-patterns

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a Phoenix application with contexts and controllers?

Phoenix contexts provide boundary-driven architecture for domain logic, while controllers handle HTTP requests with thin, focused actions. Pair fat contexts containing business logic with clean controllers that delegate to contexts, enabling maintainable separation of concerns across your web application.

What's the best way to implement authentication and authorization in Phoenix?

Use plug pipelines and action_fallback to enforce authentication and authorization consistently. Define reusable plugs that check credentials, compose them into named pipelines, and attach pipelines to route groups so policies apply uniformly across API and HTML interfaces without repetition.

How do I organize RESTful routing and plug pipelines in Phoenix?

Group related routes using Phoenix's scope and resources macros, then compose plug pipelines to handle cross-cutting concerns like authentication and content negotiation. This structure lets you apply middleware consistently across route groups while keeping controllers thin and focused.

Can I use action_fallback to handle errors consistently across controllers?

Yes, action_fallback centralizes error handling by routing failed controller actions to a single handler function. Define fallback clauses for common error tuples, then attach action_fallback to your controller so all actions automatically convert errors to appropriate HTTP responses.

What's the difference between putting logic in contexts versus controllers?

Contexts isolate domain logic and business rules into reusable modules independent of HTTP concerns, while controllers translate HTTP requests into context calls and format responses. This separation makes contexts testable without web dependencies and keeps controllers simple routing layers.