react-component-hook-guidelines
Skill18 starsChanged 5 days agoMITView on GitHub
Use when reviewing, refactoring, or implementing React components and custom Hooks with unclear boundaries or oversized props.
In this repository55 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ax-extract-workflowSkill
- conversation-json-to-mdSkill
- feature-doc-splitterSkill
- frontend-quality-guardrailsSkill
- git-commit-onlySkill
- git-pushing-fastSkill
- git-push-secondary-merge-primarySkill
- git-stepwise-commitSkill
- git-weekly-reportSkill
- linkedinSkill
- logo-design-boardSkill
- mac-software-storage-cleanupSkill
- multi-lang-readmeSkill
- novel-writerSkill
- routerbase-api-integrationSkill
- routerbase-media-generationSkill
- routerbase-model-routingSkill
- topic-bookmarks-reorganizerSkill
- tree-ring-memorySkill
- tweetclaw-twitter-automationSkill
- ui-layout-analyzerSkill
- wechat-theme-extractorSkill
- weixin-article-to-obsidianSkill
- xquik-dataSkill
- x-twitter-scraperSkill
- yuque-lakebook-exportSkill
- ax-extract-workflow-cnSkill
- conversation-json-to-md-cnSkill
- feature-doc-splitter-cnSkill
- frontend-quality-guardrails-cnSkill
- git-commit-only-cnSkill
- git-pushing-fast-cnSkill
- git-push-secondary-merge-primary-cnSkill
- git-stepwise-commit-cnSkill
- git-weekly-report-cnSkill
- linkedin-cnSkill
- logo-design-board-cnSkill
- mac-software-storage-cleanup-cnSkill
- multi-lang-readme-cnSkill
- novel-writer-cnSkill
- react-component-hook-guidelines-cnSkill
- routerbase-api-integration-cnSkill
- routerbase-media-generation-cnSkill
- routerbase-model-routing-cnSkill
- topic-bookmarks-reorganizer-cnSkill
- tree-ring-memory-cnSkill
- tweetclaw-twitter-automation-cnSkill
- ui-layout-analyzer-cnSkill
- wechat-theme-extractor-cnSkill
- weixin-article-to-obsidian-cnSkill
- xquik-data-cnSkill
- x-twitter-scraper-cnSkill
- yuque-lakebook-export-cnSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
17 rules. About 0 are common, 17 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈17
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Use this skill when the user asks to:
- Distinctive: line 25
Do not use this skill for:
- Distinctive: line 34
Check whether the change has a single reason, then look for accidental coupling between props, state, effects, routing, caching, modals, …
- Distinctive: line 35
Prefer boundary splits to reduce complexity.
- Distinctive: line 39
When you need to decide whether a component or Hook should be split, read references/react-component-hook-rules.md.
- Distinctive: line 40
When reviewing existing React code, check in this order: responsibility boundary -> props design -> complexity -> branch expansion.
- Distinctive: line 41
When landing a refactor, extract business Hooks, presentation components, and pure functions first.
- Distinctive: line 42
When implementing a new component, decide first whether it is page orchestration, a business container, a presentation component, or a …
- Distinctive: line 48
Check at least these questions:
- Distinctive: line 58
Prefer this split path:
- Distinctive: line 60
Remove business state and side effects from the page component.
- Distinctive: line 68
Before implementing, make these three decisions:
- Distinctive: line 71
Should the state logic move into a Hook?
- Distinctive: line 83
If this is a review, list "issues found" first, then the proposed changes.
- Distinctive: line 84
If this is a refactor, clearly state the new boundaries: what stays in the page, what moves into Hooks, what moves into presentation …
- Distinctive: line 85
If this is an implementation, keep code outputs aligned with the reference style, do not reintroduce "large object props" or "universal …
- Distinctive: line 95
If you cannot give a clear reason, default to tightening the boundary.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
React Component Hook Guidelines
Overview
Guide the splitting, refactoring, and review of React page components, business components, presentation components, custom Hooks, and utility functions. Focus on responsibility boundaries, props width, state flow, branching, page orchestration, and coupling between UI and logic. Use this skill to decide whether logic belongs in a page, a Hook, a presentation component, or lib/utils.
When to Use
Use this skill when the user asks to:
- Split a component or Hook
- Refactor a component, page, or Hook that feels too large or too heavy
- Review React code structure, component design, or Hook design
- Reduce prop width, state fan-out, or branch complexity
- Reorganize frontend layering or page orchestration
- Separate UI from logic, requests, routing, caching, modals, or analytics
- Extract business Hooks, presentation components, or pure utility functions
Do not use
Do not use this skill for:
- Tasks unrelated to React components, Hooks, or page orchestration
- Pure backend work
- Simple style-only changes that do not involve boundaries, state flow, or props design
Instructions
- Identify the task type first: code review, refactor, new implementation, or layer or structure cleanup.
- Locate the core unit: page component, business component, presentation component, custom Hook, or utility function.
- Check whether the change has a single reason, then look for accidental coupling between props, state, effects, routing, caching, modals, and analytics.
- Prefer boundary splits to reduce complexity. Do not use line count as a substitute for design judgment.
Quick Decisions
- When you need to decide whether a component or Hook should be split, read references/react-component-hook-rules.md.
- When reviewing existing React code, check in this order: responsibility boundary -> props design -> complexity -> branch expansion.
- When landing a refactor, extract business Hooks, presentation components, and pure functions first. Do not start with cosmetic style moves.
- When implementing a new component, decide first whether it is page orchestration, a business container, a presentation component, or a reusable UI component.
Execution Rules
Review
Check at least these questions:
- Does the file export only one main component or main Hook?
- Does it pass a page-level large state object or a full actions bundle directly to children?
- Does it couple UI, requests, routing, effects, caching, modals, or analytics?
- Does it contain more than 3 pattern branches and fit a mapping or strategy better?
- Is there logic that should be extracted into a Hook or
lib/utils?
Refactor
Prefer this split path:
- Remove business state and side effects from the page component.
- Extract reusable or testable state flow into a business Hook.
- Split heavy JSX blocks into the smallest presentation components.
- Move pure data transforms, validation, and mapping into
lib/orutils/. - Narrow props to only the fields and callbacks the child truly needs.
New Implementation
Before implementing, make these three decisions:
- Is this an orchestration layer or a presentation layer?
- Should the state logic move into a Hook?
- Does this logic still make sense outside the React lifecycle? If yes, move it to
lib/utils.
Additional hard rules:
- Code comments must be written in Chinese.
- Functions must have a function comment before the definition that explains the responsibility and the scenarios it handles.
- Hooks must have a function comment before the definition that explains the business responsibility, state scope, or side-effect boundary.
- Comments should explain responsibility, boundaries, and intent only. Do not write low-value line-by-line translation comments.
Output Requirements
- If this is a review, list "issues found" first, then the proposed changes.
- If this is a refactor, clearly state the new boundaries: what stays in the page, what moves into Hooks, what moves into presentation components, and what moves into utility functions.
- If this is an implementation, keep code outputs aligned with the reference style, do not reintroduce "large object props" or "universal Hooks", and add function comments for any new or modified functions and Hooks.
Exception Handling
Reasonable exceptions are allowed, but they must be explained. Common acceptable exceptions:
- A presentation component is a little long, but its visual structure is concentrated and stable.
- A file contains a few helper components that only serve the main component.
- A page entry file is a little long, but the business logic has already been extracted into Hooks.
If you cannot give a clear reason, default to tightening the boundary.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

