Coding

Write a Function in a Specified Programming Language

Generate a function for a given context and purpose in a specified programming language, with detailed requirements for naming conventions, parameters, and coding style, including confirmation questions before coding.

12 steps 7 variables English

Prompt template

Run these steps in order.

01
Specify the programming language as language.
02
Define the function name as function_name.
03
Describe the context or object the function operates on as context_object.
04
Explain the purpose of the function as purpose.
05
List the required parameters as required_variables.
06
List the optional parameters as optional_variables.
07
Mention the target platform is a 64-bit PC running Windows 10.
08
Instruct to use snake_case naming for all variables.
09
Request declaration of all variables immediately after the function name, also in snake_case.
10
Set maximum line length to 72 characters and wrap lines accordingly.
11
Before generating code, prompt GPT to ask clarifying questions to confirm requirements.
12
Provide any starter code as code_sample to base the function implementation on.

Prompt library

Use these prompts directly inside ChatGPT.

Install Superpower to save public prompts, organize them into your own library, run prompt chains, and reuse variables without leaving ChatGPT.