技能 next-js-better-auth-integration
📦

next-js-better-auth-integration

v1.0.0 安全

在 Next.js 中集成 Better Auth

App Router 项目中的身份认证通常涉及服务器组件、中间件、会话和客户端状态。此技能为 Claude、Codex 和 Claude Code 提供一份聚焦清单,用于实现 Better Auth 模式。

支持: Claude Codex Code(CC)
🥈 80 白银
1

下载技能 ZIP

2

在 Claude 中上传

前往 Settings → Capabilities → Skills → Upload skill

3

开启并开始使用

测试它

正在使用“next-js-better-auth-integration”。 为新的 App Router 项目规划 Better Auth 集成。

预期结果:

  • 认证配置、提供商设置和会话上下文的推荐设置顺序。
  • 公共页面和私有页面的路由保护计划。
  • 覆盖 Cookie、CSRF、密钥和速率限制的安全清单。

正在使用“next-js-better-auth-integration”。 审查我的受保护路由策略。

预期结果:

  • 对服务器端和客户端会话检查的评估。
  • 未认证用户的重定向行为。
  • 生产发布前需要验证的缺口。

安全审计

安全
v6 • 6/28/2026

Reviewed the three static findings in SKILL.md and found no confirmed malicious or unsafe behavior. The flagged lines are descriptive authentication guidance, not executable code, credential access, weak cryptography, or network reconnaissance. No prompt injection attempt or data exfiltration intent was found.

1
已扫描文件
170
分析行数
0
复核项
3
已忽略误报
已忽略静态误报 (3)

这些静态命中已被语义复核判定为误报,或只命中了 schema 定义里的词;这里保留展示用于透明度,但不影响质量评分。

False Positive: Secure Cookie Guidance
The static analyzer flagged browser credential files at SKILL.md:142. The line recommends secure, HTTP-only cookies for sessions, which is defensive authentication guidance and does not access browser credential files.
The line contains a secure cookie recommendation only. No filesystem path, browser profile access, or credential extraction behavior appears in the skill.
False Positive: Weak Cryptographic Algorithm
The static analyzer flagged weak cryptography at SKILL.md:7. The line is frontmatter description text for a conceptual Better Auth integration skill and does not name or configure a cryptographic algorithm.
The flagged line is plain metadata text. There is no MD5, SHA-1, DES, or other weak algorithm configuration at that location.
False Positive: Network Reconnaissance
The static analyzer flagged network reconnaissance at SKILL.md:122. The line advises using server components for server-side session access and does not describe port scanning, probing, or network enumeration.
The surrounding context is App Router integration guidance. No command, endpoint list, scanner, or reconnaissance workflow is present.
未发现安全问题
审计者: codex 查看审计历史 →

质量评分

55
架构
100
可维护性
87
内容
70
社区
100
安全
83
规范符合性

你能构建什么

为新应用添加身份认证

在编写实现代码之前,规划 Better Auth 设置、会话上下文和受保护页面。

审查认证架构

检查是否覆盖了会话处理、重定向、令牌行为和 Cookie 设置。

准备实现任务

将身份认证需求转换为针对 App Router、中间件和 UI 状态的聚焦工作项。

试试这些提示

规划基础设置
使用此技能为我的 Next.js App Router 项目概述 Better Auth 设置步骤。包括所需文件、会话流程和环境变量。
设计受保护路由
使用此技能为以下页面设计受保护路由行为:dashboard、settings 和 billing。包括未认证重定向和会话检查。
审查会话安全
使用此技能审查我计划的 Better Auth 会话策略。重点关注 Cookie、JWT 过期时间、CSRF 保护、速率限制和密钥处理。
创建认证迁移计划
使用此技能创建一个分阶段迁移计划,将带有社交登录和受保护服务器组件的 Next.js App Router 应用从自定义认证迁移到 Better Auth。

最佳实践

  • 在更改路由之前,先从会话和提供商需求开始。
  • 将身份认证密钥保存在托管环境变量中。
  • 测试过期会话、无效令牌和未认证访问路径。

避免

  • 不要将会话令牌存储在不安全的客户端存储中。
  • 不要仅通过客户端检查来保护页面。
  • 不要在未进行速率限制和 CSRF 审查的情况下发布身份认证流程。

常见问题

此技能会生成完整的 Better Auth 实现吗?
不会。它为规划和审查实现提供结构化指导。
这是为 Next.js Pages Router 准备的吗?
不是。此技能专注于 Next.js App Router 项目。
它能帮助处理受保护路由吗?
可以。它涵盖中间件、服务器端检查、重定向和会话状态处理。
它涵盖社交登录吗?
可以。它将提供商配置作为身份认证规划流程的一部分。
它能替代生产环境安全审查吗?
不能。生产环境设置、提供商配置和密钥仍然需要人工审核。
哪些 AI 工具可以使用此技能?
它标记为适用于 Claude、Codex 和 Claude Code。

开发者详情

文件结构

📄 SKILL.md