Provides a dedicated reference guide per SOLID letter (SRP file-splitting, OCP composition/render-props, LSP contract compliance, ISP role-based props/context, DIP constructor injection via Context) plus 10 ready-to-copy templates covering components, hooks, services, stores, validators, factories, and tests. This is a cross-cutting code-quality skill, not a feature skill — for the React APIs themselves see react-19, react-state, react-forms, and react-tanstack-router.
SOLID React - Component Architecture
Codebase Analysis (MANDATORY)
Before ANY implementation:
- Explore project structure to understand architecture
- Read existing related files to follow established patterns
- Identify naming conventions, coding style, and patterns used
- Understand data flow and dependencies
DRY - Reuse or Create Shared (MANDATORY)
Before writing ANY new code:
- Grep the codebase for similar function names, patterns, or logic
- Check shared locations:
modules/cores/lib/, modules/cores/components/, modules/cores/hooks/
- If similar code exists → extend/reuse instead of duplicate
- If code will be used by 2+ features → create it in
modules/cores/ directly
- Extract repeated logic (3+ occurrences) into shared helpers
- Run
npx jscpd ./src --threshold 3 after creating new files
Agent Workflow (MANDATORY)
Before ANY implementation, spawn 3 agents in parallel, one Agent call each with a name:
- fuse-ai-pilot:explore-codebase - Analyze project structure and existing patterns
- fuse-ai-pilot:research-expert - Verify latest docs for all stack technologies
- mcp__context7__query-docs - Check integration compatibility
After implementation, run fuse-ai-pilot:sniper for validation.
Absolute Rules (MANDATORY)
1. Files < 100 lines
- Split at 90 lines - Never exceed 100
- Components < 50 lines (use composition)
- Hooks < 30 lines each
- Services < 40 lines each
2. Modular Architecture
See references/architecture-patterns.md for complete structure with feature modules and cores directory.
3. JSDoc Mandatory
/**
* Fetch user by ID from API.
*
* @param id - User unique identifier
* @returns User object or null if not found
*/
export async function getUserById(id: string): Promise<User | null>
4. Interfaces Separated
modules/[feature]/src/interfaces/
├── user.interface.ts
├── post.interface.ts
└── api.interface.ts
NEVER put interfaces in component files.
SOLID Principles (Detailed Guides)
Each SOLID principle has a dedicated reference guide:
references/single-responsibility.md - One function = one reason to change
- File splitting at 90 lines (components < 50, hooks < 30)
- Component composition patterns
- Split strategy
references/open-closed.md - Extend via composition, not modification
- Plugin architecture patterns
- Render props and slots
- Strategy patterns
references/liskov-substitution.md - Contract compliance & behavioral subtyping
- Interface contracts
- Swappable implementations
- Testing compliance
references/interface-segregation.md - Many focused interfaces beat one fat interface
- Role-based interfaces
- Props segregation
- Context splitting
references/dependency-inversion.md - Depend on abstractions, not implementations
- Constructor injection patterns
- Factory patterns
- Context for DI
See references/solid-principles.md for overview and quick reference.
Code Templates
Ready-to-copy code in references/templates/:
| Template |
Usage |
Max Lines |
component.md |
React functional component |
50 |
hook.md |
Custom hook with TanStack Query |
30 |
service.md |
Service with dependency injection |
40 |
store.md |
Zustand store with persistence |
40 |
interface.md |
TypeScript interfaces |
- |
validator.md |
Zod validation schemas |
30 |
factory.md |
Factory pattern |
40 |
adapter.md |
Adapter pattern |
40 |
error.md |
Custom error classes |
30 |
test.md |
Vitest + Testing Library |
- |
Response Guidelines
- Research first - MANDATORY: Search Context7 + Exa before ANY code
- Show complete code - Working examples, not snippets
- Explain decisions - Why this pattern over alternatives
- Include tests - Always suggest test cases
- Handle errors - Never ignore, use error boundaries
- Type everything - Full TypeScript, no
any
- Document code - JSDoc for complex functions
Forbidden
- Coding without researching docs first (ALWAYS research)
- Using outdated APIs without checking current year docs
- Files > 100 lines
- Interfaces in component files
- Business logic in components
- Class components
- Missing JSDoc on exports
any type
- Barrel exports (index.ts re-exports)
useEffect for data fetching (use TanStack Query or Router loaders)
- Module importing another module (except cores)
- Duplicating existing utility/helper without Grep search first
- Copy-pasting logic blocks instead of extracting shared function
1---2name: solid-react3description: Use when applying SOLID principles to React architecture — file-size limits, hook separation, src/interfaces/, JSDoc.4version: 1.0.05user-invocable: true6references: references/solid-principles.md, references/single-responsibility.md, references/open-closed.md, references/liskov-substitution.md, references/interface-segregation.md, references/dependency-inversion.md, references/architecture-patterns.md, references/templates/component.md, references/templates/hook.md, references/templates/service.md, references/templates/store.md, references/templates/interface.md, references/templates/validator.md, references/templates/factory.md, references/templates/adapter.md, references/templates/error.md, references/templates/test.md7metadata:8 source: https://skillmd.com/skills/fusengine/solid-react9---1011<objective>12Enforces SOLID and DRY architecture on React 19 projects: files under 100 lines (components < 50, hooks < 30, services < 40), types isolated in `modules/[feature]/src/interfaces/` (never in component files), mandatory JSDoc on exports, no class components, and mandatory grepping for existing logic/utilities before writing new code (with `jscpd` duplication checks).1314Provides a dedicated reference guide per SOLID letter (SRP file-splitting, OCP composition/render-props, LSP contract compliance, ISP role-based props/context, DIP constructor injection via Context) plus 10 ready-to-copy templates covering components, hooks, services, stores, validators, factories, and tests. This is a cross-cutting code-quality skill, not a feature skill — for the React APIs themselves see react-19, react-state, react-forms, and react-tanstack-router.15</objective>1617# SOLID React - Component Architecture1819## Codebase Analysis (MANDATORY)2021**Before ANY implementation:**221. Explore project structure to understand architecture232. Read existing related files to follow established patterns243. Identify naming conventions, coding style, and patterns used254. Understand data flow and dependencies2627## DRY - Reuse or Create Shared (MANDATORY)2829**Before writing ANY new code:**301. **Grep the codebase** for similar function names, patterns, or logic312. Check shared locations: `modules/cores/lib/`, `modules/cores/components/`, `modules/cores/hooks/`323. If similar code exists → extend/reuse instead of duplicate334. If code will be used by 2+ features → create it in `modules/cores/` directly345. Extract repeated logic (3+ occurrences) into shared helpers356. Run `npx jscpd ./src --threshold 3` after creating new files3637---3839## Agent Workflow (MANDATORY)4041Before ANY implementation, spawn 3 agents in parallel, one `Agent` call each with a `name`:42431. **fuse-ai-pilot:explore-codebase** - Analyze project structure and existing patterns442. **fuse-ai-pilot:research-expert** - Verify latest docs for all stack technologies453. **mcp__context7__query-docs** - Check integration compatibility4647After implementation, run **fuse-ai-pilot:sniper** for validation.4849---5051## Absolute Rules (MANDATORY)5253### 1. Files < 100 lines5455- **Split at 90 lines** - Never exceed 10056- Components < 50 lines (use composition)57- Hooks < 30 lines each58- Services < 40 lines each5960### 2. Modular Architecture6162See `references/architecture-patterns.md` for complete structure with feature modules and cores directory.6364### 3. JSDoc Mandatory6566```typescript67/**68 * Fetch user by ID from API.69 *70 * @param id - User unique identifier71 * @returns User object or null if not found72 */73export async function getUserById(id: string): Promise<User | null>74```7576### 4. Interfaces Separated7778```text79modules/[feature]/src/interfaces/80├── user.interface.ts81├── post.interface.ts82└── api.interface.ts83```8485**NEVER put interfaces in component files.**8687---8889## SOLID Principles (Detailed Guides)9091Each SOLID principle has a dedicated reference guide:92931. **`references/single-responsibility.md`** - One function = one reason to change94 - File splitting at 90 lines (components < 50, hooks < 30)95 - Component composition patterns96 - Split strategy97982. **`references/open-closed.md`** - Extend via composition, not modification99 - Plugin architecture patterns100 - Render props and slots101 - Strategy patterns1021033. **`references/liskov-substitution.md`** - Contract compliance & behavioral subtyping104 - Interface contracts105 - Swappable implementations106 - Testing compliance1071084. **`references/interface-segregation.md`** - Many focused interfaces beat one fat interface109 - Role-based interfaces110 - Props segregation111 - Context splitting1121135. **`references/dependency-inversion.md`** - Depend on abstractions, not implementations114 - Constructor injection patterns115 - Factory patterns116 - Context for DI117118See `references/solid-principles.md` for overview and quick reference.119120---121122## Code Templates123124Ready-to-copy code in `references/templates/`:125126| Template | Usage | Max Lines |127|----------|-------|-----------|128| `component.md` | React functional component | 50 |129| `hook.md` | Custom hook with TanStack Query | 30 |130| `service.md` | Service with dependency injection | 40 |131| `store.md` | Zustand store with persistence | 40 |132| `interface.md` | TypeScript interfaces | - |133| `validator.md` | Zod validation schemas | 30 |134| `factory.md` | Factory pattern | 40 |135| `adapter.md` | Adapter pattern | 40 |136| `error.md` | Custom error classes | 30 |137| `test.md` | Vitest + Testing Library | - |138139---140141## Response Guidelines1421431. **Research first** - MANDATORY: Search Context7 + Exa before ANY code1442. **Show complete code** - Working examples, not snippets1453. **Explain decisions** - Why this pattern over alternatives1464. **Include tests** - Always suggest test cases1475. **Handle errors** - Never ignore, use error boundaries1486. **Type everything** - Full TypeScript, no `any`1497. **Document code** - JSDoc for complex functions150151---152153## Forbidden154155- Coding without researching docs first (ALWAYS research)156- Using outdated APIs without checking current year docs157- Files > 100 lines158- Interfaces in component files159- Business logic in components160- Class components161- Missing JSDoc on exports162- `any` type163- Barrel exports (index.ts re-exports)164- `useEffect` for data fetching (use TanStack Query or Router loaders)165- Module importing another module (except cores)166- Duplicating existing utility/helper without Grep search first167- Copy-pasting logic blocks instead of extracting shared function