Skip to content
Back to skills

Microservices Patterns

ASecurity

Provides microservices design patterns for service decomposition, API gateway, circuit breakers, saga orchestration, and inter-service communication. Use when designing or implementing microservices architecture.

  • 71 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added May 27, 2026
data-aitypescriptbashdockerkubernetesawsapidatabasebackendci/cd

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned May 27, 2026

npx -y skills add tranhieutt/software_development_department --skill microservices-patterns --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Microservices Patterns?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Microservices Patterns
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tranhieutt-microservices-patterns/badge)](https://www.skillsdirectory.com/skills/tranhieutt-microservices-patterns)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: microservices-patterns
type: reference
description: "Provides microservices design patterns for service decomposition, API gateway, circuit breakers, saga orchestration, and inter-service communication. Use when designing or implementing microservices architecture."
paths: ["**/docker-compose*", "**/k8s/**", "**/services/**"]
effort: 4
allowed-tools: Read, Glob, Grep, Write, Edit, Bash
user-invocable: true
when_to_use: "When designing microservices architecture, implementing service communication, or decomposing monoliths"
---

# Microservices Patterns

Service decomposition, communication, resilience, and orchestration patterns.

## Service Decomposition

| Pattern | Description | Use When |
|---------|-------------|----------|
| Domain-Driven | Align services with bounded contexts | Complex business domains |
| Data-Ownership | Service owns its data store | Data isolation required |
| Team-Aligned | One service per team | Large organizations |

## Communication Patterns

### Sync: HTTP/gRPC
\`\`\`yaml
# API Gateway routing
routes:
  - match: { prefix: /orders }
    route: { cluster: order-service }
  - match: { prefix: /users }
    route: { cluster: user-service }
\`\`\`

### Async: Message Queue
\`\`\`
Producer → Exchange → Queue → Consumer
         (Topic)   (DLQ on failure)
\`\`\`

Use async for: event propagation, eventual consistency, load leveling.

## Resilience Patterns

### Circuit Breaker
\`\`\`typescript
// Example with opossum
const breaker = new CircuitBreaker(fetchUserProfile, {
  timeout: 3000,
  errorThresholdPercentage: 50,
  resetTimeout: 30000,
});
\`\`\`

### Retry with Backoff
\`\`\`typescript
async function retryWithBackoff(fn, maxRetries = 3) {
  for (let i = 0; i < maxRetries; i++) {
    try { return await fn(); }
    catch (e) { await sleep(Math.pow(2, i) * 1000); }
  }
  throw new Error('Max retries exceeded');
}
\`\`\`

## Data Patterns

| Pattern | Consistency | Complexity | Use When |
|---------|-------------|------------|----------|
| Saga (orchestration) | Eventual | High | Complex multi-service transactions |
| Saga (choreography) | Eventual | Medium | Simple event chains |
| Event sourcing | Eventual | High | Audit trail, time travel |
| Shared database | Strong | Low | Anti-pattern, avoid |

## API Gateway

Tools: Kong, AWS API Gateway, Envoy, NGINX.

Responsibilities: routing, auth, rate limiting, request transformation, load balancing.

## Observability Stack

- Distributed tracing: Jaeger / Tempo
- Metrics: Prometheus + Grafana
- Logs: ELK / Loki
- Service mesh: Istio / Linkerd (adds mTLS, traffic management)

## Related Skills

- `backend-architect` — single-service architecture
- `event-sourcing-architect` — event sourcing patterns
- `kubernetes-architect` — deployment patterns
- `deployment-engineer` — CI/CD for microservices

Files in this skill

  • SKILL.md2.8 KB
  • resources/implementation-playbook.md17.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…