Provides architectural pattern knowledge for designing feature implementations including MVC, event-driven, microservices, and CQRS patterns. Use when designing system architecture or choosing implementation patterns.
Provides architectural pattern knowledge for designing system implementations including MVC, microservices, and CQRS.
/plugin marketplace add sequenzia/agent-alchemy/plugin install agent-alchemy-dev-tools@agent-alchemyThis skill inherits all available tools. When active, it can use any tool Claude has access to.
This skill provides knowledge about common architectural patterns to help design feature implementations. Apply these patterns based on the project's existing architecture and the feature's requirements.
Architecture visualizations use Mermaid syntax with classDef styling (color:#000 for text readability). When creating architecture visualizations based on these patterns, follow the technical-diagrams skill conventions.
Choose patterns based on:
When to use: Most web applications, CRUD operations, clear separation of concerns needed
Layers:
flowchart TD
A["Presentation Layer — UI, API endpoints, controllers"]:::primary
B["Application Layer — Use cases, orchestration, DTOs"]:::secondary
C["Domain Layer — Business logic, entities, rules"]:::success
D["Infrastructure Layer — Database, external services, I/O"]:::neutral
A --> B --> C --> D
classDef primary fill:#dbeafe,stroke:#2563eb,color:#000
classDef secondary fill:#f3e8ff,stroke:#7c3aed,color:#000
classDef success fill:#dcfce7,stroke:#16a34a,color:#000
classDef neutral fill:#f3f4f6,stroke:#6b7280,color:#000
Key rules:
Implementation tips:
When to use: Web applications with server-rendered views, simple CRUD apps
Components:
flowchart LR
U1[User]:::neutral -->|input| CT[Controller]:::primary
CT -->|updates| M[Model]:::secondary
M -->|reads| CT
CT -->|renders| V[View]:::success
V -->|response| U2[User]:::neutral
classDef primary fill:#dbeafe,stroke:#2563eb,color:#000
classDef secondary fill:#f3e8ff,stroke:#7c3aed,color:#000
classDef success fill:#dcfce7,stroke:#16a34a,color:#000
classDef neutral fill:#f3f4f6,stroke:#6b7280,color:#000
Model: Data and business logic View: Presentation/UI Controller: Handles input, coordinates model and view
Implementation tips:
When to use: Data access abstraction, testability, multiple data sources
Structure:
interface UserRepository {
findById(id: string): Promise<User | null>;
findByEmail(email: string): Promise<User | null>;
save(user: User): Promise<User>;
delete(id: string): Promise<void>;
}
class PostgresUserRepository implements UserRepository {
// Implementation using PostgreSQL
}
class InMemoryUserRepository implements UserRepository {
// Implementation for testing
}
Benefits:
When to use: Complex business logic, multiple entry points (API, CLI, queue)
Structure:
class UserService {
constructor(
private userRepo: UserRepository,
private emailService: EmailService,
private logger: Logger
) {}
async registerUser(data: RegisterDTO): Promise<User> {
// Validation
// Business logic
// Coordination of multiple repositories/services
// Return result
}
}
Implementation tips:
When to use: Decoupled components, async processing, audit trails, notifications
Patterns:
// Emit events for side effects
userService.on('userCreated', async (user) => {
await emailService.sendWelcome(user);
await analyticsService.trackSignup(user);
});
flowchart LR
P[Producer]:::primary --> Q[Queue]:::warning
Q --> C1[Consumer 1]:::secondary
Q --> C2[Consumer 2]:::secondary
classDef primary fill:#dbeafe,stroke:#2563eb,color:#000
classDef secondary fill:#f3e8ff,stroke:#7c3aed,color:#000
classDef warning fill:#fef3c7,stroke:#d97706,color:#000
Event structure:
interface DomainEvent {
type: string;
timestamp: Date;
payload: unknown;
metadata: {
correlationId: string;
causationId: string;
};
}
Implementation tips:
When to use: Complex domains, different read/write patterns, high-performance reads needed
Structure:
flowchart TD
subgraph write["Commands (Write)"]
CMD[Command]:::primary --> CH[Command Handler]:::secondary
CH --> WM[Write Model]:::secondary
WM --> WDB[Write Database]:::neutral
end
subgraph read["Queries (Read)"]
QRY[Query]:::primary --> QH[Query Handler]:::secondary
QH --> RM[Read Model]:::secondary
RM --> RDB[Read Database]:::neutral
end
classDef primary fill:#dbeafe,stroke:#2563eb,color:#000
classDef secondary fill:#f3e8ff,stroke:#7c3aed,color:#000
classDef neutral fill:#f3f4f6,stroke:#6b7280,color:#000
style write fill:#f8fafc,stroke:#94a3b8,color:#000
style read fill:#f8fafc,stroke:#94a3b8,color:#000
Simplified CQRS:
// Commands modify state
class CreateUserCommand {
execute(data: CreateUserDTO): Promise<void>
}
// Queries return data without modification
class GetUserQuery {
execute(id: string): Promise<UserDTO>
}
Implementation tips:
When to use: High testability needs, multiple I/O channels, long-lived applications
Structure:
flowchart TD
subgraph driving["Driving Adapters"]
H[HTTP]:::primary
CL[CLI]:::primary
Q[Queue]:::primary
T[Timer]:::primary
end
subgraph core["Application Core"]
subgraph domain["Domain Logic"]
DL[Business Rules]:::success
end
end
subgraph driven["Driven Adapters"]
DB[Database]:::neutral
CA[Cache]:::neutral
EM[Email]:::neutral
API[External API]:::neutral
end
H -->|port| DL
CL -->|port| DL
Q -->|port| DL
T -->|port| DL
DL -->|port| DB
DL -->|port| CA
DL -->|port| EM
DL -->|port| API
classDef primary fill:#dbeafe,stroke:#2563eb,color:#000
classDef success fill:#dcfce7,stroke:#16a34a,color:#000
classDef neutral fill:#f3f4f6,stroke:#6b7280,color:#000
style driving fill:#f8fafc,stroke:#94a3b8,color:#000
style core fill:#fefce8,stroke:#ca8a04,color:#000
style domain fill:#dcfce7,stroke:#16a34a,color:#000
style driven fill:#f8fafc,stroke:#94a3b8,color:#000
Key concept: Business logic at center, all I/O through ports/adapters
Implementation tips:
When to use: Large teams, independent deployability, different scaling needs
Single entry point that routes to services
Services register themselves, clients look them up
Prevent cascade failures when services are down
const breaker = new CircuitBreaker(remoteService.call, {
timeout: 3000,
errorThreshold: 50,
resetTimeout: 30000
});
Coordinate transactions across services
flowchart LR
SA[Service A]:::primary -->|step 1| SB[Service B]:::primary -->|step 2| SC[Service C]:::primary
SC -.->|failure| CC[Compensate C]:::danger
CC -.-> CB[Compensate B]:::danger
CB -.-> CA[Compensate A]:::danger
classDef primary fill:#dbeafe,stroke:#2563eb,color:#000
classDef danger fill:#fee2e2,stroke:#dc2626,color:#000
| Scenario | Recommended Pattern |
|---|---|
| Simple CRUD app | MVC + Repository |
| Complex business logic | Layered + Service Layer |
| Need audit trail | Event-Driven |
| High read/write disparity | CQRS |
| Maximum testability | Hexagonal |
| Multiple teams/services | Microservices patterns |
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.