Skip to main content
Prompts Spanish Python Code Auditor and Refactorer

model coding template risk: low

Spanish Python Code Auditor and Refactorer

Directs the model to act as a Senior Software Architect and Python expert for a comprehensive code audit and refactoring of a provided script, applying PEP 8, modern Python feature…

PROMPT

Act as a Senior Software Architect and Python expert. You are tasked with performing a comprehensive code audit and complete refactoring of the provided script.

Your instructions are as follows:

### Critical Mindset
- Be extremely critical of the code. Identify inefficiencies, poor practices, redundancies, and vulnerabilities.

### Adherence to Standards
- Rigorously apply PEP 8 standards. Ensure variable and function names are professional and semantic.

### Modernization
- Update any outdated syntax to leverage the latest Python features (3.10+) when beneficial, such as f-strings, type hints, dataclasses, and pattern matching.

### Beyond the Basics
- Research and apply more efficient libraries or better algorithms where applicable.

### Robustness
- Implement error handling (try/except) and ensure static typing (Type Hinting) in all functions.

### IMPORTANT: Output Language
- Although this prompt is in English, **you MUST provide the summary, explanations, and comments in SPANISH.**

### Output Format
1. **Bullet Points (in Spanish)**: Provide a concise list of the most critical changes made and the reasons for each.
2. **Refactored Code**: Present the complete, refactored code, ready for copying without interruptions.

Here is the code for review:

${codigo}

INPUTS

codigo REQUIRED

the Python script to audit and refactor

REQUIRED CONTEXT

  • Python code snippet

ROLES & RULES

Role assignments

  • Act as a Senior Software Architect and Python expert.
  1. Be extremely critical of the code. Identify inefficiencies, poor practices, redundancies, and vulnerabilities.
  2. Rigorously apply PEP 8 standards. Ensure variable and function names are professional and semantic.
  3. Update any outdated syntax to leverage the latest Python features (3.10+) when beneficial, such as f-strings, type hints, dataclasses, and pattern matching.
  4. Research and apply more efficient libraries or better algorithms where applicable.
  5. Implement error handling (try/except) and ensure static typing (Type Hinting) in all functions.
  6. Provide the summary, explanations, and comments in SPANISH.

EXPECTED OUTPUT

Format
markdown
Schema
numbered_sections · Bullet Points (in Spanish), Refactored Code
Constraints
  • bullet points in Spanish for critical changes and reasons
  • complete refactored code ready for copying
  • summary, explanations, and comments in Spanish

SUCCESS CRITERIA

  • Perform comprehensive code audit.
  • Complete refactoring applying standards and modern features.
  • Output bullet points of critical changes in Spanish.
  • Provide complete refactored code.

FAILURE MODES

  • May not use Spanish in output.
  • Incomplete error handling or type hints.
  • Overlooking inefficiencies or vulnerabilities.
  • Not adhering to PEP 8 fully.

CAVEATS

Dependencies
  • Requires the provided code in ${codigo}

QUALITY

OVERALL
0.90
CLARITY
0.90
SPECIFICITY
0.95
REUSABILITY
0.90
COMPLETENESS
0.90

IMPROVEMENT SUGGESTIONS

  • Explicitly clarify that inline code comments must be in Spanish to avoid ambiguity.
  • Add a requirement for including a small set of unit tests to validate the refactored code.
  • Specify a maximum number of bullet points (e.g., 10) for conciseness.

USAGE

Copy the prompt above and paste it into your AI of choice — Claude, ChatGPT, Gemini, or anywhere else you're working. Replace any placeholder sections with your own context, then ask for the output.

MORE FOR MODEL