react-standards
Use when building React UIs in a touchstone repo — components, hooks, state, data fetching, forms, Vite/PWA, accessibility. Triggers on .tsx with JSX, `react` in package.json, vite.config. Language-level TS rules live in the typescript skill; for Next.js/Nuxt use those skills.
- License 许可
- MIT
- 最近更新
- 2026-08-26
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- react-standards
- license
- MIT
- metadata
- { "author": "touchstone", "version": "0.2.0" }
- description
- Use when building React UIs in a touchstone repo — components, hooks, state, data fetching, forms, Vite/PWA, accessibility. Triggers on .tsx with JSX, `react` in package.json, vite.config. Language-level TS rules live in the typescript skill; for Next.js/Nuxt use those skills.
03 SKILL.md 正文
React (framework)
Full standard: standards/frameworks/react.md (layers on standards/languages/typescript.md).
Load-bearing rules:
Always
- Feature-based folders (
features/<name>/{api,components,hooks,...}); unidirectional importsshared → features → app(enforce in CI). Absolute imports; no barrel files. - Split server-state from client-state: server cache → TanStack Query (query-key factories; don't treat the cache as a state manager); UI/local →
useState/useReducer; app-global → Zustand/context. Never copy server data intouseStateor Redux. - Wrap in error boundaries; forms = React Hook Form + Zod; validate every API boundary with Zod.
- a11y (WCAG 2.2 AA) + Web-Vitals/bundle budgets are gates, not nice-to-haves.
Components & perf
- Function components; type props with
type(notReact.FC); colocate; abstract on the second repetition. - Profile before memoizing; adopt React Compiler and stop hand-writing
useMemo/useCallback. Don't suppressuseExhaustiveDependencies.
Don't get burned
- No source maps in prod (
build.sourcemap:false);VITE_*is a public boundary — no secrets. Keep the PWA working.
Done
biome ci · tsc · vitest · build green; PWA installs if touched. See standards/frameworks/react.md.
04 同仓库更多 Skills
ok-standards
Use when writing shell, per standards/languages/shell.md.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.
demo-standards
Use when editing demo code in a touchstone fixture repo, a deliberately ordinary description that is long enough to clear the forty character minimum.