architecture-patterns
БесплатноБез исполняемых скриптовНе проверенCommon software architecture patterns, ADR templates, and anti-pattern detection. Supports architectural review, design decisions, and system documentation.
Об этом скилле
Architecture Patterns
Reference for architectural design and documentation. Use this skill when:
- Architect reviews system design
- Planner considers architectural constraints
- Analyst investigates integration approaches
- Critic evaluates architectural alignment
Architecture Decision Records (ADR)
ADR Format
Every significant architectural decision should be documented:
# ADR-[NNN]: [Decision Title]
## Status
[Proposed | Accepted | Deprecated | Superseded by ADR-XXX]
## Context
[What is the situation? What forces are at play?]
## Decision
[What is the change being proposed or decided?]
## Consequences
### Positive
- [Benefit 1]
- [Benefit 2]
### Negative
- [Tradeoff 1]
- [Tradeoff 2]
### Neutral
- [Side effect]
## Alternatives Considered
1. [Alternative 1]: [Why rejected]
2. [Alternative 2]: [Why rejected]
## Related
- ADR-XXX: [Related decision]
- [External reference]
When to Write ADRs
| Scenario | ADR Required? |
|---|---|
| New external dependency | Yes |
| New architectural pattern | Yes |
| Technology switch | Yes |
| Module boundary change | Yes |
| Performance tradeoff | Yes |
| Bug fix | No |
| Refactoring (same behavior) | Usually no |
Common Patterns
Layered Architecture
┌─────────────────────────────────┐
│ Presentation │ UI, API endpoints
├─────────────────────────────────┤
│ Application │ Use cases, orchestration
├─────────────────────────────────┤
│ Domain │ Business logic, entities
├─────────────────────────────────┤
│ Infrastructure │ DB, external services
└─────────────────────────────────┘
Rules:
- Dependencies point downward only
- Lower layers never import from higher
- Domain has no external dependencies
Use when: Enterprise apps, clear separation needed
Repository Pattern
Purpose: Abstract data access, enable testability
// Interface in domain layer
interface UserRepository {
findById(id: string): Promise<User | null>;
save(user: User): Promise<void>;
}
// Implementation in infrastructure layer
class PostgresUserRepository implements UserRepository {
async findById(id: string): Promise<User | null> {
const row = await db.query('SELECT * FROM users WHERE id = $1', [id]);
return row ? mapToUser(row) : null;
}
}
Use when:
- Need to swap data stores
- Testing without real database
- Multiple data sources
Service Layer
Purpose: Encapsulate business operations
class OrderService {
constructor(
private orderRepo: OrderRepository,
private paymentGateway: PaymentGateway,
private notifier: Notifier
) {}
async placeOrder(cart: Cart, payment: PaymentInfo): Promise<Order> {
const order = Order.fromCart(cart);
await this.paymentGateway.charge(payment, order.total);
await this.orderRepo.save(order);
await this.notifier.sendConfirmation(order);
return order;
}
}
Use when:
- Multiple steps in operation
- Transaction coordination
- Cross-cutting concerns
Event-Driven Architecture
┌─────────┐ Event ┌─────────┐
│ Service │───────────► │ Queue │
│ A │ │ │
└─────────┘ └────┬────┘
│
┌──────────────┼──────────────┐
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Handler │ │ Handler │ │ Handler │
│ 1 │ │ 2 │ │ 3 │
└─────────┘ └─────────┘ └─────────┘
Use when:
- Loose coupling between components
- Asynchronous processing
- Multiple consumers of same event
- Audit trail needed
Dependency Injection
Purpose: Invert control, enable testing
// Without DI (hard to test)
class OrderService {
private db = new PostgresDatabase();
}
// With DI (testable)
class OrderService {
constructor(private db: Database) {}
}
// Production
new OrderService(new PostgresDatabase());
// Test
new OrderService(new MockDatabase());
Anti-Patterns to Detect
| Anti-Pattern | Detection | Fix |
|---|---|---|
| God Object | Class with 20+ methods, 500+ lines | Extract classes |
| Circular Dependencies | A→B→C→A | Introduce interface |
| Big Ball of Mud | No clear structure | Define boundaries |
| Spaghetti Code | Tangled control flow | Refactor, add layers |
| Golden Hammer | Same pattern everywhere | Choose appropriate |
| Anemic Domain | Data classes + procedure classes | Move logic to domain |
| Leaky Abstraction | Implementation details exposed | Hide behind interface |
| Premature Optimization | Complex code for speed | Measure first |
Detection Commands
# Find large files (potential God objects)
find . -name "*.ts" -exec wc -l {} \; | sort -rn | head -10
# Find circular dependencies (TypeScript)
npx madge --circu
Установить architecture-patterns в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл architecture-patterns?
Common software architecture patterns, ADR templates, and anti-pattern detection. Supports architectural review, design decisions, and system documentation.
Как установить скилл architecture-patterns?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл architecture-patterns запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic