pattern-enforcementlisted
Install: claude install-skill Elmmly/genie-team
# Pattern Enforcement
Ensure code follows established project patterns and conventions.
## Discovery Phase
Before implementing, identify project patterns:
1. **Check CLAUDE.md** for documented conventions
2. **Search for similar code** to understand existing patterns
3. **Look for pattern indicators:**
- Factory functions
- Registry patterns
- Repository pattern for data access
- Adapter pattern for integrations
- Strategy pattern for variants
## Common Patterns to Enforce
### Structural Patterns
**Registry Pattern:**
| Language | Idiomatic Form |
|----------|---------------|
| TypeScript | `const registry = new Map<string, Handler>(); registry.set('key', impl);` |
| Go | `var registry = map[string]Handler{}` with `sync.RWMutex` for concurrent access |
| Rust | `lazy_static! { static ref REGISTRY: Mutex<HashMap<String, Box<dyn Handler>>> = ...; }` |
| C# | `services.AddSingleton<IRegistry, Registry>();` via DI container |
| Java | `@Component` with `Map<String, Handler>` injected via Spring |
| Elixir | `Registry` module or ETS-backed lookup |
**Factory Pattern:**
| Language | Idiomatic Form |
|----------|---------------|
| TypeScript | `function createUser(data: UserInput): User { ... }` |
| Go | `func NewUser(data UserInput) (*User, error) { ... }` |
| Rust | `impl User { pub fn new(data: UserInput) -> Result<Self> { ... } }` |
| C# | `public static User Create(UserInput data) { ... }` |
| Java | `public static User create(UserInput data) { ... }` |