Map

From mbwsims/claude-universe · View interactive version

Map is an AI agent skill from the GitHub repository mbwsims/claude-universe. This skill should be used when the user asks to "map the architecture", "show me the architecture", "codebase overview", "how is this project structured", "architecture diagram", "module map", "dependency map", "what are the layers", mentions "/map", or wants a high-level architectural overview of t

How to use this skill

Skill file

Architecture Map

Generate a high-level architectural map of the codebase: layers, modules, boundaries,

data flow, and dependency directions. The output should give someone who's never seen

this codebase a mental model in 2 minutes.

Workflow

1. Survey the Project

Gather structural data:

the stack?

provides file count, avg risk score, top risk files, circular dependency count, hub count,

and test coverage ratio. This gives you a quantitative foundation before reading any code.

2. Identify Layers

Read representative files from each major directory to understand the layer:

Use the layer classification from skills/trace/references/layer-patterns.md to identify

which directory maps to which architectural layer. Common patterns:

For framework-specific patterns (Django, FastAPI, Spring Boot, etc.), see the reference file.

3. Map Dependencies

With lenskit-mcp (preferred): Call lenskit_graph to get the full dependency graph

with layer classifications, circular dependencies, hub files, and layer violations

pre-computed. Use this data directly for the module map and observations sections. For the

highest-risk or highest-centrality files, call lenskit_analyze to add risk-score and

coupling detail to the observations.

Note on tsconfig path aliases: If the project uses tsconfig path aliases (e.g.,

@/utils/helpers mapping to src/utils/helpers), lenskit resolves these automatically.

The graph data will show the true file-to-file dependencies even for aliased imports.

If you see aliased imports in the code that don't appear in the graph, check whether

the project's tsconfig.json has paths configured.

Without lenskit-mcp: For each major module/directory, identify what it imports from

and what imports it:

# What does src/lib/auth import?
grep -h "from" src/lib/auth/*.ts | sort -u

# What imports from src/lib/auth?
grep -rl "from.*lib/auth" src/ | grep -v "lib/auth"

Build a dependency direction map: which layers depend on which?

4. Identify Boundaries

Look for:

5. Present the Map

Report format:

## Architecture Map — {project name}

### Stack
{Framework, language, database, key dependencies — one line each}

### Layer Diagram

┌─────────────────────────────────────────┐
│  Entry (app/api/, app/(routes)/)        │ ← External requests
├─────────────────────────────────────────┤
│  Middleware (middleware.ts, lib/auth/)    │ ← Auth, rate limiting
├─────────────────────────────────────────┤
│  Business Logic (lib/services/)          │ ← Core domain
├─────────────────────────────────────────┤
│  Data Access (lib/db/)                   │ ← Database operations
├─────────────────────────────────────────┤
│  External Services (lib/clients/)        │ ← Third-party APIs
└─────────────────────────────────────────┘

### Module Map

| Module | Purpose | Depends on | Depended by |
|--------|---------|------------|-------------|
| lib/auth | Authentication | lib/db, env | api/*, middleware |
| lib/db | Database access | prisma, env | lib/services, api/* |
| lib/services | Business logic | lib/db, lib/clients | api/* |
| ... |

### Data Flow
{Primary data flow path from entry to storage — reference /trace for detailed flows}

### Boundaries
- **Trust boundary**: All API routes require auth via middleware
- **Package boundary**: (if monorepo) packages communicate via published APIs
- **External boundary**: Database via Prisma, payments via Stripe SDK

### Key Patterns
{2-3 architectural patterns the project follows: repository pattern, service layer,
middleware chain, event-driven, etc.}

### Observations
{Potential issues: circular dependencies, layer violations, god modules, etc.}

Related Skills

Monorepo Guidance

For monorepos (Turborepo, Nx, Lerna, pnpm workspaces):

modules for architecture decisions)

(should use published package exports instead)

Guidelines

(e.g., a utility importing from a route handler).

say so. That's a finding in itself.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.