en un clic
react-principles
// React best practices for component design, state management, and Effect discipline. Use when writing, reviewing, or refactoring React components, custom hooks, or any .ts/.tsx/.js/.jsx file that uses React.
// React best practices for component design, state management, and Effect discipline. Use when writing, reviewing, or refactoring React components, custom hooks, or any .ts/.tsx/.js/.jsx file that uses React.
Auto-trigger this skill when the user's input is vague, ambiguous, incomplete, or too brief to act on reliably in Codex. Indicators: single-sentence requests with no success criteria, missing target files or scope, unclear intent ("fix this", "make it better", "help me"), mixed unrelated asks in one message, or prompts that would force Codex to guess critical details. Do NOT trigger when the user's intent, scope, and done-state are already clear — even if the prompt is short.
去除文本中的 AI 生成痕迹。适用于编辑或审阅文本,使其听起来更自然、更像人类书写。 基于维基百科的"AI 写作特征"综合指南。检测并修复以下模式:夸大的象征意义、 宣传性语言、以 -ing 结尾的肤浅分析、模糊的归因、破折号过度使用、三段式法则、 AI 词汇、否定式排比、过多的连接性短语。
Apply when the task requires implementing net-new behavior — features, modules, endpoints, integrations, or any additive change. Drives development through strict red-green-refactor with test-first slicing and deterministic verification.
Spawn a subagent to produce high-quality project documentation (README, integration guide, tutorials, product docs) from the current repo state.
Improve UI/UX aesthetics and hierarchy (color, spacing, typography, layout, components) from UI code or specs. Trigger when the user asks to beautify/polish/refine/modernize the UI, wants a minimal/enterprise look, or reports the UI is messy/inconsistent/cluttered.
Track recently updated airdrop projects from CryptoRank (last 3 days). Save report locally, then send a concise Telegram notification.
| name | react-principles |
| description | React best practices for component design, state management, and Effect discipline. Use when writing, reviewing, or refactoring React components, custom hooks, or any .ts/.tsx/.js/.jsx file that uses React. |
(props, state) → JSX. Render must be side-effect-free.Prefer storing IDs/primitives; derive full objects at render time.
useEffect is for synchronizing with external systems only — DOM APIs, network connections, third-party widgets, browser subscriptions. It is not a lifecycle hook and not a data-transformation pipeline.
Why does this code run?
- Because the user did something → event handler
- Because the component must stay in sync with something external → Effect
| Antipattern | Correct approach |
|---|---|
Derived state via useEffect + useState | Compute during render; useMemo if expensive |
| State reset on prop change via Effect | key prop |
| Partial state adjustment on prop change | Store primitive ID; derive object during render |
| Shared event logic routed through state+Effect | Extract a plain function; call from event handlers |
| User-initiated POST in Effect | Move directly into the event handler |
| Effect chains (A → Effect → B → Effect → C) | Compute all next state in one event handler |
| Parent notification via Effect | Call both setters in the same event handler; or lift state |
| Pushing data up to parent via Effect | Parent fetches; passes data down as prop |
| One-time app init in component Effect | Module-level or didInit guard outside component |
| External store subscription via Effect | useSyncExternalStore |
| Data fetch without cleanup | ignore flag cleanup; prefer framework data-fetching |
react-hooks/exhaustive-deps — fix the code.Load these files when deeper guidance is needed for the specific topic at hand:
useEffectEvent: see references/separating.md