Service Dependency Mapper
by @charlie-morrison
Auto-discover and map service dependencies from code, configs, and runtime data. Generate dependency graphs, identify critical paths, find single points of f...
clawhub install service-dependency-mapperπ About This Skill
name: service-dependency-mapper description: Auto-discover and map service dependencies from code, configs, and runtime data. Generate dependency graphs, identify critical paths, find single points of failure, and assess blast radius for each service.
Service Dependency Mapper
Map your service dependencies before an outage teaches you what they are. Auto-discover dependencies from code imports, config files, network traffic, and runtime traces β then generate dependency graphs, identify critical paths, and assess blast radius.
Use when: "map our services", "what depends on what", "service dependency graph", "blast radius analysis", "single point of failure", "what breaks if X goes down", "architecture visualization", or during incident planning.
Commands
1. discover β Auto-Detect Service Dependencies
#### Step 1: Static Analysis β Code and Config
# Find service URLs in code
rg "https?://[a-z][-a-z0-9]*(\.[a-z][-a-z0-9]*)*[:/]" \
--type-not binary -g '!node_modules' -g '!vendor' -g '!*.test.*' 2>/dev/null | \
grep -v "example\.com\|localhost\|127\.0\.\|schema\.org" | head -30Find service names in Docker Compose
rg "depends_on|links:|container_name:" docker-compose*.yml 2>/dev/nullFind service references in Kubernetes
rg "serviceName:|host:|backend:" k8s/ manifests/ helm/ 2>/dev/nullFind database/cache connections
rg "DATABASE_URL|REDIS_URL|MONGO_URI|POSTGRES_|MYSQL_|AMQP_URL|KAFKA_BROKER" \
--type-not binary -g '!node_modules' -g '!vendor' 2>/dev/nullFind message queue producers/consumers
rg "publish\(|subscribe\(|produce\(|consume\(|\.queue\(|channel\." \
--type-not binary -g '!node_modules' -g '!vendor' 2>/dev/null | head -20Find gRPC/REST client instantiations
rg "GrpcClient|HttpClient|axios\.create|fetch\(.*service|\.NewClient" \
--type-not binary -g '!node_modules' -g '!vendor' 2>/dev/null
#### Step 2: Runtime Analysis (if available)
# Kubernetes services
kubectl get services -A -o json | python3 -c "
import json, sys
svcs = json.load(sys.stdin)['items']
for svc in svcs:
ns = svc['metadata']['namespace']
name = svc['metadata']['name']
stype = svc['spec']['type']
ports = [str(p['port']) for p in svc['spec'].get('ports', [])]
print(f'{ns}/{name} ({stype}) ports:{','.join(ports)}')
"Service mesh (Istio/Linkerd) β actual traffic dependencies
kubectl get destinationrules -A 2>/dev/null
istioctl proxy-config cluster 2>/dev/null | grep -v "BlackHole\|PassthroughCluster"
#### Step 3: Build Dependency Graph
dependencies = {
'api-gateway': {
'depends_on': ['auth-service', 'user-service', 'order-service'],
'type': 'sync', # sync HTTP calls
'criticality': 'critical',
},
'order-service': {
'depends_on': ['postgres', 'payment-service', 'kafka'],
'type': 'mixed',
'criticality': 'critical',
},
'notification-service': {
'depends_on': ['kafka', 'smtp-relay', 'redis'],
'type': 'async',
'criticality': 'low',
},
}
#### Step 4: Generate Dependency Map
# Service Dependency MapGraph (text representation)
[External Users]
β
βΌ
[api-gateway] βsyncβββΊ [auth-service] βsyncβββΊ [postgres-auth]
β β
β ββsyncβββΊ [user-service] βsyncβββΊ [postgres-users]
β β ββasyncββΊ [redis-cache]
β β
β ββsyncβββΊ [order-service] βsyncβββΊ [postgres-orders]
β β ββsyncβββΊ [payment-service] ββΊ [Stripe API]
β β
β ββasyncβββΊ [kafka]
β β
β ββββΊ [notification-service] ββΊ [SMTP]
β ββββΊ [analytics-service] ββΊ [ClickHouse]
Critical Path
api-gateway β order-service β postgres-orders
(Failure here = orders cannot be placed)Single Points of Failure
1. π΄ postgres-orders β no replica, single instance
2. π΄ api-gateway β single entry point, no fallback
3. π‘ kafka β 3 brokers but no multi-AZ
4. π‘ Stripe API β external dependency, no fallback payment providerBlast Radius Analysis
| If this fails... | These break... | Users affected |
|-------------------|---------------|----------------|
| postgres-orders | order-service, api-gateway (partial) | 100% orders |
| auth-service | All authenticated endpoints | 100% users |
| kafka | notifications, analytics | 0% (graceful degradation) |
| redis-cache | user-service (slow, not down) | 0% (cache miss only) |
| Stripe API | payment-service, orders | 100% new orders |
2. blast-radius β Analyze Impact of Service Failure
For a given service, trace all dependents (recursively):
3. visualize β Generate Diagram
Output dependency graph in:
4. health β Assess Architecture Health
Score the architecture based on: