---
name: "recoil-selectors-async-state"
description: "Manage fine-grained state graphs in React using Recoil atoms and pure functional selectors."
metadata:
  author: "Meta"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "create recoil atom selector"
  - "async selector recoil suspense"
  - "recoil atomfamily"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# Recoil Atoms, Selectors & Asynchronous Data Queries

Configures Meta Recoil: defining atoms and atomFamily, synchronous and asynchronous selectors, snapshot navigation, handling suspense boundaries, and synchronizing state across sibling component trees.

## When to Invoke
Invoke this skill whenever you need to:
- create recoil atom selector
- async selector recoil suspense
- recoil atomfamily

## Execution SOP & Rules
1. Declare atom: const textState = atom({ key: 'textState', default: '' }).
2. Declare selector: const charCountState = selector({ key: 'charCountState', get: ({get}) => get(textState).length }).
3. Consume state with useRecoilState(textState) or read-only useRecoilValue(charCountState).
4. Wrap root component tree in <RecoilRoot>.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
