Instruments programs to capture execution traces specifically for reproducing reported bugs, enabling consistent replay and diagnosis of failures. Use this skill when you need to reproduce a bug, capture execution traces for debugging, instrument code to record program behavior, generate replay scripts for bug reproduction, diagnose hard-to-reproduce failures, or perform deterministic replay of program execution. Triggers when users ask to instrument code for tracing, capture execution traces, reproduce bugs, generate replay scripts, or enable deterministic debugging.
npx skills add https://github.com/ArabelaTso/Skills-4-SE --skill reproduction-trace-instrumenter
This skill instruments source code to capture detailed execution traces for bug reproduction. It records function calls, variable values, control flow, and program state, then generates replay scripts to deterministically reproduce the bug for diagnosis.
Before instrumentation, understand:
Use the appropriate instrumenter for your language:
python scripts/python_instrumenter.py <source_file.py> -o <instrumented_file.py>
Options:
--no-functions: Disable function call tracing--no-variables: Disable variable assignment tracing--no-control-flow: Disable control flow tracing--exclude <patterns>: Exclude functions matching patterns (e.g., __init__ test_*)Example:
# Full instrumentation
python scripts/python_instrumenter.py app.py -o app_instrumented.py
# Minimal instrumentation (functions only)
python scripts/python_instrumenter.py app.py -o app_instrumented.py --no-variables --no-control-flow
# Exclude test functions
python scripts/python_instrumenter.py app.py -o app_instrumented.py --exclude test_ __
Execute the instrumented program with the inputs that trigger the bug:
python app_instrumented.py
The execution trace will be automatically saved to trace.json when the program exits.
Trace Output:
trace.json: Complete execution trace with all recorded eventsGenerate a human-readable summary:
python scripts/replay_generator.py trace.json --summary
This shows:
Create a replay script to reproduce the bug:
python scripts/replay_generator.py trace.json -o replay.py
Run the replay script:
python replay.py
The replay script executes the same sequence of operations, allowing you to:
Use the trace configuration template to customize instrumentation:
cp assets/trace_config_template.json trace_config.json
# Edit trace_config.json as needed
Key Configuration Options:
Instrumentation Level:
trace_functions: Record function entry/exittrace_variables: Record variable assignmentstrace_control_flow: Record if/else, loopstrace_exceptions: Record exception handlingFiltering:
exclude_patterns: Function name patterns to skipexclude_modules: Modules to skip entirelymax_string_length: Truncate long stringsmax_call_depth: Limit trace depthPerformance:
buffer_size: Events to buffer before writingasync_write: Write traces asynchronouslymax_trace_size_mb: Maximum trace file sizeChoose the appropriate level based on your needs:
python scripts/python_instrumenter.py app.py -o app_inst.py --no-variables --no-control-flow
python scripts/python_instrumenter.py app.py -o app_inst.py --no-control-flow
python scripts/python_instrumenter.py app.py -o app_inst.py
User: "I have a bug that only happens sometimes. Help me capture what's happening."
→ Instrument with full tracing
→ Run multiple times until bug occurs
→ Analyze the trace from the failing run
→ Generate replay script to reproduce consistently
User: "I don't understand why this function returns the wrong value."
→ Instrument with functions + variables
→ Run with problematic input
→ Review trace to see variable values at each step
→ Identify where the logic goes wrong
User: "Users report a crash but I can't reproduce it locally."
→ Instrument production code (minimal level for performance)
→ Deploy and wait for crash
→ Retrieve trace.json from crashed instance
→ Generate replay script to reproduce locally
User: "I fixed a bug. How do I ensure it doesn't come back?"
→ Capture trace of the bug before fix
→ Generate replay script
→ Use replay script as regression test
→ Run after each code change
Traces are stored in JSON format with the following structure:
{
"traces": [
{
"seq": 1,
"timestamp": "2024-01-15T10:30:45.123",
"type": "function_entry",
"depth": 0,
"data": {
"function": "calculate_total",
"arguments": {"price": 100, "tax_rate": 0.08}
}
},
{
"seq": 2,
"timestamp": "2024-01-15T10:30:45.125",
"type": "variable_assignment",
"depth": 1,
"data": {
"variable": "tax",
"value": 8.0,
"type": "float"
}
}
],
"metadata": {
"total_events": 2,
"max_depth": 1
}
}
--exclude to skip irrelevant code pathsModify scripts/python_instrumenter.py to add custom tracing:
For programs with multiple processes:
For distributed systems:
AST-based Python code instrumenter that:
Trace replay script generator that:
Comprehensive guide covering:
Read this reference when you need deeper understanding of instrumentation theory, want to implement instrumenters for other languages, or need to optimize trace performance.
Configuration template for customizing:
Copy and modify this template to create custom trace configurations for specific use cases.
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
Automatically creates user-facing changelogs from git commits by analyzing commit history, categorizing changes, and transforming technical commits into clear, customer-friendly release notes. Turns hours of manual changelog writing into minutes of automated generation.
Use when implementation is complete, all tests pass, and you need to decide how to integrate the work - guides completion of development work by presenting structured options for merge, PR, or cleanup
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).
React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.
React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.
Next.js best practices - file conventions, RSC boundaries, data patterns, async APIs, metadata, error handling, route handlers, image/font optimization, bundling
Use when starting feature work that needs isolation from current workspace or before executing implementation plans - creates isolated git worktrees with smart directory selection and safety verification
Take arabelatso/reproduction-trace-instrumenter from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.