phoenix-auth-customization

Extend phx.gen.auth with custom fields across migrations, schemas, and tests.

149|15|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/j-morgan6/elixir-phoenix-guide --skill phoenix-auth-customization
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: phoenix-auth-customization
Source: https://github.com/j-morgan6/elixir-phoenix-guide/tree/main/skills/phoenix-auth-customization
Command: npx skills add https://github.com/j-morgan6/elixir-phoenix-guide --skill phoenix-auth-customization

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Extending the built-in phx.gen.auth flow with custom user fields can break migrations, tests, and validations. This skill provides a clear, battle-tested approach to evolve authentication schemas without destabilizing the authentication flow.

Core Features & Use Cases

  • Update registration_changeset to include new fields and maintain validations.
  • Update LiveView registration forms and context functions to pass new fields through.
  • Provide fixtures and tests that reflect the extended user schema, including proper confirmation handling.

Quick Start

Extend phx.gen.auth with a custom field by following the step-by-step guidance to add a new attribute to users while preserving migrations and tests.

Frequently Asked Questions about phoenix-auth-customization

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

FAQPage Schema
How do I add custom fields to phx.gen.auth without breaking migrations and tests?

To add custom fields to phx.gen.auth safely, you update the registration_changeset, LiveView forms, and test fixtures without modifying the original generated migrations, ensuring validations propagate correctly.

What changes are needed in the registration_changeset when extending Phoenix auth with new user attributes?

The registration_changeset must be updated to include new fields and maintain validations, ensuring custom user attributes pass through context functions and LiveView registration forms correctly.

Does phx.gen.auth support adding custom user fields for bespoke registration flows?

phx.gen.auth supports custom user fields by extending the generated schemas, LiveView forms, and tests, allowing bespoke registration flows while preserving the original authentication structure.

Why do my Phoenix auth tests fail after adding new fields to the user schema?

Phoenix auth tests fail after adding fields because fixtures and tests must be synced with the extended user schema, including proper confirmation handling and updated changeset validations.

What's the best way to update LiveView registration forms with additional user fields in Phoenix?

The best way to update LiveView registration forms is to pass new fields through context functions and the registration_changeset, ensuring changes propagate through the entire authentication flow.

Can I extend Phoenix authentication schemas without modifying the generated migrations?

You can extend Phoenix authentication schemas without modifying generated migrations by applying changes to schemas, changesets, and tests separately, preserving the original migration files.