一键导入
trace
Navigate execution flow from an entry point, mapping call chains, external dependencies, and side effects.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Navigate execution flow from an entry point, mapping call chains, external dependencies, and side effects.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
ALWAYS use this skill whenever you would otherwise ask the user a question in free-form chat -- for clarifications, confirmations (especially destructive actions), missing parameters, multiple-choice decisions, or structured form input. Elicitations are routed through the Unique AI Platform UI via `unique-cli elicit create` + `elicit wait` (or `elicit ask` outside an agent harness) so the user gets a proper structured prompt and you get a structured answer back. Do NOT ask the user in plain chat when you can use this skill instead.
Read Agentic Table (magic table / due-diligence) sheets through the unique-cli agentic-table command. Use when the user or task involves inspecting an Agentic Table: a sheet's state and metadata, a specific cell's value or lock state, a cell's edit/answer history, or the sheet's generated export artifacts (reports, question exports). These are read-only (Tier 0) commands — they never modify the sheet and never require confirmation. Access to each sheet is enforced by the platform; a denial is reported as `agentic-table: permission denied`.
Call MCP (Model Context Protocol) server tools on the Unique AI Platform using the unique-cli mcp command. Use when the user asks to invoke, call, or execute an MCP tool, or when they need to send a JSON payload to an MCP server through the CLI. The JSON payload is forwarded 1:1 to the platform's MCP call-tool API.
Invoke connected Unique spaces/subagents through the unique-cli subagent command. Use when the workspace exposes connected-space tools and you need to delegate a question or task to one of those configured assistants.
Search the Unique AI Platform knowledge base using the unique-cli search command, with automatic per-turn citation tracking so cited facts render as clickable reference chips and `<sup>N</sup>` footnotes on the Unique platform. Use whenever the user asks to find, search, or query documents or content on Unique, including filtering by folder or metadata. Also covers `unique-cli read <cont_id>` for reading the full indexed text of a document when its content ID is already known. NOTE: This search uses combined vector + full-text indexing. Excel (.xlsx/.xls), CSV (.csv), and image files are NOT full-text indexed, so they will not appear in search results. To locate these file types, use the unique-cli-file-management skill instead (browse folders with `unique-cli ls` to find them by name).
Search the documents uploaded for the CURRENT task/row (e.g. an Agentic Table row's attached files) via the `unique-cli uploaded-search "<query>"` command, with the same per-turn citation tracking as `unique-cli search` so cited facts render as `<sup>N</sup>` footnotes and clickable reference chips on the Unique platform. ALWAYS use this skill when the user refers to documents they uploaded/attached to this task, or when you need facts from the task's own attached files. These uploaded files are scoped to the chat, NOT to a knowledge-base folder, so they will NEVER appear in `unique-cli search` results no matter the folder or metadata filters. Use `unique-cli search` for the knowledge base and this command for the task's uploaded documents; the two are complementary and citation numbering is shared across them within a turn.
| name | trace |
| description | Navigate execution flow from an entry point, mapping call chains, external dependencies, and side effects. |
| license | MIT |
| compatibility | claude cursor opencode |
| metadata | {"version":"1.0.0","languages":"all","audience":"developers","workflow":"analysis","since":"2026-02-24"} |
I map execution flow from a given entry point — a file path, function name, or class name — and produce two things:
graph TD call graph showing which functions call which, with external dependencies (APIs, databases, queues, file I/O) styled distinctly. Ambiguous callees, truncation points, and cycles are marked explicitly in the diagram.I trace the call graph depth-first up to 3 levels by default. I work with any programming language — I read the code semantically, so no static analysis tools are required.
Use me when you:
/trace src/payments/checkout.py
→ Full trace from the checkout.py entry point: call chain, all files involved, external dependencies highlighted
/trace AuthService.authenticate
→ Blast-radius map: everything that calls authenticate (callers) and everything it delegates to (callees + side effects)
/trace payments/checkout.py "what external services does this touch?"
→ Focused trace: leads with a direct answer listing all external services, then provides the full trace for context
Extract the entry point from the invocation:
src/payments/checkout.py), a function name (e.g., process_order), or a class name (e.g., AuthService)Search the codebase for the entry point:
<name> not found in the codebase. Check the spelling or provide the file path directly."Starting from the entry point, traverse outbound calls:
[TRUNCATED at depth N] and stop recursing that branch[CYCLE] and stopFor every node in the call graph, classify it as one of:
| Classification | Label | Criteria |
|---|---|---|
| Internal | (no label) | Function/method owned by the project |
| External | [EXTERNAL] | Crosses the codebase boundary: HTTP calls, DB queries, file I/O, message queue publish/consume, event emissions |
| Ambiguous | [AMBIGUOUS] | Callee cannot be statically determined: dynamic dispatch, dependency injection, reflection, eval() |
For External nodes, record: what system it connects to (e.g., "Stripe API", "PostgreSQL", "S3"), the call site (file + line or function), and the protocol/method (HTTP POST, SQL SELECT, etc.).
Identify and list all side effects encountered during the trace:
[CYCLE → <original-node>] marker in the diagram and note it in the Ambiguities section[TRUNCATED] node in the diagram and note it in the Ambiguities section with the path that was cut offIf a focus question was given:
Always produce two parts in this order:
graph TD
entryNode["file.py\nfunction_name()"]
internalNode["other_file.py\ncalled_function()"]
extNode["[EXTERNAL]\nStripe API (HTTP POST)"]:::external
ambigNode["[AMBIGUOUS]\ndynamic_handler()"]:::ambiguous
truncNode["[TRUNCATED at depth 3]"]:::truncated
cycleNode["[CYCLE → entryNode]"]:::cycle
entryNode --> internalNode
entryNode --> extNode
internalNode --> ambigNode
internalNode --> truncNode
entryNode -.-> cycleNode
classDef external fill:#fef3c7,stroke:#d97706,stroke-dasharray: 5 5
classDef ambiguous fill:#fee2e2,stroke:#dc2626,stroke-dasharray: 3 3
classDef truncated fill:#f3f4f6,stroke:#9ca3af
classDef cycle fill:#ede9fe,stroke:#7c3aed
Node label format: "filename.ext\nfunction_name()" — file on the first line, function on the second.
Always include all eight sections. Use "None" for empty sections — never omit a section.
Entry point: function_name() in path/to/file.ext
Call chain: [Prose narrative — describe the flow in plain English. E.g.: "process_order validates the cart via validate_cart, then delegates payment to charge(), which calls the Stripe API synchronously. On success, the order record is persisted to PostgreSQL via the ORM."]
Key files & their roles:
| File | Role |
|---|---|
src/payments/checkout.py | Entry point — orchestrates the order flow |
src/validators.py | Validates cart contents before payment |
src/payment.py | Handles Stripe integration |
External dependencies:
Stripe API — HTTP POST — called from payment.py::charge()PostgreSQL — SQL INSERT — called from checkout.py::process_order() via ORMSide effects:
orders tableAmbiguities & truncations:
[AMBIGUOUS] dynamic_handler() in checkout.py — callee determined at runtime via DI container; cannot be statically resolved[TRUNCATED] notification_service.send() branch cut at depth 3 — may contain additional side effectsNarrative: [One paragraph summarising the full entry-to-exit flow, written for a developer who has never seen this code. Cover: what the function does, the key path through the call graph, what external systems are touched, and any important ambiguities or side effects to be aware of.]
When the entry point is a function or class (not a file), add this additional section to the summary:
Blast radius:
<entry>): [list each caller with file path]<entry> delegates to): [list each callee with file path]<entry> is likely to affect: [caller list]Search the codebase for direct callers of the entry point and include them. This is the pre-refactor scoping view.
When a focus question is provided (e.g., /trace checkout.py "what external services does this touch?"):
Run the full trace as normal — do not skip any step
Before producing output, identify which nodes and edges most directly answer the question:
[EXTERNAL] nodesLead the output with a Focus Answer section:
Focus Answer: [1–3 sentences directly answering the question. E.g.: "This flow touches two external services: the Stripe API (HTTP POST from payment.py::charge()) and PostgreSQL (SQL INSERT from checkout.py::process_order())."]
In the structured summary, list the most relevant items first in their sections (external deps, side effects, etc.) — do not remove other items, just reorder to foreground what the question asks about
In the Mermaid diagram, add a comment above relevant nodes (e.g., %% answers focus question) — the visual structure is not changed, but the comment aids orientation
The focus question narrows attention, not scope. The complete trace is always produced.