# mermaid-diagram-auth

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.

- rule · `type=rule` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline · ★ 267 repo stars
- Author: przeprogramowani
- License: AGPL-3.0 · policy=link-only · description only; the file stays with the author
- Source: https://github.com/przeprogramowani/ai-rules-builder/tree/HEAD/.cursor/rules/mermaid-diagram-auth.mdc
- Updated: 2026-02-20
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/rules/mermaid-diagram-auth

## What it 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.

## Install

### Cursor (native platform)

**Manually: put the files in place**
- File: `.cursor/rules/mermaid-diagram-auth.mdc` — Frontmatter: description, globs, alwaysApply

### Claude Code

**Manually: put the files in place**
- File: `.claude/rules/mermaid-diagram-auth.md` — The paths frontmatter field limits the files: move globs from the source into paths

### Codex

**AGENTS.md**
- Codex reads AGENTS.md: paste the rule text there

### GitHub Copilot

**Manually: put the files in place**
- File: `.github/instructions/mermaid-diagram-auth.instructions.md` — The applyTo field sets which files it applies to: move globs from the source into applyTo

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/rules/mermaid-diagram-auth.md`

### Cline

**Manually: put the files in place**
- File: `.clinerules/mermaid-diagram-auth.md`

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/przeprogramowani/ai-rules-builder/tree/HEAD/.cursor/rules/mermaid-diagram-auth.mdc

## When to use it
- 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
- Create an auth diagram from `.ai/project-prd.md` and 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.

## Similar
- [external-diagram-mermaid-generate](https://affpapa.org/en/nevibecode/skills/external-diagram-mermaid-generate.md) — skill · 5600 installs
- [mermaid-diagram-generator](https://affpapa.org/en/nevibecode/skills/mermaid-diagram-generator.md) — skill · 348 installs
- [mermaid-diagram-specialist](https://affpapa.org/en/nevibecode/skills/mermaid-diagram-specialist.md) — skill · 145 installs
- [agent-mermaid-diagram-specialist](https://affpapa.org/en/nevibecode/plugins/agent-mermaid-diagram-specialist.md) — plugin · ★ 2707 repo stars
- [design-doc-mermaid](https://affpapa.org/en/nevibecode/skills/design-doc-mermaid.md) — skill · 101800 installs
- [pretty-mermaid](https://affpapa.org/en/nevibecode/skills/pretty-mermaid.md) — skill · 4700 installs

From the same set: [przeprogramowani/ai-rules-builder](https://affpapa.org/en/nevibecode/by/przeprogramowani/ai-rules-builder.md) — 24 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
