Agent SkillsAjayIrkal23/agentic-mercy-10x › react-hooks-patterns

react-hooks-patterns

GitHub

指导 React 组件中状态、副作用、引用及自定义 Hook 的选择与实现,涵盖审查效果安全性、闭包问题及派生状态,确保 Hook 模式的安全性与可维护性。

skills/react-hooks-patterns/SKILL.md AjayIrkal23/agentic-mercy-10x

Trigger Scenarios

React 组件需要本地状态或副作用 选择 useState、useReducer 或自定义 Hook 审查效果安全性或闭包问题

Install

npx skills add AjayIrkal23/agentic-mercy-10x --skill react-hooks-patterns -g -y
More Options

Use without installing

npx skills use AjayIrkal23/agentic-mercy-10x@react-hooks-patterns

指定 Agent (Claude Code)

npx skills add AjayIrkal23/agentic-mercy-10x --skill react-hooks-patterns -a claude-code -g -y

安装 repo 全部 skill

npx skills add AjayIrkal23/agentic-mercy-10x --all -g -y

预览 repo 内 skill

npx skills add AjayIrkal23/agentic-mercy-10x --list

SKILL.md

Frontmatter
{
    "name": "react-hooks-patterns",
    "schema": 1,
    "category": "frontend",
    "surfaces": [
        "frontend"
    ],
    "triggers": {
        "paths": [
            ".hook.",
            ".jsx",
            ".tsx",
            "\/components\/",
            "\/hooks\/use",
            "\/pages\/",
            "\/src\/hooks\/",
            "\/store\/",
            "\/views\/",
            "reducer.",
            "redux",
            "selector.",
            "slice.",
            "use-",
            "useHook"
        ],
        "intents": [
            "frontend"
        ],
        "keywords": [
            "component",
            "custom",
            "effects",
            "extraction",
            "hook",
            "hooks",
            "implementing",
            "memoization",
            "patterns",
            "react",
            "reducers",
            "refs",
            "reviewing",
            "state"
        ]
    },
    "platforms": [
        "linux",
        "darwin",
        "windows"
    ],
    "token-cost": 460,
    "description": "ALWAYS invoke when implementing or reviewing React component state, effects, refs, reducers, memoization, or custom hook extraction.",
    "disable-model-invocation": false
}

React Hooks Patterns

Use When

  • A React component needs local state or side effects.
  • You are choosing between useState, useReducer, refs, memoization, or a custom hook.
  • You are reviewing effect safety, stale closures, or derived state.
  • A frontend architecture or planning task needs explicit decisions about state ownership, effect boundaries, or custom hook extraction.

Do Not Use

  • Styling-only changes.
  • General frontend architecture without hook complexity.
  • Framework-managed server data that should live outside local effects.

Owns

  • Safe hook selection and effect hygiene.
  • Derived-state discipline and custom hook extraction.
  • Memoization decisions that are justified by behavior, not habit.

Does Not Own

  • Module boundaries and file layout.
  • Backend or API contract design.
  • Visual styling or Tailwind implementation details.

Combine With

  • architect-system-design when frontend planning must account for state ownership, effect boundaries, or custom hook extraction.
  • frontend-standards-always-follow for the always-on frontend baseline.
  • frontend-structure-standards for where logic belongs.
  • frontend-server-data-patterns when the component mirrors backend query state.
  • debug-investigation for stale closure or effect regressions.

Workflow

  1. Prefer the simplest state model that matches the behavior.
  2. Avoid effects when render or event logic is enough.
  3. Do not store derived state that can be computed from current inputs.
  4. Treat useMemo and useCallback as conditional tools, not defaults.
  5. Extract a custom hook when logic becomes reusable or hard to read inline.

Output Contract

  • The chosen hook pattern and why it fits.
  • Any effect dependencies, cleanup needs, or stale-closure risks.
  • A recommendation for custom hook extraction when appropriate.

Version History

  • 581d130 Current 2026-07-19 09:13

Same Skill Collection

attic/2026-07-09/skills-pre-update/taste-skill/SKILL.md
attic/2026-07-09/skills-pre-update/ui-ux-pro-max/SKILL.md
skills/agent-development/SKILL.md
skills/api-and-interface-design/SKILL.md
skills/api-contract-standards/SKILL.md
skills/architect-system-design/SKILL.md
skills/backend-api-standards/SKILL.md
skills/backend-code-review/SKILL.md
skills/backend-error-handling/SKILL.md
skills/backend-performance-standards/SKILL.md
skills/backend-standards-always-follow/SKILL.md
skills/canary-playwright/SKILL.md
skills/caveman/SKILL.md
skills/ci-cd-and-automation/SKILL.md
skills/code-execution-standard/SKILL.md
skills/code-review-and-quality/SKILL.md
skills/code-simplification/SKILL.md
skills/codebase-design/SKILL.md
skills/codebase-start-point-guide/SKILL.md
skills/command-development/SKILL.md
skills/composition-patterns/SKILL.md
skills/context-engineering/SKILL.md
skills/dead-code-and-change-audit/SKILL.md
skills/debug-investigation/SKILL.md
skills/debugging-and-error-recovery/SKILL.md
skills/deprecation-and-migration/SKILL.md
skills/design-extract/SKILL.md
skills/design-review-playwright/SKILL.md
skills/diagnose/SKILL.md
skills/documentation-and-adrs/SKILL.md
skills/domain-modeling/SKILL.md
skills/domain-scaffold-patterns/SKILL.md
skills/doubt-driven-development/SKILL.md
skills/dox-doc-tree/SKILL.md
skills/eval-harness/SKILL.md
skills/fix-lint-format/SKILL.md
skills/forensic-change-coupling/SKILL.md
skills/forensic-complexity-trends/SKILL.md
skills/forensic-debt-quantification/SKILL.md
skills/forensic-hotspot-finder/SKILL.md
skills/frontend-api-standards/SKILL.md
skills/frontend-code-review/SKILL.md
skills/frontend-response-handling/SKILL.md
skills/frontend-server-data-patterns/SKILL.md
skills/frontend-standards-always-follow/SKILL.md
skills/frontend-structure-standards/SKILL.md
skills/frontend-ui-engineering/SKILL.md
skills/git-workflow-and-versioning/SKILL.md
skills/golang-patterns/SKILL.md
skills/golang-testing/SKILL.md

Metadata

Files
0
Version
fc73590
Hash
9e462ffb
Indexed
2026-07-19 09:13

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-05 21:10
浙ICP备14020137号-1 $Гость$