prompt-engineering
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGuidelines for creating and editing Coding Agent prompts (commands, agents, skills, context files).
Important: Always Read the detailed reference for the corresponding prompt type before starting work.
创建和编辑Coding Agent提示词(命令、Agent、Skill、上下文文件)的指南。
重要提示:开始工作前,请务必阅读对应提示词类型的详细参考文档。
Prompt Type Quick Reference
提示词类型速查
| Type | Location | Invocation | Purpose | Reference |
|---|---|---|---|---|
| Command | | | Reusable tasks for users | |
| Agent | | | Specialized subagents | |
| Skill | `{.super-agent | .claude | .codex | .github}/skills/<name>/SKILL.md` |
| Context File | | Auto-loaded | Always-needed project context | |
| Document | Any | Manual reference | Standalone prompts | - |
Other references:
- - Orchestrator design for calling subagents
references/orchestration.md - - Permission syntax for allowed-tools
references/permission-syntax.md - - Lifecycle hook configuration
references/hooks.md
| 类型 | 位置 | 调用方式 | 用途 | 参考文档 |
|---|---|---|---|---|
| Command(命令) | | | 供用户复用的任务 | |
| Agent | | | 专业子代理 | |
| Skill | `{.super-agent | .claude | .codex | .github}/skills/<name>/SKILL.md` |
| Context File(上下文文件) | | 自动加载 | 项目必备的通用上下文 | |
| Document(文档) | 任意位置 | 手动引用 | 独立提示词 | - |
其他参考文档:
- - 调用子代理的编排器设计
references/orchestration.md - - 允许工具的权限语法
references/permission-syntax.md - - 生命周期钩子配置
references/hooks.md
Core Principles
核心原则
1. Single Responsibility
1. 单一职责
Each prompt has one clear purpose.
- ✅ Environment setup only / Code implementation only
每个提示词有且仅有一个明确的用途。
- ✅ 仅环境搭建 / 仅代码实现
2. Independence from Caller
2. 与调用方解耦
Avoid references to "orchestrator" or "parent task"; focus on input/output contracts.
- ✅ "Analyze the provided code and identify issues..."
避免提及“编排器”或“父任务”;专注于输入/输出约定。
- ✅ “分析提供的代码并识别问题...”
3. Conciseness
3. 简洁性
Only information necessary for execution. Remove verbose examples, hypothetical paths, and generic patterns.
仅保留执行所需的信息。移除冗长示例、假设路径和通用模式。
4. Noise Avoidance
4. 避免冗余
- Avoid examples in multiple languages (choose the primary language)
- Avoid hypothetical file paths (CONTRIBUTING.md, etc.)
- Omit detailed steps that the LLM can infer
- 避免使用多语言示例(选择项目的主要语言)
- 避免假设性文件路径(如CONTRIBUTING.md等)
- 省略LLM可自行推导的详细步骤
Formatting Rules
格式规则
- No h1 headings: Do not start with
# - Language: in the project's primary language; body can also be in primary language
description - XML tags: Use for structuring when there are multiple sections
- 无一级标题:请勿以开头
# - 语言:使用项目的主要语言;正文也可使用主要语言
description - XML标签:当存在多个章节时,使用XML标签进行结构化
Orchestration
编排
When calling subagents:
- Invocation template required: Include complete Task tool usage example
- Responsibility separation: Subagents should be generic; task-specific details go in templates
调用子代理时:
- 必须包含调用模板:提供完整的任务工具使用示例
- 职责分离:子代理应保持通用;任务特定细节放入模板中
Special Rules for Context Files
上下文文件的特殊规则
Be especially careful since they are always loaded:
- 80% rule: Only information needed by 80% of tasks
- Index-first: Reference details via pointers
- Scrutinize commands: Only commands the LLM will autonomously execute
- Target under 200 lines
由于上下文文件会被自动加载,需格外注意:
- 80%规则:仅保留80%的任务所需的信息
- 索引优先:通过指针引用详细内容
- 严格审核命令:仅保留LLM可自主执行的命令
- 目标行数控制在200行以内