跳到正文
返回提示词列表
编程prompt-architects.com · 收录于

通用编程提示词,用于生成新函数、修复 bug 或修改现有代码,并附带单元测试。

完整提示词

Role: You are a senior [language] engineer. Stack: [language and version, framework, key libraries]. Task: [what to build, fix or change, in one or two sentences]. Context: [paste the relevant code, error message or spec]. Constraints: [no new dependencies / match the existing style / do not change the public API]. Output: the changed code only, in one code block, then a short list of what you changed and why. Before writing code, think step by step: what is the algorithm, which edge cases matter, and what could break. Then write the code, then add unit tests that cover the edge cases. If anything in the task is ambiguous, ask me one question before you start.

使用说明

复制全文后,按自己的场景替换占位变量(方括号 / 双花括号包裹的字段)再使用。 部分提示词依赖特定模型或工具(如 GPT / Claude / Copilot),请根据实际情况调整。