Loading...
Loading...
SOLID principles for Ruby 3.3+ and Rails 8. Files < 100 lines, contracts separated, modular architecture. Modules MANDATORY.
npx skill4agent add fusengine/agents solid-rubyTeamCreateapp/modules/core/services/app/modules/core/contracts/app/modules/core/| Layer | Location | Max Lines |
|---|---|---|
| Controllers | | 50 |
| Services | | 100 |
| Repositories | | 100 |
| Contracts | | 30 |
| Models | | 50 |
| Shared | | - |
app/app/modules/[feature]/| Rule | Value |
|---|---|
| File limit | 100 lines (split at 90) |
| Controllers | < 50 lines, delegate to services |
| Contracts | |
| YARD doc | Every public method documented |
| Frozen string | |
| Concerns | Use for shared behavior (like interfaces) |
| Topic | Reference | When to consult |
|---|---|---|
| SOLID Overview | solid-principles.md | Quick reference |
| SRP | single-responsibility.md | Fat classes |
| OCP | open-closed.md | Adding strategies |
| LSP | liskov-substitution.md | Contracts |
| ISP | interface-segregation.md | Fat modules |
| DIP | dependency-inversion.md | Injection |
| Architecture | architecture-patterns.md | Modular Rails |
| Template | When to use |
|---|---|
| module.md | Feature module structure |
| service.md | Business logic service |
| contract.md | Duck typing contracts |
| model.md | Active Record model |
| error.md | Custom exceptions |
| test.md | RSpec tests |
| Anti-Pattern | Fix |
|---|---|
| Files > 100 lines | Split at 90 |
| Business logic in models | Extract to service |
| Fat controllers | Delegate to services |
Flat | Use |
| God classes | Split by responsibility |