microservices-patterns
Comprehensive microservices patterns skill covering service mesh, traffic management, circuit breakers, resilience patterns, Istio, and production microservices architecture
What this skill does
# Microservices Patterns
A comprehensive skill for building, deploying, and managing production-grade microservices architectures. This skill covers service mesh patterns, traffic management, resilience engineering, observability, security, and modern microservices best practices using Istio and Kubernetes.
## When to Use This Skill
Use this skill when:
- Architecting microservices-based applications with distributed systems
- Implementing service mesh infrastructure for service-to-service communication
- Adding resilience patterns like circuit breakers, retries, and timeouts
- Managing traffic routing, load balancing, and canary deployments
- Implementing distributed tracing and observability across microservices
- Securing microservices with mTLS and authorization policies
- Troubleshooting cascading failures and service degradation
- Building fault-tolerant distributed systems
- Implementing blue-green deployments and A/B testing
- Managing multi-cluster microservices deployments
- Implementing chaos engineering and fault injection
- Migrating from monolithic to microservices architecture
## Core Concepts
### Microservices Architecture
Microservices architecture structures an application as a collection of loosely coupled services:
- **Service Independence**: Each service is independently deployable and scalable
- **Domain-Driven Design**: Services align with business capabilities
- **Decentralized Data**: Each service owns its data store
- **API-First**: Services communicate via well-defined APIs
- **Polyglot Persistence**: Different services can use different databases
- **Failure Isolation**: Service failures don't cascade across the system
### Service Mesh Fundamentals
A service mesh is an infrastructure layer for handling service-to-service communication:
- **Data Plane**: Sidecar proxies (Envoy) deployed alongside each service
- **Control Plane**: Manages and configures proxies (Istio, Linkerd, Consul)
- **Service Discovery**: Automatic service registration and discovery
- **Load Balancing**: Intelligent traffic distribution across service instances
- **Observability**: Built-in metrics, logs, and distributed tracing
- **Security**: mTLS, authentication, and authorization
### Istio Architecture
Istio is the most popular service mesh implementation:
**Control Plane Components:**
- **Istiod**: Unified control plane for service discovery, configuration, and certificate management
- **Pilot**: Traffic management and service discovery
- **Citadel**: Certificate authority for mTLS
- **Galley**: Configuration validation and distribution
**Data Plane:**
- **Envoy Proxy**: High-performance sidecar proxy for each service
- **Iptables Rules**: Transparent traffic interception
- **Service Proxy**: Handles all network traffic for the service
### Key Service Mesh Patterns
1. **Sidecar Pattern**: Proxy deployed alongside application container
2. **Service Discovery**: Automatic registration and discovery of services
3. **Traffic Splitting**: Route percentage of traffic to different versions
4. **Circuit Breaker**: Prevent cascading failures
5. **Retry Logic**: Automatic retry with exponential backoff
6. **Timeout Policies**: Request timeout configuration
7. **Fault Injection**: Chaos testing in production
8. **Rate Limiting**: Protect services from overload
9. **mTLS**: Mutual TLS for service-to-service encryption
10. **Distributed Tracing**: Request flow across services
## Traffic Management
### Virtual Services
Virtual services define routing rules for traffic within the mesh:
**Key Features:**
- **HTTP/TCP/TLS Routing**: Protocol-specific routing rules
- **Match Conditions**: Route based on headers, URIs, methods
- **Weighted Routing**: Traffic splitting across versions
- **Redirects and Rewrites**: URL manipulation
- **Fault Injection**: Delay and abort injection
- **Retries**: Automatic retry configuration
- **Timeouts**: Request timeout policies
**Virtual Service Structure:**
```yaml
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
name: reviews
spec:
hosts:
- reviews
http:
- match:
- headers:
end-user:
exact: jason
route:
- destination:
host: reviews
subset: v2
- route:
- destination:
host: reviews
subset: v3
```
### Destination Rules
Destination rules configure policies for traffic after routing:
**Key Features:**
- **Load Balancing**: Round robin, random, least request
- **Connection Pools**: Connection limits and timeouts
- **Outlier Detection**: Circuit breaker configuration
- **TLS Settings**: mTLS mode configuration
- **Subset Definitions**: Version-based service subsets
**Common Load Balancing Strategies:**
- **ROUND_ROBIN**: Default, distributes evenly
- **LEAST_REQUEST**: Routes to instances with fewest requests
- **RANDOM**: Random distribution
- **PASSTHROUGH**: Use original destination
### Traffic Splitting
Traffic splitting enables gradual rollouts and A/B testing:
**Use Cases:**
- **Canary Deployments**: Route small percentage to new version
- **Blue-Green Deployments**: Switch traffic between versions
- **A/B Testing**: Split traffic for experimentation
- **Dark Launches**: Shadow traffic to new version
**Progressive Delivery Pattern:**
```
v1: 100% → 90% → 70% → 50% → 20% → 0%
v2: 0% → 10% → 30% → 50% → 80% → 100%
```
### Gateway Configuration
Gateways manage ingress and egress traffic:
**Ingress Gateway:**
- External traffic entry point
- TLS termination
- Protocol-specific routing
- Virtual hosting
**Egress Gateway:**
- Control outbound traffic
- Security policies for external services
- Traffic monitoring and logging
## Resilience Patterns
### Circuit Breaker Pattern
Circuit breakers prevent cascading failures by detecting and isolating failing services:
**States:**
- **Closed**: Normal operation, requests flow through
- **Open**: Service failing, requests fail immediately
- **Half-Open**: Testing if service recovered
**Configuration Parameters:**
- **Consecutive Errors**: Errors before opening circuit
- **Interval**: Time window for error counting
- **Base Ejection Time**: How long to eject failing instances
- **Max Ejection Percentage**: Maximum percentage of pool to eject
**Benefits:**
- Prevents resource exhaustion
- Fails fast instead of waiting for timeouts
- Gives failing services time to recover
- Monitors service health automatically
### Retry Logic
Automatic retry with intelligent backoff strategies:
**Retry Strategies:**
- **Fixed Delay**: Constant delay between retries
- **Exponential Backoff**: Increasing delay between retries
- **Jittered Backoff**: Random jitter to prevent thundering herd
**Configuration:**
- **Attempts**: Maximum number of retries
- **Per Try Timeout**: Timeout for each attempt
- **Retry On**: Conditions triggering retry (5xx, timeout, refused-stream)
- **Backoff**: Base interval and maximum interval
**Best Practices:**
- Only retry idempotent operations
- Use exponential backoff with jitter
- Set maximum retry attempts
- Monitor retry rates
### Timeout Policies
Timeout policies prevent indefinite waiting:
**Timeout Types:**
- **Request Timeout**: End-to-end request timeout
- **Per Try Timeout**: Timeout for each retry attempt
- **Idle Timeout**: Connection idle timeout
- **Connection Timeout**: Initial connection timeout
**Timeout Hierarchy:**
```
Overall Request Timeout
├─ Retry 1 (Per Try Timeout)
├─ Retry 2 (Per Try Timeout)
└─ Retry 3 (Per Try Timeout)
```
**Best Practices:**
- Set timeouts based on SLA requirements
- Use shorter timeouts for critical paths
- Configure per-try timeouts lower than overall timeout
- Monitor timeout rates and adjust
### Bulkhead Pattern
Bulkheads isolate resources to prevent complete system failure:
**Implementation:**
- **Thread Pools**: Separate thread pools per service
- **Connection Pools**: Limited connections per upstream
- **Queue Limits**: Bounded queues to prevent memory issues
- **Semaphores**: LimRelated in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.