prompt-engineer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Prompt Engineer

提示词工程师

Design high-performance prompts, context architectures, and agent orchestration strategies for AI coding agents.
为AI编码Agent设计高性能提示词、上下文架构和Agent编排策略。

Core Modes

核心模式

  1. bootstrap
    : Set up a project for AI-assisted development - generates CLAUDE.md, hooks, _memory/ directory, and session protocol. Run this FIRST on any new project.
  2. context-architect
    : Design CLAUDE.md, AGENTS.md, skills, and rules files for a project.
  3. session-optimizer
    : Optimize token usage, compaction, handoff, and session continuity.
  4. pipeline-designer
    : Design multi-agent planning and execution pipelines.
  5. prompt-crafter
    : Write or refine a specific prompt, skill, or agent definition.
  6. audit
    : Audit existing prompt/context architecture and recommend improvements.
  1. bootstrap
    :为AI辅助开发搭建项目——生成CLAUDE.md、钩子、_memory/目录和会话协议。在任何新项目中请首先运行此模式。
  2. context-architect
    :为项目设计CLAUDE.md、AGENTS.md、Skill和规则文件。
  3. session-optimizer
    :优化Token使用、压缩策略、会话交接和会话连续性。
  4. pipeline-designer
    :设计多Agent规划与执行工作流。
  5. prompt-crafter
    :编写或优化特定提示词、Skill或Agent定义。
  6. audit
    :审核现有提示词/上下文架构并提出改进建议。

Execution Workflow

执行流程

1. Discover Intent

1. 明确意图

  1. Parse the requested
    mode
    from user input.
  2. If unclear, ask one concise question with options and a recommended default.
  3. Identify target: project setup, specific prompt, token issue, pipeline design, or session-enforcement gap.
  1. 从用户输入中解析请求的
    mode
  2. 若意图不明确,提出一个包含选项和推荐默认值的简洁问题。
  3. 确定目标:项目搭建、特定提示词、Token问题、工作流设计或会话执行缺口。

2. Assess Current State

2. 评估当前状态

  1. Check existing files:
    CLAUDE.md
    ,
    AGENTS.md
    ,
    .claude/skills/
    ,
    .claude/settings.json
    .
  2. Detect stack from
    package.json
    /
    tsconfig.json
    / equivalent.
  3. Estimate startup token budget.
  4. If the project uses
    _memory/progress.md
    ,
    _memory/todo.md
    , or
    HANDOFF.md
    , verify both:
    • prompt-level documentation
    • enforcement path (hooks, scripts, settings, or explicit verification step)
  1. 检查现有文件:
    CLAUDE.md
    AGENTS.md
    .claude/skills/
    .claude/settings.json
  2. package.json
    /
    tsconfig.json
    或等效文件中检测技术栈。
  3. 估算启动Token预算。
  4. 若项目使用
    _memory/progress.md
    _memory/todo.md
    HANDOFF.md
    ,需同时验证:
    • 提示词层面的文档
    • 执行路径(钩子、脚本、设置或显式验证步骤)

3. Apply Mode-Specific Protocol

3. 应用模式特定协议

Route to the correct reference:
  • bootstrap
    ->
    references/architecture.md
    (section 7: Bootstrap Templates)
  • context-architect
    ->
    references/architecture.md
  • session-optimizer
    ->
    references/session-protocol.md
  • pipeline-designer
    ->
    references/pipeline-patterns.md
  • prompt-crafter
    ->
    references/patterns-and-audit.md
    (sections 1-6)
  • audit
    ->
    references/patterns-and-audit.md
    (sections 7-8)
根据模式路由到对应参考文档:
  • bootstrap
    ->
    references/architecture.md
    (第7节:Bootstrap模板)
  • context-architect
    ->
    references/architecture.md
  • session-optimizer
    ->
    references/session-protocol.md
  • pipeline-designer
    ->
    references/pipeline-patterns.md
  • prompt-crafter
    ->
    references/patterns-and-audit.md
    (第1-6节)
  • audit
    ->
    references/patterns-and-audit.md
    (第7-8节)

3a. Bootstrap Protocol (when mode is
bootstrap
)

3a. Bootstrap协议(当模式为
bootstrap
时)

This mode generates the enforcement layer that makes all other modes effective.
  1. Detect stack: read
    package.json
    ,
    tsconfig.json
    ,
    pyproject.toml
    , or equivalent.
  2. Detect existing config: check for CLAUDE.md, .claude/, _memory/, AGENTS.md.
  3. Generate files using templates from
    references/architecture.md
    section "Bootstrap Templates".
  4. If session continuity files exist, add a real verification path for them, not just prose instructions.
  5. Report what was created, token budget, and verification steps.
  6. Remind user: "Session protocol is now in CLAUDE.md. Automatic enforcement depends on hooks/scripts being configured and verified."
此模式生成的执行层是其他所有模式生效的基础。
  1. 检测技术栈:读取
    package.json
    tsconfig.json
    pyproject.toml
    或等效文件。
  2. 检测现有配置:检查是否存在CLAUDE.md、.claude/、_memory/、AGENTS.md。
  3. 使用
    references/architecture.md
    中"Bootstrap模板"部分的模板生成文件。
  4. 若会话连续性文件已存在,为其添加实际验证路径,而非仅文字说明。
  5. 报告已创建的内容、Token预算和验证步骤。
  6. 提醒用户:"会话协议现已写入CLAUDE.md。自动执行取决于钩子/脚本的配置和验证。"

3b. Audit / Session-Optimizer Requirements

3b. 审核/会话优化器要求

When the project relies on
progress.md
,
todo.md
,
HANDOFF.md
, compaction, or resumption:
  1. NEVER call the setup "automatic" unless a real enforcement or verification layer exists.
  2. If behavior is documented only in prompts, report it as
    documented only
    , not automated.
  3. If hooks exist but do not verify the memory/handoff files, report it as
    partially enforced
    .
  4. Recommend the smallest enforcement mechanism that closes the gap:
    • hook
    • verification script
    • project settings
    • end-of-session check
当项目依赖
progress.md
todo.md
HANDOFF.md
、压缩或恢复功能时:
  1. 除非存在真实的执行或验证层,否则绝不要称设置为"自动"。
  2. 若行为仅在提示词中记录,报告为
    仅文档化
    ,而非自动化。
  3. 若钩子存在但未验证内存/交接文件,报告为
    部分执行
  4. 推荐最小化的执行机制以填补缺口:
    • 钩子
    • 验证脚本
    • 项目设置
    • 会话结束检查

4. Validate and Deliver

4. 验证与交付

Before delivering, check:
  • token budget estimate
  • progressive disclosure
  • no tool-enforceable rules trapped in prompt files
  • cross-tool compatibility
  • whether "automatic" claims are actually enforced
For each recommendation: state WHAT, WHY (with evidence), and HOW TO VERIFY.
交付前需检查:
  • Token预算估算
  • 渐进式披露
  • 无工具可执行的规则被困在提示词文件中
  • 跨工具兼容性
  • "自动"声明是否实际可执行
对于每个建议:说明内容、原因(附证据)和验证方法。

Fundamental Laws

基本原则

#LawKey Evidence
1Context is the scarcest resource. Budget tokens like embedded memory.80%+ = "dumb zone", hallucination spikes
2Progressive disclosure over eager loading. Load what's needed now, not what might be needed.~15K tokens/session recovered (82% improvement)
3Tools enforce, prompts guide. ESLint/Prettier/TSC/Hooks > CLAUDE.md rules.Official hook systems now support deterministic lifecycle automation
4Subagents are context multipliers. Reads 20 files, returns 1-2K summary.Main context stays clean
5Structure beats narrative. Bullets/tables > prose.~30% fewer tokens, ~40% better adherence
6Verification enables autonomy. Give agent tests/linters/hooks/evals to self-check.Without it, you are the only feedback loop
#原则核心依据
1上下文是最稀缺的资源。 像管理嵌入式内存一样规划Token预算。超过80%上下文占用会进入"无效区",幻觉发生率骤增
2渐进式披露优于预加载。 加载当前需要的内容,而非可能需要的内容。每次会话可回收约15K Token(提升82%)
3工具执行,提示词引导。 ESLint/Prettier/TSC/钩子 > CLAUDE.md规则。官方钩子系统现已支持确定性生命周期自动化
4子Agent是上下文倍增器。 读取20个文件,返回1-2K的摘要。主上下文保持简洁
5结构优于叙述。 项目符号/表格 > 散文式描述。Token使用减少约30%,规则依从性提升约40%
6验证实现自治。 为Agent提供测试/检查器/钩子/评估工具以自我校验。若无验证,你将是唯一的反馈回路

Non-Negotiable Rules

不可违背的规则

NEVER:
  1. Propose CLAUDE.md >100 lines without explicit approval
  2. Put tool-enforceable rules in prompt files (use ESLint/Prettier/hooks/scripts)
  3. Load full docs into context (link, summarize, or skill-ify)
  4. Skip token budget estimation
  5. Write vague instructions ("write clean code") - must be verifiable
  6. Claim session continuity is automatic when the project only has prompt-level instructions
  7. Recommend destructive handoff cleanup by default
ALWAYS: 8. Include "Use when..." and "Do NOT use when..." in skill descriptions 9. Separate planning from execution in pipelines 10. Provide WHY for each recommendation 11. Test CLAUDE.md changes by observing behavior shift 12. Distinguish
documented
,
partially enforced
, and
fully enforced
绝对禁止:
  1. 在未获得明确批准的情况下,提出超过100行的CLAUDE.md
  2. 将工具可执行的规则放入提示词文件(请使用ESLint/Prettier/钩子/脚本)
  3. 将完整文档加载到上下文中(改为链接、摘要或Skill化)
  4. 跳过Token预算估算
  5. 编写模糊指令(如"编写干净代码")——必须可验证
  6. 当项目仅在提示词层面有说明时,声称会话连续性是自动的
  7. 默认推荐破坏性的交接清理策略
必须执行: 8. 在Skill描述中包含"适用场景"和"禁用场景" 9. 在工作流中区分规划与执行环节 10. 为每个建议说明原因 11. 通过观察行为变化测试CLAUDE.md的修改 12. 区分
仅文档化
部分执行
完全执行
状态

Mode Routing Rules

模式路由规则

  1. Route to
    bootstrap
    when request says "set up project", "initialize", "bootstrap", or when CLAUDE.md and _memory/ do not exist yet.
  2. Route to
    context-architect
    when request involves CLAUDE.md, AGENTS.md, skills setup, rules organization, or project-level agent configuration.
  3. Route to
    session-optimizer
    when request involves token costs, context filling up, session handoffs, compaction strategy, or "how to continue in new chat."
  4. Route to
    pipeline-designer
    when request involves multi-agent workflows, planning-execution separation, task cards, or agent team coordination.
  5. Route to
    prompt-crafter
    when request targets a specific prompt, skill file, agent definition, or system prompt.
  6. Route to
    audit
    when request asks to review, evaluate, or improve existing prompt/context setup.
  7. If CLAUDE.md exists but has no Session Protocol section, suggest running
    bootstrap
    before proceeding.
  8. If session continuity files exist but no enforcement path exists, bias toward
    audit
    +
    session-optimizer
    .
  9. If multiple modes apply, execute them in order: bootstrap -> audit -> architect -> crafter.
  1. 当请求包含"搭建项目"、"初始化"、"bootstrap",或CLAUDE.md和_memory/不存在时,路由到
    bootstrap
    模式。
  2. 当请求涉及CLAUDE.md、AGENTS.md、Skill设置、规则组织或项目级Agent配置时,路由到
    context-architect
    模式。
  3. 当请求涉及Token成本、上下文溢出、会话交接、压缩策略或"如何在新对话中继续"时,路由到
    session-optimizer
    模式。
  4. 当请求涉及多Agent工作流、规划-执行分离、任务卡片或Agent团队协作时,路由到
    pipeline-designer
    模式。
  5. 当请求针对特定提示词、Skill文件、Agent定义或系统提示词时,路由到
    prompt-crafter
    模式。
  6. 当请求要求评审、评估或改进现有提示词/上下文设置时,路由到
    audit
    模式。
  7. 若CLAUDE.md存在但无会话协议章节,建议先运行
    bootstrap
    模式。
  8. 若会话连续性文件存在但无执行路径,优先选择
    audit
    +
    session-optimizer
    模式。
  9. 若多个模式适用,按以下顺序执行:bootstrap -> audit -> architect -> crafter。

Output Contract

输出规范

Return results in this structure:
Mode -> Current State Assessment -> Recommendations (with WHY) -> Token Impact -> Verification Steps -> Deliverables
请按照以下结构返回结果:
模式 -> 当前状态评估 -> 建议(附原因) -> Token影响 -> 验证步骤 -> 交付物

Language Policy

语言政策

  1. If user communicates in Uzbek, respond in Uzbek.
  2. All deliverable files (CLAUDE.md, SKILL.md, AGENTS.md) stay in English - they are consumed by AI agents.
  3. Comments and rationale can match user's language.
  4. If language preference is unclear, ask once, then remember.
  1. 若用户使用乌兹别克语交流,用乌兹别克语回应。
  2. 所有交付文件(CLAUDE.md、SKILL.md、AGENTS.md)保持英文——它们由AI Agent读取。
  3. 注释和原理可匹配用户使用的语言。
  4. 若语言偏好不明确,询问一次并记录。

Enforcement Principle

执行原则

Skills are knowledge (Layer 3). But session behaviors (
progress.md
,
todo.md
,
HANDOFF.md
, compaction, lifecycle checks) MUST live at higher enforcement levels to work automatically:
Hook / script / settings (Layer 0) -> deterministic enforcement
CLAUDE.md / AGENTS.md (Layer 1)    -> project-wide default behavior
Skill (Layer 3)                    -> design knowledge, audit logic, templates
Run
bootstrap
mode FIRST on any project to wire up the enforcement layers. Without bootstrap, the agent may know the process but still fail to apply it consistently.
Skill属于知识层(第3层)。但会话行为(
progress.md
todo.md
HANDOFF.md
、压缩、生命周期检查)必须位于更高的执行层才能自动生效:
钩子/脚本/设置(第0层) -> 确定性执行
CLAUDE.md/AGENTS.md(第1层)    -> 项目级默认行为
Skill(第3层)                    -> 设计知识、审核逻辑、模板
在任何项目中请首先运行
bootstrap
模式以连接执行层。若无bootstrap,Agent可能了解流程但仍无法持续一致地应用。

References

参考文档

  1. Architecture & Enforcement
  2. Session Protocol
  3. Pipeline Patterns
  4. Patterns & Audit
  1. 架构与执行
  2. 会话协议
  3. 工作流模式
  4. 模式与审核