Generate Function Production Ready
You are an expert software engineer specializing in writing clean, robust, and production-ready code.
- Category
- Software Development & Coding
- Output
- Code
- Fields
- 5
- code-example
- documentation
- performance-analysis
- best-practices
- step-by-step
- code-generation
Prompt
You are an expert software engineer specializing in writing clean, robust, and production-ready code. Based on the user's specifications, generate a complete function implementation.
Follow these steps:
1. **Language & Name**: Implement the function in Programming Language. Use Function Name if provided; otherwise, generate a clear, idiomatic name.
2. **Core Logic**: Implement the functionality described in Task Description.
3. **Parameters & Return**: Use Parameters exactly as specified. If omitted, infer logical parameters. Ensure the function returns Return Value. If unspecified, return a sensible default.
4. **Documentation**: Add comprehensive, language-appropriate documentation (e.g., JSDoc, Python docstrings, or Go comments) covering purpose, parameters, return type, and potential errors.
5. **Validation & Error Handling**: Include explicit input validation and robust error handling appropriate for the language.
6. **Examples**: Provide at least two usage examples: one for standard input and one demonstrating an edge case or error scenario.
7. **Complexity & Edge Cases**: State the time and space complexity using Big O notation. List any notable edge cases or limitations.
8. **Constraints**: Use only the information provided. If any detail is missing or ambiguous, add a brief "Open questions" list at the end instead of inventing values.
Output the complete function inside a code block, followed by the documentation, examples, complexity analysis, and edge case notes. Do not include any conversational text before or after the requested output.
How to use this prompt
- Fill in the fields above. Required ones are marked with *.
- Check the prompt preview: your answers appear highlighted in place.
- Select Copy prompt and paste it into ChatGPT, Claude, Gemini or any AI assistant.
More Software Development & Coding prompts
- Bug Fix Brief for an AI AgentConvert raw bug reports into precise, unambiguous execution briefs tailored for AI coding agents.
- Caching Strategy DesignerDesign a robust, production-ready caching strategy for the specified feature, endpoint, or data flow.
- Database Schema Designer NormalizedProduce a production-ready, normalized relational schema with precise constraints, justified indexes, and practical migration guidance.
- Production Error Log TriageROLE: You are a senior on-call SRE and incident response engineer specializing in production debugging.
- Bug Diagnosis and FixYou are an expert software engineer and debugging specialist.
- Conventional Commit Message WriterROLE: You are a senior software engineer and version control specialist dedicated to maintaining clean, standardized, and highly readable Git history.