react-component
minagayid/Agents/skills/library/react-component/SKILL.md
Build a clean, accessible, well-typed React component following modern best practices. Use when the user asks to create or refactor a React component.
Skill1 starsChanged 3 months ago
What's in it
- React Component
- Principles
- Checklist
- Example (shape)
- Guidelines
---
name: react-component
description: Build a clean, accessible, well-typed React component following modern best practices. Use when the user asks to create or refactor a React component.
---
# React Component
Write React components that are readable, reusable, accessible, and correct.
## Principles
- **Function components + hooks.** No class components for new code.
- **Typed props** (TypeScript). Model the real states; make illegal states unrepresentable.
- **Single responsibility.** One component, one job; extract subcomponents when it grows.
- **Controlled vs. uncontrolled** — pick deliberately and document which.
- **Derive, don't sync.** Compute from props/state during render instead of mirroring into extra state.
- **Effects are for side effects**, not for transforming data — most `useEffect` uses are avoidable.
- **Stable keys** in lists (not array index when items reorder).
- **Accessible by default** — semantic elements, labels, focus management, keyboard support.
## Checklist
- Props typed and minimal; sensible defaults.
- No unnecessary state or effects; memoize only where profiling shows a need.
- Handles loading / empty / error states.
- No layout shift; responsive; respects reduced motion.
- Styling matches the project's system (CSS modules / Tailwind / styled — follow existing code).
## Example (shape)
```tsx
type Props = { label: string; onClick: () => void; disabled?: boolean };
export function Button({ label, onClick, disabled = false }: Props) {
return (
<button type="button" onClick={onClick} disabled={disabled}>
{label}
</button>
);
}
```
## Guidelines
- Match the surrounding codebase's conventions over any generic style.
- Co-locate tests; test behavior via the accessible role/name, not internals.
More agent context in minagayid/Agents
25 other files this repository gives its agents.
Skill
- agent-project-scaffoldskills/agent-project-scaffold/SKILL.md
- accessibility-auditskills/library/accessibility-audit/SKILL.md
- changelog-keeperskills/library/changelog-keeper/SKILL.md
- code-review-checklistskills/library/code-review-checklist/SKILL.md
- conventional-commitsskills/library/conventional-commits/SKILL.md
- data-cleaningskills/library/data-cleaning/SKILL.md
- debugging-methodologyskills/library/debugging-methodology/SKILL.md
- dependency-auditskills/library/dependency-audit/SKILL.md
- dockerfile-authorskills/library/dockerfile-author/SKILL.md
- exploratory-data-analysisskills/library/exploratory-data-analysis/SKILL.md
- github-actions-ciskills/library/github-actions-ci/SKILL.md
- incident-postmortemskills/library/incident-postmortem/SKILL.md
- kubernetes-manifestskills/library/kubernetes-manifest/SKILL.md
- pr-descriptionskills/library/pr-description/SKILL.md
- prompt-engineeringskills/library/prompt-engineering/SKILL.md
- readme-generatorskills/library/readme-generator/SKILL.md
- refactoringskills/library/refactoring/SKILL.md
- rest-api-designerskills/library/rest-api-designer/SKILL.md
- secure-coding-reviewskills/library/secure-coding-review/SKILL.md
- sql-optimizerskills/library/sql-optimizer/SKILL.md
- technical-writingskills/library/technical-writing/SKILL.md
- terraform-moduleskills/library/terraform-module/SKILL.md
- threat-modelskills/library/threat-model/SKILL.md
- unit-test-writerskills/library/unit-test-writer/SKILL.md
- web-performanceskills/library/web-performance/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
No reports yet. Be the first to say whether it worked.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

