·nextjs-client-cookie-pattern
</>

nextjs-client-cookie-pattern

wsimmonds/claude-nextjs-skills

客戶端組件調用服務器操作以在 Next.js 中設置 cookie 的模式。涵蓋客戶端組件的雙文件模式以及調用服務器操作來修改 cookie 的用戶交互(onClick、表單提交)。在構建身份驗證、首選項或會話管理等功能時使用,其中客戶端觸發器需要設置/修改服務器端 cookie。

45安裝·0熱度·@wsimmonds

安裝

$npx skills add https://github.com/wsimmonds/claude-nextjs-skills --skill nextjs-client-cookie-pattern

SKILL.md

This pattern handles a common Next.js requirement: client-side interaction (button click) that needs to set server-side cookies.

Can't client components set cookies directly? No. Client components run in the browser, and modern browsers restrict cookie manipulation for security. Server actions run on the server where cookie-setting is allowed.

Why not use a Route Handler (API route)? You can! But server actions are simpler and more integrated with the Next.js App Router pattern.

客戶端組件調用服務器操作以在 Next.js 中設置 cookie 的模式。涵蓋客戶端組件的雙文件模式以及調用服務器操作來修改 cookie 的用戶交互(onClick、表單提交)。在構建身份驗證、首選項或會話管理等功能時使用,其中客戶端觸發器需要設置/修改服務器端 cookie。 來源:wsimmonds/claude-nextjs-skills。

查看原文

可引用資訊

為搜尋與 AI 引用準備的穩定欄位與指令。

安裝指令
npx skills add https://github.com/wsimmonds/claude-nextjs-skills --skill nextjs-client-cookie-pattern
分類
</>開發工具
認證
收錄時間
2026-02-01
更新時間
2026-02-18

快速解答

什麼是 nextjs-client-cookie-pattern?

客戶端組件調用服務器操作以在 Next.js 中設置 cookie 的模式。涵蓋客戶端組件的雙文件模式以及調用服務器操作來修改 cookie 的用戶交互(onClick、表單提交)。在構建身份驗證、首選項或會話管理等功能時使用,其中客戶端觸發器需要設置/修改服務器端 cookie。 來源:wsimmonds/claude-nextjs-skills。

如何安裝 nextjs-client-cookie-pattern?

開啟你的終端機或命令列工具(如 Terminal、iTerm、Windows Terminal 等) 複製並執行以下指令:npx skills add https://github.com/wsimmonds/claude-nextjs-skills --skill nextjs-client-cookie-pattern 安裝完成後,技能將自動設定到你的 AI 程式設計環境中,可以在 Claude Code 或 Cursor 中使用

這個 Skill 的原始碼在哪?

https://github.com/wsimmonds/claude-nextjs-skills