标签: 2026-07-07 次
AI编程技巧- 为每个技能定义分配一个角色
知道技能运行前谁在说话
长话短说:在每个技能文件的顶部始终定义一个明确的角色,这样你就能知道是谁的视角驱动执行。
常见错误
你写了一条充满规则的技能但没有分配角色。
人工智能开始执行,但它不知道这是初级开发人员、经验丰富的架构师还是质量保证工程师。
你得到的回复感觉像是千篇一律,缺乏权威性,或者在不同运行中改变观点。
解决的问题
人工智能选择一个随机的声音,因此每次会话的输出是不可预测的。
你不能审计这个技能,因为你不知道它适用于谁的判断。
人工智能在单次执行中混合了不同的音调和专业水平。
技能链中断,因为每个技能假定不同的隐含角色。
你失去了责任感:没有人知道谁签署了输出结果。
如何操作
打开你的技能文件,并将角色声明作为第一条指令添加。
在任何其他规则之前,请写“你是[角色],在[领域]方面有专业知识”。
添加一两句话描述该角色的约束和责任。
在文件中后续的每个指令中保持角色的一致性。
当你连招技能时,确保每个技能都明确声明其自己的角色。
福利
一致的声音: AI每次运行都从相同的专家水平执行,因此输出是可预测的。
可审计的输出: 你知道是谁的视角生成了结果,这使得评论更快。
更好的校准: 一个知道自己是高级审查员的人工智能比没有角色的人工智能提出更难的问题。
安全链接: 当你链接技能时,每个技能都会从一个声明的身份说话,而不是猜测。
更快的调试: 当一个技能给出错误的答案时,你知道质疑谁的镜头。
上下文
没有角色的技能就像没有指挥官的命令。
你可以读取文件中的每一条指令,但仍不知道谁说了什么或为什么。
当你声明一个角色时,你给AI一个稳定的参考框架。
人工智能停止猜测,从特定的角度开始执行。
这也有助于你设计技能:如果你知道AI是一个“严格的代码审查者”,你就知道该包括哪些规则,哪些规则可以省略。
当你要求分析师,而不是分析时,你已经在提示级别应用这个想法。
一个技能更进一步:你将角色融入定义中,这样你就不需要每次都重复它。
你也可以将每个技能与一个陷阱文件配对来定义这个角色绝不应该做的事情。
提示参考
糟糕的提示
---
name: technosignature-analyzer
version: 1.0.0
description: "|"
Analyzes signals from radio telescope arrays.
Reports unusual frequency patterns as candidates.
allowed-tools:
- ReadTelescope
- SendAlarm
---
# Technosignature Analyzer
Analyze signals from the telescope array.
Check for unusual frequency patterns.
Cross-reference with the Hipparcos catalog.
Flag any readings that deviate from baseline.
Report findings with confidence levels.
好提示
---
name: technosignature-analyzer
version: 1.0.0
description: |
Detects technosignatures in telescope data and classifies
each candidate signal with a confidence percentage.
Rejects signals explained by known natural phenomena.
allowed-tools:
- ReadTelescope
- SendAlarm
---
# Technosignature Analyzer
You are a senior astrophysicist with 20 years of SETI experience.
You worked at the Allen Telescope Array and the Parkes Observatory.
You hold a PhD in Radio Astronomy with 40+ publications.
You distinguish RFI from natural astrophysical signals.
You separately flag artificial sources.
You apply the scientific method.
Form a hypothesis, test it, and document it.
You apply Six Sigma rigor to rule out false positives.
You don't report candidates below a 5-sigma confidence threshold.
You always cross-check three independent baselines before escalating.
Identify narrowband signals inconsistent with natural sources.
Flag laser pulses or structured optical emissions.
Compare power ratios against stellar baselines.
Classify each candidate with a confidence percentage.
Reject signals explained by known natural phenomena.
注意事项
保持角色声明简短:最多一到三句话。
一个冗长的人物描述会增加噪音并稀释实际的技能规则。
不要发明像“你是一个编码的巫师”这样的虚构角色。
使用真实的专业角色。
当角色与技能的领域匹配时,人工智能表现最佳。
输入
[X] 半自动
限制事项
人工智能不会强制执行你分配的角色,而是将其作为上下文采用。
如果你的指示与角色矛盾,AI可能会将两者混合并产生不一致的输出。