[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6E2XQGFB60V3B5K0PMJ2B45":3,"skill-same:01M6E2XQGFB60V3B5K0PMJ2B45":108},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":48,"commitSha":49,"skillDirectory":50,"forksCount":51,"repositoryHtmlUrl":52,"repositoryHomepageUrl":6,"ownerHtmlUrl":53,"ownerBlogUrl":6,"ownerDescription":54,"updatedAt":55,"install":56,"resources":69},"01M6E2XQGFB60V3B5K0PMJ2B45","auth-expert",null,"Expert-level authentication and authorization. Use when implementing OAuth2, OIDC, JWT, session management, RBAC, ABAC, MFA, SSO, password hashing, or integrating auth providers (Auth0, Clerk, NextAuth, Supabase Auth). Also use when the user mentions 'OAuth', 'JWT', 'OIDC', 'RBAC', 'MFA', 'SSO', 'session management', 'refresh token', 'access token', or 'login flow'.","luokai0\u002Fai-agent-skills-by-luo-kai","luokai0","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F266954973?v=4","01M6E16VNT42JB8B3X3254QWJ7","luo kai","01M6E16VTFVP6S5XJF1V1MPV90",14,"MIT","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F06-security-and-auth (by Luo Kai)\u002F01-authentication-authorization\u002Fauth-expert\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"auth expert","expert","auth","password","token","clerk","hashing","use","session","management","refresh","access","jwt","mfa","sso","OAuth","flow","supabase","authentication","rbac","2026-11-10 10:12:30",false,"---\nauthor: luo-kai\nname: auth-expert\ndescription: Expert-level authentication and authorization. Use when implementing OAuth2, OIDC, JWT, session management, RBAC, ABAC, MFA, SSO, password hashing, or integrating auth providers (Auth0, Clerk, NextAuth, Supabase Auth). Also use when the user mentions 'OAuth', 'JWT', 'OIDC', 'RBAC', 'MFA', 'SSO', 'session management', 'refresh token', 'access token', or 'login flow'.\nlicense: MIT\nmetadata:\n  author: luokai0\n  version: \"1.0\"\n  category: coding\n---\n\n# Authentication & Authorization Expert\n\nYou are an expert in authentication and authorization with deep knowledge of OAuth2, OIDC, JWT, session management, RBAC, MFA, and modern auth providers.\n\n## Before Starting\n\n1. **Auth type** — JWT, sessions, OAuth2, OIDC, API keys?\n2. **Stack** — Node.js, Python, Go, Next.js, mobile?\n3. **Provider** — self-hosted, Auth0, Clerk, Supabase, Cognito?\n4. **Problem type** — implementing from scratch, debugging, security review?\n5. **Requirements** — MFA, SSO, social login, enterprise (SAML)?\n\n---\n\n## Core Expertise Areas\n\n- **OAuth2 flows**: authorization code + PKCE, client credentials, device flow\n- **OIDC**: ID tokens, UserInfo endpoint, discovery, provider integration\n- **JWT**: structure, signing (RS256, ES256, HS256), validation, rotation\n- **Session management**: secure cookies, session fixation, sliding expiry\n- **RBAC\u002FABAC**: role design, permission modeling, policy enforcement\n- **MFA**: TOTP, WebAuthn\u002FPasskeys, SMS\u002Femail OTP, recovery codes\n- **Refresh token rotation**: silent refresh, token families, revocation\n- **SSO**: SAML 2.0, OIDC federation, enterprise IdP integration\n\n---\n\n## Key Patterns & Code\n\n### OAuth2 Authorization Code + PKCE Flow\n```\nMost secure flow for SPAs and mobile apps.\nNever use implicit flow — it is deprecated.\n\nFlow:\n1. App generates code_verifier (random 43-128 char string)\n2. App hashes it: code_challenge = BASE64URL(SHA256(code_verifier))\n3. App redirects to auth server with code_challenge\n4. User authenticates and consents\n5. Auth server redirects back with authorization code\n6. App exchanges code + code_verifier for tokens\n7. Auth server verifies hash(code_verifier) == code_challenge\n\nWhy PKCE: prevents authorization code interception attacks\nEven if code is stolen, attacker does not have code_verifier\n```\n```typescript\n\u002F\u002F PKCE implementation\nimport crypto from 'crypto';\n\nfunction generateCodeVerifier(): string {\n  return crypto.randomBytes(32).toString('base64url');\n}\n\nfunction generateCodeChallenge(verifier: string): string {\n  return crypto\n    .createHash('sha256')\n    .update(verifier)\n    .digest('base64url');\n}\n\nfunction generateState(): string {\n  return crypto.randomBytes(16).toString('hex');\n}\n\n\u002F\u002F Step 1: Build authorization URL\nfunction buildAuthUrl(config: OAuthConfig): { url: string; state: string; verifier: string } {\n  const state = generateState();\n  const verifier = generateCodeVerifier();\n  const challenge = generateCodeChallenge(verifier);\n\n  const params = new URLSearchParams({\n    response_type: 'code',\n    client_id: config.clientId,\n    redirect_uri: config.redirectUri,\n    scope: 'openid profile email',\n    state,\n    code_challenge: challenge,\n    code_challenge_method: 'S256',\n  });\n\n  return {\n    url: `${config.authorizationEndpoint}?${params}`,\n    state,\n    verifier,\n  };\n}\n\n\u002F\u002F Step 2: Exchange code for tokens\nasync function exchangeCode(\n  code: string,\n  verifier: string,\n  config: OAuthConfig\n): Promise\u003CTokenResponse> {\n  const response = await fetch(config.tokenEndpoint, {\n    method: 'POST',\n    headers: { 'Content-Type': 'application\u002Fx-www-form-urlencoded' },\n    body: new URLSearchParams({\n      grant_type: 'authorization_code',\n      code,\n      redirect_uri: config.redirectUri,\n      client_id: config.clientId,\n      code_verifier: verifier,\n    }),\n  });\n\n  if (!response.ok) {\n    const error = await response.json();\n    throw new Error(`Token exchange failed: ${error.error_description}`);\n  }\n\n  return response.json();\n}\n```\n\n### JWT — Implementation & Validation\n```typescript\nimport jwt from 'jsonwebtoken';\nimport { readFileSync } from 'fs';\n\n\u002F\u002F Use RS256 (asymmetric) for production — private key signs, public key verifies\n\u002F\u002F Use HS256 (symmetric) only for internal services with shared secret\n\n\u002F\u002F Load RSA keys\nconst privateKey = readFileSync('private.pem');\nconst publicKey  = readFileSync('public.pem');\n\ninterface TokenPayload {\n  sub: string;          \u002F\u002F user ID\n  email: string;\n  role: string;\n  sessionId: string;\n  iat?: number;         \u002F\u002F issued at (auto-set by jwt.sign)\n  exp?: number;         \u002F\u002F expiry (auto-set)\n}\n\n\u002F\u002F Sign access token — short lived\nfunction signAccessToken(payload: Omit\u003CTokenPayload, 'iat' | 'exp'>): string {\n  return jwt.sign(payload, privateKey, {\n    algorithm: 'RS256',\n    expiresIn: '15m',   \u002F\u002F short lived — 15 minutes\n    issuer: 'https:\u002F\u002Fauth.example.com',\n    audience: 'https:\u002F\u002Fapi.example.com',\n  });\n}\n\n\u002F\u002F Sign refresh token — long lived, stored in DB\nfunction signRefreshToken(userId: string, sessionId: string): string {\n  return jwt.sign({ sub: userId, sessionId }, privateKey, {\n    algorithm: 'RS256',\n    expiresIn: '7d',\n    issuer: 'https:\u002F\u002Fauth.example.com',\n  });\n}\n\n\u002F\u002F Validate and decode token\nfunction verifyAccessToken(token: string): TokenPayload {\n  try {\n    return jwt.verify(token, publicKey, {\n      algorithms: ['RS256'],      \u002F\u002F never allow 'none' algorithm\n      issuer: 'https:\u002F\u002Fauth.example.com',\n      audience: 'https:\u002F\u002Fapi.example.com',\n    }) as TokenPayload;\n  } catch (error) {\n    if (error instanceof jwt.TokenExpiredError) {\n      throw new UnauthorizedError('Token expired');\n    }\n    if (error instanceof jwt.JsonWebTokenError) {\n      throw new UnauthorizedError('Invalid token');\n    }\n    throw error;\n  }\n}\n\n\u002F\u002F Auth middleware\nexport function authenticate(req: Request, res: Response, next: NextFunction) {\n  const authHeader = req.headers.authorization;\n  if (!authHeader?.startsWith('Bearer ')) {\n    return res.status(401).json({ error: 'Missing authorization header' });\n  }\n\n  const token = authHeader.slice(7);\n  try {\n    req.user = verifyAccessToken(token);\n    next();\n  } catch (error) {\n    return res.status(401).json({ error: error.message });\n  }\n}\n```\n\n### Refresh Token Rotation\n```typescript\n\u002F\u002F Refresh token rotation prevents token theft\n\u002F\u002F Each refresh invalidates the old token and issues a new one\n\u002F\u002F If old token is used again → token family is revoked (theft detected)\n\ninterface Session {\n  id: string;\n  userId: string;\n  refreshToken: string;   \u002F\u002F hashed\n  familyId: string;       \u002F\u002F for theft detection\n  expiresAt: Date;\n  createdAt: Date;\n}\n\nasync function refreshTokens(refreshToken: string): Promise\u003CTokenPair> {\n  \u002F\u002F Find session by refresh token hash\n  const tokenHash = hashToken(refreshToken);\n  const session = await db.session.findOne({ where: { refreshToken: tokenHash } });\n\n  if (!session) {\n    \u002F\u002F Token not found — may be theft attempt\n    \u002F\u002F Check if it belongs to a family and revoke all sessions in family\n    const revokedToken = await db.revokedToken.findOne({ where: { tokenHash } });\n    if (revokedToken) {\n      \u002F\u002F Token was already used — THEFT DETECTED\n      await db.session.deleteMany({ where: { familyId: revokedToken.familyId } });\n      throw new UnauthorizedError('Token reuse detected — all sessions revoked');\n    }\n    throw new UnauthorizedError('Invalid refresh token');\n  }\n\n  if (session.expiresAt \u003C new Date()) {\n    await db.session.delete({ where: { id: session.id } });\n    throw new UnauthorizedError('Refresh token expired');\n  }\n\n  \u002F\u002F Rotate: invalidate old token, issue new one\n  const newRefreshToken = crypto.randomBytes(32).toString('hex');\n  const newAccessToken  = signAccessToken({ sub: session.userId, sessionId: session.id });\n\n  \u002F\u002F Store old token hash as revoked (for theft detection)\n  await db.revokedToken.create({\n    data: { tokenHash, familyId: session.familyId, expiresAt: session.expiresAt }\n  });\n\n  \u002F\u002F Update session with new refresh token\n  await db.session.update({\n    where: { id: session.id },\n    data: {\n      refreshToken: hashToken(newRefreshToken),\n      expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),\n    }\n  });\n\n  return { accessToken: newAccessToken, refreshToken: newRefreshToken };\n}\n\nfunction hashToken(token: string): string {\n  return crypto.createHash('sha256').update(token).digest('hex');\n}\n```\n\n### Secure Session Management\n```typescript\nimport session from 'express-session';\nimport RedisStore from 'connect-redis';\nimport { createClient } from 'redis';\n\nconst redisClient = createClient({ url: process.env.REDIS_URL });\nawait redisClient.connect();\n\napp.use(session({\n  store: new RedisStore({ client: redisClient }),\n  secret: process.env.SESSION_SECRET!,  \u002F\u002F 32+ random bytes\n  name: '__Host-session',               \u002F\u002F __Host- prefix = more secure\n  resave: false,\n  saveUninitialized: false,\n  cookie: {\n    httpOnly: true,       \u002F\u002F not accessible via JS\n    secure: true,         \u002F\u002F HTTPS only\n    sameSite: 'strict',   \u002F\u002F CSRF protection\n    maxAge: 24 * 60 * 60 * 1000,  \u002F\u002F 24 hours\n  },\n}));\n\n\u002F\u002F Session fixation prevention — regenerate session ID after login\nasync function login(req: Request, userId: string) {\n  return new Promise\u003Cvoid>((resolve, reject) => {\n    \u002F\u002F Regenerate session ID to prevent fixation attack\n    req.session.regenerate((err) => {\n      if (err) return reject(err);\n      req.session.userId = userId;\n      req.session.loginAt = Date.now();\n      req.session.save((err) => {\n        if (err) return reject(err);\n        resolve();\n      });\n    });\n  });\n}\n\n\u002F\u002F Logout — destroy session completely\nasync function logout(req: Request) {\n  return new Promise\u003Cvoid>((resolve, reject) => {\n    req.session.destroy((err) => {\n      if (err) return reject(err);\n      resolve();\n    });\n  });\n}\n```\n\n### RBAC Implementation\n```typescript\n\u002F\u002F Role-Based Access Control\n\n\u002F\u002F Define permissions\nconst permissions = {\n  \u002F\u002F posts\n  'posts:read':   ['user', 'moderator', 'admin'],\n  'posts:create': ['user', 'moderator', 'admin'],\n  'posts:update': ['moderator', 'admin'],\n  'posts:delete': ['admin'],\n\n  \u002F\u002F users\n  'users:read':   ['moderator', 'admin'],\n  'users:update': ['admin'],\n  'users:delete': ['admin'],\n\n  \u002F\u002F admin\n  'admin:access': ['admin'],\n} as const;\n\ntype Permission = keyof typeof permissions;\ntype Role = 'user' | 'moderator' | 'admin';\n\nfunction hasPermission(role: Role, permission: Permission): boolean {\n  return (permissions[permission] as readonly string[]).includes(role);\n}\n\n\u002F\u002F Middleware factory\nfunction requirePermission(permission: Permission) {\n  return (req: Request, res: Response, next: NextFunction) => {\n    if (!req.user) {\n      return res.status(401).json({ error: 'Authentication required' });\n    }\n\n    if (!hasPermission(req.user.role as Role, permission)) {\n      return res.status(403).json({ error: 'Insufficient permissions' });\n    }\n\n    next();\n  };\n}\n\n\u002F\u002F Usage\napp.delete('\u002Fapi\u002Fposts\u002F:id',\n  authenticate,\n  requirePermission('posts:delete'),\n  deletePostHandler\n);\n\napp.get('\u002Fapi\u002Fusers',\n  authenticate,\n  requirePermission('users:read'),\n  getUsersHandler\n);\n```\n\n### TOTP MFA Implementation\n```typescript\nimport { authenticator } from 'otplib';\nimport QRCode from 'qrcode';\n\n\u002F\u002F Generate TOTP secret for user\nasync function setupMFA(userId: string, userEmail: string) {\n  const secret = authenticator.generateSecret();\n\n  \u002F\u002F Store secret (encrypted) in database\n  await db.user.update({\n    where: { id: userId },\n    data: {\n      mfaSecret: encrypt(secret),  \u002F\u002F encrypt at rest\n      mfaEnabled: false,           \u002F\u002F not enabled until verified\n    }\n  });\n\n  \u002F\u002F Generate QR code for authenticator app\n  const otpAuthUrl = authenticator.keyuri(userEmail, 'MyApp', secret);\n  const qrCodeDataUrl = await QRCode.toDataURL(otpAuthUrl);\n\n  return { secret, qrCodeDataUrl };\n}\n\n\u002F\u002F Verify TOTP token during setup\nasync function verifyMFASetup(userId: string, token: string): Promise\u003Cboolean> {\n  const user = await db.user.findUnique({ where: { id: userId } });\n  if (!user?.mfaSecret) throw new Error('MFA not initialized');\n\n  const secret = decrypt(user.mfaSecret);\n  const isValid = authenticator.verify({ token, secret });\n\n  if (isValid) {\n    \u002F\u002F Generate backup codes\n    const backupCodes = generateBackupCodes();\n\n    await db.user.update({\n      where: { id: userId },\n      data: {\n        mfaEnabled: true,\n        backupCodes: backupCodes.map(code => hashToken(code)),\n      }\n    });\n\n    return true;\n  }\n  return false;\n}\n\n\u002F\u002F Verify TOTP during login\nasync function verifyMFALogin(userId: string, token: string): Promise\u003Cboolean> {\n  const user = await db.user.findUnique({ where: { id: userId } });\n  if (!user?.mfaSecret || !user.mfaEnabled) return true; \u002F\u002F MFA not enabled\n\n  const secret = decrypt(user.mfaSecret);\n\n  \u002F\u002F Check TOTP token\n  if (authenticator.verify({ token, secret })) return true;\n\n  \u002F\u002F Check backup codes\n  const hashedToken = hashToken(token);\n  const backupCodeIndex = user.backupCodes.indexOf(hashedToken);\n  if (backupCodeIndex !== -1) {\n    \u002F\u002F Remove used backup code\n    const newCodes = [...user.backupCodes];\n    newCodes.splice(backupCodeIndex, 1);\n    await db.user.update({\n      where: { id: userId },\n      data: { backupCodes: newCodes }\n    });\n    return true;\n  }\n\n  return false;\n}\n\nfunction generateBackupCodes(count = 10): string[] {\n  return Array.from({ length: count }, () =>\n    crypto.randomBytes(5).toString('hex').toUpperCase()\n      .replace(\u002F(.{5})\u002Fg, '$1-').slice(0, -1)  \u002F\u002F format: XXXXX-XXXXX\n  );\n}\n```\n\n### NextAuth.js (Next.js)\n```typescript\n\u002F\u002F app\u002Fapi\u002Fauth\u002F[...nextauth]\u002Froute.ts\nimport NextAuth from 'next-auth';\nimport { PrismaAdapter } from '@auth\u002Fprisma-adapter';\nimport GitHub from 'next-auth\u002Fproviders\u002Fgithub';\nimport Google from 'next-auth\u002Fproviders\u002Fgoogle';\nimport Credentials from 'next-auth\u002Fproviders\u002Fcredentials';\nimport { db } from '@\u002Flib\u002Fdb';\nimport { verifyPassword } from '@\u002Flib\u002Fauth';\nimport { z } from 'zod';\n\nconst handler = NextAuth({\n  adapter: PrismaAdapter(db),\n\n  providers: [\n    GitHub({\n      clientId: process.env.GITHUB_CLIENT_ID!,\n      clientSecret: process.env.GITHUB_CLIENT_SECRET!,\n    }),\n    Google({\n      clientId: process.env.GOOGLE_CLIENT_ID!,\n      clientSecret: process.env.GOOGLE_CLIENT_SECRET!,\n    }),\n    Credentials({\n      credentials: {\n        email: { type: 'email' },\n        password: { type: 'password' },\n      },\n      async authorize(credentials) {\n        const parsed = z.object({\n          email: z.string().email(),\n          password: z.string().min(8),\n        }).safeParse(credentials);\n\n        if (!parsed.success) return null;\n\n        const user = await db.user.findUnique({\n          where: { email: parsed.data.email }\n        });\n\n        if (!user?.passwordHash) return null;\n\n        const valid = await verifyPassword(\n          parsed.data.password,\n          user.passwordHash\n        );\n\n        return valid ? user : null;\n      },\n    }),\n  ],\n\n  session: { strategy: 'jwt' },\n\n  callbacks: {\n    async jwt({ token, user }) {\n      if (user) {\n        token.role = user.role;\n        token.id = user.id;\n      }\n      return token;\n    },\n    async session({ session, token }) {\n      session.user.id   = token.id as string;\n      session.user.role = token.role as string;\n      return session;\n    },\n  },\n\n  pages: {\n    signIn: '\u002Flogin',\n    error: '\u002Fauth\u002Ferror',\n  },\n});\n\nexport { handler as GET, handler as POST };\n```\n\n---\n\n## Best Practices\n\n- Use authorization code + PKCE for all browser and mobile OAuth flows\n- Access tokens should expire in 15 minutes — use refresh tokens for longevity\n- Always rotate refresh tokens on use — detect theft via token reuse\n- Store refresh tokens hashed in the database — never plaintext\n- Use HttpOnly + Secure + SameSite=Strict cookies for session tokens\n- Regenerate session ID after login to prevent session fixation\n- Never put sensitive data in JWT payload — it is only base64 encoded not encrypted\n- Verify JWT algorithm explicitly — never allow 'none' algorithm\n- Use RS256 or ES256 for JWTs — not HS256 in distributed systems\n\n---\n\n## Common Pitfalls\n\n| Pitfall | Problem | Fix |\n|---|---|---|\n| Long-lived access tokens | Stolen token gives long access window | Expire access tokens in 15 minutes |\n| No refresh token rotation | Stolen refresh token usable indefinitely | Rotate on every use, detect reuse |\n| JWT with sensitive data | Data readable by anyone (base64) | Never put PII or secrets in JWT |\n| Allowing 'none' algorithm | Attacker can forge tokens | Explicitly specify allowed algorithms |\n| No session regeneration after login | Session fixation attack | Always call session.regenerate() after login |\n| TOTP without backup codes | Users locked out if phone lost | Always generate and store backup codes |\n| Storing tokens in localStorage | XSS can steal tokens | Use HttpOnly cookies for refresh tokens |\n| No MFA on admin accounts | Admin takeover via password breach | Require MFA for all privileged accounts |\n\n---\n\n## Related Skills\n\n- **appsec-expert**: For general application security patterns\n- **cryptography-expert**: For JWT signing and token hashing\n- **nextjs-expert**: For NextAuth.js integration\n- **nodejs-expert**: For Express session and JWT middleware\n- **supabase-expert**: For Supabase Auth integration\n- **secrets-management**: For storing auth secrets securely\n","# Authentication & Authorization Expert\n\nYou are an expert in authentication and authorization with deep knowledge of OAuth2, OIDC, JWT, session management, RBAC, MFA, and modern auth providers.\n\n## Before Starting\n\n1. **Auth type** — JWT, sessions, OAuth2, OIDC, API keys?\n2. **Stack** — Node.js, Python, Go, Next.js, mobile?\n3. **Provider** — self-hosted, Auth0, Clerk, Supabase, Cognito?\n4. **Problem type** — implementing from scratch, debugging, security review?\n5. **Requirements** — MFA, SSO, social login, enterprise (SAML)?\n\n---\n\n## Core Expertise Areas\n\n- **OAuth2 flows**: authorization code + PKCE, client credentials, device flow\n- **OIDC**: ID tokens, UserInfo endpoint, discovery, provider integration\n- **JWT**: structure, signing (RS256, ES256, HS256), validation, rotation\n- **Session management**: secure cookies, session fixation, sliding expiry\n- **RBAC\u002FABAC**: role design, permission modeling, policy enforcement\n- **MFA**: TOTP, WebAuthn\u002FPasskeys, SMS\u002Femail OTP, recovery codes\n- **Refresh token rotation**: silent refresh, token families, revocation\n- **SSO**: SAML 2.0, OIDC federation, enterprise IdP integration\n\n---\n\n## Key Patterns & Code\n\n### OAuth2 Authorization Code + PKCE Flow\n```\nMost secure flow for SPAs and mobile apps.\nNever use implicit flow — it is deprecated.\n\nFlow:\n1. App generates code_verifier (random 43-128 char string)\n2. App hashes it: code_challenge = BASE64URL(SHA256(code_verifier))\n3. App redirects to auth server with code_challenge\n4. User authenticates and consents\n5. Auth server redirects back with authorization code\n6. App exchanges code + code_verifier for tokens\n7. Auth server verifies hash(code_verifier) == code_challenge\n\nWhy PKCE: prevents authorization code interception attacks\nEven if code is stolen, attacker does not have code_verifier\n```\n```typescript\n\u002F\u002F PKCE implementation\nimport crypto from 'crypto';\n\nfunction generateCodeVerifier(): string {\n  return crypto.randomBytes(32).toString('base64url');\n}\n\nfunction generateCodeChallenge(verifier: string): string {\n  return crypto\n    .createHash('sha256')\n    .update(verifier)\n    .digest('base64url');\n}\n\nfunction generateState(): string {\n  return crypto.randomBytes(16).toString('hex');\n}\n\n\u002F\u002F Step 1: Build authorization URL\nfunction buildAuthUrl(config: OAuthConfig): { url: string; state: string; verifier: string } {\n  const state = generateState();\n  const verifier = generateCodeVerifier();\n  const challenge = generateCodeChallenge(verifier);\n\n  const params = new URLSearchParams({\n    response_type: 'code',\n    client_id: config.clientId,\n    redirect_uri: config.redirectUri,\n    scope: 'openid profile email',\n    state,\n    code_challenge: challenge,\n    code_challenge_method: 'S256',\n  });\n\n  return {\n    url: `${config.authorizationEndpoint}?${params}`,\n    state,\n    verifier,\n  };\n}\n\n\u002F\u002F Step 2: Exchange code for tokens\nasync function exchangeCode(\n  code: string,\n  verifier: string,\n  config: OAuthConfig\n): Promise\u003CTokenResponse> {\n  const response = await fetch(config.tokenEndpoint, {\n    method: 'POST',\n    headers: { 'Content-Type': 'application\u002Fx-www-form-urlencoded' },\n    body: new URLSearchParams({\n      grant_type: 'authorization_code',\n      code,\n      redirect_uri: config.redirectUri,\n      client_id: config.clientId,\n      code_verifier: verifier,\n    }),\n  });\n\n  if (!response.ok) {\n    const error = await response.json();\n    throw new Error(`Token exchange failed: ${error.error_description}`);\n  }\n\n  return response.json();\n}\n```\n\n### JWT — Implementation & Validation\n```typescript\nimport jwt from 'jsonwebtoken';\nimport { readFileSync } from 'fs';\n\n\u002F\u002F Use RS256 (asymmetric) for production — private key signs, public key verifies\n\u002F\u002F Use HS256 (symmetric) only for internal services with shared secret\n\n\u002F\u002F Load RSA keys\nconst privateKey = readFileSync('private.pem');\nconst publicKey  = readFileSync('public.pem');\n\ninterface TokenPayload {\n  sub: string;          \u002F\u002F user ID\n  email: string;\n  role: string;\n  sessionId: string;\n  iat?: number;         \u002F\u002F issued at (auto-set by jwt.sign)\n  exp?: number;         \u002F\u002F expiry (auto-set)\n}\n\n\u002F\u002F Sign access token — short lived\nfunction signAccessToken(payload: Omit\u003CTokenPayload, 'iat' | 'exp'>): string {\n  return jwt.sign(payload, privateKey, {\n    algorithm: 'RS256',\n    expiresIn: '15m',   \u002F\u002F short lived — 15 minutes\n    issuer: 'https:\u002F\u002Fauth.example.com',\n    audience: 'https:\u002F\u002Fapi.example.com',\n  });\n}\n\n\u002F\u002F Sign refresh token — long lived, stored in DB\nfunction signRefreshToken(userId: string, sessionId: string): string {\n  return jwt.sign({ sub: userId, sessionId }, privateKey, {\n    algorithm: 'RS256',\n    expiresIn: '7d',\n    issuer: 'https:\u002F\u002Fauth.example.com',\n  });\n}\n\n\u002F\u002F Validate and decode token\nfunction verifyAccessToken(token: string): TokenPayload {\n  try {\n    return jwt.verify(token, publicKey, {\n      algorithms: ['RS256'],      \u002F\u002F never allow 'none' algorithm\n      issuer: 'https:\u002F\u002Fauth.example.com',\n      audience: 'https:\u002F\u002Fapi.example.com',\n    }) as TokenPayload;\n  } catch (error) {\n    if (error instanceof jwt.TokenExpiredError) {\n      throw new UnauthorizedError('Token expired');\n    }\n    if (error instanceof jwt.JsonWebTokenError) {\n      throw new UnauthorizedError('Invalid token');\n    }\n    throw error;\n  }\n}\n\n\u002F\u002F Auth middleware\nexport function authenticate(req: Request, res: Response, next: NextFunction) {\n  const authHeader = req.headers.authorization;\n  if (!authHeader?.startsWith('Bearer ')) {\n    return res.status(401).json({ error: 'Missing authorization header' });\n  }\n\n  const token = authHeader.slice(7);\n  try {\n    req.user = verifyAccessToken(token);\n    next();\n  } catch (error) {\n    return res.status(401).json({ error: error.message });\n  }\n}\n```\n\n### Refresh Token Rotation\n```typescript\n\u002F\u002F Refresh token rotation prevents token theft\n\u002F\u002F Each refresh invalidates the old token and issues a new one\n\u002F\u002F If old token is used again → token family is revoked (theft detected)\n\ninterface Session {\n  id: string;\n  userId: string;\n  refreshToken: string;   \u002F\u002F hashed\n  familyId: string;       \u002F\u002F for theft detection\n  expiresAt: Date;\n  createdAt: Date;\n}\n\nasync function refreshTokens(refreshToken: string): Promise\u003CTokenPair> {\n  \u002F\u002F Find session by refresh token hash\n  const tokenHash = hashToken(refreshToken);\n  const session = await db.session.findOne({ where: { refreshToken: tokenHash } });\n\n  if (!session) {\n    \u002F\u002F Token not found — may be theft attempt\n    \u002F\u002F Check if it belongs to a family and revoke all sessions in family\n    const revokedToken = await db.revokedToken.findOne({ where: { tokenHash } });\n    if (revokedToken) {\n      \u002F\u002F Token was already used — THEFT DETECTED\n      await db.session.deleteMany({ where: { familyId: revokedToken.familyId } });\n      throw new UnauthorizedError('Token reuse detected — all sessions revoked');\n    }\n    throw new UnauthorizedError('Invalid refresh token');\n  }\n\n  if (session.expiresAt \u003C new Date()) {\n    await db.session.delete({ where: { id: session.id } });\n    throw new UnauthorizedError('Refresh token expired');\n  }\n\n  \u002F\u002F Rotate: invalidate old token, issue new one\n  const newRefreshToken = crypto.randomBytes(32).toString('hex');\n  const newAccessToken  = signAccessToken({ sub: session.userId, sessionId: session.id });\n\n  \u002F\u002F Store old token hash as revoked (for theft detection)\n  await db.revokedToken.create({\n    data: { tokenHash, familyId: session.familyId, expiresAt: session.expiresAt }\n  });\n\n  \u002F\u002F Update session with new refresh token\n  await db.session.update({\n    where: { id: session.id },\n    data: {\n      refreshToken: hashToken(newRefreshToken),\n      expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),\n    }\n  });\n\n  return { accessToken: newAccessToken, refreshToken: newRefreshToken };\n}\n\nfunction hashToken(token: string): string {\n  return crypto.createHash('sha256').update(token).digest('hex');\n}\n```\n\n### Secure Session Management\n```typescript\nimport session from 'express-session';\nimport RedisStore from 'connect-redis';\nimport { createClient } from 'redis';\n\nconst redisClient = createClient({ url: process.env.REDIS_URL });\nawait redisClient.connect();\n\napp.use(session({\n  store: new RedisStore({ client: redisClient }),\n  secret: process.env.SESSION_SECRET!,  \u002F\u002F 32+ random bytes\n  name: '__Host-session',               \u002F\u002F __Host- prefix = more secure\n  resave: false,\n  saveUninitialized: false,\n  cookie: {\n    httpOnly: true,       \u002F\u002F not accessible via JS\n    secure: true,         \u002F\u002F HTTPS only\n    sameSite: 'strict',   \u002F\u002F CSRF protection\n    maxAge: 24 * 60 * 60 * 1000,  \u002F\u002F 24 hours\n  },\n}));\n\n\u002F\u002F Session fixation prevention — regenerate session ID after login\nasync function login(req: Request, userId: string) {\n  return new Promise\u003Cvoid>((resolve, reject) => {\n    \u002F\u002F Regenerate session ID to prevent fixation attack\n    req.session.regenerate((err) => {\n      if (err) return reject(err);\n      req.session.userId = userId;\n      req.session.loginAt = Date.now();\n      req.session.save((err) => {\n        if (err) return reject(err);\n        resolve();\n      });\n    });\n  });\n}\n\n\u002F\u002F Logout — destroy session completely\nasync function logout(req: Request) {\n  return new Promise\u003Cvoid>((resolve, reject) => {\n    req.session.destroy((err) => {\n      if (err) return reject(err);\n      resolve();\n    });\n  });\n}\n```\n\n### RBAC Implementation\n```typescript\n\u002F\u002F Role-Based Access Control\n\n\u002F\u002F Define permissions\nconst permissions = {\n  \u002F\u002F posts\n  'posts:read':   ['user', 'moderator', 'admin'],\n  'posts:create': ['user', 'moderator', 'admin'],\n  'posts:update': ['moderator', 'admin'],\n  'posts:delete': ['admin'],\n\n  \u002F\u002F users\n  'users:read':   ['moderator', 'admin'],\n  'users:update': ['admin'],\n  'users:delete': ['admin'],\n\n  \u002F\u002F admin\n  'admin:access': ['admin'],\n} as const;\n\ntype Permission = keyof typeof permissions;\ntype Role = 'user' | 'moderator' | 'admin';\n\nfunction hasPermission(role: Role, permission: Permission): boolean {\n  return (permissions[permission] as readonly string[]).includes(role);\n}\n\n\u002F\u002F Middleware factory\nfunction requirePermission(permission: Permission) {\n  return (req: Request, res: Response, next: NextFunction) => {\n    if (!req.user) {\n      return res.status(401).json({ error: 'Authentication required' });\n    }\n\n    if (!hasPermission(req.user.role as Role, permission)) {\n      return res.status(403).json({ error: 'Insufficient permissions' });\n    }\n\n    next();\n  };\n}\n\n\u002F\u002F Usage\napp.delete('\u002Fapi\u002Fposts\u002F:id',\n  authenticate,\n  requirePermission('posts:delete'),\n  deletePostHandler\n);\n\napp.get('\u002Fapi\u002Fusers',\n  authenticate,\n  requirePermission('users:read'),\n  getUsersHandler\n);\n```\n\n### TOTP MFA Implementation\n```typescript\nimport { authenticator } from 'otplib';\nimport QRCode from 'qrcode';\n\n\u002F\u002F Generate TOTP secret for user\nasync function setupMFA(userId: string, userEmail: string) {\n  const secret = authenticator.generateSecret();\n\n  \u002F\u002F Store secret (encrypted) in database\n  await db.user.update({\n    where: { id: userId },\n    data: {\n      mfaSecret: encrypt(secret),  \u002F\u002F encrypt at rest\n      mfaEnabled: false,           \u002F\u002F not enabled until verified\n    }\n  });\n\n  \u002F\u002F Generate QR code for authenticator app\n  const otpAuthUrl = authenticator.keyuri(userEmail, 'MyApp', secret);\n  const qrCodeDataUrl = await QRCode.toDataURL(otpAuthUrl);\n\n  return { secret, qrCodeDataUrl };\n}\n\n\u002F\u002F Verify TOTP token during setup\nasync function verifyMFASetup(userId: string, token: string): Promise\u003Cboolean> {\n  const user = await db.user.findUnique({ where: { id: userId } });\n  if (!user?.mfaSecret) throw new Error('MFA not initialized');\n\n  const secret = decrypt(user.mfaSecret);\n  const isValid = authenticator.verify({ token, secret });\n\n  if (isValid) {\n    \u002F\u002F Generate backup codes\n    const backupCodes = generateBackupCodes();\n\n    await db.user.update({\n      where: { id: userId },\n      data: {\n        mfaEnabled: true,\n        backupCodes: backupCodes.map(code => hashToken(code)),\n      }\n    });\n\n    return true;\n  }\n  return false;\n}\n\n\u002F\u002F Verify TOTP during login\nasync function verifyMFALogin(userId: string, token: string): Promise\u003Cboolean> {\n  const user = await db.user.findUnique({ where: { id: userId } });\n  if (!user?.mfaSecret || !user.mfaEnabled) return true; \u002F\u002F MFA not enabled\n\n  const secret = decrypt(user.mfaSecret);\n\n  \u002F\u002F Check TOTP token\n  if (authenticator.verify({ token, secret })) return true;\n\n  \u002F\u002F Check backup codes\n  const hashedToken = hashToken(token);\n  const backupCodeIndex = user.backupCodes.indexOf(hashedToken);\n  if (backupCodeIndex !== -1) {\n    \u002F\u002F Remove used backup code\n    const newCodes = [...user.backupCodes];\n    newCodes.splice(backupCodeIndex, 1);\n    await db.user.update({\n      where: { id: userId },\n      data: { backupCodes: newCodes }\n    });\n    return true;\n  }\n\n  return false;\n}\n\nfunction generateBackupCodes(count = 10): string[] {\n  return Array.from({ length: count }, () =>\n    crypto.randomBytes(5).toString('hex').toUpperCase()\n      .replace(\u002F(.{5})\u002Fg, '$1-').slice(0, -1)  \u002F\u002F format: XXXXX-XXXXX\n  );\n}\n```\n\n### NextAuth.js (Next.js)\n```typescript\n\u002F\u002F app\u002Fapi\u002Fauth\u002F[...nextauth]\u002Froute.ts\nimport NextAuth from 'next-auth';\nimport { PrismaAdapter } from '@auth\u002Fprisma-adapter';\nimport GitHub from 'next-auth\u002Fproviders\u002Fgithub';\nimport Google from 'next-auth\u002Fproviders\u002Fgoogle';\nimport Credentials from 'next-auth\u002Fproviders\u002Fcredentials';\nimport { db } from '@\u002Flib\u002Fdb';\nimport { verifyPassword } from '@\u002Flib\u002Fauth';\nimport { z } from 'zod';\n\nconst handler = NextAuth({\n  adapter: PrismaAdapter(db),\n\n  providers: [\n    GitHub({\n      clientId: process.env.GITHUB_CLIENT_ID!,\n      clientSecret: process.env.GITHUB_CLIENT_SECRET!,\n    }),\n    Google({\n      clientId: process.env.GOOGLE_CLIENT_ID!,\n      clientSecret: process.env.GOOGLE_CLIENT_SECRET!,\n    }),\n    Credentials({\n      credentials: {\n        email: { type: 'email' },\n        password: { type: 'password' },\n      },\n      async authorize(credentials) {\n        const parsed = z.object({\n          email: z.string().email(),\n          password: z.string().min(8),\n        }).safeParse(credentials);\n\n        if (!parsed.success) return null;\n\n        const user = await db.user.findUnique({\n          where: { email: parsed.data.email }\n        });\n\n        if (!user?.passwordHash) return null;\n\n        const valid = await verifyPassword(\n          parsed.data.password,\n          user.passwordHash\n        );\n\n        return valid ? user : null;\n      },\n    }),\n  ],\n\n  session: { strategy: 'jwt' },\n\n  callbacks: {\n    async jwt({ token, user }) {\n      if (user) {\n        token.role = user.role;\n        token.id = user.id;\n      }\n      return token;\n    },\n    async session({ session, token }) {\n      session.user.id   = token.id as string;\n      session.user.role = token.role as string;\n      return session;\n    },\n  },\n\n  pages: {\n    signIn: '\u002Flogin',\n    error: '\u002Fauth\u002Ferror',\n  },\n});\n\nexport { handler as GET, handler as POST };\n```\n\n---\n\n## Best Practices\n\n- Use authorization code + PKCE for all browser and mobile OAuth flows\n- Access tokens should expire in 15 minutes — use refresh tokens for longevity\n- Always rotate refresh tokens on use — detect theft via token reuse\n- Store refresh tokens hashed in the database — never plaintext\n- Use HttpOnly + Secure + SameSite=Strict cookies for session tokens\n- Regenerate session ID after login to prevent session fixation\n- Never put sensitive data in JWT payload — it is only base64 encoded not encrypted\n- Verify JWT algorithm explicitly — never allow 'none' algorithm\n- Use RS256 or ES256 for JWTs — not HS256 in distributed systems\n\n---\n\n## Common Pitfalls\n\n| Pitfall | Problem | Fix |\n|---|---|---|\n| Long-lived access tokens | Stolen token gives long access window | Expire access tokens in 15 minutes |\n| No refresh token rotation | Stolen refresh token usable indefinitely | Rotate on every use, detect reuse |\n| JWT with sensitive data | Data readable by anyone (base64) | Never put PII or secrets in JWT |\n| Allowing 'none' algorithm | Attacker can forge tokens | Explicitly specify allowed algorithms |\n| No session regeneration after login | Session fixation attack | Always call session.regenerate() after login |\n| TOTP without backup codes | Users locked out if phone lost | Always generate and store backup codes |\n| Storing tokens in localStorage | XSS can steal tokens | Use HttpOnly cookies for refresh tokens |\n| No MFA on admin accounts | Admin takeover via password breach | Require MFA for all privileged accounts |\n\n---\n\n## Related Skills\n\n- **appsec-expert**: For general application security patterns\n- **cryptography-expert**: For JWT signing and token hashing\n- **nextjs-expert**: For NextAuth.js integration\n- **nodejs-expert**: For Express session and JWT middleware\n- **supabase-expert**: For Supabase Auth integration\n- **secrets-management**: For storing auth secrets securely\n",{"name":5,"author":44,"license":15,"metadata":45,"description":7},"luo-kai",{"author":9,"version":46,"category":47},"1.0","coding","main","4d2fb89cdfb75f3f6fd3c6c5ec9ad90ea129eb3c","ai-agent-skills\u002F06-security-and-auth (by Luo Kai)\u002F01-authentication-authorization\u002Fauth-expert",2,"https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai","https:\u002F\u002Fgithub.com\u002Fluokai0","a solo builder.","2026-05-06 04:29:04",{"source":8,"skillName":5,"commands":57,"prompt":67,"zipAvailable":68},[58,61,64],{"tool":59,"command":60},"npx","npx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill auth-expert",{"tool":62,"command":63},"bunx","bunx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill auth-expert",{"tool":65,"command":66},"pnpm","pnpm dlx skills add luokai0\u002Fai-agent-skills-by-luo-kai --skill auth-expert","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F06-security-and-auth (by Luo Kai)\u002F01-authentication-authorization\u002Fauth-expert\u002FSKILL.md",true,[70,76,80,86,92,96,100,104],{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},".gitignore","OTHER","其他",774,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__changeflowhq--stealth-browser\u002F.gitignore",{"path":77,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":78,"sourceHtmlUrl":79},"data\u002F.gitkeep",0,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__changeflowhq--stealth-browser\u002Fdata\u002F.gitkeep",{"path":81,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":84,"sourceHtmlUrl":85},"hooks\u002FREADME.md","REFERENCE","参考文档",2459,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__changeflowhq--stealth-browser\u002Fhooks\u002FREADME.md",{"path":87,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":90,"sourceHtmlUrl":91},"hooks\u002Fwebfetch-fallback.sh","SCRIPT","脚本",1393,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__changeflowhq--stealth-browser\u002Fhooks\u002Fwebfetch-fallback.sh",{"path":93,"resourceType":88,"resourceTypeDesc":89,"sizeBytes":94,"sourceHtmlUrl":95},"hooks\u002Fwebfetch-preflight.sh",1244,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__changeflowhq--stealth-browser\u002Fhooks\u002Fwebfetch-preflight.sh",{"path":97,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":98,"sourceHtmlUrl":99},"LEARNED.md",272,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__changeflowhq--stealth-browser\u002FLEARNED.md",{"path":101,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":102,"sourceHtmlUrl":103},"profile\u002FDefault\u002FPreferences",682,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__changeflowhq--stealth-browser\u002Fprofile\u002FDefault\u002FPreferences",{"path":105,"resourceType":82,"resourceTypeDesc":83,"sizeBytes":106,"sourceHtmlUrl":107},"README.md",13944,"https:\u002F\u002Fgithub.com\u002FJSGforever\u002Fskillguard\u002Fblob\u002Fmain\u002Fbenchmarks\u002Ffinal\u002Fskills\u002Fasset1__changeflowhq--stealth-browser\u002FREADME.md",[109,135,152,177,202,227],{"skillNo":110,"name":111,"nameZh":6,"description":112,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":113,"categories":114,"keywords":115,"publishedAt":39},"01M6F2SKTE208174C7S7JJCZC7","write-contracts","Generates secure Aptos Move V2 smart contracts with Object model, Digital Asset integration, security patterns, and storage type guidance. Includes comprehensive storage decision framework for optimal data structure selection. Triggers on: 'write contract', 'create NFT collection', 'build marketplace', 'implement minting', 'generate Move module', 'create token contract', 'build DAO', 'implement staking'. Ask storage questions when: 'store', 'track', 'registry', 'mapping', 'list', 'collection'.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fwrite-contracts\u002FSKILL.md",[],[116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,23,132,133,134],"write","contracts","write contracts","storage","secure","create","generate","collection","model","decision","ask","smart-contracts","selection","objects","structure","nft","aptos","critical","move",{"skillNo":136,"name":137,"nameZh":6,"description":138,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":139,"categories":140,"keywords":141,"publishedAt":39},"01M6F2RFXJ6T9MKW0A7N7GM45B","web-search","通用网络搜索技能，支持多引擎搜索（百度、必应、DuckDuckGo），无需API密钥即可获取实时信息","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fweb-search-ex-skill\u002FSKILL.md",[],[142,143,144,145,146,147,148,149,150,151],"web","search","web search","搜索","baidu","bing","duckduckgo","百度","多引擎","internet",{"skillNo":153,"name":154,"nameZh":6,"description":155,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":39},"01M6F2K968G1FZEZFPW2E6B222","solo-build","Execute implementation plan tasks with TDD workflow, auto-commit, and phase gates. Use when user says \"build it\", \"start building\", \"execute plan\", \"implement tasks\", \"ship it\", or references a track ID. Do NOT use for planning (use \u002Fplan) or scaffolding (use \u002Fscaffold).","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fsolo-build\u002FSKILL.md",[],[159,160,161,162,163,164,165,166,143,167,168,169,116,170,171,172,173,174,175,176],"build","solo","solo build","MCP","workflow","commit","tasks","code","Bash","plan","read","auto","references","context7","query","scaffolding","ship it","project",{"skillNo":178,"name":179,"nameZh":6,"description":180,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":181,"categories":182,"keywords":183,"publishedAt":39},"01M6F2GKN39SGHSPWYB3662YC8","react-email","Use when building HTML email templates with React components, adding a visual email editor to an application using the React Email visual editor, rendering emails to HTML, or sending emails with Resend. Covers welcome emails, password resets, notifications, order confirmations, newsletters, transactional emails, and the embeddable email editor component.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Freact-email-skills\u002FSKILL.md",[],[184,185,186,187,188,189,190,191,192,193,194,22,195,26,196,197,198,199,200,201],"react","email","react email","github","editor","components","react components","component","welcome","https","notifications","node","html","resend","visual","emails","rendering","with",{"skillNo":203,"name":204,"nameZh":6,"description":205,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":206,"categories":207,"keywords":208,"publishedAt":39},"01M6F2FBVGVDFSG8SSFJGXA40C","APITester Agent-Driven API Testing","Test API endpoints and document responses. Define tests in plain English, run them, get formatted results. Agent-driven Postman alternative.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fopenclaw-api-tester\u002FSKILL.md",[],[209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224,225,226],"testing","api","api testing","driven","APITester Agent Driven API Testing","test","run","postman","results","plain english","tester","endpoints","document","get","define","tests","english","api-tester",{"skillNo":228,"name":229,"nameZh":6,"description":230,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":231,"categories":232,"keywords":233,"publishedAt":39},"01M6F273Y3NGAPVJZ608BC0G9G","hubspot-implementation-plan","Generate a phased implementation plan from a HubSpot audit report. Creates prioritized, sequenced cleanup processes with effort estimates, dependencies, and automation feasibility. Use after running \u002Fhubspot-audit.","https:\u002F\u002Fgithub.com\u002Fluokai0\u002Fai-agent-skills-by-luo-kai\u002Fblob\u002Fmain\u002Fai-agent-skills\u002F22-clawhub-skills\u002Fhubspot-implementation-plan\u002FSKILL.md",[],[168,234,235,236,237,238,239,122,240,241,242,243,244,26,245,246,201,247],"implementation","hubspot","hubspot implementation plan","automation","feasibility","cleanup","planning","report","audit","audit report","phased implementation","dependencies","processes","hubspot audit"]