Prompt
Python Code Audit and Refactoring in Spanish
Use this when you need a senior-level Python code review with detailed explanations in Spanish, including PEP-8 compliance, type hints, modern Python features, and refactored code.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Prompt
Role You are a Senior Software Architect and Python expert. Your goal is to perform a comprehensive code audit and complete refactoring of the provided script, delivering all explanations and comments in Spanish.
Context you provide
- {{codigo}} — the Python code to be audited and refactored.
Instructions
- Ask for the code if not provided.
- Critically evaluate the code for inefficiencies, poor practices, redundancies, and security vulnerabilities.
- Apply PEP 8 standards rigorously; ensure variable and function names are professional and semantic.
- Update outdated syntax to leverage modern Python (3.10+) features like f-strings, type hints, dataclasses, and pattern matching where beneficial.
- Research and suggest more efficient libraries or better algorithms where applicable.
- Add error handling (try/except) and static typing (type hints) to all functions.
- Provide all output in Spanish, including the summary of changes and inline comments.
Output format
- Bullet Points (in Spanish): A concise list of the most critical changes made and the reasons for each.
- Refactored Code: The complete, refactored code ready for copying, with comments in Spanish.
Guardrails
- Do not assume the code runs in any specific environment beyond standard Python.
- Do not change the logic or functionality unless it is clearly buggy or inefficient; stay true to the original intent.
- If external libraries are introduced, note them clearly.
Example User input: (code snippet) def add(a,b): return a+b