What it does
Pattern Surgeon is a Claude Code skill that analyzes your codebase and recommends or applies design patterns (Strategy, Factory, Adapter, Repository, Observer, Dependency Injection) across 9 languages: TypeScript, Python, Java, C#, PHP, Kotlin, Dart, and Swift.
How it works
Point the skill at a file or function. It detects the language automatically, scores candidate patterns against smell-detection rules, and either suggests changes or applies them with a safety checkpoint. Every mutation is verified—if tests or typecheck fail, it auto-reverts to the git snapshot. Never loops; maximum one retry.
Five modes
Suggest: “What pattern fits this?” Refactor: Apply a pattern with auto-verify-or-revert Compare: Score Strategy vs Factory for your code Follow: Match existing patterns in your codebase Greenfield: Implement new code using TDD-first with the right pattern
Use cases
Break apart big if-else chains, reduce service coupling, implement observer patterns in mobile apps, modernize legacy code, onboard teams to consistent patterns, and handle framework idioms (Hilt, Room, Riverpod, BLoC, SwiftUI, Spring, .NET).
Who benefits
Backend and mobile engineers refactoring large services, teams standardizing architecture, code reviewers enforcing patterns, and developers learning design patterns through real examples.