phoenix-contexts

Design Elixir Phoenix contexts with bounded principles and Phoenix 1.8+ scope integration.

517|35|Updated Feb 12, 2026
One-click install
npx skills add https://github.com/oliver-kriska/claude-elixir-phoenix --skill phoenix-contexts
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phoenix-contexts
Source: https://github.com/oliver-kriska/claude-elixir-phoenix/tree/main/plugins/elixir-phoenix/skills/phoenix-contexts
Command: npx skills add https://github.com/oliver-kriska/claude-elixir-phoenix --skill phoenix-contexts

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides guidance on organizing Elixir Phoenix application code into maintainable and scalable contexts, ensuring clean separation of concerns and adherence to best practices.

Core Features & Use Cases

  • Context Design Patterns: Learn how to structure modules for business logic, manage data ownership, and implement scopes.
  • Phoenix 1.8+ Scope Integration: Understand how to leverage the built-in %Scope{} struct for authorization and data scoping.
  • Anti-pattern Avoidance: Identify and correct common mistakes in context implementation, such as direct Repo calls in controllers or side effects in schemas.
  • Use Case: When designing a new feature that involves user accounts and posts, use this Skill to ensure your Accounts and Blog contexts are structured correctly from the start, preventing future refactoring headaches.

Quick Start

Use the phoenix-contexts skill to learn about structuring Elixir Phoenix contexts.

Frequently Asked Questions about phoenix-contexts

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

FAQPage Schema
How do I structure business logic in Elixir Phoenix contexts?

To structure Elixir Phoenix contexts, organize modules by business domain to ensure clean separation of concerns. This approach uses bounded context principles to group related data and logic, preventing cross-domain coupling and maintaining scalable application architecture.

What is a bounded context in Phoenix framework applications?

A bounded context in Phoenix is an architectural pattern that isolates specific business domains into separate module groups. It manages data ownership and scoping independently, ensuring that features like user accounts and blog posts do not tightly couple their internal logic or database schemas.

How does Phoenix 1.8 scope integration handle authorization and data scoping?

Phoenix 1.8 scope integration uses a built-in `%Scope{}` struct to manage authorization and data scoping. This struct passes user-specific context through your application, allowing contexts to automatically filter data access and enforce permissions based on the current user session.

What are common anti-patterns to avoid when implementing Phoenix contexts?

Common Phoenix context anti-patterns include making direct repository calls from controllers instead of through context modules, and embedding side effects directly within schemas. These practices break the bounded context boundaries and reduce overall code maintainability.

How do I manage cross-context communication in Elixir Phoenix?

Cross-context communication in Elixir Phoenix should be managed through public context API functions rather than direct database queries. This maintains strict bounded context boundaries, ensuring modules interact via documented function calls and preserving robust application architecture.

Can I use Phoenix contexts for small Elixir applications or is it only for large systems?

Phoenix contexts are suitable for Elixir applications of any scale needing clean separation of concerns. Structuring modules by bounded context early prevents future refactoring headaches and ensures a maintainable codebase as your application's features and data ownership grow.