一键导入
react-use-effect-discipline
Use when writing, adding, reviewing, or refactoring React Effect Hooks or custom hooks that sync state when values change
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when writing, adding, reviewing, or refactoring React Effect Hooks or custom hooks that sync state when values change
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Use when testing, validating, pressure-testing, or iterating an agent skill by having subagents use it
Use when creating, editing, reviewing, or testing agent skills, skill repositories, SKILL.md files, bootstrap skills, or skill discovery rules
Use when adding backend feature modules, creating tRPC routers, writing Drizzle adapters, defining domain ports or services, or diagnosing backend layer-boundary issues
Use when cleaning, deleting, pruning, or removing files from the repository root `.handoff/` directory
Use when adding a new React TypeScript frontend app to an existing pnpm monorepo or wiring a new app to package/ui
Use when creating a new TypeScript monorepo, initializing a fresh workspace, or bootstrapping apps and packages from an empty directory
基于 SOC 职业分类
| name | react-use-effect-discipline |
| description | Use when writing, adding, reviewing, or refactoring React Effect Hooks or custom hooks that sync state when values change |
Use this skill before writing a new useEffect, useLayoutEffect, or useInsertionEffect, keeping an existing Effect Hook during a refactor, wrapping an Effect inside a custom hook, or reviewing React code that adds effect-like synchronization logic.
Do not use it for non-React code, purely server-side code, or changes that only rename variables inside an already justified Effect without changing its behavior.
Do not write an Effect until you can state the external system it synchronizes with. A user request to "add a useEffect" is implementation wording, not permission to skip this test; satisfy the underlying behavior with a better React pattern when there is no external system.
If there is no external system, remove the Effect and express the behavior through render calculation, event handling, keys, lifted state, a purpose-built hook, or the repository's data fetching abstraction.
useMemo only for expensive pure calculations that are worth caching.key when a conceptual identity changes.useSyncExternalStore or a custom hook for external store subscriptions.key would make the changed identity explicit.useEffect with useLayoutEffect or useInsertionEffect to avoid the decision process.Before finishing work that touched React Effects, report a short evidence block:
Effect discipline:
- Rejected Effects: [count and reason, or "none"]
- Remaining Effect Hooks: [hook/file or "none"]
- External-system sentences: [one per remaining Effect Hook]
- Cleanup/dependency check: [passed or known gap]
Also verify:
reference.md for the React decision table and source summary.pressure-scenario.md for behavior validation.