ワンクリックで
add-atom
Add a new Jotai atom to the state system with type definitions, registry, and Store API access
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Add a new Jotai atom to the state system with type definitions, registry, and Store API access
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Create a new card part within a section with factory/class pattern, Card wrapper, and proper cleanup
Create a reusable UI component with factory pattern, theme compatibility, and proper cleanup
Scaffold a new toggleable feature with full structure, storage, API exposure, and bootstrap registration
Create a reactive global variable that derives from atoms with subscription support
Create a game UI injection that modifies existing game elements with proper cleanup
Create a new core infrastructure module with standard API, lazy init, and proper structure
| name | add-atom |
| description | Add a new Jotai atom to the state system with type definitions, registry, and Store API access |
| aliases | ["new-atom","create-atom"] |
/add-atom <atomName>
What state does this atom hold?
Brief description:
Where does the data come from?
A) Game WebSocket - Captured from server messages
B) User input - Settings, preferences
C) Derived - Computed from other atoms
D) Internal - Module/feature internal state
How often does this atom update?
A) Rarely - User actions only
B) Occasionally - Every few seconds
C) Frequently - Multiple times per second
→ If C: Consider adding a Signature function
Should this atom be exposed in window.Gemini?
A) Yes - Part of public API
B) No - Internal only
src/atoms/types.ts// 1. Add to AtomKey union
export type AtomKey =
| "existingAtom"
| "<atomName>" // Add this
// ...
// 2. Define the state type
export interface <AtomName>State {
// Define fields
}
// 3. Add to AtomTypeMap
export interface AtomTypeMap {
existingAtom: ExistingState;
<atomName>: <AtomName>State; // Add this
// ...
}
src/atoms/atoms.tsimport { atom } from 'jotai';
import type { <AtomName>State } from './types';
export const <atomName>Atom = atom<<AtomName>State | null>(null);
src/atoms/lookup.tsimport { <atomName>Atom } from './atoms';
export const atomRegistry = {
// ... existing
<atomName>: <atomName>Atom,
} as const;
src/atoms/index.tsexport { <atomName>Atom } from './atoms';
export type { <AtomName>State } from './types';
src/atoms/signature.tsimport type { <AtomName>State } from './types';
/**
* Returns a stable hash for change detection
* Only reacts to meaningful changes, not every tick
*/
export function get<AtomName>Signature(state: <AtomName>State | null): string {
if (!state) return 'null';
// Hash only fields that matter
return `${state.id}-${state.version}`;
}
src/atoms/view.tsimport type { <AtomName>State } from './types';
export interface <AtomName>View {
// UI-friendly format
items: string[];
total: number;
}
export function get<AtomName>View(state: <AtomName>State | null): <AtomName>View {
if (!state) return { items: [], total: 0 };
return {
items: state.items.map(item => item.name),
total: state.items.length,
};
}
AtomKey type in types.tsAtomTypeMap in types.tsatoms.ts with atom<T | null>(null)lookup.tsindex.ts (if public)Store.select('<atomName>') worksStore.set('<atomName>', value) worksStore.subscribe('<atomName>', callback) works// Read
const value = await Store.select('<atomName>');
// Write
await Store.set('<atomName>', newValue);
// Subscribe
const unsub = await Store.subscribe('<atomName>', (value) => {
console.log('Changed:', value);
});
// Cleanup
unsub();
.claude/rules/state/atoms.mdsrc/atoms/src/atoms/store.ts