Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Recoil Pro

ASecurity

Manage React state with Recoil: atoms, selectors, async selectors, and atom families/effects. Use when maintaining Recoil codebases or needing its data-flow graph.

2 stars
0 votes
0 copies
0 views
Added 9/29/2026
ai-agentsgoreactapi

Works with

api

Security Analysis

A100/100

Scanned 9/29/2026

$npx -y skills add aicodedecode/awesome-muse-skills --skill recoil-pro --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Recoil Pro?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Recoil Pro
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/aicodedecode-recoil-pro/badge)](https://www.skillsdirectory.com/skills/aicodedecode-recoil-pro)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: recoil-pro
description: Manage React state with Recoil: atoms, selectors, async selectors, and atom families/effects. Use when maintaining Recoil codebases or needing its data-flow graph.
category: development
---

# Recoil Pro

A practical guide to Recoil: Facebook's experimental-but-widely-used atomic state library — atoms, selectors (sync/async), atom families, and effects. Particularly useful for maintaining existing Recoil codebases and understanding its data-flow graph model.

## Overview

Recoil models state as a **data-flow graph**: **atoms** (units of state, identified by unique string keys) and **selectors** (pure functions deriving from atoms/other selectors, cached per dependency set). Components subscribe via hooks and re-render only when their subscribed values change. Async selectors integrate with Suspense. Note: Recoil's development has slowed (maintenance mode); for new projects, Jotai or Zustand are usually better choices — but large production codebases run on Recoil, and its concepts transfer.

## When to use

- Maintaining an existing Recoil codebase.
- Understanding selector-based derived data (concepts apply to Jotai/others).
- Apps needing the data-flow graph mental model (explicit deps, cached derivations).
- Evaluating migration off Recoil (to Jotai/Zustand).

## Core concepts

- **Atoms.** `const nameState = atom({ key: 'nameState', default: '' })`. Keys must be globally unique — collisions are silent and nasty.
- **Selectors.** `selector({ key: 'upperName', get: ({ get }) => get(nameState).toUpperCase() })` — derived, memoized, recompute only when deps change. `set` for writable selectors.
- **Async selectors.** `get` can be async → Suspense integration. `useRecoilValueLoadable` for manual loading/error states without Suspense.
- **Atom families.** `atomFamily({ key: 'todoState', default: id => fetchTodo(id) })` — parameterized atoms, `todoState(id)` per instance.
- **Effects (`effects_UNSTABLE`).** Per-atom effects: persistence to localStorage, logging, syncing with external stores. The escape hatch for side effects.
- **`useRecoilState` / `useRecoilValue` / `useSetRecoilState` / `useResetRecoilState`.** Split read/write subscriptions like Jotai's hooks.
- **`waitForAll` / `waitForNone`.** Concurrent async selector helpers: `waitForAll([selA, selB])` parallelizes; `waitForNone` gives loadables for partial rendering.

## Practical workflow

**1. Define state with unique keys.**
```ts
import { atom, selector } from 'recoil';

export const todosState = atom<Todo[]>({ key: 'todosState', default: [] });
export const filterState = atom<Filter>({ key: 'filterState', default: 'all' });

export const visibleTodosState = selector({
  key: 'visibleTodosState',
  get: ({ get }) => {
    const todos = get(todosState);
    const filter = get(filterState);
    return filter === 'all' ? todos : todos.filter(t => !t.done);
  },
});
```

**2. Consume.**
```tsx
const visible = useRecoilValue(visibleTodosState);
const setTodos = useSetRecoilState(todosState);
```

**3. Async with loadables.**
```ts
const userQuery = selector({
  key: 'userQuery',
  get: async ({ get }) => api.getUser(get(userIdState)),
});
// component: const loadable = useRecoilValueLoadable(userQuery);
// switch (loadable.state) { case 'loading': ...; case 'hasValue': ...; case 'hasError': ... }
```

**4. Persist via effects.**
```ts
const localStorageEffect = (key) => ({ setSelf, onSet }) => {
  const saved = localStorage.getItem(key);
  if (saved) setSelf(JSON.parse(saved));
  onSet((v) => localStorage.setItem(key, JSON.stringify(v)));
};
```

**5. Debug.** Recoil DevTools / React DevTools: inspect atom values; use snapshots (`useRecoilSnapshot`) in tests to assert state transitions.

## Common pitfalls

- **Duplicate keys.** Two atoms with the same `key` silently share/collide. Namespace keys by feature (`'cart/itemsState'`); consider a lint or helper enforcing prefixes.
- **Selector side effects.** `get` must be pure. Fetching is fine (async get), but writing atoms or mutating external state inside `get` corrupts the graph.
- **Async selector waterfalls.** Sequential dependent selectors suspend one after another. Use `waitForAll` for parallel fetches.
- **Suspense-everywhere.** Async selectors suspend by default; missing boundaries crash. Prefer `useRecoilValueLoadable` at leaves for granular loading UI.
- **Atom family memory.** Families retain every parameterized instance; unbounded params (per-message IDs) leak. Prune or avoid families for unbounded sets.
- **Effects_UNSTABLE instability.** The API is literally marked unstable; behavior changed across versions. Pin the Recoil version and wrap effects in your own helpers.
- **Over-selectoring.** Trivial derivations as selectors add indirection; inline simple computations in components.
- **Migration planning.** If moving to Jotai: atoms map nearly 1:1 (drop keys), selectors map to derived atoms, families to atomFamily. Migrate feature by feature behind the same component APIs.

Attribution

aicodedecodeaicodedecode
View sourceSee grades on GitHubMore from aicodedecode →
SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills DirectorySkills Directory

Ship a skill? Prove it's safe.

Free 120-pattern security scan, letter grade, and an embeddable README badge.

Submit a skill

Related Skills

Caveman

Terse caveman voice: answer first, fluff gone, every technical fact kept. Use for /caveman, "caveman mode", "talk like caveman", "be brief", "less tokens". Stays on until "stop caveman" or "normal mode".

1100021 votes

Hyperplan

Adversarial multi-agent planning skill. Self-orchestrates 5 hostile category members (unspecified-low, unspecified-high, deep, ultrabrain, artistry) via team-mode for ruthless cross-critique debate, distills only the defensible insights, then MANDATORILY hands the distilled insight bundle to the `plan` agent for executable plan formalization. Use when planning needs maximum rigor and surfacing of weak assumptions, blind spots, and over-engineering. Triggers: 'hyperplan', 'hpp', '/hyperplan', ...

698621 votes

Writing Skills

Create and manage Claude Code skills in HASH repository following Anthropic best practices. Use when creating new skills, modifying skill-rules.json, understanding trigger patterns, working with hooks, debugging skill activation, or implementing progressive disclosure. Covers skill structure, YAML frontmatter, trigger types (keywords, intent patterns), UserPromptSubmit hook, and the 500-line rule. Includes validation and debugging with SKILL_DEBUG. Examples include rust-error-stack, cargo-dep...

3931 votes

Mcp Code Execution

Routes multi-tool workflows through MCP servers for large datasets and pipelines. Use when Bash tool overhead is limiting throughput on data-heavy tasks.

3421 votes

catchup

Recovers the conversation and failed tool calls of a previous Codex, Amp, Claude Code, Antigravity, Cline, Copilot CLI, Cursor, DeepSeek Harness, Grok Build, Kimi, OpenCode, Pi Agent, or ZCode session. Use when the user says "catch up", "what did the last session do", "get me up to speed", "I switched agents", asks to recover/summarize a previous session before continuing, or asks to diagnose or report a catchup failure. Do NOT use for the current conversation, git history, or any non-agent log.

741 votes
View all in ai-agents →