AgentSkillsCN

prompt-optimizer

使用 Anthropic 官方的最佳实践,优化 Claude 4.x 模型的提示词。当用户希望改进、精炼或创建高效的 Claude 提示词时,可启用此技能。触发条件包括优化提示词、使提示词更有效、修复表现不佳的提示词、创建系统提示词、提升指令遵循能力、减少冗长表述、控制输出格式,或增强代理式/工具使用行为。此外,当用户反映 Claude 过于冗长、未能准确遵循指令、未妥善使用工具,或生成的内容过于通用时,也可启用此技能。

SKILL.md
--- frontmatter
name: prompt-optimizer
description: Optimize prompts for Claude 4.x models using Anthropic's official best practices. Use when users want to improve, refine, or create effective prompts for Claude. Triggers include requests to optimize prompts, make prompts more effective, fix underperforming prompts, create system prompts, improve instruction following, reduce verbosity, control output formatting, or enhance agentic/tool-use behaviors. Also use when users report Claude is being too verbose, not following instructions, not using tools properly, or producing generic outputs.

Prompt Optimizer

Optimize prompts for Claude 4.x models (Sonnet 4.5, Haiku 4.5, Opus 4.5) using Anthropic's official guidance.

Core Principles

1. Be Explicit

Claude 4.x models follow instructions precisely. Request behaviors explicitly rather than hoping Claude infers them.

Less effective: Create an analytics dashboard

More effective: Create an analytics dashboard. Include as many relevant features and interactions as possible. Go beyond the basics to create a fully-featured implementation.

2. Provide Context for Why

Explain motivation behind instructions to help Claude generalize appropriately.

Less effective: NEVER use ellipses

More effective: Your response will be read aloud by a text-to-speech engine, so never use ellipses since the text-to-speech engine will not know how to pronounce them.

3. Align Examples with Desired Behavior

Claude pays close attention to examples. Ensure they demonstrate exactly what you want, without patterns you want to avoid.

Optimization Workflow

  1. Diagnose the issue (verbosity, formatting, tool use, instruction following)
  2. Select relevant patterns from references/patterns.md
  3. Apply the appropriate prompt snippets
  4. Test the optimized prompt

Quick Fixes by Issue

Too Verbose

Add: Keep responses concise and direct. Avoid unnecessary elaboration.

Too Much Markdown/Bullets

See references/formatting.md for detailed prompts to control output style.

Not Using Tools

Add: By default, implement changes rather than only suggesting them. Use tools to take action.

Generic "AI Slop" Output

Add creativity guidance or use the frontend-aesthetics pattern from references/patterns.md.

Not Following Instructions

Make instructions explicit, add context for why, frame positively (what TO do, not what NOT to do).

Reference Files

  • references/patterns.md - Complete prompt snippets organized by use case
  • references/formatting.md - Output format control patterns
  • references/agentic.md - Tool use, parallel execution, and multi-context workflows

Load the appropriate reference file based on the optimization need.