auth-flow-designer
Skill7 starsChanged 43 days agoMITView on GitHub
Choose and design API authentication and authorization: API keys, JWT, OAuth2/OIDC, or mTLS, with token lifetimes, refresh and revocation strategy, and scope design. Use when the user asks how to authenticate an API, design login or token flows, add OAuth2 scopes, or secure machine-to-machine access.
In this repository83 other files it gives its agents.
- AGENTS.mdAGENTS.md
- accessibility-enforcerSkill
- access-policy-designerSkill
- adaptive-guardSkill
- agent-reviewerSkill
- anti-ai-slop-designSkill
- api-mock-designerSkill
- api-observability-plannerSkill
- app-store-reviewerSkill
- ask-first-act-laterSkill
- assumption-checkerSkill
- b2b-founder-roadmapSkill
- brand-name-labSkill
- breaking-change-detectorSkill
- changelog-generatorSkill
- checkpoint-guardianSkill
- claude-style-codingSkill
- claw-integration-designSkill
- context-compressorSkill
- contract-first-designerSkill
- coolify-orchestratorSkill
- crash-analystSkill
- data-lineage-tracerSkill
- data-maskerSkill
- deep-link-architectSkill
- design-intelligenceSkill
- design-md-enforcerSkill
- ecosystem-apiSkill
- ecosystem-databaseSkill
- ecosystem-mobileSkill
- ecosystem-orchestrationSkill
- ecosystem-productSkill
- ecosystem-reasoningSkill
- ecosystem-securitySkill
- ecosystem-webSkill
- error-recoverySkill
- fth-design-crafterSkill
- geo-auditorSkill
- geo-optimizerSkill
- index-advisorSkill
- jev-orchestratorSkill
- mastermind-loggerSkill
- memory-ledgerSkill
- migration-strategistSkill
- mobile-perf-auditorSkill
- mobile-security-auditorSkill
- multi-brain-debateSkill
- multi-brain-expertsSkill
- multi-brain-scoreSkill
- multi-brainSkill
- offline-sync-designerSkill
- onboarding-designerSkill
- output-criticSkill
- parallel-plannerSkill
- pgbouncer-architectSkill
- plan-hardenerSkill
- plan-implement-verify-recoverSkill
- proje-analizcisiSkill
- project-analyzerSkill
- project-focus-firstSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Before designing, make sure you have the inputs below.
- Distinctive: line 34
Rotation: Every time a refresh token is used, it is invalidated and a new one is issued (Refresh Token Rotation).
≈ “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.
Files
Auth Flow Designer Protocol
This skill designs the authentication and authorization strategy for an API. It prevents developers from defaulting to "Just use JWTs for everything," ensuring the right security model is applied based on the consumers and the data sensitivity.
Core assumption: A leaked token is inevitable. The architecture must minimize the damage through short lifespans, refresh flows, and tight scopes.
0. Context Intake
Before designing, make sure you have the inputs below. Read the previous workflow step's artifact first if it exists. Ask only for what is missing, in a single message, and state any assumption you make instead of blocking.
- Client types: browser SPA, mobile app, server-to-server, third-party integrators, AI agents.
- Identity provider in use or allowed (Auth0, Cognito, Keycloak, Supabase, custom).
- Compliance or security requirements (SOC 2, PCI, HIPAA, token revocation needs).
1. Flow Selection (Static)
Analyze the consumer type to pick the right strategy:
- Server-to-Server (Internal):
mTLS(Mutual TLS) or service-specific short-livedJWTsigned by an internal KMS. - Server-to-Server (B2B/External):
API Keyswith IP whitelisting, orOAuth2 Client Credentialsflow. - Single Page App (SPA) / Frontend:
HttpOnly Cookiesholding the session ID or a short-livedJWT. NEVER store JWTs inlocalStorage. - Mobile App:
OAuth2 Authorization Code Flow with PKCE. Use a refresh token rotation strategy.
2. Token Lifecycle & Strategy
Define the rules of engagement:
- Access Token: Very short lifespan (e.g., 5-15 minutes). Contains minimal claims (
user_id,role). - Refresh Token: Longer lifespan (e.g., 7-30 days). Opacity is preferred (random string in DB, not a JWT).
- Rotation: Every time a refresh token is used, it is invalidated and a new one is issued (Refresh Token Rotation).
3. Scope Design (RBAC vs ABAC)
Define how permissions are enforced:
- RBAC (Role-Based): Standard roles (
admin,user). - Scopes (Capability-Based):
read:orders,write:profile. Ensure scopes are attached to the token payload so the API Gateway can reject requests before they hit the microservice.
4. Output Generation
Outputs. In file mode — the user wants artifacts, or this skill runs as a step of an ecosystem workflow — write both files below to docs/api-report/. In inline mode — a quick question — answer in the chat and end with the JSON below as a Handoff block instead of creating files.
- Human-Readable Markdown (
docs/api-report/auth-flow-report.md)
### 🔐 Authentication Architecture Plan
- **Primary Consumer:** React Native Mobile App
- **Selected Flow:** OAuth2 Authorization Code Flow (PKCE)
- **Token Strategy:** JWT Access Token + Opaque Refresh Token (Rotated)
#### 🚦 Token Configurations
- **Access Token (JWT):** Lifespan: 15 minutes. Claims: `sub` (UUID), `roles` (Array).
- **Refresh Token (Opaque):** Lifespan: 30 days. Action: Rotated on every use. Stored securely on the device encrypted enclave.
#### 🛡️ API Gateway Enforcement
The API Gateway must validate the JWT Signature and ensure `Scope: read:orders` exists before forwarding to the upstream service.- Machine-Readable JSON (
docs/api-report/auth-flow-output.json)
{
"skill": "auth-flow-designer",
"flow": "oauth2_pkce",
"client_type": "mobile",
"access_token": {"type": "JWT", "lifespan_min": 15},
"refresh_token": {"type": "Opaque", "lifespan_days": 30, "rotation": true},
"required_scopes": ["read:orders", "write:profile"]
}When to Skip
- The user only asks how to call an already-designed auth endpoint, or authentication is fully delegated to a managed gateway with no design choices left.
Guardrails
- JWT in LocalStorage: Strictly forbid and flag this practice. Push towards
HttpOnlycookies for web clients. - Revocation: Point out that stateless JWTs cannot be instantly revoked without a blocklist check. If instant revocation is required, suggest opaque Session IDs or a Redis-backed blocklist.
🔗 Next Steps & Handoffs
<!-- BEGIN GENERATED: handoffs (generated from the ecosystem workflow map by build_ecosystems.py — do not edit by hand) -->Ecosystem: @ecosystem-api — API Domain.
Workflows:
- Agent Connectivity Flow (
orch-agent-connectivity, step 2 of 3, via@ecosystem-orchestration): next →@security-auditor. - API Security & Scale Flow (
api-security-scale, step 1 of 3): next →@rate-limit-strategist.
Direct handoffs:
@access-policy-designer— Authorization must also be enforced in the database (RLS).
Handoff contract: pass results to the next skill through docs/api-report/auth-flow-output.json with the fields skill, workflow, created_at, inputs, summary, and next (the handoff contract of @ecosystem-api). If a next skill is not installed, continue with its step from the ecosystem map, or install it with npx skills add fatih-developer/fth-skills --skill <name> after the user agrees.
<!-- END GENERATED: handoffs -->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
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.

