# Skills

Install every skill with `npx skills add https://aipatterns.dev`, or pick skills from the GitHub repository with `npx skills add <owner>/<repo> --skill <name>`.

## aipatterns-code-smells

Detect code smells such as Long Method, Large Class, Primitive Obsession, Feature Envy, Shotgun Surgery, Duplicate Code, Speculative Generality and 17 more. Maps each smell to the refactorings that treat it, and says when to leave a smell alone. Use when reviewing code, when asked "what's wrong with this code", when planning a refactor, or when deciding whether code is worth changing.

```bash
npx skills add https://aipatterns.dev --skill aipatterns-code-smells
```

## aipatterns-design-patterns

Implement the 22 classic GoF design patterns in TypeScript, Python, Go or Java. Each pattern gives its forces, structure, steps, trade-offs and "do not use it when" rules. Use before you implement, review or explain a pattern such as Factory Method, Abstract Factory, Builder, Prototype, Singleton, Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy, Chain of Responsibility, Command, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method or Visitor. Also covers patterns original to the reference - resilience (Timeout, Retry, Exponential Backoff, Circuit Breaker, Fallback, Rate Limiting), data (Cache-Aside, Transactional Outbox, Saga, Idempotent Consumer, CQRS) and architecture (Strangler Fig, Backends for Frontends). Not for behavior changes or when a language feature covers the variance - run aipatterns-pattern-selection first.

```bash
npx skills add https://aipatterns.dev --skill aipatterns-design-patterns
```

## aipatterns-grill

Grill a product from idea to production, or grill a design-pattern application before code. Use when the user starts a new project, presents a product idea, or asks to build an app. Use for the full product lifecycle - discovery, research, requirements, architecture, design, implementation, testing, deployment, and cost planning. Use when the user wants to apply or implement a pattern such as factory, saga, circuit breaker, or rate limiting in real code. Asks questions in small rounds with recommended answers. Writes planning documents. Builds to a deployed, tested application. Not for explaining, researching, comparing, or reviewing a pattern in the abstract. Not for stress-testing a plan the user does not intend to build.

```bash
npx skills add https://aipatterns.dev --skill aipatterns-grill
```

## aipatterns-pattern-selection

Decide whether the code needs a design pattern, and which one. Use before you introduce any GoF pattern such as factory, builder, singleton, adapter, decorator, strategy, observer or visitor. Use when a user asks "which pattern should I use". Use when you review code that adds abstraction layers. Use when you want an interface "for flexibility". Default to no pattern unless a concrete, current pain justifies one.

```bash
npx skills add https://aipatterns.dev --skill aipatterns-pattern-selection
```

## aipatterns-refactoring

Apply 67 refactoring techniques - the 66 classics (Extract Method, Move Method, Replace Conditional with Polymorphism, Introduce Parameter Object) plus Consolidate Tools for agent-facing tool surfaces - as small steps. Each step preserves behavior, and tests stay green between steps. Use when a task asks you to refactor, clean up, simplify, restructure or "make this code better" without changing behavior. Use also when someone identified a code smell and needs its treatment.

```bash
npx skills add https://aipatterns.dev --skill aipatterns-refactoring
```
