Code Prompting
Domain: Prompt Engineering
π― Motivation
Special considerations for code: specify language, version, style, testing requirements, and error handling expectations.
π Concrete Example
βWrite Python 3.11 code. Follow PEP 8 style. Include type hints. Add unit tests using pytest. Handle empty input with ValueError.β Specific code requirements produce better code.
π Analogy
A blueprint for a building - β3 floors, reinforced concrete, earthquake-resistant, includes parking.β The more specific the requirements, the better the architectβs design. Code prompting specifies code requirements.