agentleFS
OneDro1dOneDro1d/dark-factory/skills/service-mapper/SKILL.md

service-mapper

Skill4 starsChanged 2 months agoApache-2.0View on GitHub

Analyze a codebase to produce a complete service map — microservices, inter-service communication, database ownership, external integrations, and event flows. Generates AI-agent-friendly markdown. Use when onboarding to a new codebase, auditing architecture, updating CLAUDE.md, or before planning new features. Triggers on "map services", "service map", "map the architecture", "what services exist", "how do services communicate", "map this repo", "generate service map", "architecture map".

  • Reads credentials

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 5 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before planning a new feature (understand what exists)

    line 14
  2. Distinctive:

    After significant refactoring to verify the architecture still makes sense

    line 17
  3. Distinctive:

    No clear owner for a table

    line 90
  4. Distinctive:

    Use these to accelerate analysis.

    line 133
  5. Distinctive:

    Before presenting the service map, verify:

    line 197

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Service Mapper

Analyze a codebase and produce a structured, AI-agent-friendly service map. The output documents every microservice, how they communicate, what databases and tables they own, and what external systems they integrate with.

When to Use

  • Onboarding to an unfamiliar codebase
  • Generating or updating a CLAUDE.md or SERVICE-MAP.md
  • Before planning a new feature (understand what exists)
  • Auditing service boundaries and ownership
  • Detecting architectural violations (shared DBs, direct HTTP between services, etc.)
  • After significant refactoring to verify the architecture still makes sense

Workflow

Execute these steps in order. Each step builds on the previous.

Step 1: Identify Service Boundaries

Scan the repository structure to find all deployable units (services, workers, lambdas, cron jobs).

What to look for:

SignalExamples
Entrypointsmain.go, main.ts, index.ts, app.py, Program.cs, main.rs
Build configsDockerfile, docker-compose.yaml, serverless.yml, app.yaml
Package manifestspackage.json, go.mod, Cargo.toml, pom.xml, *.csproj
Deployment specsK8s manifests, Terraform, Helm charts, DO app specs
Monorepo markerspackages/, services/, apps/, cmd/, internal/

For each service, record:

  • Name
  • Language / framework
  • Entrypoint file
  • Port (if HTTP)
  • Type: webservice | worker | cron | lambda | gateway

Step 2: Map Inter-Service Communication

For each service, trace how it talks to other services.

Communication patterns to detect:

PatternHow to Find
REST / HTTPLook for HTTP client calls, fetch, axios, http.Get, base URLs pointing to other services
Message bus (RabbitMQ, Kafka, NATS, SQS)Look for publish, subscribe, consume, queue names, exchange declarations, topic subscriptions
gRPCLook for .proto files, gRPC client/server setup, grpc.Dial
Shared library / SDKLook for internal packages imported across services (e.g., DatabaseClient, shared types)
Direct function callsIn monoliths or tightly coupled services — function imports across module boundaries
Event contractsShared schema definitions (Zod, Protobuf, Avro, JSON Schema) that define inter-service messages

For each connection, record:

  • Source service
  • Target service
  • Protocol (HTTP / AMQP / gRPC / SDK / etc.)
  • Direction (unidirectional / request-response / pub-sub)
  • What data flows (event names, endpoint paths, RPC methods)

Step 3: Map Database Ownership

Identify every database, schema, or table and determine which service owns it.

What to look for:

SignalExamples
DB connection stringsDATABASE_URL, SUPABASE_URL, MONGO_URI, connection config
ORM models / migrationsPrisma schema, TypeORM entities, GORM models, Alembic migrations, Knex migrations
Raw SQLCREATE TABLE, SELECT FROM, table names in queries
DB client importsWhich services import the DB client or ORM?
Gateway patternDoes one service proxy DB access for others?

For each data store, record:

  • Type (PostgreSQL, MongoDB, Redis, S3, etc.)
  • Tables / collections (list them)
  • Owner service (the service that writes to it)
  • Reader services (services that read from it — directly or via gateway)
  • Access pattern: direct | via-gateway-service | via-message-bus

Flag violations:

  • Multiple services writing to the same table (shared mutable state)
  • Services bypassing a DB gateway to access the database directly
  • No clear owner for a table

Step 4: Map External Integrations

Find every connection to systems outside the codebase.

What to look for:

SignalExamples
API clientsREST clients, SDK imports, webhook handlers
API keys / secretsEnvironment variables like *_API_KEY, *_SECRET, *_TOKEN
External URLsHardcoded or configured URLs to third-party services
Webhook endpointsRoutes that receive callbacks from external systems

For each integration, record:

  • External system name (e.g., Stripe, SendGrid, S3)
  • Which service connects to it
  • Direction: outbound (we call them) | inbound (they call us) | bidirectional
  • Auth method (API key, OAuth, mTLS, etc.)
  • Data exchanged (what we send/receive)

Step 5: Trace Event Flows

For event-driven architectures, map the full lifecycle of key events.

For each event type:

  • Publisher (which service emits it)
  • Subscribers (which services consume it)
  • Payload schema (or reference to contract)
  • What triggers the event
  • What downstream effects it causes

Build 3-5 critical flow diagrams showing end-to-end event chains (e.g., "user action → ingestion → processing → storage → notification").

Step 6: Generate the Service Map

Produce the output document using the structure in TEMPLATES.md.


Discovery Commands

Use these to accelerate analysis. Adapt to the project's language/framework.

Find entrypoints

# Go
find . -name "main.go" -not -path "*/vendor/*"

# Node/TypeScript
find . -name "index.ts" -path "*/src/*" -not -path "*/node_modules/*"

# Python
find . -name "main.py" -o -name "app.py" -o -name "wsgi.py" | grep -v __pycache__

Find message bus usage

# RabbitMQ / AMQP
grep -rn "publish\|subscribe\|consume\|createChannel\|assertQueue\|assertExchange" --include="*.ts" --include="*.go" --include="*.py"

# Kafka
grep -rn "producer\|consumer\|KafkaClient\|kafka.NewReader\|kafka.NewWriter" --include="*.ts" --include="*.go" --include="*.py"

# Event type constants
grep -rn "EVENT_TYPE\|event_type\|EventType\|ROUTING_KEY\|routing_key" --include="*.ts" --include="*.go" --include="*.py"

Find database access

# Table names in SQL
grep -rn "FROM \|INTO \|UPDATE \|CREATE TABLE\|ALTER TABLE" --include="*.ts" --include="*.go" --include="*.py" --include="*.sql"

# ORM models
grep -rn "Entity\|@Table\|@Model\|tableName\|__tablename__" --include="*.ts" --include="*.py" --include="*.java"

# DB connection setup
grep -rn "DATABASE_URL\|SUPABASE_URL\|MONGO_URI\|createConnection\|createPool\|getConnection" --include="*.ts" --include="*.go" --include="*.py" --include="*.env*"

Find external API calls

# HTTP clients
grep -rn "axios\|fetch(\|http.Get\|http.Post\|requests.get\|requests.post\|HttpClient" --include="*.ts" --include="*.go" --include="*.py"

# API keys in env
grep -rn "API_KEY\|API_SECRET\|_TOKEN\|_SECRET" --include="*.env*" --include="*.yaml" --include="*.ts"

Find deployment configs

# Docker
find . -name "Dockerfile" -o -name "docker-compose*.yaml" -o -name "docker-compose*.yml"

# Kubernetes
find . -name "*.yaml" -path "*/k8s/*" -o -name "*.yaml" -path "*/deploy*/*"

# Serverless
find . -name "serverless.yml" -o -name "serverless.ts"

# Cloud platform
find . -name "app.yaml" -o -name "app.spec.yaml" -o -name "*.tf"

Quality Checks

Before presenting the service map, verify:

  • Every service has a clear type (webservice/worker/cron/lambda/gateway)
  • Every inter-service connection has protocol and direction documented
  • Every database table has exactly one owner service identified
  • Every external integration has the connecting service identified
  • No orphan services (services with zero connections — likely missed something)
  • Event flows cover the critical business paths
  • ASCII diagrams are present for high-level architecture and key flows
  • The map is self-contained — an AI agent can understand the architecture without reading code

Supporting Files

  • TEMPLATES.md — Output format and examples for the service map

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.