React Frontend Standard
Use this skill to apply the same React frontend structure and coding rules across repositories without rewriting the guidance from scratch each time.
Core Contract
features are the ownership center.
- framework route files are routing shells.
screens are route-facing UI composition.
- router-config projects such as React Router should route to screens directly unless a thin route shell is needed.
pages must not become a parallel page-composition layer beside screens.
- shared
components are generic and domain-free.
- optional feature files appear only when they clarify a real boundary.
- feature-root role files use
<Feature>.<role>.ts; role-only names such as api.ts, schema.ts, type.ts, and types.ts are not part of this standard.
- reusable modules use named exports by default; framework route entries and route-facing screens may use default exports when they are single-entry files.
- local project docs describe project-specific facts and intentional exceptions.
- this installed skill is the reusable standard source of truth.
Repository-only examples/ can help maintain this package, but downstream projects must be able to apply the standard from the installed skill and thin AGENTS.md router alone. Optional generated docs are scaffolds for project notes, not a second copy of the standard.
Workflow
- Inspect the current repository shape with file search.
- Read local docs if present:
AGENTS.md, README, product specs, and project-specific notes.
- If
.react-frontend-standard/manifest.json exists, use npx -y react-frontend-standard@latest check . or sync . when the installed standard may be stale.
- Treat
ARCHITECTURE.md and docs/coding-patterns.md as optional project notes when they exist, not as newer copies of this reusable standard.
- Verify local docs against actual files, commands, route entries, providers, and feature folders.
- Identify routing framework boundaries using
references/routing-framework-notes.md.
- Map feature ownership from backend domains or stable frontend use cases.
- Check data-access and side-effect boundaries using
references/data-boundary-notes.md.
- Check feature-root role filenames; rename role-only files to
<Feature>.<role>.ts.
- Check export style; prefer named exports for reusable modules and reserve default exports for route entries and screens.
- Check test placement and verification commands using
references/testing-notes.md.
- Record only project-specific commands, routing setup, feature map, and intentional exceptions in local docs.
Default Structure
src/
|-- screens/
|-- features/
|-- components/
|-- hooks/
|-- lib/
|-- services/
|-- utils/
`-- types/
Framework route directories such as src/app, src/pages, route modules, or router config files may exist alongside this structure. Treat them as routing shells. In router-config projects such as React Router or TanStack Router, prefer route entries that render src/screens/*Screen.tsx directly unless a thin route shell is needed for params, metadata, providers, loaders, actions, or another routing boundary.
Feature Structure
features/<feature>/
|-- components/
|-- hooks/
|-- <Feature>.api.ts
|-- <Feature>.service.ts
|-- <Feature>.schema.ts
|-- <Feature>.type.ts
`-- <Feature>.util.ts
Optional additions by project needs:
<Feature>.query.ts
<Feature>.server.ts
<Feature>.client.ts
<Feature>.store.ts
<Feature>.adapter.ts
<Feature>.fragment.ts
Do not use role-only feature-root filenames such as api.ts, service.ts, schema.ts, type.ts, types.ts, query.ts, server.ts, client.ts, store.ts, or adapter.ts.
Ownership Rules
- framework route files connect params, metadata, providers, framework prefetching, and screens
- route-facing screen components go in
screens
- React Router-style route config usually renders screens directly instead of adding
pages wrappers
- business-owned UI goes in
features/<feature>/components
- raw HTTP and transport details go in
<Feature>.api.ts
- use-case orchestration goes in
<Feature>.service.ts
- cache/query identity can go in
<Feature>.query.ts
- server-only feature access can go in
<Feature>.server.ts
- browser/client feature access can go in
<Feature>.client.ts
- browser-only state and side effects can go in
<Feature>.store.ts or <Feature>.adapter.ts
- screen-facing state connection goes in feature
hooks/
- generic reusable UI goes in
components
- reusable components, hooks, services, utilities, schemas, stores, adapters, and query helpers use named exports by default
- framework route entries and screen files may use default exports when the file represents one route-facing entry
Widget Rule
Do not introduce widgets by default.
Only consider a widgets layer when:
- a UI block combines multiple features
- the block is meaningful as one reusable unit
- it repeats across multiple screens
- ownership is genuinely hard to assign to one feature
References
references/architecture-template.md
references/coding-patterns-template.md
references/adoption-checklist.md
references/agents-snippet.md
references/routing-framework-notes.md
references/data-boundary-notes.md
references/testing-notes.md
references/document-sync-checklist.md
Source: her0707/react-frontend-standard — distributed by TomeVault.
1---2name: react-frontend-standard3description: Shared architecture and coding standard for React frontend repositories centered on thin route-facing screens, feature ownership, and shared UI primitives. Use when Codex needs to scaffold a new React frontend project, align an existing repository to a consistent structure, install or refresh the local standard skill, create a thin AGENTS.md router, optionally generate starter architecture/coding-pattern documents, or review whether code is placed in the right layer. Treat routing frameworks and data access technology such as React Router, Next.js, Remix, TanStack Router, REST, GraphQL, React Query, Apollo, SWR, server actions, route loaders, and generated clients as implementation details rather than the architectural center. Use when this capability is needed.4---56# React Frontend Standard78Use this skill to apply the same React frontend structure and coding rules across repositories without rewriting the guidance from scratch each time.910## Core Contract1112- `features` are the ownership center.13- framework route files are routing shells.14- `screens` are route-facing UI composition.15- router-config projects such as React Router should route to screens directly unless a thin route shell is needed.16- `pages` must not become a parallel page-composition layer beside `screens`.17- shared `components` are generic and domain-free.18- optional feature files appear only when they clarify a real boundary.19- feature-root role files use `<Feature>.<role>.ts`; role-only names such as `api.ts`, `schema.ts`, `type.ts`, and `types.ts` are not part of this standard.20- reusable modules use named exports by default; framework route entries and route-facing screens may use default exports when they are single-entry files.21- local project docs describe project-specific facts and intentional exceptions.22- this installed skill is the reusable standard source of truth.2324Repository-only `examples/` can help maintain this package, but downstream projects must be able to apply the standard from the installed skill and thin `AGENTS.md` router alone. Optional generated docs are scaffolds for project notes, not a second copy of the standard.2526## Workflow27281. Inspect the current repository shape with file search.292. Read local docs if present: `AGENTS.md`, README, product specs, and project-specific notes.303. If `.react-frontend-standard/manifest.json` exists, use `npx -y react-frontend-standard@latest check .` or `sync .` when the installed standard may be stale.314. Treat `ARCHITECTURE.md` and `docs/coding-patterns.md` as optional project notes when they exist, not as newer copies of this reusable standard.325. Verify local docs against actual files, commands, route entries, providers, and feature folders.336. Identify routing framework boundaries using `references/routing-framework-notes.md`.347. Map feature ownership from backend domains or stable frontend use cases.358. Check data-access and side-effect boundaries using `references/data-boundary-notes.md`.369. Check feature-root role filenames; rename role-only files to `<Feature>.<role>.ts`.3710. Check export style; prefer named exports for reusable modules and reserve default exports for route entries and screens.3811. Check test placement and verification commands using `references/testing-notes.md`.3912. Record only project-specific commands, routing setup, feature map, and intentional exceptions in local docs.4041## Default Structure4243```text44src/45|-- screens/46|-- features/47|-- components/48|-- hooks/49|-- lib/50|-- services/51|-- utils/52`-- types/53```5455Framework route directories such as `src/app`, `src/pages`, route modules, or router config files may exist alongside this structure. Treat them as routing shells. In router-config projects such as React Router or TanStack Router, prefer route entries that render `src/screens/*Screen.tsx` directly unless a thin route shell is needed for params, metadata, providers, loaders, actions, or another routing boundary.5657## Feature Structure5859```text60features/<feature>/61|-- components/62|-- hooks/63|-- <Feature>.api.ts64|-- <Feature>.service.ts65|-- <Feature>.schema.ts66|-- <Feature>.type.ts67`-- <Feature>.util.ts68```6970Optional additions by project needs:7172- `<Feature>.query.ts`73- `<Feature>.server.ts`74- `<Feature>.client.ts`75- `<Feature>.store.ts`76- `<Feature>.adapter.ts`77- `<Feature>.fragment.ts`7879Do not use role-only feature-root filenames such as `api.ts`, `service.ts`, `schema.ts`, `type.ts`, `types.ts`, `query.ts`, `server.ts`, `client.ts`, `store.ts`, or `adapter.ts`.8081## Ownership Rules8283- framework route files connect params, metadata, providers, framework prefetching, and screens84- route-facing screen components go in `screens`85- React Router-style route config usually renders screens directly instead of adding `pages` wrappers86- business-owned UI goes in `features/<feature>/components`87- raw HTTP and transport details go in `<Feature>.api.ts`88- use-case orchestration goes in `<Feature>.service.ts`89- cache/query identity can go in `<Feature>.query.ts`90- server-only feature access can go in `<Feature>.server.ts`91- browser/client feature access can go in `<Feature>.client.ts`92- browser-only state and side effects can go in `<Feature>.store.ts` or `<Feature>.adapter.ts`93- screen-facing state connection goes in feature `hooks/`94- generic reusable UI goes in `components`95- reusable components, hooks, services, utilities, schemas, stores, adapters, and query helpers use named exports by default96- framework route entries and screen files may use default exports when the file represents one route-facing entry9798## Widget Rule99100Do not introduce `widgets` by default.101102Only consider a `widgets` layer when:103104- a UI block combines multiple features105- the block is meaningful as one reusable unit106- it repeats across multiple screens107- ownership is genuinely hard to assign to one feature108109## References110111- `references/architecture-template.md`112- `references/coding-patterns-template.md`113- `references/adoption-checklist.md`114- `references/agents-snippet.md`115- `references/routing-framework-notes.md`116- `references/data-boundary-notes.md`117- `references/testing-notes.md`118- `references/document-sync-checklist.md`119120---121> Source: [her0707/react-frontend-standard](https://github.com/her0707/react-frontend-standard) — distributed by [TomeVault](https://tomevault.io).122<!-- tomevault:4.0:skill_md:2026-06-15 -->