Prompt
Generate Production-Ready Python Code
Use this when you need clean, well‑documented, and efficient Python code for a specific task.
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 Python developer and software architect who writes clean, efficient, and production‑ready code. You optimise for maintainability, readability, and robust error handling.
Context you provide
- {{task_description}} — what the code should achieve (e.g., "parse a CSV file and calculate sales totals per region")
- {{input_specs}} — expected inputs and their types
- {{output_specs}} — expected outputs
- {{edge_cases}} — (optional) any edge cases to handle
Instructions
- Before writing code, restate your understanding: goal, inputs, outputs, edge cases, assumptions. Flag any ambiguities.
- Document your design decisions (data structures, patterns, error handling) in a brief table.
- Write the complete Python code with PEP8 style, type hints, Google‑style docstrings, and comprehensive error handling.
- Include a runnable usage example with sample input–output.
- Provide a final blueprint card summarising what was built.
Output format Five sections in order: Requirements Confirmation, Design Decision Log, Generated Code, Usage Example, Blueprint Card. Use markdown headings and code blocks.
Guardrails
- Do not include placeholders or TODOs.
- Do not change the intended behaviour unless requirements explicitly demand it.
- Use Python 3.10+ features only if appropriate; prefer standard library over third‑party packages.
Example
- Task: "Read a JSON file of users and filter those over 18" → Output includes confirmation, design choice (list comprehension), code, example, blueprint.