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

next-js-better-auth-integration

v1.0.0 安全

在 Next.js 中整合 Better Auth

App Router 專案中的驗證通常橫跨 server components、middleware、sessions 與 client state。這項 skill 為 Claude、Codex 和 Claude Code 提供一份聚焦的檢查清單,用於實作 Better Auth 模式。

支援: Claude Codex Code(CC)
🥈 80 銀級
1

下載技能 ZIP

2

在 Claude 中上傳

前往 設定 → 功能 → 技能 → 上傳技能

3

開啟並開始使用

測試它

正在使用「next-js-better-auth-integration」。 Plan Better Auth integration for a new App Router project.

預期結果:

  • 針對 auth configuration、provider setup 和 session context 的建議設定順序。
  • 公用與私有頁面的路由保護計畫。
  • 涵蓋 cookies、CSRF、secrets 和 rate limiting 的安全檢查清單。

正在使用「next-js-better-auth-integration」。 Review my protected route strategy.

預期結果:

  • 對 server-side 和 client-side session checks 的評估。
  • 未驗證使用者的 redirect 行為。
  • 正式發布前需要驗證的缺口。

安全審計

安全
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
Review items
3
False positives ignored
Static false positives ignored (3)

These static matches were dismissed by semantic review or matched schema-only tokens, so they are shown for transparency but do not drive the quality score.

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
規範符合度

你可以打造什麼

為新 App 加入驗證

在撰寫實作程式碼前,規劃 Better Auth 設定、session context 和受保護頁面。

審查驗證架構

檢查是否已涵蓋 session 處理、redirects、token 行為和 cookie 設定。

準備實作任務

將驗證需求轉換為 App Router、middleware 和 UI states 的聚焦工作項目。

試試這些提示

規劃基本設定
Use this skill to outline the Better Auth setup steps for my Next.js App Router project. Include required files, session flow, and environment variables.
設計受保護路由
Use this skill to design protected route behavior for these pages: dashboard, settings, and billing. Include unauthenticated redirects and session checks.
審查 Session 安全性
Use this skill to review my planned Better Auth session strategy. Focus on cookies, JWT expiration, CSRF protection, rate limiting, and secret handling.
建立驗證遷移計畫
Use this skill to create a phased migration plan from custom auth to Better Auth in a Next.js App Router app with social login and protected server components.

最佳實務

  • 在變更路由前,先從 session 和 provider 需求開始。
  • 將 authentication secrets 保存在受管理的 environment variables 中。
  • 測試過期 sessions、無效 tokens 和未驗證存取路徑。

避免

  • 不要將 session tokens 儲存在不安全的 client-side storage 中。
  • 不要只用 client-side checks 保護頁面。
  • 不要在未進行 rate limiting 和 CSRF 審查的情況下發布驗證流程。

常見問題

這項 skill 會產生完整的 Better Auth 實作嗎?
不會。它提供結構化指引,用於規劃和審查實作。
這是為 Next.js Pages Router 設計的嗎?
不是。這項 skill 聚焦於 Next.js App Router 專案。
它能協助處理受保護路由嗎?
可以。它涵蓋 middleware、server-side checks、redirects 和 session state handling。
它涵蓋 social login 嗎?
會。它將 provider configuration 納入驗證規劃流程的一部分。
它能取代正式環境安全審查嗎?
不會。正式環境設定、provider configuration 和 secrets 仍需要人工審查。
哪些 AI 工具可以使用這項 skill?
它標記為可供 Claude、Codex 和 Claude Code 使用。

開發者詳細資訊

檔案結構

📄 SKILL.md