Get the FREE Ultimate OpenClaw Setup Guide →

prompt-optimizer

npx machina-cli add skill Aznatkoiny/zAI-Skills/prompt-optimizer --openclaw
Files (1)
SKILL.md
2.7 KB

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.

Source

git clone https://github.com/Aznatkoiny/zAI-Skills/blob/master/AI-Toolkit/skills/prompt-optimizer/SKILL.mdView on GitHub

Overview

This skill helps you optimize prompts for Claude 4.x models using Anthropic's official guidance. It emphasizes explicit instructions, context for why decisions matter, and aligned examples to improve instruction following, reduce verbosity, and control output formatting and tool usage.

How This Skill Works

It uses a four-step workflow: diagnose the issue, select relevant patterns from references, apply the appropriate prompt snippets, and test the optimized prompt. It leverages Claude-specific principles (be explicit, justify why, align examples) and references like patterns.md, formatting.md, and agentic.md to tailor prompts.

When to Use It

  • When a Claude prompt is too verbose or vague and needs concise, explicit guidance
  • When responses fail to follow instructions or misuse tools
  • When you need to create or refine system prompts and control output formatting
  • When outputs are generic or lack stylistic or aesthetic direction
  • When improving agentic/tool-use behaviors or reducing unnecessary formatting

Quick Start

  1. Step 1: Diagnose the current prompt for verbosity, formatting, tool use, and instruction clarity
  2. Step 2: Select relevant patterns from references/patterns.md and formatting guidance from references/formatting.md
  3. Step 3: Apply the appropriate prompt snippets and test the optimized prompt

Best Practices

  • Be explicit in instruction wording and expected behaviors
  • Provide context for why the instruction matters to guide generalization
  • Align examples with the exact desired behavior and avoid patterns you want to avoid
  • Follow the optimization workflow: diagnose, select patterns, apply snippets, test
  • Reference and reuse targeted patterns from references/patterns.md, formatting.md, and agentic.md

Example Use Cases

  • Optimizing a Claude prompt to generate a feature-rich analytics dashboard with explicit requirements
  • Reducing verbosity in a report-generation prompt while preserving key metrics
  • Creating a system prompt that enforces consistent output formatting across responses
  • Rewriting prompts to improve tool-use behavior (e.g., invoking tools and sequencing actions)
  • Fixing a prompt that produced generic outputs by adding creativity and frontend aesthetics guidance

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers