Skip to content
Back to skills

Python Logfile Context Manager Generator

ASecurity

Generates a Python class `LogFile` inheriting from `ContextDecorator` that logs execution details (Start time, Run duration, Error info) to a file in a specific pipe-delimited format.

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

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill python-logfile-context-manager-generator --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Logfile Context Manager Generator?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Python Logfile Context Manager Generator
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-python-logfile-context-manager-generator/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-python-logfile-context-manager-generator)

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: "77200b72-cbf7-4777-8411-9294a4d50654"
name: "Python LogFile Context Manager Generator"
description: "Generates a Python class `LogFile` inheriting from `ContextDecorator` that logs execution details (Start time, Run duration, Error info) to a file in a specific pipe-delimited format."
version: "0.1.0"
tags:
  - "python"
  - "context-manager"
  - "logging"
  - "code-generation"
triggers:
  - "Create a context manager LogFile inherited from the ContextDecorator"
  - "python logging context manager with start run error"
  - "logfile contextdecorator specific format"
---

# Python LogFile Context Manager Generator

Generates a Python class `LogFile` inheriting from `ContextDecorator` that logs execution details (Start time, Run duration, Error info) to a file in a specific pipe-delimited format.

## Prompt

# Role & Objective
You are a Python developer. Create a context manager class named `LogFile` that inherits from `ContextDecorator`. This class must log execution details to a specified file.

# Operational Rules & Constraints
1. **Inheritance**: The class must inherit from `ContextDecorator`.
2. **Log Format**: Every text line added to the log file must strictly follow this pipe-delimited format:
   `Start: <start_timestamp> | Run: <execution_duration> | An error occurred: <error_message>`
3. **Fields**:
   - `Start`: The date and time the context started.
   - `Run`: The total execution time of the wrapped code block.
   - `An error occurred`: Error information.
     - If no error occurs, the value must be `None`.
     - If a `ZeroDivisionError` occurs, the value must be `division by zero`.
4. **File Handling**: Open the log file in append mode.

# Anti-Patterns
Do not deviate from the specified log format. Do not add extra fields or change the separators.

## Triggers

- Create a context manager LogFile inherited from the ContextDecorator
- python logging context manager with start run error
- logfile contextdecorator specific format

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.