frontend-technical-spec
Skill236 starsChanged 7 days agoMITView on GitHub
Defines React environment, component architecture, state/data flow, build verification, and frontend non-functional criteria from repository evidence. Use when configuring or designing a React frontend, its build, or its runtime boundaries.
- Reads credentials
In this repository44 other files it gives its agents.
- coding-standardsSkill
- documentation-criteriaSkill
- frontend-typescript-rulesSkill
- frontend-typescript-testingSkill
- implementation-approachSkill
- integration-e2e-testingSkill
- llm-friendly-contextSkill
- project-contextSkill
- requirement-convergenceSkill
- skill-optimizationSkill
- subagents-orchestration-guideSkill
- technical-specSkill
- typescript-rulesSkill
- typescript-testingSkill
- coding-standardsSkill
- documentation-criteriaSkill
- frontend-technical-specSkill
- frontend-typescript-rulesSkill
- frontend-typescript-testingSkill
- implementation-approachSkill
- integration-e2e-testingSkill
- llm-friendly-contextSkill
- project-contextSkill
- requirement-convergenceSkill
- skill-optimizationSkill
- subagents-orchestration-guideSkill
- technical-specSkill
- typescript-rulesSkill
- typescript-testingSkill
- coding-standardsSkill
- documentation-criteriaSkill
- frontend-technical-specSkill
- frontend-typescript-rulesSkill
- frontend-typescript-testingSkill
- implementation-approachSkill
- integration-e2e-testingSkill
- llm-friendly-contextSkill
- project-contextSkill
- requirement-convergenceSkill
- skill-optimizationSkill
- subagents-orchestration-guideSkill
- technical-specSkill
- typescript-rulesSkill
- typescript-testingSkill
The file
We split this skill into the rules it gives an agent
11 rules. About 0 are common, 9 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
CRITICAL: All frontend code is public and visible in browser
- Very specific: line 37
Keep local .env files outside version control and provide non-secret example files for required variable names
- Distinctive: line 57
Component Hierarchy: Follow the repository's established component layering (for example, Atoms -> Molecules -> Organisms -> Templates -> …
- Distinctive: line 59
Co-location: Place tests, styles, and related files alongside components
- Distinctive: line 62
Keep state local when one component subtree owns every read and write
- Distinctive: line 63
Use Context when multiple descendants require the same low-frequency state and the provider boundary is explicit
- Distinctive: line 64
Use a server-state library only when the configured dependency exists and caching, deduplication, background refresh, or request lifecycle …
- Distinctive: line 89
Immutable Updates: Use immutable patterns for state updates
- Very specific: line 136
Transition evidence: every configured lint/format/type/build check exits successfully.
- Distinctive: line 148
Browser Compatibility: Use the repository's Browserslist/build target or a named product requirement.
- Distinctive: line 149
Rendering Performance: Use the browser matrix and performance thresholds defined by project requirements, CI, or performance configuration.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Technical Design Rules (Frontend)
Prerequisite Detection
Inspect package.json, the lockfile, TypeScript/build configuration, CI definitions, and representative components before applying a tool- or framework-specific rule. Treat React, Vite, Next.js, a state library, form library, or script as available only when repository evidence names it. Label surrounding-pattern conclusions as inferred. When a missing decision changes rendering architecture, compatibility, security, or verification, stop and name the exact evidence or user decision required.
Basic Technology Stack Policy
These rules apply when repository configuration confirms a TypeScript-based React application. Select architecture by mapping current requirements and constraints to component responsibilities, state ownership, server/client boundaries, and observable verification points.
Environment Variable Management and Security
Environment Variable Management
- Use the build tool's client-exposure mechanism: Browser code can read only values explicitly exposed by the configured bundler/framework; server-only environment access remains outside client bundles
- Centrally manage environment variables through configuration layer
- Parse exposed values at one typed configuration boundary before application use
- Give a value a default only when requirements define valid behavior for absence; otherwise fail startup/build validation with the variable name and expected format
// Build tool environment variables (public values only; client-exposed vars need the VITE_ prefix)
const config = {
apiUrl: import.meta.env.VITE_API_URL || 'http://localhost:3000',
appName: import.meta.env.VITE_APP_NAME || 'My App'
}
// Does not work in frontend
const apiUrl = process.env.API_URLSecurity (Client-side Constraints)
- CRITICAL: All frontend code is public and visible in browser
- Keep secrets server-side: Client-exposed configuration contains public values only; a backend or trusted service owns API keys, tokens, and credentials
- Keep local
.envfiles outside version control and provide non-secret example files for required variable names - Log and return only fields approved for the current trust boundary; redact passwords, tokens, and personal data
Correct Approach for Secrets:
// Security risk: API key exposed in browser
const apiKey = import.meta.env.VITE_API_KEY
const response = await fetch(`https://api.example.com/data?key=${apiKey}`)
// Correct: Backend manages secrets, frontend accesses via proxy
const response = await fetch('/api/data') // Backend handles API key authenticationArchitecture Design
Frontend Architecture Patterns
React Component Architecture:
- Function Components: Mandatory; class components allowed solely for Error Boundaries (no hook equivalent)
- Custom Hooks: For logic reuse and dependency injection
- Component Hierarchy: Follow the repository's established component layering (for example, Atoms -> Molecules -> Organisms -> Templates -> Pages) when one exists
- Props-driven: Pass data through props when one explicit parent owns it; apply the state rules below otherwise
- Co-location: Place tests, styles, and related files alongside components
Select a component/state pattern using these rules:
- Keep state local when one component subtree owns every read and write
- Use Context when multiple descendants require the same low-frequency state and the provider boundary is explicit
- Use a server-state library only when the configured dependency exists and caching, deduplication, background refresh, or request lifecycle state is required
- Introduce an additional state-management dependency only when current requirements cannot be covered by local state, reducer state, existing Context, or the repository's established state mechanism
State Management Patterns:
- Local State:
useStatefor component-specific state - Context API: For sharing state across component tree (theme, auth, etc.)
- Custom Hooks: Encapsulate state logic and side effects
- Server State: The configured server-state library (e.g., React Query or SWR) when the rule above selects one
Unified Data Flow Principles
Client-side Data Flow
Maintain consistent data flow throughout the React application:
- Single Source of Truth: Each piece of state has one authoritative source
- UI state: Component state or Context
- Server data: The repository's server-state mechanism (a configured React Query/SWR cache, or component/Context state)
- Form data: Controlled components, using the configured form library (e.g., React Hook Form) when present
- Unidirectional Flow: Data flows top-down via props
API Response -> State -> Props -> Render -> UI User Input -> Event Handler -> State Update -> Re-render - Immutable Updates: Use immutable patterns for state updates
// Immutable state update setUsers(prev => [...prev, newUser]) // Invalid mutable state update users.push(newUser) setUsers(users)
Type Safety in Data Flow
- Frontend -> Backend: Props/State (Type Guaranteed) -> API Request (Serialization)
- Backend -> Frontend: API Response (
unknown) -> Type Guard -> State (Type Guaranteed)
// Type-safe data flow
async function fetchUser(id: string): Promise<User> {
const response = await fetch(`/api/users/${id}`)
const data: unknown = await response.json()
if (!isUser(data)) {
throw new Error('Invalid user data')
}
return data // Type guaranteed as User
}Build and Testing
Select the package manager from the packageManager field, lockfile, or CI command in that order. Execute only scripts present in the selected manifest.
Build Commands
- Auto-detect and execute the following from package.json scripts:
- Development server
- Production build
- Type check (no emit)
Testing Commands
test- Run tests
Quality Check Requirements
Quality checks are mandatory upon implementation completion:
Phase 1-3: Basic Checks
check- Biome (lint + format)build- TypeScript build
Transition evidence: every configured lint/format/type/build check exits successfully. A missing required script is reported with the manifest/configuration path, and the remaining checks still run; whether the missing check leaves required proof unavailable is decided by the quality-fixer result.
Phase 4-5: Tests and Final Confirmation
test- Test executioncheck:all- Overall integrated check
Completion evidence: configured tests pass, the production build succeeds, and the integrated check remains clean after test fixes. Record an environment-dependent test as blocked with its exact prerequisite.
Test Focus
- Give foundational, high-reuse units such as shared components, custom hooks, and utilities direct tests for their observable contracts. Verify higher-composition surfaces such as organisms and pages through integration or E2E tests when that boundary best exposes the relevant failure
Non-functional Requirements
- Browser Compatibility: Use the repository's Browserslist/build target or a named product requirement; record the source and test the affected browser-specific behavior
- Rendering Performance: Use the browser matrix and performance thresholds defined by project requirements, CI, or performance configuration. When none exists, report measured conditions as diagnostic evidence without inventing a pass threshold
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

