ワンクリックで
react
Use this skill when writing any React code. This skill details best practices, component design, composition, and hook gotchas.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use this skill when writing any React code. This skill details best practices, component design, composition, and hook gotchas.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Conventions for running Vite+ (`vp`) commands in this repo. Use whenever invoking vp — check, test, install, build, add, remove, run. Key rule: always run `vp check --fix`, never bare `vp check` followed by `vp check --fix`.
Use when working with Node.js, npm, package.json, or npx. Alternative package managers like Yarn and pnpm as well as monorepo tools like nx, yarn, or turborepo should also use this skill
Use this skill when writing any TypeScript or JavaScript. This specifies explicit code style, language features, and guidance that WILL be validated after editing files and WILL fail your edits if you do not follow this skill precisely
| name | react |
| description | Use this skill when writing any React code. This skill details best practices, component design, composition, and hook gotchas. |
The ONLY acceptable use for a useRef is to capture a native component using
ref={myRef}. In order to track state between calls, a useState, useMemo, and
useEffect ensures proper rerenders happen. useRef is too brittle for state
management.
JSX should be SIMPLE. At most, conditional rendering is allowed with a single variable comparison. Complex conditionals should be stored in a well-named variable before the JSX renders and referenced. Ternaries in JSX are allowed, but they must render only two paths. Nested Ternaries are too complex, and should instead be broken out into a separate component in the components directory.
Only ONE component definition is allowed per file. Components should be reusable
and have their own FOLDER in the src/components/<ComponentName> folder with a
barrel file.
Sometimes, you have a tightly coupled component that the Component needs. Instead
of polluting the src/components folder with a bunch of really small tightly
coupled components (think: like a row definition component for a specific
table), you can make a "private" component file in the
src/components/<ComponentName>/_MyPrivateComponent.tsx. This honors the
One Component per File rule while also keeping the main component file clean and
easy to manage.
ANY new array or object definition that is used in JSX MUST be wrapped in a useMemo with ALL dependencies in the dependency array.
This ensures there are no rerender loops or stale data references. React has a very good state management and rerender system. Use it and let React be smart about ensuring good render performance.
ALL functions used in JSX MUST be wrapped in a useCallback with ALL dependencies in the dependency array.
This ensures that there are no stale references in the callback (a very difficult to debug error)