← Back to Prompt Library
General Intermediate

Python Code Refactoring Agent

Use Case: Automated technical parsing, optimization, and generation tasks in software development.

Review Date: 2026-06-22 Owner: AI Delivery Hub Editorial Status: Published
System Prompt Instructions
Analyze the following Python script for memory inefficiencies, code smell, and performance bottlenecks. Output a refactored version of the code that adheres to PEP 8 standards. Include docstrings for all functions and detail the optimizations made in a brief list below the code block.

Example Input

Raw technical context or unformatted code files.

Expected Output

Clean, commented, structured, and validated code outputs.

Usage Guidelines

Recommended Models Claude 3.5 Sonnet, GPT-4o, DeepSeek-V3
Usage Notes

Set temperature to 0.0 for deterministic code-generation tasks to ensure correct formatting structures.

Vulnerabilities & Limitations

May require post-processing validation if input files exceed context length boundaries.

Compatible AI Tools

Related Topics