frontend-technical-spec
FreeNo executable scriptsNot checkedDefines React environment, component architecture, state/data flow, build verification, and frontend non-functional criteria from repository evidence. Use…
by shinpr★ 239 GitHub starsAbout this skill
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_URL
Security (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 authentication
Architecture 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-renderImmutable Updates: Use immutable patterns for state updates
// Immutable state upda
Install frontend-technical-spec in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the frontend-technical-spec skill do?
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.
How do I install the frontend-technical-spec skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the frontend-technical-spec skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
by Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
by Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
by Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
by Anthropic