Trace

From mbwsims/claude-universe · View interactive version

Trace is an AI agent skill from the GitHub repository mbwsims/claude-universe. This skill should be used when the user asks to "trace a feature", "follow the data flow", "how does this feature work", "trace the request", "where does data flow", "walk me through this flow", "trace from entry to database", mentions "/trace", or wants to understand how a feature or request flows

How to use this skill

Skill file

Trace Feature

Follow a feature from entry point through every layer of the codebase. Produces a visual

flow showing exactly how data moves: route → handler → service → database, with every

transformation, validation, and side effect along the way.

Understanding data flow is a prerequisite for safe changes. You cannot safely modify code

you don't understand.

Workflow

0. Build the Dependency Graph

If lenskit_graph is available, call it FIRST to get the full project dependency graph.

Use this data throughout the trace to:

For the files at the center of the flow, call lenskit_analyze to add coupling and risk

context so you can flag especially fragile handoff points.

This step takes seconds and saves minutes of manual grep work.

If lenskit_graph is unavailable, build the import chain manually: for each file in

the trace, use Grep to find import.*from statements and follow them forward. This is

slower but produces the same trace. Skip the hub/cycle annotations.

1. Identify the Entry Point

Find where the feature begins:

If the user specified a feature name (e.g., "checkout"), find the entry point by grepping

for related routes, components, or handlers.

For event-driven / pub-sub systems: The entry point may not be an HTTP route. Look for:

(what reacts to it). Note the async boundary between them.

2. Trace Forward

Starting from the entry point, follow the execution path. At each step, document:

Read each file in the chain. Follow imports, function calls, and async operations.

Don't guess — read the actual code.

3. Identify Layers

As you trace, identify which architectural layer each step belongs to:

| Layer | Examples | Role |

|-------|----------|------|

| Entry | Route handler, controller, API gateway | Receives external input |

| Validation | Schema validation, auth checks, input parsing | Ensures input is safe and valid |

| Business Logic | Services, use cases, domain models | Core logic and decisions |

| Data Access | Repositories, ORM calls, query builders | Reads/writes persistent state |

| External | API clients, email services, queue publishers | Communicates with external systems |

| Response | Serializers, formatters, view models | Shapes output for the caller |

For framework-specific layer identification, see references/layer-patterns.md.

4. Note Observations

While tracing, flag:

5. Present the Trace

Report format:

## Trace — {feature name}

### Flow Summary
{One-line description of the complete flow}

### Data Flow

Entry: {entry point}
  ↓ {what data}
Validation: {validation step}
  ↓ {validated data}
Logic: {business logic}
  ↓ {processed data}
Storage: {database/API call}
  ↓ {result}
Response: {what goes back to caller}

### Branches (if applicable)
- Add one bullet per meaningful branch: **{condition}** -> {where it goes}
- **Default path**: {which branch is the happy path}

### Detailed Steps

**Step 1: {file}:{function}** — {layer}
Input: {what comes in}
Does: {what happens}
Output: {what goes out}
Side effects: {any}

**Step 2: {file}:{function}** — {layer}
...

### Observations
{Missing validation, error handling gaps, test coverage, etc.}

The flow diagram should be scannable in 10 seconds. The detailed steps provide depth

when needed.

Guidelines

the primary path and note the branches.

third-party libraries unless relevant.

Related Skills

Additional Resources

identify them in different frameworks

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.