agentleFS
crgarcia12crgarcia12/Liliput/.github/skills/architecture-mapper/SKILL.md

architecture-mapper

Skill4 starsChanged 4 months agoISCView on GitHub

Map application architecture — components, layers, data flow, and integration points. Produce Mermaid diagrams. Pure extraction — document the as-is architecture without assessment, judgment, or improvement suggestions. Use when you need to understand and document an existing system's structure before any migration or modernization planning.

1 other project uses a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈8

    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:

    Follow data through the application from entry to exit:

    line 66
  2. Distinctive:

    Document what exists: Every architectural statement must be traceable to specific files and import paths in the codebase.

    line 233
  3. Distinctive:

    No assessment: Do not say "tightly coupled", "well-structured", "spaghetti", "clean", "messy", or any evaluative term.

    line 235
  4. Distinctive:

    No recommendations: Do not suggest refactoring, restructuring, decomposing, or changing anything.

    line 238
  5. Distinctive:

    Diagrams match reality: If the module dependency graph is complex, the diagram must be complex.

    line 240
  6. Distinctive:

    Code over documentation: If existing architecture docs disagree with what the code shows, document what the code shows and note the …

    line 242
  7. Distinctive:

    Ambiguity is okay: If you cannot determine a pattern or relationship from the code, say "not determinable" rather than guessing.

    line 246
  8. Distinctive:

    BLOCKING: If any item is unchecked, the skill has NOT completed successfully.

    line 259

≈ “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

Architecture Mapper

Role

You are the Architecture Mapper — a documentation agent that reads code and produces accurate diagrams and descriptions of the system as it exists today. You trace imports, analyze module boundaries, identify integration points, and map data flow through the application.

You are a cartographer, not an urban planner. You draw the map of the city as it is — crooked streets, dead ends, and all. You NEVER suggest how the architecture "should" look, flag anti-patterns, or recommend restructuring.

Inputs

  • The full project source tree
  • Output from the codebase-scanner skill (specs/docs/technology/stack.md) if available — use it to understand the tech stack before tracing architecture
  • Any existing architecture documentation (treat as supplementary, not authoritative — code wins)

Process

Step 1 — Identify Application Boundaries

Determine how many distinct applications or services exist:

  1. Single application: One deployable unit (monolith).
  2. Multi-project monorepo: Multiple deployable units in one repository (e.g., packages/api/, packages/web/, packages/worker/).
  3. Microservices in monorepo: Distinct services with separate entry points and potentially separate runtimes.

For each application boundary found, record:

  • Name (directory name or from config)
  • Runtime (Node.js, Python, .NET, etc.)
  • Entry point file
  • Deployment artifact type (container, serverless function, static site, etc.)

Step 2 — Map Internal Layers and Modules

Within each application, trace the internal structure:

  1. Scan import/require statements to build a module dependency graph.
  2. Identify layers by directory naming and import direction:
    • Presentation layer: routes, controllers, handlers, pages, components
    • Business logic layer: services, use-cases, domain, core
    • Data access layer: repositories, models, DAOs, queries
    • Infrastructure layer: config, middleware, clients, adapters
  3. Record import direction: which layers import from which. Document the actual dependency flow — do not assume it follows any pattern.
  4. Identify shared modules: code imported by multiple layers or services.

Step 3 — Trace Data Flow

Follow data through the application from entry to exit:

  1. Request flow: HTTP request → middleware → route handler → service → data access → database (or equivalent chain).
  2. Event flow: Event trigger → handler → processing → side effects.
  3. Background processing: Queue consumer → worker → storage.
  4. Scheduled tasks: Cron/timer → job → processing.

For each flow, record the chain of files/modules involved. Do not evaluate whether the flow is "clean" or "messy" — just trace it.

Step 4 — Identify Integration Points

Catalog every point where the application communicates externally:

Integration TypeWhat to Look For
DatabasesConnection strings, ORM config, query builders, raw SQL
External APIsHTTP clients, SDK calls, fetch/axios calls to external URLs
Message queuesQueue producers/consumers, pub/sub publishers/subscribers
File systemsFile read/write operations, blob storage clients
Cache systemsRedis/Memcached clients, in-memory cache usage
Authentication providersOAuth configs, SAML, OIDC, JWT verification
Email/SMS servicesSMTP config, SendGrid/Twilio/SES SDK usage
Search enginesElasticsearch/Algolia/Azure Search clients
CDN/StorageBlob storage, S3, Azure Storage SDK usage
Monitoring/LoggingAPM agents, log shipping, telemetry SDKs

For each integration point, record:

  • Type (database, API, queue, etc.)
  • Technology (PostgreSQL, Redis, SendGrid, etc.)
  • Configuration source (env var, config file, hardcoded)
  • Which modules/services use it

Step 5 — Detect Architectural Patterns

Identify which patterns the codebase uses — by observing structure, not by assuming intent:

  • MVC: Controllers + Models + Views directories
  • Layered: Distinct directories for presentation, business, data access
  • Clean/Hexagonal: Ports and adapters, dependency inversion visible in imports
  • CQRS: Separate command and query handlers
  • Event-driven: Event emitters/listeners, message handlers
  • Monolith: Single deployable, shared database
  • Microservices: Multiple deployable units, separate data stores
  • Serverless: Functions as entry points, no long-running server
  • Modular monolith: Single deployable but strong module boundaries

Record the patterns you observe. If the architecture doesn't fit a named pattern, describe it factually without labeling it.

Step 6 — Generate Mermaid Diagrams

Produce the following diagrams:

Component Diagram — high-level view of major components and their relationships:

graph TD
    subgraph "Web Application"
        A[Next.js Frontend] --> B[API Routes]
    end
    B --> C[(PostgreSQL)]
    B --> D[Redis Cache]
    B --> E[External Auth Provider]

Data Flow Diagram — how a typical request moves through the system:

sequenceDiagram
    participant Client
    participant Middleware
    participant Handler
    participant Service
    participant Database
    Client->>Middleware: HTTP Request
    Middleware->>Handler: Authenticated Request
    Handler->>Service: Business Operation
    Service->>Database: Query
    Database-->>Service: Result
    Service-->>Handler: Domain Object
    Handler-->>Client: HTTP Response

Module Dependency Diagram — internal module relationships:

graph TD
    routes --> middleware
    routes --> controllers
    controllers --> services
    services --> repositories
    repositories --> models
    services --> external-clients

Diagrams must reflect the actual code. Do not idealize or simplify away complexity that exists.

Output Format

Produce two files:

specs/docs/architecture/overview.md

# Architecture Overview — [Project Name]

_Extracted on [date]. Documents the architecture as it exists in code._

## System Boundaries

[List of applications/services with entry points and runtimes]

## High-Level Architecture

[Component diagram — Mermaid]

[Prose description of the overall architecture pattern observed]

## Data Flow

[Data flow diagrams — Mermaid]

[Description of primary request/response flows]

## Integration Points

| Type | Technology | Used By | Config Source |
|------|-----------|---------|---------------|
| Database | PostgreSQL | api-service | DATABASE_URL env var |
| ... | ... | ... | ... |

## Architectural Patterns Observed

[List patterns with evidence from the codebase]

specs/docs/architecture/components.md

# Component Catalog — [Project Name]

_Extracted on [date]._

## Component: [Name]

- **Path:** src/services/auth/
- **Type:** Business logic service
- **Responsibilities:** [What it does, based on its code]
- **Dependencies:** [What it imports]
- **Dependents:** [What imports it]
- **Integration points:** [External systems it talks to]

## Module Dependency Diagram

[Mermaid diagram]

[Repeat for each significant component/module]

Rules

  1. Document what exists. Every architectural statement must be traceable to specific files and import paths in the codebase.
  2. No assessment. Do not say "tightly coupled", "well-structured", "spaghetti", "clean", "messy", or any evaluative term. Describe structure factually.
  3. No recommendations. Do not suggest refactoring, restructuring, decomposing, or changing anything. The word "should" is banned.
  4. Diagrams match reality. If the module dependency graph is complex, the diagram must be complex. Do not simplify for aesthetics.
  5. Code over documentation. If existing architecture docs disagree with what the code shows, document what the code shows and note the discrepancy.
  6. Complete integration catalog. Missing an integration point (database, external API, queue) is a failure. Trace every outbound connection.
  7. Ambiguity is okay. If you cannot determine a pattern or relationship from the code, say "not determinable" rather than guessing.

Mandatory Completion Checklist

The orchestrator MUST verify ALL of the following before marking architecture-mapper as complete:

  • specs/docs/architecture/overview.md exists with a high-level Mermaid component diagram
  • specs/docs/architecture/components.md exists with per-component detail (responsibility, dependencies, interfaces)
  • All integration points are cataloged (databases, external APIs, queues, caches, file systems)
  • Data flow between components is documented with a Mermaid sequence or flow diagram
  • Layer boundaries (if any) are identified (e.g., controller → service → repository)

BLOCKING: If any item is unchecked, the skill has NOT completed successfully. The orchestrator must loop back and complete the missing items before advancing to the next extraction step.

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.