NEW Browse AI tools across categories — updated daily. See what's new →

Presets

Pre-built atom shapes — `openAtom` (boolean toggle), `loadingAtom` (loading flag), `fetchingAtom` (full fetch lifecycle), and `portalAtom` (modal/drawer coordinator) — and when to reach for each. T...

Version1.0.0
LicenseMIT
Token count~1,322
UpdatedJun 5, 2026

Pre-built atom shapes — `openAtom` (boolean toggle), `loadingAtom` (loading flag), `fetchingAtom` (full fetch lifecycle), and `portalAtom` (modal/drawer coordinator) — and when to reach for each. TRIGGER when: code imports or calls `openAtom`, `loadingAtom`, `fetchingAtom`, or `portalAtom` from `@mongez/react-atom`; code uses `useOpened`, `useLoading`, `useData`, `useError`, `usePagination`, `startLoading`, `stopLoading`, `toggleLoading`, `success`, `failed`, `append`, `prepend`, or `toggle` ...

Install

Quick install

via npx skills · works with 57+ agents
npx skills add https://github.com/hassanzohdy/mongez-atomic-query
Or pick agent:
npx skills add hassanzohdy/mongez-atomic-query --agent claude-code
npx skills add hassanzohdy/mongez-atomic-query --agent cursor
npx skills add hassanzohdy/mongez-atomic-query --agent codex
npx skills add hassanzohdy/mongez-atomic-query --agent opencode
npx skills add hassanzohdy/mongez-atomic-query --agent github-copilot
npx skills add hassanzohdy/mongez-atomic-query --agent windsurf
More install options

Shorthand — useful for multi-skill repos:

npx skills add hassanzohdy/mongez-atomic-query

Manual — clone the repo and drop the folder into your agent's skills directory:

git clone https://github.com/hassanzohdy/mongez-atomic-query.git
cp -r mongez-atomic-query ~/.claude/skills/
How to use: Once installed, ask your agent to "use the Presets skill" or describe what you want (e.g. "Pre-built atom shapes — `openAtom` (boolean toggle), `loadingAtom` (loading flag"). Requires Node.js 18+.

Presets

Pre-built atom shapes — openAtom (boolean toggle), loadingAtom (loading flag), fetchingAtom (full fetch lifecycle), and portalAtom (modal/drawer coordinator) — and when to reach for each.
TRIGGER when: code imports or calls openAtom, loadingAtom, fetchingAtom, or portalAtom from @mongez/react-atom; code uses useOpened, useLoading, useData, useError, usePagination, startLoading, stopLoading, toggleLoading, success, failed, append, prepend, or toggle ...

---
name: mongez-react-atom-presets
description: |
Pre-built atom shapes — openAtom (boolean toggle), loadingAtom (loading flag), fetchingAtom (full fetch lifecycle), and portalAtom (modal/drawer coordinator) — and when to reach for each.
TRIGGER when: code imports or calls openAtom, loadingAtom, fetchingAtom, or portalAtom from @mongez/react-atom; code uses useOpened, useLoading, useData, useError, usePagination, startLoading, stopLoading, toggleLoading, success, failed, append, prepend, or toggle methods on a preset atom; user asks "how do I make a toggle / open-close atom", "how do I model a loading flag", "how do I do a fetch lifecycle with isLoading/data/error", or "how do I coordinate a modal/drawer"; typical import import { openAtom, portalAtom } from "@mongez/react-atom".
SKIP: hand-rolling a custom action atom from scratch — use mongez-react-atom-atoms; richer cache-keyed server state (invalidation, refetch on focus) belongs in @mongez/atomic-query, not fetchingAtom; SSR scoping/hydration of preset atoms still uses mongez-react-atom-ssr; end-to-end flow examples use mongez-react-atom-recipes.
---

Preset atoms

Four pre-built atom shapes that collapse common patterns to one line.

openAtom

A boolean-shaped toggle with open, close, toggle, and a useOpened() hook.

import { openAtom } from "@mongez/react-atom";

const sidebar = openAtom("sidebar", /* defaultOpened */ false);

// Anywhere:
sidebar.open();
sidebar.close();
sidebar.toggle();

// In components:
function Sidebar() {
  const opened = sidebar.useOpened();
  return opened ? <Drawer /> : null;
}

Equivalent to writing:

const sidebar = atom<boolean, { open(): void; close(): void; toggle(): void; useOpened(): boolean }>({
  key: "sidebar",
  default: false,
  actions: {
    open()   { this.update(true); },
    close()  { this.update(false); },
    toggle() { this.update(!this.value); },
    useOpened() { return (this as any).useValue(); },
  },
});

loadingAtom

A boolean with startLoading / stopLoading / toggleLoading verbs.

import { loadingAtom } from "@mongez/react-atom";

const usersLoading = loadingAtom("usersLoading");

async function fetchUsers() {
  usersLoading.startLoading();
  try {
    const users = await api.users.list();
    setUsers(users);
  } finally {
    usersLoading.stopLoading();
  }
}

fetchingAtom

A full fetch lifecycle: isLoading, data, error, optional pagination. Comes with startLoading, stopLoading, success(data, pagination?), failed(error), append(data), prepend(data), plus hooks useLoading(), useData(), useError(), usePagination().

import { fetchingAtom } from "@mongez/react-atom";

type User = { id: number; name: string };
const usersAtom = fetchingAtom<User[]>("users");

async function loadUsers() {
  usersAtom.startLoading();
  try {
    const { data, pagination } = await api.users.list();
    usersAtom.success(data, pagination);
  } catch (err) {
    usersAtom.failed(err);
  }
}

function UsersList() {
  const isLoading = usersAtom.useLoading();
  const data = usersAtom.useData();
  const error = usersAtom.useError();
  if (isLoading) return <Spinner />;
  if (error) return <ErrorBox e={error} />;
  return <ul>{data?.map(u => <li key={u.id}>{u.name}</li>)}</ul>;
}

For richer cache management, prefer @mongez/atomic-query. fetchingAtom is for one-off fetch flows; queryAtom.useQuery is for keyed cache.

portalAtom

A coordinator atom for modals, drawers, tooltips, dropdowns. Holds { opened: boolean, data: T } and exposes open(data?), close(), toggle(data?), useOpened(), useData().

import { portalAtom } from "@mongez/react-atom";

type DeleteData = { userId: number; userName: string };
const deleteUserModal = portalAtom<DeleteData>("deleteUserModal");

// Anywhere:
deleteUserModal.open({ userId: 7, userName: "Alice" });

function ConfirmDeleteUser() {
  const opened = deleteUserModal.useOpened();
  const { userId, userName } = deleteUserModal.useData();
  if (!opened) return null;
  return (
    <Dialog>
      <p>Delete {userName}?</p>
      <button onClick={() => deleteUserModal.close()}>Cancel</button>
      <button onClick={async () => { await api.users.remove(userId); deleteUserModal.close(); }}>
        Delete
      </button>
    </Dialog>
  );
}

Each portalAtom key is suffixed with -portal internally, so portalAtom("deleteUser") creates an atom whose key is deleteUser-portal.

---

Source: https://github.com/hassanzohdy/mongez-atomic-query
Author: hassanzohdy
Discovered via: skillsdirectory.com
Genre: development

SKILL.md source

---
name: Presets
description: Pre-built atom shapes — `openAtom` (boolean toggle), `loadingAtom` (loading flag), `fetchingAtom` (full fetch lifecycle), and `portalAtom` (modal/drawer coordinator) — and when to reach for each. T...
---

# Presets

Pre-built atom shapes — `openAtom` (boolean toggle), `loadingAtom` (loading flag), `fetchingAtom` (full fetch lifecycle), and `portalAtom` (modal/drawer coordinator) — and when to reach for each.
TRIGGER when: code imports or calls `openAtom`, `loadingAtom`, `fetchingAtom`, or `portalAtom` from `@mongez/react-atom`; code uses `useOpened`, `useLoading`, `useData`, `useError`, `usePagination`, `startLoading`, `stopLoading`, `toggleLoading`, `success`, `failed`, `append`, `prepend`, or `toggle` ...

---
name: mongez-react-atom-presets
description: |
  Pre-built atom shapes — `openAtom` (boolean toggle), `loadingAtom` (loading flag), `fetchingAtom` (full fetch lifecycle), and `portalAtom` (modal/drawer coordinator) — and when to reach for each.
  TRIGGER when: code imports or calls `openAtom`, `loadingAtom`, `fetchingAtom`, or `portalAtom` from `@mongez/react-atom`; code uses `useOpened`, `useLoading`, `useData`, `useError`, `usePagination`, `startLoading`, `stopLoading`, `toggleLoading`, `success`, `failed`, `append`, `prepend`, or `toggle` methods on a preset atom; user asks "how do I make a toggle / open-close atom", "how do I model a loading flag", "how do I do a fetch lifecycle with isLoading/data/error", or "how do I coordinate a modal/drawer"; typical import `import { openAtom, portalAtom } from "@mongez/react-atom"`.
  SKIP: hand-rolling a custom action atom from scratch — use `mongez-react-atom-atoms`; richer cache-keyed server state (invalidation, refetch on focus) belongs in `@mongez/atomic-query`, not `fetchingAtom`; SSR scoping/hydration of preset atoms still uses `mongez-react-atom-ssr`; end-to-end flow examples use `mongez-react-atom-recipes`.
---
# Preset atoms

Four pre-built atom shapes that collapse common patterns to one line.

## `openAtom`

A boolean-shaped toggle with `open`, `close`, `toggle`, and a `useOpened()` hook.

```ts
import { openAtom } from "@mongez/react-atom";

const sidebar = openAtom("sidebar", /* defaultOpened */ false);

// Anywhere:
sidebar.open();
sidebar.close();
sidebar.toggle();

// In components:
function Sidebar() {
  const opened = sidebar.useOpened();
  return opened ? <Drawer /> : null;
}
```

Equivalent to writing:

```ts
const sidebar = atom<boolean, { open(): void; close(): void; toggle(): void; useOpened(): boolean }>({
  key: "sidebar",
  default: false,
  actions: {
    open()   { this.update(true); },
    close()  { this.update(false); },
    toggle() { this.update(!this.value); },
    useOpened() { return (this as any).useValue(); },
  },
});
```

## `loadingAtom`

A boolean with `startLoading` / `stopLoading` / `toggleLoading` verbs.

```ts
import { loadingAtom } from "@mongez/react-atom";

const usersLoading = loadingAtom("usersLoading");

async function fetchUsers() {
  usersLoading.startLoading();
  try {
    const users = await api.users.list();
    setUsers(users);
  } finally {
    usersLoading.stopLoading();
  }
}
```

## `fetchingAtom`

A full fetch lifecycle: `isLoading`, `data`, `error`, optional `pagination`. Comes with `startLoading`, `stopLoading`, `success(data, pagination?)`, `failed(error)`, `append(data)`, `prepend(data)`, plus hooks `useLoading()`, `useData()`, `useError()`, `usePagination()`.

```ts
import { fetchingAtom } from "@mongez/react-atom";

type User = { id: number; name: string };
const usersAtom = fetchingAtom<User[]>("users");

async function loadUsers() {
  usersAtom.startLoading();
  try {
    const { data, pagination } = await api.users.list();
    usersAtom.success(data, pagination);
  } catch (err) {
    usersAtom.failed(err);
  }
}

function UsersList() {
  const isLoading = usersAtom.useLoading();
  const data = usersAtom.useData();
  const error = usersAtom.useError();
  if (isLoading) return <Spinner />;
  if (error) return <ErrorBox e={error} />;
  return <ul>{data?.map(u => <li key={u.id}>{u.name}</li>)}</ul>;
}
```

For richer cache management, prefer [`@mongez/atomic-query`](https://github.com/hassanzohdy/mongez-atomic-query). `fetchingAtom` is for one-off fetch flows; `queryAtom.useQuery` is for keyed cache.

## `portalAtom`

A coordinator atom for modals, drawers, tooltips, dropdowns. Holds `{ opened: boolean, data: T }` and exposes `open(data?)`, `close()`, `toggle(data?)`, `useOpened()`, `useData()`.

```ts
import { portalAtom } from "@mongez/react-atom";

type DeleteData = { userId: number; userName: string };
const deleteUserModal = portalAtom<DeleteData>("deleteUserModal");

// Anywhere:
deleteUserModal.open({ userId: 7, userName: "Alice" });

function ConfirmDeleteUser() {
  const opened = deleteUserModal.useOpened();
  const { userId, userName } = deleteUserModal.useData();
  if (!opened) return null;
  return (
    <Dialog>
      <p>Delete {userName}?</p>
      <button onClick={() => deleteUserModal.close()}>Cancel</button>
      <button onClick={async () => { await api.users.remove(userId); deleteUserModal.close(); }}>
        Delete
      </button>
    </Dialog>
  );
}
```

Each `portalAtom` key is suffixed with `-portal` internally, so `portalAtom("deleteUser")` creates an atom whose key is `deleteUser-portal`.


---

**Source**: https://github.com/hassanzohdy/mongez-atomic-query
**Author**: hassanzohdy
**Discovered via**: skillsdirectory.com
**Genre**: development

Related skills 6

caveman

★ Featured

Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.

juliusbrussee 167k
Development

secure-linux-web-hosting

★ Featured

Use when setting up, hardening, or reviewing a cloud server for self-hosting, including DNS, SSH, firewalls, Nginx, static-site hosting, reverse-proxying an app, HTTPS with Let's Encrypt or ACME clients, safe HTTP-to-HTTPS redirects, or optional post-launch network tuning such as BBR.

xixu-me 155k
Development

readme-i18n

★ Featured

Use when the user wants to translate a repository README, make a repo multilingual, localize docs, add a language switcher, internationalize the README, or update localized README variants in a GitHub-style repository.

xixu-me 155k
Development

lark-shared

★ Featured

Use when first setting up lark-cli, running auth login, switching user/bot identity (--as), handling permission denied or scope errors, needing to update lark-cli, or seeing _notice in JSON output.

larksuite 155k
Development

improve-codebase-architecture

★ Featured

Find deepening opportunities in a codebase, informed by the domain language in CONTEXT.md and the decisions in docs/adr/. Use when the user wants to improve architecture, find refactoring opportunities, consolidate tightly-coupled modules, or make a codebase more testable and AI-navigable.

mattpocock 151k
Development

paper-context-resolver

★ Featured

Optional RigorPilot helper for README-first deep learning repo reproduction. Use only when the README and repository files leave a narrow reproduction-critical gap and the task is to resolve a specific paper detail such as dataset split, preprocessing, evaluation protocol, checkpoint mapping, or runtime assumption from primary paper sources while recording conflicts. Do not use for general paper summary, repo scanning, environment setup, command execution, title-only paper lookup, or replacin...

lllllllama 127k
Development