Skip to content
Agentmart
Submit a tool

trace-function

Statically trace what happens when a C++ function is called, including verified call edges, max-depth stack trace, and branch gates.

Skill by enricogolfieri

IndexedUnlicense★ 1
Write a review

Install

Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.

npx agentmarket install skill/enricogolfieri-trace-function

Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.

Get the weekly diff

The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.

We use your email only for this newsletter. Privacy

About

Statically trace what happens when a C++ function is called, including verified call edges, max-depth stack trace, and branch gates. Use when the user asks to trace a function, inspect how a function is linked in the codebase, or says "Trace what happens when <FUNC> is called."

No reviews yet. Installed it? Reviews come from verified installers only. How reviews work

Permissions

What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.

Tools
No tools found
Secrets
None asked for
Install scripts
None found
Runs as
Python package

Network hosts it talks to 1

  • codeload.github.com · found in install command

Files it touches

  • ~/.claude/skills/trace-function

What's inside

Skill name
trace-function
Description
Statically trace what happens when a C++ function is called, including verified call edges, max-depth stack trace, and branch gates. Use when the user asks to trace a function, inspect how a function is linked in the codebase, or says "Trace what happens when <FUNC> is called."
License
Unlicense
Instructions
74 lines in SKILL.md · view on GitHub

Before installing

  • Ships executable scripts

Files (3)

  • SKILL.md
  • cpp_trace_links.cpython-313.pyc · scripts/__pycache__/
  • cpp_trace_links.py · scripts/

SKILL.md (first lines)

# Trace Function

## Required Behavior

Trace what happens when `<FUNC>` is called. Don't run anything — read the
source. Output:

1. A mermaid sequenceDiagram from `<FUNC>` down to its leaves. Every arrow
   labeled `funcName  file:line`. Use solid arrows for calls you verified
   in source, dashed (-.->) for any edge you had to guess.

2. A textual stack trace at max depth, top frame first:
   #0  funcName()     path/file.ext:LINE
   #1  caller()       path/file.ext:LINE

3. A "branches not taken" list: every if/switch/early-return that gates a
   different call path, with file:line.

Rules: cite file:line for every edge. If you can't verify a call from
source, omit it or mark it dashed. Don't suggest running, debugging, or
adding prints.

## Workflow

1. Treat this as a static source-reading task. Do not run tests, binaries, debuggers, servers, repros, or add logging.
2. Use the helper script only to find candidates. Never cite script output as proof.
3. Read the source for each included function, call edge, and branch gate.
4. Prefer omitting uncertain edges. Use dashed `-.->` only when an edge is necessary to explain the trace and clearly mark it as inferred.
5. Stop at leaves where no further project-local direct calls are verified, or where expanding would leave the requested scope.

## Helper Script

Run from the repository root:

```bash
python3 ~/.cursor/skills/trace-function/scripts/cpp_trace_links.py '<FUNC>' --root .
```

Useful options:

```bash
python3 ~/.cursor/skills/trace-function/scripts/cpp_trace_links.py '<FUNC>' --root . --max-depth 4 --json
python3 ~/.cursor/skills/trace-function/scripts/cpp_trace_links.py '<FUNC>' --root src/mongo/db --max-files 2000
```

The script reports candidate definitions, callers, callees, and nearby branch gates in C++ source files. It is regex-based and conservative by design; use it to decide what to read next, not as final evidence.

## Verification Rules

- Every final mermaid edge must cite the call-site source line.
- Every stack frame must cite the defining source line or the verified call-site line, whichever is clearer.
- Every branch not taken must cite the `if`, `switch`, `case`, `default`, ternary, or early-return line that gates an alternate path.
- For overloaded functions, templates, virtual dispatch, callbacks, function pointers, or macros, read enough surrounding code to distinguish candidate matches. If source cannot prove the edge, omit it or make it dashed.
- Keep paths relative to the repository root in final output.

## Output Template

````markdown
```mermaid
sequenceDiagram
    participant A as funcA
    participant B as funcB
    A->>B: funcB  src/path/file.cpp:123
```

Textual stack trace:
#0  leafFunc()      src/path/file.cpp:456
#1  callerFunc()    src/path/file.cpp:123

Branches not taken:
- `condition description` gates `otherFunc()` at `src/path/file.cpp:120`
````

From enricogolfieri/workspace-mongo, Unlicense.

More from enricogolfieri/workspace-mongo

Signals

Stars
1
Forks
0
Open issues
0
Last commit (this folder)
Aug 12, 2026 (2 months ago)

From GitHub (fetched Oct 24, 2026).

Details

License
Unlicense
First seen
Oct 24, 2026
Last checked
Oct 24, 2026

More from enricogolfieri

Cite this page

trace-function skill. Agent Mart. https://agentmart.dev/skills/enricogolfieri-trace-function (last updated 2026-10-24)