component-advisor
React component design patterns — composition, hooks, state management, performance
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
React component design patterns — composition, hooks, state management, performance
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Use when creating an SDD implementation plan from exploration.md, with deep interview, task breakdown, and batch assignments.
Generate a Product Requirements Document via interactive interview. Writes a markdown PRD that captures intent, user stories, and out-of-scope. Use when the brief is vague, when no ticket is bound, or when SDD invokes it from its PRD gate.
Use when executing an SDD plan via batch-based task implementation, tracking progress with [ ]/[X] markers and quality gates.
Use when starting an SDD workflow to discover codebase context, curate relevant files, and prepare exploration.md for planning.
SDD Orchestrator coordinates SDD (Spec-Driven Development) workflow via sub-agents
Use when reviewing code changes before commit, comparing implementation against SDD plan, or doing standalone code review with advisor consultation.
| name | component-advisor |
| scope | ["frontend"] |
| description | React component design patterns — composition, hooks, state management, performance |
| version | 1.0 |
| tags | ["react","components","hooks","design-patterns","performance"] |
Guide React component design toward maintainable, composable, and performant patterns. Apply composition principles, proper hooks usage, and clear prop contracts to produce components that are easy to test and extend.
React components compose by nesting. Prefer small, focused components that assemble into larger structures over monolithic components with many responsibilities. Use children and render props for extensibility rather than adding flags and conditional branches.
// Avoid: pass-through object anti-pattern
function Button({ config }) { ... }
// Prefer: explicit props
function Button({ label, onClick, disabled, variant = 'primary' }) { ... }
Pass data where it is actually needed rather than threading it through intermediate components. Use Context for truly global state (theme, auth, locale).
interface CardProps {
title: string // required
description?: string // optional
variant?: 'outlined' | 'filled' // optional with default
}
function Card({ title, description, variant = 'outlined' }: CardProps) { ... }
Co-locate component files:
components/
ProductCard/
index.tsx <- main export
ProductCard.tsx <- component
ProductCard.test.tsx
ProductCard.module.css (if using CSS modules)
useProductCard.ts <- extracted hook (if needed)
For simple components, a single file is fine:
components/
Button.tsx
Button.test.tsx
Detailed patterns and examples are available in the references/ directory. Load these on demand when the review touches the specific topic.
references/hooks-patterns.md for custom hooks extraction patterns, logic-vs-rendering separation, and hook testing guidance.references/state-management.md for local state, lifting state up, Context usage, memoizing context values, and when to add external state management.references/performance.md for React.memo, useMemo, useCallback patterns and guidance on when memoization is justified.Before finalizing your review, check gotchas.md for common Claude mistakes in this domain.
When reviewing React components:
React.memo, useMemo, useCallback used only where profiling justifies itThis skill supports advisor mode: when invoked by the SDD orchestrator with a GUIDANCE CONTEXT FROM PLANNER block in the prompt, use the following procedure instead of the standard interactive review flow.
Advisor mode is active when the prompt contains:
GUIDANCE CONTEXT FROM PLANNER: blockCURRENT PLAN EXCERPT: blockGUIDANCE CONTEXT FROM PLANNER block to understand what the planner needs reviewed.CURRENT PLAN EXCERPT to see the specific tasks and design decisions.Focus ONLY on your specialist domain: React component patterns, hooks, props design, state management.
### Strengths
- [What looks sound in the plan from this skill's domain perspective]
### Issues Found
[Severity: Critical / Major / Minor — reference specific task IDs or section names]
- T001: [issue description]
### Recommendations
[Specific, actionable. Reference task ID or section name for each recommendation.]
- T001: [recommendation]
Save full advice output to engram:
mem_save(
title: "sdd/{change-name}/guidance/component-advisor",
type: "architecture",
project: "{project-name}",
content: "{your full structured advice output}"
)
If engram is unavailable, skip silently.
Return a concise summary (3-5 bullet points) plus the engram observation ID:
### Summary
- [key point 1]
- [key point 2]
- ...
### Engram ID
{observation_id or "unavailable"}
Do NOT return an SDD Envelope when in advisor mode.