AU

Enforces standard implementation patterns for QAuth credential providers and token claims.

Install

mkdir -p .claude/skills/auth-engine && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/11982" && unzip -o skill.zip -d .claude/skills/auth-engine && rm skill.zip

Installs to .claude/skills/auth-engine

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

Auth engine rules for QAuth. Use when working with CredentialProvider implementations, token claim generation, the provider registry, or the federation layer. Enforces the pluggable provider pattern and correct token claim behaviour.
233 chars✓ has a “when” trigger
Advanced

Key capabilities

  • Verify credential provider input
  • Extract user attributes from verified identity
  • Issue tokens with user ID as subject
  • Manage token claims (sub, email, acr)
  • Resolve claims based on source trust level
  • Handle password hashing with Argon2id

How it works

The auth engine looks up credentials, passes data to `provider.verify()`, receives `VerifiedIdentity`, upserts `user_attributes` from `provider.extractAttributes()`, and issues tokens with `sub = users.id`.

Inputs & outputs

You give it
Credential data passed to provider.verify()
You get back
VerifiedIdentity and user attributes, leading to token issuance

When to use auth-engine

  • Implementing a new CredentialProvider
  • Verifying token claim logic
  • Registering authentication providers
  • Debugging federation layer issues

About this skill

Auth Engine Rules

You are working in the QAuth authentication core.

CredentialProvider Pattern

Every authentication method implements the CredentialProvider interface:

// libs/server/federation/src/providers/credential-provider.interface.ts
export interface CredentialProvider {
  readonly type: string;
  verify(input: unknown): Promise<VerifiedIdentity>;
  extractAttributes(result: VerifiedIdentity): UserAttribute[];
}

The auth engine:

  1. Looks up the credential from user_credentials by (realm_id, provider_type, external_sub)
  2. Passes credential data to provider.verify()
  3. Receives VerifiedIdentity
  4. Upserts user_attributes from provider.extractAttributes()
  5. Issues tokens with sub = users.id

The engine does not contain provider-specific logic. Switch/case on provider_type belongs only in the provider registry, not in service routes.

Current Providers

  • PasswordProvider (provider_type: 'password') — Phase 1, COMPLETE
    • Located at libs/server/federation/src/providers/password.provider.ts
    • externalSub is the normalized email address
    • assuranceLevel: 'low' — no acr claim in tokens
  • WalletProvider (provider_type: 'wallet') — T4, IN PROGRESS (Epic #231)
    • Skeleton shipped (#232): libs/server/federation/src/providers/wallet.provider.ts
    • verify() throws by design until a validated OID4VP presentation exists — proving key possession is not authentication (see #233); do not wire it into a login path yet

Token Claims

  • sub: always users.id (UUID) — never email, never external_sub
  • email: from user_attributes WHERE attr_key='email' AND verified=true, highest-trust source OMIT entirely if no verified email — do not set null
  • acr: eIDAS assurance level from VerifiedIdentity.assuranceLevel Omit for password credentials (assuranceLevel: 'low' → no acr claim)
  • All other claims: from user_attributes, same trust-ordered resolution

Claim Resolution

// Claim resolution order by source trust level
// wallet > oidc_* > self_reported
const emailAttr = await fastify.repositories.userAttributes.findVerifiedByUserIdAndKey(
  userId,
  'email'
);
// Returns undefined if no verified email → omit claim from token

Crypto

All signing, hashing, and key operations go through libs/server/jwt/ and libs/server/password/. Never implement crypto directly in TypeScript service code. The libs/server/password/ library wraps Argon2id for password hashing — use it via the passwordHasher Fastify decorator. Do not call Argon2 directly.

Phase Status

  • Phase 1 (email/password + OAuth 2.1 / OIDC): COMPLETE after identifier-abstraction refactor
  • Phase 2 (Developer Portal): IN PROGRESS — no new providers
  • T4 (WalletProvider + OID4VP 1.0): ACTIVE (Epic #231; skeleton shipped in #232, transport layer #233 first). The mechanism is OID4VP 1.0, not SIOPv2 — HAIP 1.0 §5 mandates response_type=vp_token, which excludes the Self-Issued ID Token. Do not implement SIOPv2. See ADR-004 § Spec status (2026-07-20); profile order is decided (#296 locked): oid4vp-1.0-base first, haip-1.0 second.
  • The PasswordProvider is permanent infrastructure, not a legacy path to be deprecated

When not to use it

  • When implementing provider-specific logic outside the provider registry
  • When implementing crypto directly in TypeScript service code
  • When calling Argon2 directly instead of using passwordHasher

Limitations

  • Does not contain provider-specific logic
  • Does not implement crypto directly in TypeScript service code
  • Does not allow direct calls to Argon2

How it compares

This skill enforces a pluggable `CredentialProvider` pattern and specific token claim behaviors, centralizing authentication logic and preventing provider-specific logic from scattering across service routes.

Compared to similar skills

auth-engine side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
auth-engine (this skill)04moNo flagsAdvanced
supabase-developer957moReviewIntermediate
supabase-mcp-integration138moReviewAdvanced
better-auth-best-practices186moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

You might also like

supabase-developer

daffy0208

Build full-stack applications with Supabase (PostgreSQL, Auth, Storage, Real-time, Edge Functions). Use when implementing authentication, database design with RLS, file storage, real-time features, or serverless functions.

95185

supabase-mcp-integration

manutej

Comprehensive Supabase integration covering authentication, database operations, realtime subscriptions, storage, and MCP server patterns for building production-ready backends with PostgreSQL, Auth, and real-time capabilities

13124

better-auth-best-practices

novuhq

Skill for integrating Better Auth - the comprehensive TypeScript authentication framework.

1854

nextjs-supabase-auth

davila7

Expert integration of Supabase Auth with Next.js App Router Use when: supabase auth next, authentication next.js, login supabase, auth middleware, protected route.

1259

better-auth

mrgoonie

Implement authentication and authorization with Better Auth - a framework-agnostic TypeScript authentication framework. Features include email/password authentication with verification, OAuth providers (Google, GitHub, Discord, etc.), two-factor authentication (TOTP, SMS), passkeys/WebAuthn support, session management, role-based access control (RBAC), rate limiting, and database adapters. Use when adding authentication to applications, implementing OAuth flows, setting up 2FA/MFA, managing user sessions, configuring authorization rules, or building secure authentication systems for web applications.

527

auth-patterns

davepoon

This skill should be used when the user asks about "authentication in Next.js", "NextAuth", "Auth.js", "middleware auth", "protected routes", "session management", "JWT", "login flow", or needs guidance on implementing authentication and authorization in Next.js applications.

720

Search skills

Search the agent skills registry