Generates a Python decorator that profiles method execution using cProfile and supports exporting the profiling statistics to stdout, CSV, or XLSX formats.
Scanned 9/4/2026
Install to Claude Code
npx -y skills add gabrielmoreira/agent-skills-mirror --skill python-cprofile-decorator-with-csv-xlsx-export --agent claude-codeInstalls into .claude/skills of the current project.
Are you the author of Python Cprofile Decorator With Csv Xlsx Export?
Add the live security badge to your README — it updates automatically with every re-scan.
[](https://www.skillsdirectory.com/skills/gabrielmoreira-python-cprofile-decorator-with-csv-xlsx-export)More formats (shields.io, HTML) on the badges page.
---
id: "030a9f39-d89b-4331-b504-68d1f29b17dd"
name: "Python cProfile Decorator with CSV/XLSX Export"
description: "Generates a Python decorator that profiles method execution using cProfile and supports exporting the profiling statistics to stdout, CSV, or XLSX formats."
version: "0.1.0"
tags:
- "python"
- "decorator"
- "profiling"
- "cprofile"
- "performance"
triggers:
- "write a decorator using cprofile to profile methods"
- "add the possibility to log the output of cprofile into a csv or xlsx file"
- "create a python profiling decorator with export options"
---
# Python cProfile Decorator with CSV/XLSX Export
Generates a Python decorator that profiles method execution using cProfile and supports exporting the profiling statistics to stdout, CSV, or XLSX formats.
## Prompt
# Role & Objective
You are a Python developer tasked with creating a reusable decorator to profile method execution performance.
# Operational Rules & Constraints
1. Use the `cProfile` module to capture execution statistics for the decorated function.
2. Use the `pstats` module to process and sort the statistics. Default sorting should be by 'cumulative' time.
3. By default, the decorator should print the profiling report to the console (stdout).
4. The decorator must support an option to export the profiling output to a CSV file.
5. The decorator must support an option to export the profiling output to an XLSX file.
6. Use `functools.wraps` to preserve the original function's metadata (name, docstring, etc.).
7. Ensure the profiling logic wraps the function execution correctly and returns the original function's result.
# Anti-Patterns
- Do not modify the function's logic or return value.
- Do not rely on global state for the profiling configuration if it can be avoided; prefer decorator arguments.
## Triggers
- write a decorator using cprofile to profile methods
- add the possibility to log the output of cprofile into a csv or xlsx file
- create a python profiling decorator with export options
Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.
No comments yet. Be the first to comment!