A comprehensive reference for Gang of Four design patterns and fundamental data structures for Claude Code. Language-agnostic pseudocode examples that translate to any programming language.
| Category | Count | Description |
|---|---|---|
| GoF Creational Patterns | 5 | Abstract Factory, Builder, Factory Method, Prototype, Singleton |
| GoF Structural Patterns | 7 | Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy |
| GoF Behavioral Patterns | 11 | Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor |
| Data Structures | 23 | Arrays, Lists, Trees, Graphs, Hash Tables, and more |
| Decision Guides | 3 | Pattern selection, data structure selection, complexity cheat sheet |
Total: 50 comprehensive documentation files (~35,000 lines)
npx skills add git@github.com:grndlvl/software-patterns.git -gThis installs the skill globally so it's available in all your projects.
npx skills add git@github.com:grndlvl/software-patterns.gitgit clone git@github.com:grndlvl/software-patterns.git
cp -r software-patterns/.claude/skills/software-patterns ~/.claude/skills/Once installed, the skill auto-activates when you:
- Ask about or need to implement a design pattern
- Need to choose between patterns or data structures
- Are refactoring code and considering structural improvements
- Discuss architecture, decoupling, or extensibility
- Need to understand time/space complexity trade-offs
"Which design pattern should I use for creating objects without specifying their concrete classes?"
"What's the best data structure for fast lookups with frequent insertions?"
"Show me how to implement the Observer pattern"
"Compare the trade-offs between using a hash table vs a balanced tree"
| Pattern | Intent |
|---|---|
| Abstract Factory | Create families of related objects |
| Builder | Construct complex objects step-by-step |
| Factory Method | Let subclasses decide which class to instantiate |
| Prototype | Clone existing objects |
| Singleton | Ensure single instance |
| Pattern | Intent |
|---|---|
| Adapter | Convert interface to expected interface |
| Bridge | Separate abstraction from implementation |
| Composite | Treat individual and groups uniformly |
| Decorator | Add responsibilities dynamically |
| Facade | Simplified interface to subsystem |
| Flyweight | Share common state efficiently |
| Proxy | Control access to object |
| Pattern | Intent |
|---|---|
| Chain of Responsibility | Pass request along handler chain |
| Command | Encapsulate request as object |
| Interpreter | Define grammar and interpret sentences |
| Iterator | Sequential access without exposing internals |
| Mediator | Centralize complex communications |
| Memento | Capture and restore object state |
| Observer | Notify dependents of state changes |
| State | Alter behavior when state changes |
| Strategy | Encapsulate interchangeable algorithms |
| Template Method | Define skeleton, let subclasses fill in |
| Visitor | Add operations without changing classes |
Array · Dynamic Array · Linked List · Stack · Queue · Deque
Binary Tree · BST · AVL Tree · Red-Black Tree · B-Tree · Trie · Heap
Hash Table · Hash Set · Bloom Filter
Adjacency List · Adjacency Matrix · Graph Algorithms
Skip List · Disjoint Set · Segment Tree · Fenwick Tree
- Pattern Selection Guide - Flowcharts and decision trees for choosing patterns
- Data Structure Selection Guide - Choose the right structure by use case
- Complexity Cheat Sheet - Big-O quick reference
Each pattern/structure includes:
- Intent - Core purpose in one paragraph
- Motivation - Real-world scenario explaining why it's needed
- Structure - ASCII diagrams showing relationships
- Participants - Roles and responsibilities
- Implementation - Language-agnostic pseudocode
- Example - Complete working example
- When to Use / When NOT to Use - Practical guidance
- Related Patterns - Connections to other patterns
All examples use language-agnostic pseudocode designed to translate easily to:
- PHP - Direct class mapping
- JavaScript/TypeScript - ES6 classes or functional patterns
- Python - Classes with type hints
- Java/C# - Direct mapping with generics
- Go/Rust - Adapt to language idioms
Contributions are welcome! See CONTRIBUTING.md for guidelines.
Ideas for contributions:
- Additional patterns (SOLID, GRASP, enterprise patterns)
- Language-specific examples
- More data structures (persistent, probabilistic)
- Improvements to existing documentation
- Translations
MIT License - see LICENSE for details.
- Gang of Four: Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides
- Design Patterns: Elements of Reusable Object-Oriented Software (1994)
- The software engineering community
Made with Claude Code