スキル一覧に戻る
kensleDev

nextjs-client-cookie-pattern

by kensleDev

0🍴 0📅 2026年1月16日
GitHubで見るManusで実行

SKILL.md


name: nextjs-client-cookie-pattern

IMPORTANT: Keep description on ONE line for Claude Code compatibility

prettier-ignore

Next.js: Client → Server Cookie Pattern

Quick Start

Two files: Client component ('use client') + Server action ('use server')

// Button.tsx
'use client';
import { setTheme } from './actions';
export default function Button() {
  return <button onClick={() => setTheme('dark')}>Enable Dark Mode</button>;
}

// actions.ts
'use server';
import { cookies } from 'next/headers';
export async function setTheme(theme: string) {
  const cookieStore = await cookies();
  cookieStore.set('theme', theme, { httpOnly: true, maxAge: 60*60*24*365 });
}

Reference Files

  • patterns.md - Cookie patterns, form submission, redirect, reading cookies

Notes

  • Server-side only: cookies() only works in Server Actions/Components
  • Use document.cookie in client components to read
  • Last verified: 2025-01-11

スコア

総合スコア

40/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です