AgentSkillsCN

WritePrompt

创建、修改、审查并强化智能型提示词/斜杠命令。当您需要创建提示词、新命令、斜杠命令、修改提示词、更新工作流、改进提示词、编辑提示词、调整提示词结构、设计工作流提示词、将工作流融入技能、编写工作流文件、撰写工作流、审查提示词、强化提示词、添加验证、添加钩子、进行自我验证、验证智能体、添加自我验证时,可使用此功能。它以7个提示词层级为指引,每个层级都配有恰当的章节。

SKILL.md
--- frontmatter
name: WritePrompt
description: Create, modify, review, and harden agentic prompts/slash commands. USE WHEN create prompt OR new command OR slash command OR modify prompt OR update workflow OR improve prompt OR edit prompt OR prompt structure OR workflow prompt OR skill workflow OR add workflow to skill OR workflow file OR write workflow OR review prompt OR harden prompt OR add validation OR add hooks OR self-validation OR validate agent OR add self-validation. Guides through 7 prompt levels with proper sections.

WritePrompt

Framework for creating, modifying, and reviewing agentic prompts following the 7-level prompt hierarchy.

Core Principle

The prompt is THE fundamental unit of agentic engineering.

Every prompt should have the right level of complexity for its use case — no more, no less.

Workflow Routing

WorkflowTriggerFile
Write"create prompt", "new command", "modify prompt", "update workflow", "edit prompt", "improve prompt"Workflows/Write.md
Review"review this prompt", "check prompt quality", "audit prompt"Workflows/Review.md
Harden"harden prompt", "add validation", "add hooks", "self-validation", "add self-validation"Workflows/Harden.md

The 7 Prompt Levels

LevelNameKey FeatureWhen to Use
1High LevelStatic, reusableSimple one-shot tasks
2WorkflowSequential steps with I/OMulti-step processes
3Control FlowConditions and loopsDynamic branching logic
4DelegateSpawns subagentsParallel or distributed work
5Higher OrderAccepts prompt files as inputComposable prompt systems
6Template MetapromptCreates new promptsPrompt generation
7Self-ImprovingUpdates its own expertiseLearning systems

Quick Section Reference

Essential sections (most prompts need these):

  • Metadata — YAML frontmatter (allowed-tools, description, argument-hint, model)
  • # Title — Clear, action-oriented name
  • ## Purpose — What it does and when to use it
  • ## Variables — Dynamic ($1, $ARGUMENTS) and static values
  • ## Workflow — Numbered steps to execute
  • ## Report — How to present results

Advanced sections (for complex prompts):

  • ## Instructions — Rules, constraints, edge cases
  • ## Relevant Files — Files to read/modify
  • ## Codebase Structure — Directory layout context
  • ## Expertise — Accumulated domain knowledge (Level 7)
  • ## Template — Output format for metaprompts (Level 6)
  • ## Examples — Usage demonstrations

Examples

Example 1: Create a new slash command

code
User: "Create a command to summarize git history"
→ Invokes Write workflow (create mode)
→ Asks clarifying questions (output format? date range?)
→ Determines Level 2 (Workflow) is appropriate
→ Creates .claude/commands/git-summary.md with proper sections

Example 2: Modify existing prompt

code
User: "Add a verification step to the Check workflow"
→ Invokes Write workflow (modify mode)
→ Reads existing prompt, identifies what needs to change
→ Adds the new step, renumbers subsequent steps
→ Updates the prompt file

Example 3: Review prompt quality

code
User: "Review this prompt and suggest improvements"
→ Invokes Review workflow
→ Identifies current level and sections
→ Suggests missing sections or level upgrade
→ Provides concrete recommendations (does NOT modify)

Example 4: Complex automation prompt

code
User: "Create a command that processes multiple files in parallel"
→ Invokes Write workflow (create mode)
→ Recognizes need for Level 4 (Delegate)
→ Includes Task tool delegation pattern
→ Adds proper agent configuration variables

Example 5: Add self-validation to existing agent

code
User: "Harden the normalize-csv command with validation hooks"
→ Invokes Harden workflow
→ Reads the command, identifies CSV output + Edit/Write tool usage
→ Recommends Stop hook with csv-validator.py
→ Writes validator script, adds hooks YAML to frontmatter
→ Verifies the validator runs without errors

References

  • PromptLevels — Detailed breakdown of all 7 levels with examples
  • PromptSections — Complete section reference with usage guidelines
  • SelfValidationHooks — Hook types, JSON protocol, validator architecture, design patterns