·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