en un clic
architecture-patterns
// Common software architecture patterns, ADR templates, and anti-pattern detection. Supports architectural review, design decisions, and system documentation.
// Common software architecture patterns, ADR templates, and anti-pattern detection. Supports architectural review, design decisions, and system documentation.
Code review checklist, severity definitions, and document templates. Load when performing code reviews or defining review criteria.
Unified document lifecycle management. Defines terminal statuses, unified numbering via .next-id, close procedures, and orphan detection. Load at session start.
Unified Memory Contract for Flowbaby integration. Defines when and how to retrieve and store memory. Load at session start - memory is core to agent reasoning, not optional.
TDD workflow and test strategy patterns including test pyramid, coverage strategies, mocking approaches, and anti-patterns. Load when writing tests, designing test strategies, or reviewing test coverage.
Version management, release verification, and deployment procedures for software releases. Includes semver guidance, version consistency checks, and platform-specific constraints.
Security vulnerability detection patterns including OWASP Top 10, language-specific vulnerabilities, and remediation guidance. Load when reviewing code for security issues, conducting audits, or implementing authentication/authorization.
| name | architecture-patterns |
| description | Common software architecture patterns, ADR templates, and anti-pattern detection. Supports architectural review, design decisions, and system documentation. |
| license | MIT |
| metadata | {"author":"groupzer0","version":"1.0"} |
Reference for architectural design and documentation. Use this skill when:
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]
| 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 |
┌─────────────────────────────────┐
│ Presentation │ UI, API endpoints
├─────────────────────────────────┤
│ Application │ Use cases, orchestration
├─────────────────────────────────┤
│ Domain │ Business logic, entities
├─────────────────────────────────┤
│ Infrastructure │ DB, external services
└─────────────────────────────────┘
Rules:
Use when: Enterprise apps, clear separation needed
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:
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:
┌─────────┐ Event ┌─────────┐
│ Service │───────────► │ Queue │
│ A │ │ │
└─────────┘ └────┬────┘
│
┌──────────────┼──────────────┐
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Handler │ │ Handler │ │ Handler │
│ 1 │ │ 2 │ │ 3 │
└─────────┘ └─────────┘ └─────────┘
Use when:
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-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 |
# Find large files (potential God objects)
find . -name "*.ts" -exec wc -l {} \; | sort -rn | head -10
# Find circular dependencies (TypeScript)
npx madge --circular src/
# Find files with many imports
grep -c "^import" src/**/*.ts | sort -t: -k2 -rn | head -10
For system-architecture.md:
Use Mermaid for version-controlled diagrams:
graph TB
subgraph Presentation
API[API Gateway]
UI[Web UI]
end
subgraph Application
Auth[Auth Service]
Orders[Order Service]
end
subgraph Data
DB[(PostgreSQL)]
Cache[(Redis)]
end
UI --> API
API --> Auth
API --> Orders
Orders --> DB
Orders --> Cache
When the Architect reconciles architecture docs after implementations, use this format in the system-architecture.md changelog:
| Date | Change | Rationale | Source |
|------|--------|-----------|--------|
| 2024-12-20 | Added memory retrieval caching layer | Reconciled from Plan-015 implementation | Plan-015-memory-caching |
| 2024-12-18 | Updated API boundary diagram | Implementation added new endpoint | Post-implementation audit |
| 2024-12-15 | Documented Cognee integration pattern | Previously undocumented, discovered during health audit | Health audit |
Reconciliation Entry Format:
Track architectural improvements in the Problem Areas section of system-architecture.md:
## Problem Areas / Design Debt Registry
### Active Design Debt
| ID | Area | Current State | Optimal State | Priority | Discovered | Last Reviewed |
|----|------|---------------|---------------|----------|------------|---------------|
| DD-001 | Memory Subsystem | Direct Cognee calls scattered | Unified memory service facade | Medium | 2024-12-15 | 2024-12-20 |
| DD-002 | Error Handling | Inconsistent error types | Typed error hierarchy | Low | 2024-12-18 | 2024-12-18 |
### Resolved Design Debt
| ID | Resolution | Resolved Date | Related Plan |
|----|------------|---------------|--------------|
| DD-000 | Extracted shared utilities | 2024-12-10 | Plan-012 |
Design Debt Entry Fields:
Priority Guidelines:
system-architecture.md as single source of truthsystem-architecture.md before planningsystem-architecture.md during plan reviewSee references/diagram-templates.md for diagram examples.