agentleFS
igmarinigmarin/elixir-phoenix-skills/skills/phoenix-authentication/SKILL.md

phoenix-authentication

Skill4 starsChanged 4 months agoMITView on GitHub

Use when adding or changing Phoenix authentication, phx.gen.auth integration, LiveView session identity, or migration between current_user and Phoenix 1.8 Scope.

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Follow the generated authentication code and Phoenix version in the project.

    line 11
  2. Distinctive:

    Keep password/session verification in the generated auth boundary.

    line 22
  3. Distinctive:

    Test unauthenticated redirect, valid session, invalid session, registration validation, and the changed flow.

    line 24
  4. Very specific:

    Keep authorization rules in policies or phoenix-authorization-patterns.

    line 26

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Phoenix Authentication

Follow the generated authentication code and Phoenix version in the project. Keep authentication (who is signed in) separate from authorization (what that identity may do).

Version path

  • Phoenix 1.7 projects commonly store user_token in the session and derive current_user for request and LiveView assigns. Preserve this token-to-assign flow unless the task migrates it.
  • Phoenix 1.8 projects may use a Scope struct. Follow the project's generated current_scope plumbing; do not mix both models in one request path without a migration plan.
  • Confirm generator output and APIs against mix.lock and the checked-out source.

Change flow

  1. Trace router pipelines, session plugs, on_mount, generated user schema, and existing tests.
  2. Keep password/session verification in the generated auth boundary. Add custom registration fields through a separate migration and explicit changeset allowlists.
  3. Derive LiveView identity from the verified session. Never trust a client-supplied user ID or socket param as identity.
  4. Test unauthenticated redirect, valid session, invalid session, registration validation, and the changed flow.

Keep authorization rules in policies or phoenix-authorization-patterns. Authentication changes require focused tests; schema or session changes need an explicit migration/compatibility checkpoint when they affect existing users.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.