solid-generic
SOLID Generic - TypeScript / Bun / Node.js
Agent Workflow (MANDATORY)
Before ANY implementation, use TeamCreate to spawn 3 agents:
- 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
anytype- 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
More from fusengine/agents
laravel-architecture
Design Laravel app architecture with services, repositories, actions, and clean code patterns. Use when structuring projects, creating services, implementing DI, or organizing code layers.
97laravel-blade
Create Blade templates with components, slots, layouts, and directives. Use when building views, reusable components, or templating.
88laravel-livewire
Livewire 3 reactive components - wire:model, actions, events, Volt, Folio. Use when building reactive UI without JavaScript.
86nextjs-i18n
Next.js 16 internationalization with next-intl or DIY. Use when implementing i18n, translations, localization, multilingual, language switch, locale routing, or formatters.
59solid-php
SOLID principles for Laravel 12 and PHP 8.5. Files < 100 lines, interfaces separated, PHPDoc mandatory. Auto-detects Laravel and FuseCore architecture.
51laravel-testing
Write tests with Pest 3/PHPUnit, feature tests, unit tests, mocking, fakes, and factories. Use when testing controllers, services, models, or implementing TDD.
50