shinpr/frontend-technical-spec
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.
npx skills add https://github.com/shinpr/ai-coding-project-boilerplate --skill frontend-technical-spec
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.
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.
// 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
.env files outside version control and provide non-secret example files for required variable namesCorrect 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
React Component Architecture:
Select a component/state pattern using these rules:
State Management Patterns:
useState for component-specific stateMaintain consistent data flow throughout the React application:
API Response -> State -> Props -> Render -> UI
User Input -> Event Handler -> State Update -> Re-render
// Immutable state update
setUsers(prev => [...prev, newUser])
// Invalid mutable state update
users.push(newUser)
setUsers(users)
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
}
Select the package manager from the packageManager field, lockfile, or CI command in that order. Execute only scripts present in the selected manifest.
test - Run teststest:coverage - Run tests with coveragetest:coverage:fresh - Run tests with coverage (fresh cache)test:safe - Safe test execution (with auto cleanup)cleanup:processes - Cleanup Vitest processesQuality checks are mandatory upon implementation completion:
Phase 1-3: Basic Checks
check - Biome (lint + format)build - TypeScript buildTransition evidence: every configured lint/format/type/build check exits successfully. A missing required script blocks the next phase until an equivalent repository command is identified.
Phase 4-5: Tests and Final Confirmation
test - Test executiontest:coverage:fresh - Coverage measurementcheck:all - Overall integrated checkCompletion 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.
Take shinpr/frontend-technical-spec from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.