custom-react-coding

Applies React and TypeScript component conventions for file layout, props, and JSX formatting.

1|Updated Apr 3, 2021
One-click install
npx skills add https://github.com/NaoyaMiyagawa/dotfiles --skill custom-react-coding-naoyamiyagawa
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: custom-react-coding
Source: https://github.com/NaoyaMiyagawa/dotfiles/tree/main/.ai/skills/custom-react-coding
Command: npx skills add https://github.com/NaoyaMiyagawa/dotfiles --skill custom-react-coding-naoyamiyagawa

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? React codebases drift into inconsistent patterns: wrapper components that only forward data, oversized page files, redundant type assertions, and JSX without consistent spacing. This Skill encodes a concrete set of React/TSX conventions so components are implemented and refactored the same way every time. ## Core Features & Use Cases - Component boundary rules: Eliminates pass-through wrapper components, prefers shared design-system primitives, and splits long pages into section components under a nested Partials directory. - Type and naming conventions: Colocates types with components, enforces explicit return types on module functions, removes redundant assertions on as const declarations, and standardizes collection and lookup naming. - JSX and test formatting: Enforces blank lines between sibling JSX elements (react/jsx-newline) and AAA (Arrange, Act, Assert) comments in every test. - Use Case: When asked to build a new settings page, the Skill structures it as section components under Partials/, branches rendering on the fetch hook's isLoading/isError/data flags, orders defaulted props last, and writes specs with AAA markers. ## Quick Start Refactor this React component to follow the custom React coding conventions, splitting sections into Partials and fixing JSX spacing.

Frequently Asked Questions about custom-react-coding

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a large React page component?▼

Split a long page by extracting its distinct visual sections into child components under a nested Partials directory next to the parent. Create one component per section rather than one per JSX block, and name each component for what it renders.

When should I create a wrapper component in React?▼

Avoid components whose only job is fetching data and forwarding it to one child; move the fetch into the child instead. Add a wrapper only when a second consumer needs the same child with different data.

Should I use satisfies or as casts with as const in TypeScript?▼

No. as const already fixes a literal's type, so adding satisfies, a Record annotation, or an as readonly cast on top is redundant. Keep the declaration that already carries the type and remove the extra assertion.

How do I handle loading and error states in React components?▼

Branch rendering on the fetch hook's lifecycle flags: render isLoading && <Spinner />, isError handling, and data && <Content />. Do not derive a parallel status from the presence or absence of data fields.

Where should React component prop types be defined?▼

Colocate props and local types in the .tsx file that uses them. Create a sibling Component.types.ts file only when a second module imports those types, and export only what another module actually imports.