Agent skill

Jotai X

by udecode in udecode/kitcn

A skill your agent uses when working with Jotai X stores (createAtomStore), accessing state in components or callbacks, persisting state to cookies or localStorage

Apache-2.0Auto-check passed

Install Jotai X

skills CLI
$ npx skills add udecode/kitcn --skill jotai-x -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install udecode/kitcn jotai-x --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/udecode/kitcn.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/jotai-x .claude/skills/jotai-x && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
jotai-x
GitHub stars
451
Token cost
~3.7k tokens
SKILL.md length
480 words
Files
1
Skills in repo
33
Repo updated
First seen
Licence
Apache-2.0

At a glance

A skill your agent uses when working with Jotai X stores (createAtomStore), accessing state in components or callbacks, persisting state to cookies or localStorage

  • Working with Jotai X stores (createAtomStore)
  • SKILL.md covers Core Principle, When to Use, The Golden Rule and Decision Guide, plus 9 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Accessing state in components

What it does

Jotai X is an agent skill from udecode/kitcn. Use when working with Jotai X stores (createAtomStore), accessing state in components or callbacks, persisting state to cookies or localStorage

Its SKILL.md is about 3.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: Convex + Better Auth + tRPC + Drizzle + TanStack Query + shadcn. The licence is Apache-2.0.

When your agent uses it

  • Working with Jotai X stores (createAtomStore)
  • Accessing state in components
  • Persisting state to cookies

Example prompts

  • “/jotai-x”

What it can do on your machine

Read from SKILL.md and the folder at commit c6010f5. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Jotai X loads about 3.7k tokens when it runs. Until then it costs about 38 tokens; SKILL.md has 480 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~38
When it runs · the whole SKILL.md, loaded when a task matches
~3.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from udecode/kitcn at commit c6010f5, republished under its Apache-2.0 licence (© udecode). 480 words, ~3,664 tokens.

Download SKILL.mdSave it as .claude/skills/jotai-x/SKILL.md (or your agent's skills folder).
name
jotai-x
description
Use when working with Jotai X stores (createAtomStore), accessing state in components or callbacks, persisting state to cookies or localStorage

Jotai X Consumer Patterns

Core Principle

Minimize subscriptions, maximize performance. Use hooks (useValue) only when you need reactivity. Use store methods (store.get, store.set) everywhere else.

When to Use

  • Creating or consuming Jotai X stores (createAtomStore)
  • Accessing state in components, callbacks, or event handlers
  • Choosing between useAppValue vs store.get, useAppSet vs store.set
  • Optimizing component re-renders and subscriptions

The Golden Rule

typescript
// ✅ Subscribe with hooks ONLY when component needs to re-render on change
const count = useAppValue("count"); // Component re-renders when count changes

// ✅ Read without subscribing in callbacks/handlers
const handleClick = () => {
  const count = store.get("count"); // Just reads current value, no subscription
  console.log(count);
};

// ✅ Write with store.set in callbacks/handlers
const handleIncrement = () => {
  store.set("count", (prev) => prev + 1);
};

Decision Guide

Reading State:

  • Need component to re-render when value changes? → useAppValue('key')
  • Just need current value once? → store.get('key')
  • In callback/event handler? → store.get('key')
  • In useEffect? → Usually store.get('key') unless you need dependency

Writing State:

  • All cases → store.set('key', value)

Getting both read + write:

  • Never use useAppState or useAppSet - use combinations above

Quick Reference

ScenarioUseDon't Use
Component needs reactivityuseAppValue('key')store.get('key')
Callback reads oncestore.get('key')useAppValue('key')
Event handler readsstore.get('key')useAppValue('key')
Any write operationstore.set('key', val)useAppSet('key')
Need both read + writeuseAppValue + store.setuseAppState

API Reference

Creating a Store
typescript
import { createAtomStore } from "jotai-x";

export const {
  useChatStore, // Get store instance
  useChatValue, // Subscribe to value (use sparingly!)
  ChatProvider, // Provider component
} = createAtomStore(
  {
    count: 0,
    name: "Alice",
    items: [] as string[],
  },
  {
    name: "chat", // Prefix for all hooks
  }
);
Store Instance API
typescript
const store = useChatStore();

// Read without subscribing
store.get("count"); // Get single value
store.getCount(); // Alternative syntax

// Write
store.set("count", 5); // Set value
store.set("count", (c) => c + 1); // Update with function
store.setCount(5); // Alternative syntax

// Subscribe (rarely needed - prefer useAppValue)
const unsub = store.subscribe("count", (value) => {
  console.log(value);
});
Hook API (Use Sparingly)
typescript
// Subscribe to value (component re-renders on change)
const count = useChatValue("count");

// With selector
const firstItem = useChatValue(
  "items",
  {
    selector: (items) => items[0],
  },
  []
);

// With equality function
const items = useChatValue(
  "items",
  {
    equalityFn: (a, b) => a.length === b.length,
  },
  []
);

Complete Example

typescript
import { createAtomStore } from "jotai-x";

// 1. Create store
export const { useChatStore, useChatValue, ChatProvider } = createAtomStore(
  {
    messages: [] as Message[],
    input: "",
    status: "idle" as "idle" | "loading",
  },
  {
    name: "chat",
  }
);

// 2. Custom hook for complex operations
export const useSendMessage = () => {
  const store = useChatStore();

  return async () => {
    // ✅ Use store.get to read without subscribing
    const input = store.get("input");
    const messages = store.get("messages");

    if (!input.trim()) return;

    // ✅ Use store.set to write
    store.set("status", "loading");
    store.set("input", "");

    try {
      const response = await fetch("/api/chat", {
        method: "POST",
        body: JSON.stringify({ input, messages }),
      });

      const newMessage = await response.json();

      // ✅ Functional update
      store.set("messages", (prev) => [...prev, newMessage]);
      store.set("status", "idle");
    } catch (error) {
      store.set("status", "idle");
      console.error(error);
    }
  };
};

// 3. Component with minimal subscriptions
function ChatMessages() {
  // ✅ Subscribe ONLY to what component needs to render
  const messages = useChatValue("messages");
  const status = useChatValue("status");

  return (
    <div>
      {messages.map((msg) => (
        <Message key={msg.id} {...msg} />
      ))}
      {status === "loading" && <LoadingSpinner />}
    </div>
  );
}

// 4. Component with event handlers
function ChatInput() {
  const store = useChatStore();
  const sendMessage = useSendMessage();

  // ✅ Subscribe to input for controlled input
  const input = useChatValue("input");

  return (
    <form
      onSubmit={(e) => {
        e.preventDefault();
        sendMessage();
      }}
    >
      <input
        value={input}
        onChange={(e) => {
          // ✅ Use store.set directly
          store.set("input", e.target.value);
        }}
      />
      <button
        type="submit"
        onClick={() => {
          // ✅ Can read current value without subscribing
          if (store.get("status") === "loading") {
            return; // Don't submit while loading
          }
        }}
      >
        Send
      </button>
    </form>
  );
}

Common Mistakes

❌ Using hooks in callbacks
typescript
// ❌ WRONG - Creates subscription for no reason
function Component() {
  const count = useChatValue("count"); // Subscribes!

  const handleClick = () => {
    console.log(count); // Uses stale closure
  };
}

// ✅ CORRECT - Read when needed
function Component() {
  const store = useChatStore();

  const handleClick = () => {
    console.log(store.get("count")); // Always current
  };
}
❌ Using useAppState
typescript
// ❌ WRONG - Over-subscribing
const [count, setCount] = useChatState("count");

// ✅ CORRECT - Subscribe only if component needs reactivity
const count = useChatValue("count");
const store = useChatStore();
// Then use store.set('count', ...) to write
❌ Using useAppSet
typescript
// ❌ WRONG - Unnecessary hook call
const setCount = useChatSet("count");
setCount(5);

// ✅ CORRECT - Direct access
const store = useChatStore();
store.set("count", 5);
❌ Over-subscribing
typescript
// ❌ WRONG - Component subscribes to everything
function Component() {
  const input = useChatValue("input");
  const status = useChatValue("status");
  const messages = useChatValue("messages");
  const error = useChatValue("error");

  // But only renders messages and status
  return (
    <div>
      {messages.map((m) => (
        <div key={m.id}>{m.text}</div>
      ))}
      {status === "loading" && <Spinner />}
    </div>
  );
}

// ✅ CORRECT - Subscribe only to what you render
function Component() {
  const messages = useChatValue("messages");
  const status = useChatValue("status");
  // Access input/error with store.get when needed
}

Rationalization Table

ExcuseReality
"README shows useAppValue, so I should use it"README shows all features. Use store.get/set for better performance.
"Hooks are the React way"Hooks for reactivity. Store methods for one-time access. Both are React patterns.
"store.get/set is more advanced"Actually simpler - direct access without subscription overhead.
"Using hooks everywhere is more consistent"Consistency at the cost of performance. Each tool for its purpose.
"Official docs recommend useAppValue"Docs show options. Choose based on whether you need subscription.
"I need the setter from useAppState"Use store.set instead - works everywhere, not just in components.
"I'll optimize later, hooks for now"Wrong pattern from start = tech debt. Use store.get/set from beginning.
"Getting store adds extra line of code"One line enables all direct access. More efficient than multiple hooks.
"What if I need value multiple times?"store.get is instant, no overhead. Call it as many times as needed.
"Hooks auto-subscribe, don't have to think"Thinking prevents bugs. Explicit > implicit. Performance > convenience.
Show full SKILL.md (153 more words)Show less

Red Flags - Check Your Code

If you see any of these patterns, reconsider:

  • useAppState anywhere (almost never needed)
  • useAppSet anywhere (use store.set)
  • useAppValue in a callback/event handler (use store.get)
  • More than 2-3 useAppValue calls in one component (over-subscribing)
  • useAppValue but never using the returned value in JSX (just use store.get)

All of these mean: Switch to store.get or store.set.

Performance Impact

Bad pattern (unnecessary subscriptions):

typescript
function UserProfile() {
  const firstName = useChatValue("firstName");
  const lastName = useChatValue("lastName");
  const email = useChatValue("email");
  const age = useChatValue("age");

  // Component re-renders on ANY change to firstName, lastName, email, OR age
  return (
    <div>
      {firstName} {lastName}
    </div>
  );
}
// Subscribes to 4 atoms, only uses 2 in render

Good pattern (minimal subscriptions):

typescript
function UserProfile() {
  // Only subscribe to what we render
  const firstName = useChatValue("firstName");
  const lastName = useChatValue("lastName");

  // Access others with store.get when needed in callbacks
  const store = useChatStore();

  const handleSubmit = () => {
    const email = store.get("email");
    const age = store.get("age");
    // ...
  };

  return (
    <div>
      {firstName} {lastName}
    </div>
  );
}
// Subscribes to 2 atoms, exactly what we render

Advanced Patterns

Derived Values
typescript
// Custom hook with derived state
export const useChatEmpty = () => {
  // ✅ Subscribe only to values used in computation
  const status = useChatValue("status");
  const messages = useChatValue("messages");
  const hasSubmitted = useChatValue("hasSubmitted");

  return !hasSubmitted && messages.length === 0 && status === "ready";
};
Switching State
typescript
export const useSwitchChat = () => {
  const store = useChatStore();
  const currentChatId = useChatValue("chatId");

  return (chatId: string) => {
    if (chatId === currentChatId) return;

    // ✅ Multiple writes with store.set
    store.set("chatId", chatId);
    store.set("newChatId", null);
    store.set("status", "syncing");
    store.get("actions").setMessages([]);
    store.set("hasSubmitted", false);
  };
};
Complex Operations
typescript
export const useRetry = () => {
  const store = useChatStore();
  // ✅ Subscribe only if we need reactivity for computation
  const messages = useChatValue("messages");

  return async (messageId?: string) => {
    const currentIdx = messageId
      ? messages.findIndex((m) => m.id === messageId)
      : messages.findLastIndex((m) => m.role === "assistant");

    // ✅ Read values with store.get - no subscription needed
    const chatId = store.get("chatId");
    const actions = store.get("actions");

    // Perform async operation...
    await deleteMessages(chatId, messageId);

    // ✅ Write with store.set
    const newMessages = messages.slice(0, currentIdx);
    actions.setMessages(newMessages);
    actions.regenerate();
  };
};

Persistent State

Persist store values to cookies or localStorage by using atomWithCookie or atomWithLocalStorage directly in store definition.

When to Use Which
StorageUse Case
CookieServer-side access needed, SSR hydration, small data
LocalStorageClient-only, larger data, no SSR needed
atomWithCookie (SSR-friendly)

1. Store definition - Replace primitive with atomWithCookie:

typescript
import { atomWithCookie } from "@/lib/utils/atomWithCookie";

export const { useChatStore, useChatValue, ChatProvider } = createAtomStore(
  {
    isOpen: atomWithCookie("chat_isOpen", true), // ✅ Direct assignment
    // ... other state
  },
  { name: "chat" }
);

2. Server-side hydration - Read cookie and pass to Provider:

typescript
// Layout.tsx (Server Component)
import { cookies } from "next/headers";
import { getCookieParser } from "@/lib/utils/getCookieParser";

export async function Layout({ children }) {
  const cookieStore = await cookies();
  const parser = getCookieParser(cookieStore);
  const isOpen = parser.boolean("chat_isOpen") ?? true;

  return <ChatProvider initialValues={{ isOpen }}>{children}</ChatProvider>;
}

Cookie naming convention: prefix_key (e.g., chat_isOpen, chat_mode)

atomWithLocalStorage (Client-only)
typescript
import { atomWithLocalStorage } from "@/lib/utils/atomWithLocalStorage";

export const { useAppStore, useAppValue, AppProvider } = createAtomStore(
  {
    theme: atomWithLocalStorage("app_theme", "light"),
    // ... other state
  },
  { name: "app" }
);

No server hydration needed - localStorage is client-only.

Common Mistakes
typescript
// ❌ WRONG - Don't use extend option for persistence
createAtomStore(
  { isOpen: true },
  {
    name: "chat",
    extend: (atoms) => ({ ...atoms, isOpen: someAtom }), // Unnecessary complexity
  }
);

// ✅ CORRECT - Direct assignment
createAtomStore({ isOpen: atomWithCookie("chat_isOpen", true) }, { name: "chat" });

// ❌ WRONG - Forgetting server hydration with cookies
<ChatProvider initialValues={{}}> // Cookie value ignored on first render

// ✅ CORRECT - Pass server-read value
<ChatProvider initialValues={{ isOpen }}> // Hydrated from cookie

© udecode, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/jotai-x of udecode/kitcn.

Open the folder on GitHubat commit c6010f5

Compare with similar skills

Jotai X next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Jotai X compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Jotai X this skilludecode/kitcn451—~3.7kAutomated safety check: PassApache-2.0
Accessibilityaffaan-m/ECC276k1 repos~1.6kAutomated safety check: PassMIT
Accessibilityaffaan-m/ECC276k—~1.2kAutomated safety check: PassMIT
Accessibilityaffaan-m/ECC276k—~1kAutomated safety check: PassMIT
Accessibilityelastic/kibana21k—~338Automated safety check: PassCustom licence
Accessible Notificationsthedaviddias/Front-End-Checklist74k—~438Automated safety check: PassMIT

Similar skills

  • Accessibility

    affaan-m/ECC

    Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels, accessibility traits and hints, focus management, contrast, target…

    276k GitHub starsUsed in 1 repo~1.6k tokens
    Frontend & DesignAuto-check passed
  • Accessibility

    affaan-m/ECC

    WCAG 2.2 レベル AA 標準を用いてインクルーシブなデジタルプロダクトを設計・実装・監査します。Web 用のセマンティック ARIA および Web・ネイティブプラットフォーム(iOS/Android)のアクセシビリティトレイトを生成するために使用します。

    276k GitHub stars~1.2k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Accessibility

    affaan-m/ECC

    使用 WCAG 2.2 Level AA 标准设计、实施和审计包容性数字产品。运用此技能为 Web 生成语义 ARIA,并为 Web 和原生平台(iOS/Android)生成无障碍特性。

    276k GitHub stars~1k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • Accessibility

    elastic/kibana

    Official

    Accessibility guidance for Kibana. An agent skill from elastic/kibana.

    21k GitHub stars~338 tokensUpdated today
    Frontend & DesignAuto-check passed
  • Accessible Notifications

    thedaviddias/Front-End-Checklist

    A skill your agent uses when reviewing templates, rendered HTML, or shared components related to Make notifications accessible.

    74k GitHub stars~438 tokensUpdated 3 days ago
    Frontend & DesignAuto-check passed
  • Accessible Tooltips

    thedaviddias/Front-End-Checklist

    A skill your agent uses when reviewing templates, rendered HTML, or shared components related to Create accessible tooltips.

    74k GitHub stars~421 tokensUpdated 3 days ago
    Frontend & DesignAuto-check passed

More from udecode/kitcn

All 33 skills in this repo
  • Walkthrough

    udecode/kitcn

    Create a short annotated visual walkthrough from real final-state screenshots or rendered artifacts.

    451 GitHub stars~1.6k tokensUpdated 8 days ago
    Auto-check passed
  • Avoid Feature Creep

    udecode/kitcn

    Prevent feature creep when building software, apps, and AI-powered products.

    451 GitHub stars~2.7k tokensUpdated 8 days ago
    Auto-check passed
  • Changeset Resolve

    udecode/kitcn

    Repair an unreleased .changeset/.md file so it matches the real branch delta against main.

    451 GitHub stars~922 tokensUpdated 8 days ago
    Auto-check passed
  • Audit newer Convex npm releases against kitcn. An agent skill from udecode/kitcn.

    451 GitHub stars~1.8k tokensUpdated 8 days ago
    Auto-check passed
  • Linear Backlog

    udecode/kitcn

    Run a scoped Linear backlog autonomously as a sequence of maximal safe parallel batches by composing orchestrator, autogoal, and task.

    451 GitHub stars~3.1k tokensUpdated 8 days ago
    Auto-check passed
  • Nextjs

    udecode/kitcn

    Next.js routing with typed routes, PageProps, LayoutProps helpers, and nuqs for URL state.

    451 GitHub stars~1.4k tokensUpdated 8 days ago
    Auto-check passed

Questions about Jotai X

What does Jotai X do?

A skill your agent uses when working with Jotai X stores (createAtomStore), accessing state in components or callbacks, persisting state to cookies or localStorage. Jotai X is an agent skill from udecode/kitcn.

When should I use Jotai X?

Jotai X fits situations like: working with Jotai X stores (createAtomStore); accessing state in components; persisting state to cookies.

How do I install Jotai X in Claude Code?

Run `npx skills add udecode/kitcn --skill jotai-x -a claude-code`. Or copy the skill folder (.agents/skills/jotai-x in udecode/kitcn) into .claude/skills/jotai-x in your project. Claude Code loads it when a task matches its description.

How do I install Jotai X in Codex?

Run `npx skills add udecode/kitcn --skill jotai-x -a codex`. Or copy the skill folder (.agents/skills/jotai-x in udecode/kitcn) into .agents/skills/jotai-x in your project. Codex loads it when a task matches its description.

Can I use Jotai X in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add udecode/kitcn --skill jotai-x -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/jotai-x, .gemini/skills/jotai-x, .github/skills/jotai-x and .opencode/skills/jotai-x in your project.

What does Jotai X need to run?

SKILL.md names no scripts, command-line tools or credentials: Jotai X is instructions for the agent only.

Does Jotai X access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Jotai X safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Jotai X use?

Jotai X is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Jotai X use?

About 3.7k tokens (SKILL.md is roughly 15k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Jotai X?

Skills that share tags, products or a category with Jotai X: Accessibility (affaan-m/ECC, 276k stars), Accessibility (affaan-m/ECC, 276k stars), Accessibility (affaan-m/ECC, 276k stars) and Accessibility (elastic/kibana, 21k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Jotai X?

udecode (a GitHub organization) maintains it in udecode/kitcn, which has 451 GitHub stars. The repository holds 33 skills in this directory. The repository was last updated on October 1, 2026.

Source: udecode/kitcn on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.