Skip to content
Back to skills

Python Cprofile Decorator With Csv Xlsx Export

ASecurity

Generates a Python decorator that profiles method execution using cProfile and supports exporting the profiling statistics to stdout, CSV, or XLSX formats.

  • 611 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added November 11, 2026
educationpythonperformance

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill python-cprofile-decorator-with-csv-xlsx-export --agent claude-code

Installs 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 with every re-scan.

Security grade badge for Python Cprofile Decorator With Csv Xlsx Export
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-python-cprofile-decorator-with-csv-xlsx-export/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-python-cprofile-decorator-with-csv-xlsx-export)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in education →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.