hassanzohdy/atom/atoms

Claude Code and agent skill by hassanzohdy/atom

Trust tier 3
  • community
  • ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Source check pending

Checking that the SKILL.md file is still in the repository.

Full reference for `createAtom` — signature, base methods, object-only methods, lifecycle events, registry helpers, and usage examples.

Install

npx vskill@latest install hassanzohdy/atom/atoms

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

Atoms

The flagship export: createAtom(options).

Signature

ts
createAtom<Value, Actions>(options: AtomOptions<Value, Actions>): Atom<Value, Actions>
ts
type AtomOptions<V, A> = {
key: string;
default: V;
actions?: A & ThisType<Atom<V, A>>;
beforeUpdate?: (next: V, prev: V, atom: Atom<V, A>) => V | void;
onUpdate?: (callback: AtomChangeCallback<V, A>) => EventSubscription;
get?: (key: string, defaultValue?: V, atomValue?: V) => V;
persist?: PersistOption<V>;
persistHydration?: "immediate" | "deferred"; // when the stored value is read; default "immediate"
register?: boolean; // false = local atom, kept out of the global registry
};

Base methods (always present)

MethodDescription
atom.keyThe unique key passed to createAtom.
atom.valueCurrent value (getter).
atom.defaultValueThe initial default (getter, never mutates).
atom.currentValueSame as value but a plain property — exposed for hot-paths.
`atom.update(next \(prev, atom) => next)`Set the value and emit an update event. Updater function is supported.
atom.silentUpdate(next)Set the value WITHOUT emitting the update event. Used for hydration / time-travel.
atom.reset()Restore default. Emits both update + reset events.
atom.silentReset()Restore default without emitting update; still emits reset.
atom.onChange(cb)Subscribe to updates. Returns { unsubscribe }.
atom.onReset(cb) / atom.onDestroy(cb)Specific lifecycle hooks.
atom.clone({ register?, seed? })Deep-clone into a new atom with key ${key}.clone.{n}. Pass register: false to skip the global registry and seed: "default" to start from the default value instead of the current one — both used by AtomStore.
atom.hydratePersisted()Read the persist adapter once and apply the stored value (needed with persistHydration: "deferred").
atom.destroy()Remove from the registry, unsubscribe this atom's own update / reset / delete topics (its clones keep theirs).
atom.type`"object" \"array" \typeof primitive` — set at construction time.
atom.lengthWhen the value is an array/string.

Object-only methods (conditional)

These exist only when V is an object or array — Atom<boolean> does not carry them.

MethodDescription
atom.merge(partial)Shallow merge into the value, emit update.
atom.change(key, value)Set one own property of the value, emit update.
atom.silentChange(key, value)Same without emitting update.
atom.get(key, default?)Read one own property (or via custom get(...) if provided).
atom.watch(key, cb)Subscribe to changes of a single key. Returns { unsubscribe }.

Lifecycle events (via @mongez/events)

Events are namespaced as atoms.${key}.${type}:

  • atoms.${key}.update — fired by update/change/merge.
  • atoms.${key}.reset — fired by reset/silentReset.
  • atoms.${key}.delete — fired by destroy.

Namespace matching is segment-aware, so destroying users.1 does NOT also destroy users.10.

Examples

Primitive atom with action verbs
ts
const counter = createAtom({
key: "counter",
default: 0,
actions: {
increment() { this.update(this.value + 1); },
decrement() { this.update(this.value - 1); },
addTen() { this.update(prev => prev + 10); },
},
});
counter.increment();
counter.value; // 1
Object atom with watch + merge
ts
const user = createAtom({
key: "auth.user",
default: { name: "Anon", lastSeen: 0 },
});
user.watch("name", (next, prev) => console.log(`Name: ${prev} → ${next}`));
user.merge({ name: "Alice" });
// "Name: Anon → Alice"
beforeUpdate validator
ts
const port = createAtom({
key: "config.port",
default: 3000,
beforeUpdate(next) {
if (next < 1 || next > 65535) return; // void = keep next
return Math.floor(next);
},
});
port.update(8443.7); // value becomes 8443
port.update(999999); // ignored, stays 8443
Registry helpers
ts
getAtom("auth.user"); // Atom | undefined
atomsList(); // Atom[]
atomsObject(); // Record<string, Atom>

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Extension points

  • hookPre/post lifecycle hooks

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/hassanzohdy/atom/atoms/badge)](https://verified-skill.com/skills/hassanzohdy/atom/atoms)

Something wrong with this skill or its page? Tell us.