Loading...
Loading...
Unified router for 7 canonical software engineering knowledge bases. Routes queries to appropriate underlying skills: gof-patterns (23 design patterns), clrs-algorithms (40 data structures), clean-code (SOLID + practices), ddia (distributed systems), pragmatic-programmer (craftsmanship), ddd (domain modeling), sicp (CS fundamentals). Auto-activates for architecture decisions, pattern selection, algorithm choice, and system design.
npx skill4agent add grndlvl/software-patterns software-patterns| Skill | Files | Coverage | Use For |
|---|---|---|---|
| gof-patterns | 25 | 23 GoF design patterns + selection guides | Object creation, composition, behavior |
| clrs-algorithms | 40 | Data structures & algorithms | Performance optimization, algorithm selection |
| clean-code | 14 | SOLID principles + 8 practices | Code quality, refactoring, maintainability |
| ddia | 21 | Distributed systems concepts | Scalability, consistency, availability |
| pragmatic-programmer | 19 | 7 principles + 11 practices | Software craftsmanship, debugging, tooling |
| ddd | 15 | 4 strategic + 5 tactical patterns | Domain modeling, bounded contexts |
| sicp | 13 | 12 fundamental CS concepts | Abstraction, recursion, interpreters |
/pattern <problem>/pattern create objects without knowing exact type/pattern add behavior dynamically/pattern notify multiple objects of changes/pattern simplify complex subsystemgof-patterns/ds <requirement>/ds fast lookup by key/ds maintain sorted order/ds fast insert/delete at ends/ds priority queueclrs-algorithms/architecture <scenario>/architecture e-commerce checkout/architecture real-time leaderboard/architecture multi-tenant SaaSgof-patternsclrs-algorithmsddiaddd/implement <pattern> [language]/implement factory method typescript/implement observer python/implement heap java/compare <a> vs <b>/compare factory method vs abstract factory/compare array vs linked list/compare postgres vs mongodb/compare event sourcing vs crudpatterns:
- "create", "instantiate", "build" → Creational patterns
- "structure", "compose", "organize" → Structural patterns
- "behavior", "algorithm", "interact" → Behavioral patterns
data_structures:
- "fast lookup", "search", "find" → Hash or Tree
- "sorted", "ordered" → Tree or Heap
- "insert", "delete", "add", "remove" → List or Tree
- "queue", "stack", "priority" → Specialized structures
distributed_systems:
- "scale", "partition", "shard" → ddia/partitioning
- "replicate", "consistency" → ddia/replication
- "distributed", "consensus" → ddia/consensus
domain_modeling:
- "entity", "value object", "aggregate" → ddd/tactical
- "bounded context", "ubiquitous language" → ddd/strategic| Query Type | Primary Skill | Supporting Skills |
|---|---|---|
| Design pattern | | |
| Data structure | | |
| Code quality | | |
| Distributed systems | | |
| Domain modeling | | |
| Fundamentals | | |
| Architecture | ALL | Orchestrated solution |
1. clrs-algorithms → LRU cache data structure (Hash Table + Doubly Linked List)
2. gof-patterns → Proxy pattern (control access), Flyweight (share state)
3. ddia → Replication strategies, consistency models
4. clean-code → Interface design, SOLID principles1. ddd → Order aggregate, bounded contexts (order, payment, shipping)
2. gof-patterns → State (order states), Command (payment actions), Observer (notifications)
3. clrs-algorithms → Priority Queue (order processing), Hash Table (inventory lookup)
4. ddia → Event sourcing, CQRS, distributed transactions
5. clean-code → SRP (one class per concern), DIP (depend on abstractions)Pattern: Caching layer with eviction policy
Skills Used:
- clrs-algorithms: Hash Table + Doubly Linked List (LRU)
- gof-patterns: Proxy (control access), Flyweight (share state)
- ddia: Replication (distributed cache), Consistency (cache coherence)
- clean-code: SRP (separate concerns), DIP (interface-based)
Implementation Guide:
1. Use Hash Table for O(1) key lookup
2. Use Doubly Linked List for O(1) LRU eviction
3. Apply Proxy pattern to control access and logging
4. Apply Flyweight to share immutable state
5. Consider replication strategy for distributed scenariosPattern: Event-driven system with processing pipeline
Skills Used:
- gof-patterns: Observer (event notification), Command (encapsulate actions)
- clrs-algorithms: Queue (FIFO processing), Priority Queue (prioritized events)
- ddia: Stream Processing (Kafka/Flink), Event Sourcing
- ddd: Domain Events, Aggregates (event producers)
- clean-code: SRP (one handler per event type)
Implementation Guide:
1. Use Observer for event subscription
2. Use Queue or Priority Queue for event buffer
3. Use Command pattern for event handlers
4. Apply Event Sourcing for audit trail
5. Define Domain Events in Ubiquitous LanguagePattern: Isolated tenants with shared infrastructure
Skills Used:
- ddd: Bounded Contexts (per tenant or shared), Context Mapping
- gof-patterns: Abstract Factory (tenant-specific objects), Strategy (tenant policies)
- clrs-algorithms: Hash Table (tenant lookup), B-Tree (tenant data indexing)
- ddia: Partitioning (tenant sharding), Isolation Levels
- clean-code: OCP (extend without modifying), ISP (tenant-specific interfaces)
Implementation Guide:
1. Define Bounded Context boundaries (shared kernel vs separate)
2. Use Abstract Factory for tenant-specific object creation
3. Use Strategy for tenant-specific policies (pricing, limits)
4. Partition data by tenant ID for isolation
5. Choose appropriate isolation level (row-level, schema-level, database-level)Pattern: Order processing with inventory, payment, shipping
Skills Used:
- ddd: Aggregates (Order, Inventory, Payment), Bounded Contexts
- gof-patterns: State (order lifecycle), Command (payment operations), Observer (notifications)
- clrs-algorithms: Priority Queue (order processing), Hash Table (inventory lookup)
- ddia: Distributed Transactions (Saga pattern), Event Sourcing
- clean-code: SRP (separate concerns), DIP (depend on repositories)
Implementation Guide:
1. Define Order Aggregate with invariants
2. Use State pattern for order states (cart → payment → processing → shipped)
3. Use Command for payment operations (process, refund, cancel)
4. Use Observer for notifications (customer, warehouse, shipping)
5. Apply Saga pattern for distributed transaction coordination
6. Use Event Sourcing for order history and replayPattern: Sorted rankings with fast updates
Skills Used:
- clrs-algorithms: Red-Black Tree or Skip List (sorted rankings), Hash Table (user lookup)
- gof-patterns: Observer (rank change notifications), Memento (snapshot rankings)
- ddia: Replication (read scaling), Partitioning (range-based)
- clean-code: Functions (small, focused), DRY (ranking logic)
Implementation Guide:
1. Use Sorted Set (Red-Black Tree) for O(log n) insert/delete/rank
2. Use Hash Table for O(1) user score lookup
3. Apply Observer for real-time rank change notifications
4. Use Read Replicas for scaling leaderboard queries
5. Partition by rank ranges for very large leaderboardsPrimary Match: Creational Patterns (gof-patterns)
Recommendation: Factory Method Pattern
Routing to: gof-patterns/gof-creational/factory-method.md
Additional Considerations:
- If creating families of related objects → Abstract Factory
- If construction is complex → Builder
- See: gof-patterns/pattern-selection.md for decision treePrimary Match: Data Structure Selection (clrs-algorithms)
Recommendation: Tree Map (Red-Black Tree or AVL Tree)
Comparison:
- Hash Table: O(1) lookup, NO sorted order
- Tree Map: O(log n) lookup, YES sorted order ✓
- Sorted Array: O(log n) search, O(n) insert ✗
Routing to: clrs-algorithms/data-structures/trees/red-black-tree.md
See also: clrs-algorithms/data-structure-selection.mdMulti-Skill Solution:
1. Pattern Selection (gof-patterns):
- Observer Pattern: Subscribe to events
- Strategy Pattern: Switch between notification methods
- Command Pattern: Queue notification actions
2. Data Structures (clrs-algorithms):
- Priority Queue: Prioritize urgent notifications
- Hash Table: User preference lookup
3. Distributed Systems (ddia):
- Queue (Kafka/RabbitMQ): Async processing
- Retry mechanisms: Handle failures
4. Code Quality (clean-code):
- SRP: One class per notification channel
- OCP: Add new channels without modifying existing
Implementation Stack:
Observer → Command → Priority Queue → Strategy → DIPPrimary Match: Code Quality (clean-code)
Violations Detected:
1. Single Responsibility Principle (SRP) - function does too many things
2. Function size - should be 5-20 lines
Refactoring Steps:
1. Extract methods for each responsibility (clean-code/practices/functions.md)
2. Apply SRP (clean-code/solid/single-responsibility.md)
3. Use meaningful names (clean-code/practices/meaningful-names.md)
Supporting Guidance:
- pragmatic-programmer/practices/refactoring.md: When and how to refactor
- gof-patterns: Consider Template Method or Strategy if algorithm varies
Tools:
- Extract Method refactoring
- Compose Method pattern
- Replace Temp with Queryclassfunction->//name: Type| Language | Class | Method | Call | Comment | Types |
|---|---|---|---|---|---|
| PHP | | | | | Docblocks or PHP 8+ |
| JavaScript | | | | | JSDoc or TypeScript |
| TypeScript | | method / arrow | | | Native types |
| Python | | | | | Type hints |
| Java | | method | | | Native types |
| C# | | method | | | Native types |
| Go | | | | | Native types |
| Rust | | | | | Native types |
"I need a comprehensive solution for [problem] covering patterns, data structures, and distributed systems""Show me the full Observer pattern documentation"
→ Routes to: gof-patterns/gof-behavioral/observer.md
"Explain Red-Black Tree implementation with examples"
→ Routes to: clrs-algorithms/data-structures/trees/red-black-tree.md
"What are all SOLID principles?"
→ Routes to: clean-code/solid/ (all 5 principles)"/compare singleton vs dependency injection"
→ Multi-skill analysis from gof-patterns + clean-code
"/compare b-tree vs lsm-tree"
→ Multi-skill analysis from clrs-algorithms + ddia
"/compare entity vs value object"
→ Analysis from ddd/tactical/