.agents/skills/frontend-architecture/SKILL.md
Guidelines and strict rules for scaffolding React components, interfaces, and maintaining alias imports.
npx skillsauth add filippovskii09/quize-audit Frontend Architecture StandardsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Enforcement levels: MUST = mandatory · SHOULD = expected default · MAY = optional.
Every component MUST live in its own folder:
src/components/<domain>/<ComponentName>/
index.tsx ← component implementation
types.ts ← prop interfaces
index.spec.tsx ← tests (if single spec file)
__tests__/ ← used when multiple spec files exist
types.ts file inside the component folder.index.tsx.Components are grouped into domain-specific subdirectories under src/components/:
| Directory | Contains |
|---|---|
| ui/ | Shared, generic, stateless UI primitives (Button, ProgressBar, etc.) |
| student/ | Feature components for the student role |
| admin/ | Feature components for the admin role |
| icons/ | SVG icon components (see §6) |
ui/.index.ts).The project uses path aliases defined in vite.config.ts and tsconfig.app.json:
| Alias | Resolves to |
|---|---|
| @ui | src/components/ui |
| @icons | src/components/icons |
| @components | src/components |
| @src | src/ |
../ paths for cross-folder imports../ only for imports within the same component folder.// ✅
import { Button } from '@ui';
import { useLocalStorage } from '@src/hooks';
// ❌
import { Button } from '../../../components/ui/Button';
index.ts that re-exports its contents.export * from './...' or export { X } from './...').// ✅
import { ProgressBar } from '@ui';
// ❌
import { ProgressBar } from '@ui/ProgressBar';
interface for component props and object shapes.type only for aliases and union types.as const for constant literals (not enums — see §7).type keyword for type-only imports when verbatimModuleSyntax is enabled:import type { ButtonProps } from './types';
import { type ReactElement } from 'react';
All SVG icons MUST be extracted into standalone React components under src/components/icons/:
src/components/icons/
SettingsIcon.tsx
ClipboardIcon.tsx
index.ts ← barrel export
<svg> markup directly inside feature components.className, width, height) via spread.@icons alias:// ✅
import { SettingsIcon } from '@icons';
// ❌
import { ReactComponent as SettingsIcon } from '../../assets/settings.svg';
Application-level state constants (modes, statuses, flags) MUST follow these rules:
All shared constants MUST live in src/constants/index.ts.
Constants MUST use UPPER_SNAKE_CASE:
// ✅
export const APP_MODE = { IDLE: 'idle', STUDENT: 'student', ADMIN: 'admin' } as const;
// ❌
export const AppMode = { ... };
export enum AppMode { ... }
as const objects.enum (incompatible with some build tool optimizations).// ✅
setAppState({ mode: APP_MODE.IDLE });
if (appState.mode === APP_MODE.ADMIN) { ... }
// ❌
setAppState({ mode: 'idle' });
if (appState.mode === 'admin') { ... }
Derive union types from constants using typeof:
export const APP_MODE = { IDLE: 'idle', STUDENT: 'student', ADMIN: 'admin' } as const;
export type AppMode = (typeof APP_MODE)[keyof typeof APP_MODE];
Test files follow a proximity rule — tests live as close as possible to their source:
If a folder contains only one spec file, place it directly alongside the source:
src/components/ui/Button/
index.tsx
types.ts
index.spec.tsx ← ✅ only one spec, stays in root of component folder
If a folder contains two or more spec files (e.g., index.spec, utils.spec, hooks.spec), MUST move all specs into a __tests__/ subfolder:
src/hooks/
useLocalStorage.ts
usePagination.ts
__tests__/
useLocalStorage.spec.ts ← ✅ multiple specs → __tests__/
usePagination.spec.ts
The rule applies to both
src/components/**andsrc/hooks/,src/utils/etc.
development
Domain skill for React internationalization setup with react-intl, locale switching, and typed i18n context. Use when adding new translations or extending locale behavior.
development
Domain skill for reusable typed React hooks used in business logic. Use when extending or validating shared hooks like local storage and pagination.
development
Reusable Prettier formatting recipe for TypeScript and frontend repositories. Use when enforcing consistent code style and integrating format checks in hooks.
tools
Declarative pre-commit framework recipe for polyglot repositories with stage-aware hooks (pre-commit and pre-push). Use when repositories need non-Node quality gates or mixed toolchains.