Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计通过

create-auth创建授权

Agent Skill

用于辅助安全审计、权限检查、凭据风险、认证流程和常见漏洞排查。它适合让 Agent 梳理敏感配置、检查依赖风险、分析鉴权逻辑或生成安全复核清单。使用时不能把工具输出直接当最终结论,涉及密钥、令牌、用户数据或生产系统时,应先确认最小权限、脱敏方式和操作边界。

总安装

220

周安装

9

GitHub Stars

22

下载量

71
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:create-auth(创建授权)
来源仓库:https://github.com/himself65/auth-spec
仓库路径:skills/create-auth
安装命令:
npx skills add https://github.com/himself65/auth-spec --skill create-auth
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/himself65/auth-spec --skill create-auth

简介

用于为项目搭建用户认证系统, 包括登录、注册及相关流程。适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

  • 自动检测项目技术栈并推荐适配方案, 生成完整鉴权代码。create-auth 属于研究检索类 Skill,可作为该场景下的辅助能力补充。
  • 需识别数据库、框架和依赖项,避免重复造轮子,确保与现有系统集成。

SKILL.md

Create Auth

You are scaffolding authentication (signin + signup) for the user's project.

Step 1: Detect Existing Project Context

Before asking any questions, scan the user's project to detect their stack:

  1. Look for framework config files (e.g., next.config.*, package.json, go.mod, Cargo.toml, pyproject.toml, build.gradle*, pom.xml)
  2. Look for existing database/ORM setup (e.g., prisma/schema.prisma, drizzle.config.*, alembic/, diesel.toml, ormconfig.*)
  3. Look for existing auth code or dependencies

Use what you find to pre-select the best options in the questions below. If the project clearly uses a specific stack, set that as the recommended option.

Step 2: Gather Context with Interactive Questions

Use the AskUserQuestion tool to ask the user to make selections. Ask up to 3 questions in a single AskUserQuestion call so the user can answer everything at once.

Question 1: Language/Framework

Ask "Which language and framework are you using?" with header "Framework".

Pick the top 4 most relevant options based on what you detected in the project. If you detected the framework, put it first and mark it "(Recommended)". If you could not detect it, use these defaults:

  • Next.js — "TypeScript, App Router, API routes"
  • Express — "TypeScript/JavaScript, minimal and flexible"
  • FastAPI — "Python, async-first with type hints"
  • Go + Chi — "Go, lightweight and idiomatic"

The user can always pick "Other" to specify a different stack.

Question 2: Database/ORM

Ask "Which database and ORM/query layer?" with header "Database".

Again, pick the top 4 most relevant options based on the project. If detected, mark it "(Recommended)". Defaults:

  • PostgreSQL + Prisma — "Type-safe ORM with migrations (JS/TS)"
  • PostgreSQL + Drizzle — "Lightweight TypeScript ORM, SQL-like syntax"
  • PostgreSQL + SQLAlchemy — "Full-featured Python ORM"
  • SQLite + raw queries — "Simple, no server needed, good for prototyping"

Question 3: Session Strategy

Ask "How should sessions be managed?" with header "Sessions".

  • Database sessions (Recommended) — "Server-side sessions stored in your database. More secure — sessions can be revoked instantly"
  • JWT tokens — "Stateless tokens signed by the server. Simpler to scale, but harder to revoke"

Step 3: Ask Which Features to Add

After the user answers the stack questions, use AskUserQuestion again to ask which additional auth features they want. Use multiSelect: true so they can pick multiple features at once.

Question 1: Authentication Methods

Ask "Which authentication methods do you want to add?" with header "Auth methods". Set multiSelect to true.

  • Email OTP — "Passwordless sign-in via one-time codes sent to email"
  • Magic Link — "Passwordless sign-in via emailed links"
  • Phone Number — "SMS-based OTP authentication"
  • Passkey — "WebAuthn/FIDO2 passwordless authentication"

Question 2: Security Features

Ask "Which security features do you want?" with header "Security". Set multiSelect to true.

  • Two-Factor Auth (Recommended) — "TOTP-based second factor with backup codes"
  • Captcha — "Bot protection on sign-up and sign-in (reCAPTCHA, hCaptcha, Turnstile)"
  • Password Breach Check — "Check passwords against the Have I Been Pwned database"
  • Rate Limiting — "Throttle auth endpoints to prevent brute-force attacks (includes KV cache)"

Question 3: Additional Capabilities

Ask "Any additional capabilities?" with header "Extras". Set multiSelect to true.

  • Multi-Session — "Allow multiple concurrent sessions per user"
  • Username Auth — "Sign in with username instead of (or in addition to) email"
  • Organization / Teams — "Multi-tenant support with roles, invitations, and RBAC"
  • API Keys — "Generate API keys for programmatic access"

Step 4: Wait for All Answers

Do not write any code until the user has answered all questions. Once you have their selections, proceed to Step 5.

Step 5: Generate Auth

Generate the core auth (schema + endpoints below) plus any selected features. For each selected feature, read the matching reference file from references/features/ to get the schema additions, endpoint specs, and implementation details.

Dependency: If the user selects Rate Limiting, also read references/features/kv-cache.md and generate the KV cache module first — rate limiting depends on it. The KV cache is a general-purpose utility that other features can also use, so generate it as a standalone module.

FeatureReference file
Email OTPreferences/features/email-otp.md
Magic Linkreferences/features/magic-link.md
Phone Numberreferences/features/phone-number.md
Passkeyreferences/features/passkey.md
Two-Factor Authreferences/features/two-factor.md
Captchareferences/features/captcha.md
Password Breachreferences/features/password-breach.md
Rate Limitingreferences/features/rate-limiting.md
KV Cachereferences/features/kv-cache.md
Multi-Sessionreferences/features/multi-session.md
Username Authreferences/features/username.md
Organization/Teamsreferences/features/organization.md
API Keysreferences/features/api-key.md

Core Schema and Endpoints

Generate the following core auth using the schema and endpoint specs below.

Adapt everything to the user's language/framework idioms:

  • Naming: email_verified (snake_case) in Python/Go/Rust, emailVerified (camelCase) in JS/TS, EmailVerified (PascalCase) in C#
  • Types: use the language's native types (e.g. std::string in C++, String in Rust/Java, string in Go/TS)
  • IDs: use idiomatic generation — uuid.New() (Go), Uuid::new_v4() (Rust), crypto.randomUUID() (JS), uuid4() (Python), boost::uuids::random_generator() (C++), etc.
  • Password hashing: use the idiomatic library — bcrypt (Go/JS/Python), argon2 (Rust), libsodium (C/C++), etc.
  • Error handling: use the language's conventions (Result types in Rust, error returns in Go, exceptions in Python/Java, etc.)
  • File structure: follow the project's existing layout and conventions

Schema

Create these tables/models:

User

FieldTypeConstraints
idstringprimary key
emailstringunique, not null
namestringnullable
emailVerifiedbooleandefault false
createdAtdatetimedefault now
updatedAtdatetimeauto-update

Session

FieldTypeConstraints
idstringprimary key
userIdstringforeign key -> User, not null
tokenstringunique, not null
expiresAtdatetimenot null
createdAtdatetimedefault now

Account

FieldTypeConstraints
idstringprimary key
userIdstringforeign key -> User, not null
providerIdstringnot null (e.g. "credential")
passwordHashstringnullable
createdAtdatetimedefault now
updatedAtdatetimeauto-update

Endpoints

POST /api/auth/sign-up

  • Body: {email, password, name?}
  • Validate email format and password length (min 8 chars)
  • Hash password with a strong algorithm (bcrypt, argon2, or scrypt — use whichever is idiomatic for the language)
  • Create User + Account (providerId: "credential") + Session
  • Return session token and user (without password)
  • Email enumeration protection: If the email already exists, return the same 200 OK status and same response shape as a successful sign-up — do not return 409 or any error that reveals the email is taken. The response should be indistinguishable from a real sign-up. Implementation: attempt the insert, catch the unique constraint violation, hash the password anyway (to keep timing consistent), and return a fake success with a dummy user ID and token (that won't actually work as a session). This prevents attackers from discovering which emails are registered via the sign-up endpoint.

POST /api/auth/sign-in

  • Body: {email, password}
  • Look up user by email, verify password hash
  • Create new Session
  • Return session token and user (without password)
  • Return 401 on invalid credentials (generic message, no user enumeration)

GET /api/auth/session

  • Read session token from Authorization header (Bearer) or cookie
  • Look up session, verify not expired
  • Return user info if valid, 401 if not

POST /api/auth/sign-out

  • Read session token
  • Delete session from database
  • Return 200

Implementation Rules

  • Write all auth code by hand. Do NOT use auth libraries (better-auth, next-auth, Auth.js, lucia, passport, etc.). The only external dependencies allowed are: the web framework itself, the database/ORM layer, and a password hashing library (bcrypt, argon2, scrypt). Everything else — session management, token generation, route handlers — must be written directly. Keep it minimal.
  • Use crypto-random IDs for all primary keys and session tokens — use the idiomatic method for the language (crypto.randomUUID(), uuid.New(), Uuid::new_v4(), secrets.token_hex(), etc.)
  • Hash passwords with a strong algorithm — use what's standard for the ecosystem (bcrypt, argon2, scrypt, libsodium, etc.)
  • Never log or expose password hashes
  • Use constant-time comparison for password verification (the hashing library handles this)
  • Set session expiry to 7 days by default
  • Return generic "Invalid credentials" on sign-in failure — do not reveal whether the email exists
  • Prevent email enumeration on sign-up: When a duplicate email is submitted, return the same status code and response shape as a successful sign-up. Always hash the password (even for duplicates) to prevent timing-based detection. Return a plausible but non-functional fake token and user ID so the response is indistinguishable from a real sign-up.
  • Follow the project's existing code style, file structure, and patterns
  • If the language has a strong type system (Rust, Go, C++, etc.), define proper types/structs for request/response bodies — do not use untyped maps

Step 6: Run the Migration

After generating all code, run the database migration automatically so the user doesn't hit "table does not exist" errors. Use the project's existing database driver/connection to execute the migration SQL.

For JS/TS projects using @neondatabase/serverless, the tagged-template sql function cannot run plain SQL strings. Use sql.query(statement) instead when executing migration statements programmatically.

Common Pitfalls

Before generating code, read all files in references/pitfalls/ and follow their rules strictly. These are real bugs encountered in production.

PitfallReference file
API routes must catch DB errorsreferences/pitfalls/api-error-handling.md
Sign-up catch must not re-throwreferences/pitfalls/signup-rethrow.md
Auth helpers must not throwreferences/pitfalls/auth-helpers-no-throw.md
Client must handle non-JSONreferences/pitfalls/client-json-parsing.md
OAuth redirect must not use request.urlreferences/pitfalls/oauth-redirect-request-url.md
API key hash/gen must not be duplicatedreferences/pitfalls/api-key-shared-utils.md

Reference Implementations

Full working examples are in the references/ directory alongside this skill. Use the matching reference as a starting point and adapt to the user's specific setup:

FileStack
nextjs-drizzle.tsNext.js App Router + Drizzle + PostgreSQL
express-prisma.tsExpress + Prisma + PostgreSQL
go-chi.goGo + Chi + database/sql + PostgreSQL
fastapi-sqlalchemy.pyFastAPI + SQLAlchemy + PostgreSQL
axum-sqlx.rsRust + Axum + sqlx + PostgreSQL
spring-boot.ktKotlin + Spring Boot + JPA + PostgreSQL

If the user's stack doesn't match any reference, use the closest one as a structural guide and adapt idioms accordingly.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

37%
按下载量换算26

Claude

29.88%
按下载量换算21

Cursor

16.43%
按下载量换算12

Gemini CLI

9.89%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills