Skip to main content

framework-react

Provides engineering and architecture patterns for the React library (React 18+ / React 19) and its ecosystem. Covers functional components, advanced Hooks, Server Components (RSC), state management (Context, Zustand, TanStack Query), routing, performance optimization, and testing.

インストールへ移動

ソース情報

リポジトリ
dandgabr/Coacus
ソースの最終更新活動
2026年9月20日 03:33
検出された SKILL.md の言語
英語
スター
0
フォーク
0

インストール方法

デフォルトでは、最初にソースを確認する Prompt が選択されています。直接コマンドに切り替えるか、ローカルコピーをダウンロードすることもできます。

ソースファイルを確認

インストールを決める前に、SKILL.md と SkillsMP に表示されている付属ファイルをお読みください。

ファイルエクスプローラー
5 ファイル

SKILL.md を表示中

SKILL.md
ソースの指示 · 読み取り専用プレビュー
name
framework-react
description
Provides engineering and architecture patterns for the React library (React 18+ / React 19) and its ecosystem. Covers functional components, advanced Hooks, Server Components (RSC), state management (Context, Zustand, TanStack Query), routing, performance optimization, and testing.
# AI Skill: React Engineering and Architecture (framework-react) This skill guides the AI to act as a specialist in the **React** library (versions 18 and 19) and its modern ecosystem, aligned with the official documentation maintained by Meta ([react.dev](https://react.dev/)). It covers functional component architecture, React Server Components (RSC), Hooks, global and server state management, render optimization, and testing. --- ## 🧭 Component Architecture and React Server Components (RSC) ### 1. Separation Between Server Components and Client Components - **Server Components (RSC - Default in React 19 / Next.js App Router)**: - Components that run exclusively on the server with no JavaScript bundle sent to the client. - Ideal for direct database access, internal APIs, and heavy static/dynamic rendering. - **Client Components (`'use client'`)**: - Components hydrated in the browser that use local state (`useState`), effects (`useEffect`), or DOM event listeners (`onClick`, `onChange`). ### 2. Fundamental and Advanced Hook Patterns ```tsx import React, { useState, useTransition, useId } from 'react'; interface SearchBoxProps { onSearch: (query: string) => void; } export const SearchBox: React.FC<SearchBoxProps> = ({ onSearch }) => { const [input, setInput] = useState(''); const [isPending, startTransition] = useTransition(); const inputId = useId(); const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => { const value = e.target.value; setInput(value); // Atualização de baixa prioridade sem congelar a interface startTransition(() => { onSearch(value); }); }; return ( <div className="search-container"> <label htmlFor={inputId}>Buscar Produtos:</label> <input id={inputId} type="text" value={input} onChange={handleChange} placeholder="Digite para pesquisar..." /> {isPending && <span className="spinner">Atualizando resultados...</span>} </div> ); }; ``` --- ## 🛠️ Global State and Server State Management ### 1. Server State vs. UI State - **Server State**: Use **TanStack Query (React Query)** or **SWR** for caching, automatic background revalidation, pagination, and asynchronous mutations with optimistic rollback. - **Global UI State (Client State)**: - For simple state: React Context API. - For complex, high-performance state: **Zustand** or **Jotai** (avoiding unnecessary re-renders of the whole tree). --- ## ⚡ Performance Optimization and Web Vitals Measurement 1. **Avoid Unwanted Re-renders**: - Keep state as close as possible to where it is used (*Lift state up* only when necessary). - Use automatic compilation from the **React Compiler** (React 19) or deliberate manual memoization with `useCallback` and `useMemo`. 2. **Code-Splitting and Lazy Loading**: - Import heavy components dynamically via `React.lazy()` wrapped in `<Suspense fallback={<Loading />}>`. --- ## 🧪 Testing Strategies - **React Testing Library & Vitest/Jest**: - Test behaviors visible from the end user's point of view (using selectors such as `getByRole`, `getByText`) instead of testing internal state implementation details. --- ## 🔗 Integration with Other Skills - For complete interface development with TypeScript and accessibility (WCAG), see [frontend-developer](../../roles/frontend-developer/SKILL.md) and [lang-typescript](../../languages/lang-typescript/SKILL.md). - To automate component and web application test suites, see [framework-testing-javascript](../framework-testing-javascript/SKILL.md) and [qa-engineer](../../roles/qa-engineer/SKILL.md). - For protection against web vulnerabilities (XSS, CSRF, Secure Headers), see [appsec-owasp-asvs](../../security/appsec/appsec-owasp-asvs/SKILL.md).
GitHubで見る