Karya Frontend Builder
Purpose
Transform a product contract into a complete, navigable, visually resolved React frontend. Implement the product directly in code; do not generate instructions for another application builder.
Preserve every explicit product decision and materialize it through the Karya stack and architecture. Fill implementation gaps with reasonable assumptions, record consequential assumptions, and prioritize a convincing MVP over premature platform complexity.
Authority Order
Resolve decisions in this order:
- Follow the user's explicit request.
- Follow explicit product-contract decisions.
- Follow Karya standards in this skill.
- Make the smallest reasonable implementation decision.
Do not let a vague preference override an explicit product requirement. Explain any necessary exception to the factory baseline.
Required Context
Accept any of these inputs:
- product contract or product brief
- PRD or client notes with enough product detail
- screen and flow specification
- existing repository plus a request for a new product area
- sufficiently defined idea when reasonable assumptions can close small gaps
Before coding, identify the objective, users, MVP scope, routes, primary journey, most important screen, data entities, critical interactions, visual direction, responsive expectations, and non-goals.
Prefer contracts under docs/product/: either product-brief.md, or the modular set prd.md, screen-map.md, business-rules.md, data-contract.md, visual-direction.md, and acceptance-criteria.md. Preserve path mappings documented by product-brief-architect when an existing PRD lives elsewhere.
If the input is too ambiguous to determine the core user journey or primary screen, route product definition to product-brief-architect before implementation. Do not invent a materially different product.
Load References
Read only the references needed for the task, but always read the stack and architecture references before initializing a new project:
references/stack-baseline.md for required technologies, versions, configuration, and exceptions.
references/architecture-standard.md for repository shape and dependency direction.
references/component-responsibilities.md before implementing pages, components, hooks, and shared UI.
references/data-and-api-boundary.md before implementing mocks, persistence, forms, TanStack Query, Axios, or API contracts.
references/visual-responsive-standard.md before defining tokens, layouts, PrimeReact theming, tables, charts, or mobile behavior.
references/npm-supply-chain-security.md before adding, installing, auditing, or updating npm packages.
references/project-context-standard.md before initializing or updating AGENTS.md, .codex/, or repository-local domain skills.
references/sites-composition.md when the Karya workflow invokes this skill together with the external Sites plugin.
references/validation-checklist.md before claiming completion.
Use assets/frontend-starter/ when creating a new frontend from scratch. Adapt its product-neutral example instead of preserving demo content.
Use assets/project-context-starter/ at the generated project root. Initialize it with scripts/init-project-context.mjs; preserve existing project context and rules.
Run scripts/scan-karya-frontend.mjs from the consuming project root after implementation. Use --strict only when warnings should fail CI.
Workflow
- Read repository instructions and every applicable contract under
docs/product/.
- Inspect existing files when a repository already exists; preserve unrelated user work.
- Run the product-contract validator when available, resolve blocking contradictions, and state a concise implementation plan covering routes, features, data boundaries, visual system, validation, and explicit exclusions.
- Initialize or merge the project-root Codex context from
assets/project-context-starter/.
- Initialize
frontend/ from assets/frontend-starter/ when no frontend exists, unless the target repository itself is the frontend root.
- Inspect dependency changes, run the lockfile verifier, and use the secure npm policy before installing packages.
- Establish environment examples, design tokens, global styles, providers, shell, router, error boundary, and route-level loading behavior.
- Implement the most important screen first, then complete the primary journey before secondary screens.
- Keep routes thin and move screen composition into feature pages.
- Put orchestration and derived state in hooks or view models.
- Put data access, persistence, DTO mapping, and mock/API switching behind services or repository adapters.
- Implement real interactions. Do not leave buttons, filters, forms, dialogs, menus, or navigation visually present but inert.
- Implement loading, error, empty, success, disabled, and destructive-confirmation states where applicable.
- Validate mobile behavior beginning at 360px and expand layouts for larger viewports.
- Add focused tests for critical behavior, data mapping, validation, and the primary user journey.
- Create or update
docs/frontend-architecture.md, docs/api-contract.md, and docs/validation-report.md when they improve the downstream handoff.
- Run supply-chain verification, clean install, signature verification, vulnerability audit, typecheck, format check, lint, tests, build, architecture scan, and local browser validation.
- When the invoking request also names the Sites plugin, let Sites own its preview, hosting metadata, packaging, private deployment, and opening of the deployed URL. Continue to enforce this skill's stack and architecture throughout construction.
- Report implemented scope, assumptions, validation results, remaining gaps, and the backend/publication handoff.
Required Stack
Use the baseline defined in references/stack-baseline.md:
- Node.js 24 LTS and npm
- React 19 and TypeScript strict
- Vite
- React Router
- PrimeReact and PrimeIcons
- SCSS Modules plus controlled global styles and design tokens
- React Hook Form and Zod for non-trivial forms
- TanStack Query for asynchronous/server state
- React Context for small, truly global app state
- Axios behind a shared API client
- Vitest, Testing Library, and Playwright
- ESLint and Prettier
Pin direct dependency versions exactly, commit package-lock.json, restrict registry sources, require a seven-day release age, and disable dependency install scripts by default. Do not install an unreviewed package merely because generated code imports it.
Do not introduce CRA, CRACO, JavaScript-only source, Tailwind, shadcn/ui, Styled Components, Redux, or Zustand by default. Add a non-baseline library only when the product requires it and document why.
Architecture Rule
Enforce this direction:
Route -> Feature Page -> Hook/View Model -> Service -> Mock Repository or API Adapter
Components must not directly access Axios, mock files, localStorage, environment variables, or backend endpoints. Shared code must remain domain-neutral. Feature code may depend on shared code; shared code must not depend on features.
Visual Implementation Rule
Create a deliberate visual system before expanding screens:
- define colors, typography, spacing, radius, elevation, motion, and breakpoints as tokens
- configure PrimeReact consistently
- use product-specific copy and realistic mock data
- avoid generic dashboard filler and identical card grids
- make the primary screen visually strongest
- keep responsive behavior functional at 360px without horizontal page overflow
- provide accessible labels, focus states, keyboard behavior, contrast, and reduced-motion handling
Use image generation only when the product genuinely needs original raster imagery. Do not use it to replace ordinary interface implementation.
MVP and Integration Boundaries
Default to mocked data and local persistence when a backend is not available. Prepare the same service contract for a later API adapter.
Do not implement Django, database migrations, authentication infrastructure, payments, external APIs, OCR, or AI inference unless explicitly included in the current task. Represent unavailable integrations honestly through mocks and document the future API requirement.
This skill does not install, vendor, or emulate the Sites plugin. In the Karya site workflow, the invoking command must reference both @sites and $karya-frontend-builder. Sites owns preview and publication mechanics; this skill owns stack, code architecture, quality, security, data boundaries, and validation expectations.
Validation Commands
Run the available equivalents of:
npm run security:lockfile
npm ci
npm run security:scripts
npm run security:signatures
npm run security:audit
npm run typecheck
npm run format:check
npm run lint
npm run test -- --run
npm run build
node <skill-path>/scripts/scan-karya-frontend.mjs
npm run dev
npm run preview
Open the local application when browser tooling is available. Check the primary journey, console errors, responsive layouts, navigation, forms, dialogs, empty states, and failure feedback. Do not claim local readiness from a successful build alone.
Definition of Done
Finish only when these conditions pass or are explicitly reported as blocked:
- product scope and assumptions are documented
- product contracts pass their validator, or warnings and blockers are reported
- all promised routes and primary flows are implemented
- the most important screen is complete and visually resolved
- interactions are functional rather than decorative
- routes, feature pages, hooks, services, mocks, and shared code have clear boundaries
- direct mock, API, storage, and environment access is absent from UI components
- loading, error, empty, success, and responsive states are implemented where relevant
- accessibility basics are checked
- API and architecture handoff documentation reflects the implementation
- direct dependencies, lockfile sources, integrity hashes, and install-script approvals pass supply-chain checks
- signature verification and vulnerability audit were attempted and blocking findings were investigated
- typecheck, formatting, lint, tests, build, scanner, dev server, and browser smoke checks were attempted
- when composed with Sites, Sites preview/publication results are reported without changing the Karya stack or architecture silently
- failures and unimplemented integrations are reported honestly
1---2name: karya-frontend-builder3description: Build complete frontend applications directly from a product contract, PRD, screen specification, client notes, or sufficiently defined product idea. Use when Codex must initialize and implement a React product, site, dashboard, SaaS, internal tool, MVP, or prototype with the Karya stack, feature architecture, visual system, mocks, local persistence, API boundaries, responsive behavior, tests, and local validation. When invoked together with the external Sites plugin, act as the mandatory stack and architecture contract while Sites owns preview and publication. Do not install or embed Sites as an npm dependency. Do not use only to generate prompts, build Django backends, or configure full-stack infrastructure.4---56# Karya Frontend Builder78## Purpose910Transform a product contract into a complete, navigable, visually resolved React frontend. Implement the product directly in code; do not generate instructions for another application builder.1112Preserve every explicit product decision and materialize it through the Karya stack and architecture. Fill implementation gaps with reasonable assumptions, record consequential assumptions, and prioritize a convincing MVP over premature platform complexity.1314## Authority Order1516Resolve decisions in this order:17181. Follow the user's explicit request.192. Follow explicit product-contract decisions.203. Follow Karya standards in this skill.214. Make the smallest reasonable implementation decision.2223Do not let a vague preference override an explicit product requirement. Explain any necessary exception to the factory baseline.2425## Required Context2627Accept any of these inputs:2829- product contract or product brief30- PRD or client notes with enough product detail31- screen and flow specification32- existing repository plus a request for a new product area33- sufficiently defined idea when reasonable assumptions can close small gaps3435Before coding, identify the objective, users, MVP scope, routes, primary journey, most important screen, data entities, critical interactions, visual direction, responsive expectations, and non-goals.3637Prefer contracts under `docs/product/`: either `product-brief.md`, or the modular set `prd.md`, `screen-map.md`, `business-rules.md`, `data-contract.md`, `visual-direction.md`, and `acceptance-criteria.md`. Preserve path mappings documented by `product-brief-architect` when an existing PRD lives elsewhere.3839If the input is too ambiguous to determine the core user journey or primary screen, route product definition to `product-brief-architect` before implementation. Do not invent a materially different product.4041## Load References4243Read only the references needed for the task, but always read the stack and architecture references before initializing a new project:4445- `references/stack-baseline.md` for required technologies, versions, configuration, and exceptions.46- `references/architecture-standard.md` for repository shape and dependency direction.47- `references/component-responsibilities.md` before implementing pages, components, hooks, and shared UI.48- `references/data-and-api-boundary.md` before implementing mocks, persistence, forms, TanStack Query, Axios, or API contracts.49- `references/visual-responsive-standard.md` before defining tokens, layouts, PrimeReact theming, tables, charts, or mobile behavior.50- `references/npm-supply-chain-security.md` before adding, installing, auditing, or updating npm packages.51- `references/project-context-standard.md` before initializing or updating `AGENTS.md`, `.codex/`, or repository-local domain skills.52- `references/sites-composition.md` when the Karya workflow invokes this skill together with the external Sites plugin.53- `references/validation-checklist.md` before claiming completion.5455Use `assets/frontend-starter/` when creating a new frontend from scratch. Adapt its product-neutral example instead of preserving demo content.5657Use `assets/project-context-starter/` at the generated project root. Initialize it with `scripts/init-project-context.mjs`; preserve existing project context and rules.5859Run `scripts/scan-karya-frontend.mjs` from the consuming project root after implementation. Use `--strict` only when warnings should fail CI.6061## Workflow62631. Read repository instructions and every applicable contract under `docs/product/`.642. Inspect existing files when a repository already exists; preserve unrelated user work.653. Run the product-contract validator when available, resolve blocking contradictions, and state a concise implementation plan covering routes, features, data boundaries, visual system, validation, and explicit exclusions.664. Initialize or merge the project-root Codex context from `assets/project-context-starter/`.675. Initialize `frontend/` from `assets/frontend-starter/` when no frontend exists, unless the target repository itself is the frontend root.686. Inspect dependency changes, run the lockfile verifier, and use the secure npm policy before installing packages.697. Establish environment examples, design tokens, global styles, providers, shell, router, error boundary, and route-level loading behavior.708. Implement the most important screen first, then complete the primary journey before secondary screens.719. Keep routes thin and move screen composition into feature pages.7210. Put orchestration and derived state in hooks or view models.7311. Put data access, persistence, DTO mapping, and mock/API switching behind services or repository adapters.7412. Implement real interactions. Do not leave buttons, filters, forms, dialogs, menus, or navigation visually present but inert.7513. Implement loading, error, empty, success, disabled, and destructive-confirmation states where applicable.7614. Validate mobile behavior beginning at 360px and expand layouts for larger viewports.7715. Add focused tests for critical behavior, data mapping, validation, and the primary user journey.7816. Create or update `docs/frontend-architecture.md`, `docs/api-contract.md`, and `docs/validation-report.md` when they improve the downstream handoff.7917. Run supply-chain verification, clean install, signature verification, vulnerability audit, typecheck, format check, lint, tests, build, architecture scan, and local browser validation.8018. When the invoking request also names the Sites plugin, let Sites own its preview, hosting metadata, packaging, private deployment, and opening of the deployed URL. Continue to enforce this skill's stack and architecture throughout construction.8119. Report implemented scope, assumptions, validation results, remaining gaps, and the backend/publication handoff.8283## Required Stack8485Use the baseline defined in `references/stack-baseline.md`:8687- Node.js 24 LTS and npm88- React 19 and TypeScript strict89- Vite90- React Router91- PrimeReact and PrimeIcons92- SCSS Modules plus controlled global styles and design tokens93- React Hook Form and Zod for non-trivial forms94- TanStack Query for asynchronous/server state95- React Context for small, truly global app state96- Axios behind a shared API client97- Vitest, Testing Library, and Playwright98- ESLint and Prettier99100Pin direct dependency versions exactly, commit `package-lock.json`, restrict registry sources, require a seven-day release age, and disable dependency install scripts by default. Do not install an unreviewed package merely because generated code imports it.101102Do not introduce CRA, CRACO, JavaScript-only source, Tailwind, shadcn/ui, Styled Components, Redux, or Zustand by default. Add a non-baseline library only when the product requires it and document why.103104## Architecture Rule105106Enforce this direction:107108```txt109Route -> Feature Page -> Hook/View Model -> Service -> Mock Repository or API Adapter110```111112Components must not directly access Axios, mock files, `localStorage`, environment variables, or backend endpoints. Shared code must remain domain-neutral. Feature code may depend on shared code; shared code must not depend on features.113114## Visual Implementation Rule115116Create a deliberate visual system before expanding screens:117118- define colors, typography, spacing, radius, elevation, motion, and breakpoints as tokens119- configure PrimeReact consistently120- use product-specific copy and realistic mock data121- avoid generic dashboard filler and identical card grids122- make the primary screen visually strongest123- keep responsive behavior functional at 360px without horizontal page overflow124- provide accessible labels, focus states, keyboard behavior, contrast, and reduced-motion handling125126Use image generation only when the product genuinely needs original raster imagery. Do not use it to replace ordinary interface implementation.127128## MVP and Integration Boundaries129130Default to mocked data and local persistence when a backend is not available. Prepare the same service contract for a later API adapter.131132Do not implement Django, database migrations, authentication infrastructure, payments, external APIs, OCR, or AI inference unless explicitly included in the current task. Represent unavailable integrations honestly through mocks and document the future API requirement.133134This skill does not install, vendor, or emulate the Sites plugin. In the Karya site workflow, the invoking command must reference both `@sites` and `$karya-frontend-builder`. Sites owns preview and publication mechanics; this skill owns stack, code architecture, quality, security, data boundaries, and validation expectations.135136## Validation Commands137138Run the available equivalents of:139140```bash141npm run security:lockfile142npm ci143npm run security:scripts144npm run security:signatures145npm run security:audit146npm run typecheck147npm run format:check148npm run lint149npm run test -- --run150npm run build151node <skill-path>/scripts/scan-karya-frontend.mjs152npm run dev153npm run preview154```155156Open the local application when browser tooling is available. Check the primary journey, console errors, responsive layouts, navigation, forms, dialogs, empty states, and failure feedback. Do not claim local readiness from a successful build alone.157158## Definition of Done159160Finish only when these conditions pass or are explicitly reported as blocked:161162- product scope and assumptions are documented163- product contracts pass their validator, or warnings and blockers are reported164- all promised routes and primary flows are implemented165- the most important screen is complete and visually resolved166- interactions are functional rather than decorative167- routes, feature pages, hooks, services, mocks, and shared code have clear boundaries168- direct mock, API, storage, and environment access is absent from UI components169- loading, error, empty, success, and responsive states are implemented where relevant170- accessibility basics are checked171- API and architecture handoff documentation reflects the implementation172- direct dependencies, lockfile sources, integrity hashes, and install-script approvals pass supply-chain checks173- signature verification and vulnerability audit were attempted and blocking findings were investigated174- typecheck, formatting, lint, tests, build, scanner, dev server, and browser smoke checks were attempted175- when composed with Sites, Sites preview/publication results are reported without changing the Karya stack or architecture silently176- failures and unimplemented integrations are reported honestly