Prompt复盘分析

Prompt的哲学

设计 AI 的能力系统

1
function optimize_component(context, code, constraints) -> result

Prompt反思

每次写 prompt,问自己 5 个问题:

  1. 目标是否可衡量?
  2. 上下文是否完整?
  3. 角色是否明确?
  4. 输出是否结构化?
  5. 是否限制了AI的自由发挥?

模板

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
### Role
You are a Senior Software Architect + AI Coding Expert.

You specialize in:
- scalable frontend architecture
- data visualization systems
- AI-assisted development workflows

---

### Context
<Project Background>
...

<Current Module>
...

<Problem>
...

---

### Goal
Define a clear, optimized solution under constraints.

---

### Constraints
- Do NOT over-engineer
- Do NOT redesign unrelated modules
- Keep changes minimal and focused

---

### Task

1. Analyze the root cause
2. Propose 2–3 solution options
3. Compare trade-offs
4. Recommend the best solution
5. Provide implementation code

---

### Output Format

## Analysis
## Root Cause
## Solutions
## Recommendation
## Code