mermaid-diagram-auth — Claude Code rule: auth diagram
The mermaid-diagram-auth rule guides Claude Code through project auth requirements and asks it to create a Mermaid sequence diagram. Use it to map sign-up, login, sessions, and token handling.
AGPL-3.0 ★ 267 updated 2026-02-20
.cursor/rules/mermaid-diagram-auth.mdcWhat mermaid-diagram-auth does
The rule points Claude Code to .ai/project-prd.md for project requirements and sets .ai/diagrams/auth.md as the output file. The requested diagram covers Browser, Middleware, Astro API, and Supabase Auth, with login, sign-up, redirects, and the response to an expired token.
Before drawing, the agent is asked to identify the auth flows and the actors involved. The output should be in Polish and use Mermaid sequenceDiagram syntax, including numbered steps, declared participants, conditional branches, and activation blocks. It also sets a line-length limit and asks the agent to check the diagram for syntax and rendering issues.
The project needs .ai/project-prd.md for the requirements review. Without that file, the agent has no referenced project specification to base the diagram on.
What it helps with
- Map the login and sign-up sequence
- Show where tokens are checked and refreshed
- Document redirects after authentication
- Describe what happens when a session token expires
- Check the diagram against project requirements
Example prompts for the agent
- Create an auth diagram from
.ai/project-prd.mdand save it to.ai/diagrams/auth.md. - Show how Middleware and Supabase Auth handle an expired token in Mermaid.
- Review the login and sign-up flows, then write a Polish sequence diagram.
How to install mermaid-diagram-auth
Manually: put the files in place
.cursor/rules/mermaid-diagram-auth.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.claude/rules/mermaid-diagram-auth.mdThe paths frontmatter field limits the files: move globs from the source into paths
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.github/instructions/mermaid-diagram-auth.instructions.mdThe applyTo field sets which files it applies to: move globs from the source into applyTo
Manually: put the files in place
.devin/rules/mermaid-diagram-auth.mdManually: put the files in place
.clinerules/mermaid-diagram-auth.mdStep by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules
Questions about mermaid-diagram-auth
How do I install mermaid-diagram-auth in Claude Code?
Save the rule as .claude/rules/mermaid-diagram-auth.md in the project.
What does mermaid-diagram-auth do?
It instructs Claude Code to review auth requirements and produce a Mermaid sequence diagram for login and sign-up. The target file is .ai/diagrams/auth.md.
Which technologies does the rule cover?
Its requested auth flow uses React, Astro, and Supabase Auth. The agent is directed to read project requirements from .ai/project-prd.md.