Before writing any new code it requires a DRY check across modules/cores/lib, modules/cores/interfaces, and modules/cores/errors, extracting anything repeated 3+ times into a shared helper. Each of the 5 SOLID principles has its own detailed reference (single-responsibility.md through dependency-inversion.md), plus copy-paste-ready templates for modules, services, interfaces, validators, factories, errors, and tests.
SOLID Generic - TypeScript / Bun / Node.js
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 TypeScript/Bun docs via Context7
- mcp__context7__query-docs - Check integration compatibility
After implementation, run fuse-ai-pilot:sniper for validation.
DRY - Reuse Before Creating (MANDATORY)
Before writing ANY new code:
- Grep the codebase for similar function names, patterns, or logic
- Check shared locations:
modules/cores/lib/, modules/cores/interfaces/, modules/cores/errors/
- If similar code exists -> extend/reuse instead of duplicate
- If code will be used by 2+ modules -> create in
modules/cores/
- Extract repeated logic (3+ occurrences) into shared helpers
Absolute Rules (MANDATORY)
1. Files < 100 lines
- Split at 90 lines - Never exceed 100
- Modules < 80 lines
- Services < 60 lines
- Validators < 40 lines
2. Interfaces Separated (Modular MANDATORY)
modules/[feature]/src/interfaces/ # Feature types
|- user.interface.ts
\- service.interface.ts
modules/cores/interfaces/ # Shared types
\- shared.interface.ts
NEVER put interfaces in implementation files.
NEVER use flat src/ structure - always modules/.
3. JSDoc Mandatory
/**
* Parse configuration from file path.
*
* @param filePath - Absolute path to config file
* @returns Parsed configuration object
* @throws ConfigError if file is invalid
*/
export function parseConfig(filePath: string): Config
SOLID Principles (Detailed Guides)
| # |
Principle |
Reference |
Key Rule |
| S |
Single Responsibility |
single-responsibility.md |
One file = one reason to change |
| O |
Open/Closed |
open-closed.md |
Extend via composition, not modification |
| L |
Liskov Substitution |
liskov-substitution.md |
Implementations honor interface contracts |
| I |
Interface Segregation |
interface-segregation.md |
Many focused interfaces > one fat interface |
| D |
Dependency Inversion |
dependency-inversion.md |
Depend on abstractions, inject dependencies |
See solid-principles.md for overview and architecture-patterns.md for project structure.
Code Templates
| Template |
Usage |
Max Lines |
| module.md |
TypeScript/Bun module |
80 |
| service.md |
Service with DI |
60 |
| interface.md |
TypeScript interfaces |
- |
| validator.md |
Zod validation schemas |
40 |
| factory.md |
Factory pattern |
60 |
| error.md |
Custom error classes |
40 |
| test.md |
Bun test / Vitest |
- |
Forbidden
- Files > 100 lines
- Interfaces in implementation files
- Business logic in entry points
- Missing JSDoc on exports
any type
- Barrel exports (index.ts re-exports)
- Duplicating existing utility without Grep search first
- Copy-pasting logic blocks instead of extracting shared function
- Concrete dependencies without interface abstraction
1---2name: solid-generic3description: "Use when building CLI tools, libraries, scripts, hooks, or non-framework TypeScript code (Bun/Node.js -- SOLID, files < 100 lines, JSDoc mandatory)."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/module.md, references/templates/service.md, references/templates/interface.md, references/templates/validator.md, references/templates/factory.md, references/templates/error.md, references/templates/test.md7related-skills: solid-react, solid-nextjs, solid-php, solid-swift8metadata:9 source: https://skillmd.com/skills/fusengine/solid-generic10---1112<objective>13SOLID Generic enforces a modular architecture for plain TypeScript/Bun/Node.js code with no framework (CLI tools, libraries, scripts, hooks): interfaces live in `modules/[feature]/src/interfaces/` or `modules/cores/interfaces/` for shared types, never in implementation files; files stay under 100 lines (modules <80, services <60, validators <40); every export carries JSDoc.1415Before writing any new code it requires a DRY check across `modules/cores/lib`, `modules/cores/interfaces`, and `modules/cores/errors`, extracting anything repeated 3+ times into a shared helper. Each of the 5 SOLID principles has its own detailed reference (`single-responsibility.md` through `dependency-inversion.md`), plus copy-paste-ready templates for modules, services, interfaces, validators, factories, errors, and tests.16</objective>1718# SOLID Generic - TypeScript / Bun / Node.js1920## Agent Workflow (MANDATORY)2122Before ANY implementation, spawn 3 agents in parallel, one `Agent` call each with a `name`:23241. **fuse-ai-pilot:explore-codebase** - Analyze project structure and existing patterns252. **fuse-ai-pilot:research-expert** - Verify latest TypeScript/Bun docs via Context7263. **mcp__context7__query-docs** - Check integration compatibility2728After implementation, run **fuse-ai-pilot:sniper** for validation.2930---3132## DRY - Reuse Before Creating (MANDATORY)3334**Before writing ANY new code:**351. **Grep the codebase** for similar function names, patterns, or logic362. Check shared locations: `modules/cores/lib/`, `modules/cores/interfaces/`, `modules/cores/errors/`373. If similar code exists -> extend/reuse instead of duplicate384. If code will be used by 2+ modules -> create in `modules/cores/`395. Extract repeated logic (3+ occurrences) into shared helpers4041---4243## Absolute Rules (MANDATORY)4445### 1. Files < 100 lines46- **Split at 90 lines** - Never exceed 10047- Modules < 80 lines48- Services < 60 lines49- Validators < 40 lines5051### 2. Interfaces Separated (Modular MANDATORY)52```text53modules/[feature]/src/interfaces/ # Feature types54 |- user.interface.ts55 \- service.interface.ts56modules/cores/interfaces/ # Shared types57 \- shared.interface.ts58```59**NEVER put interfaces in implementation files.**60**NEVER use flat `src/` structure - always `modules/`.**6162### 3. JSDoc Mandatory63```typescript64/**65 * Parse configuration from file path.66 *67 * @param filePath - Absolute path to config file68 * @returns Parsed configuration object69 * @throws ConfigError if file is invalid70 */71export function parseConfig(filePath: string): Config72```7374---7576## SOLID Principles (Detailed Guides)7778| # | Principle | Reference | Key Rule |79|---|-----------|-----------|----------|80| S | Single Responsibility | [single-responsibility.md](references/single-responsibility.md) | One file = one reason to change |81| O | Open/Closed | [open-closed.md](references/open-closed.md) | Extend via composition, not modification |82| L | Liskov Substitution | [liskov-substitution.md](references/liskov-substitution.md) | Implementations honor interface contracts |83| I | Interface Segregation | [interface-segregation.md](references/interface-segregation.md) | Many focused interfaces > one fat interface |84| D | Dependency Inversion | [dependency-inversion.md](references/dependency-inversion.md) | Depend on abstractions, inject dependencies |8586See [solid-principles.md](references/solid-principles.md) for overview and [architecture-patterns.md](references/architecture-patterns.md) for project structure.8788---8990## Code Templates9192| Template | Usage | Max Lines |93|----------|-------|-----------|94| [module.md](references/templates/module.md) | TypeScript/Bun module | 80 |95| [service.md](references/templates/service.md) | Service with DI | 60 |96| [interface.md](references/templates/interface.md) | TypeScript interfaces | - |97| [validator.md](references/templates/validator.md) | Zod validation schemas | 40 |98| [factory.md](references/templates/factory.md) | Factory pattern | 60 |99| [error.md](references/templates/error.md) | Custom error classes | 40 |100| [test.md](references/templates/test.md) | Bun test / Vitest | - |101102---103104## Forbidden105106- Files > 100 lines107- Interfaces in implementation files108- Business logic in entry points109- Missing JSDoc on exports110- `any` type111- Barrel exports (index.ts re-exports)112- Duplicating existing utility without Grep search first113- Copy-pasting logic blocks instead of extracting shared function114- Concrete dependencies without interface abstraction