mcpbeat Sign in

Automatic Stateful Prompt Improver Agent Skill

Automatically intercepts and optimizes prompts using the prompt-learning MCP server. Learns from performance over time via embedding-indexed history. Uses APE, OPRO, DSPy patterns. Activate on "optimize prompt", "improve this prompt", "prompt engineering", or ANY complex task request. Requires prompt-learning MCP server. NOT for simple questions (just answer them), NOT for direct commands (just execute them), NOT for conversational responses (no optimization needed).

23k tokens
context cost
the whole folder, loaded on every use
10
files
instructions only
0
copies elsewhere
how many repositories repackaged it
177
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/curiositech/some_claude_skills --skill automatic-stateful-prompt-improver

The instruction itself

16 sections, as written by the author

Automatic Stateful Prompt Improver

MANDATORY AUTOMATIC BEHAVIOR

When this skill is active, I MUST follow these rules:

Auto-Optimization Triggers

I AUTOMATICALLY call mcp__prompt-learning__optimize_prompt BEFORE responding when:

  • Complex task (multi-step, requires reasoning)
  • Technical output (code, analysis, structured data)
  • Reusable content (system prompts, templates, instructions)
  • Explicit request ("improve", "better", "optimize")
  • Ambiguous requirements (underspecified, multiple interpretations)
  • Precision-critical (code, legal, medical, financial)

Auto-Optimization Process

1. INTERCEPT the user's request
2. CALL: mcp__prompt-learning__optimize_prompt
   - prompt: [user's original request]
   - domain: [inferred domain]
   - max_iterations: [3-20 based on complexity]
3. RECEIVE: optimized prompt + improvement details
4. INFORM user briefly: "I've refined your request for [reason]"
5. PROCEED with the OPTIMIZED version

Do NOT Optimize

  • Simple questions ("what is X?")
  • Direct commands ("run npm install")
  • Conversational responses ("hello", "thanks")
  • File operations without reasoning
  • Already-optimized prompts

Learning Loop (Post-Response)

After completing ANY significant task:

1. ASSESS: Did the response achieve the goal?
2. CALL: mcp__prompt-learning__record_feedback
   - prompt_id: [from optimization response]
   - success: [true/false]
   - quality_score: [0.0-1.0]
3. This enables future retrievals to learn from outcomes

Quick Reference

Iteration Decision

| Factor | Low (3-5) | Medium (5-10) | High (10-20) |

|--------|-----------|---------------|--------------|

| Complexity | Simple | Multi-step | Agent/pipeline |

| Ambiguity | Clear | Some | Underspecified |

| Domain | Known | Moderate | Novel |

| Stakes | Low | Moderate | Critical |

Convergence (When to Stop)

  • Improvement < 1% for 3 iterations
  • User satisfied
  • Token budget exhausted
  • 20 iterations reached
  • Validation score > 0.95

Performance Expectations

| Scenario | Improvement | Iterations |

|----------|-------------|------------|

| Simple task | 10-20% | 3-5 |

| Complex reasoning | 20-40% | 10-15 |

| Agent/pipeline | 30-50% | 15-20 |

| With history | +10-15% bonus | Varies |

Anti-Patterns

Over-Optimization

| What it looks like | Why it's wrong |

|--------------------|----------------|

| Prompt becomes overly complex with many constraints | Causes brittleness, model confusion, token waste |

| Instead: Apply Occam's Razor - simplest sufficient prompt wins |

Template Obsession

| What it looks like | Why it's wrong |

|--------------------|----------------|

| Focusing on templates rather than task understanding | Templates don't generalize; understanding does |

| Instead: Focus on WHAT the task requires, not HOW to format it |

Iteration Without Measurement

| What it looks like | Why it's wrong |

|--------------------|----------------|

| Multiple rewrites without tracking improvements | Can't know if changes help without metrics |

| Instead: Always define success criteria before optimizing |

Ignoring Model Capabilities

| What it looks like | Why it's wrong |

|--------------------|----------------|

| Assumes model can't do things it can | Over-scaffolding wastes tokens |

| Instead: Test capabilities before heavy prompting |

Reference Files

Load for detailed implementations:

| File | Contents |

|------|----------|

| references/optimization-techniques.md | APE, OPRO, CoT, instruction rewriting, constraint engineering |

| references/learning-architecture.md | Warm start, embedding retrieval, MCP setup, drift detection |

| references/iteration-strategy.md | Decision matrices, complexity scoring, convergence algorithms |


Goal: Simplest prompt that achieves the outcome reliably. Optimize for clarity, specificity, and measurable improvement.

Other skills for the same job

different authors, same section of the catalogue
Skill Creator
by anthropics
vendor ×10

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

56k tokens scripts
Skill Creator
by vercel-labs
vendor ×10

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

12k tokens scripts
Skill Creator
by JayZeeDesign
×9

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

10k tokens scripts
Template Skill
by JayZeeDesign
×7

Replace with description of the skill and when Claude should use it.

35 tokens
Dispatching Parallel Agents
by ZhanlinCui
×5

Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies

2k tokens
Skill Development
by anthropics
vendor ×4

This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.

9k tokens
Find Skills
by sanity-io
vendor ×4

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

1k tokens
Writing Skills
by ZhanlinCui
×4

Use when creating new skills, editing existing skills, or verifying skills work before deployment

26k tokens scripts

How to use it

Copy the folder

Take curiositech/automatic-stateful-prompt-improver from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.

Install what it needs

The instructions reference npm. Without those the skill loads but fails at the first command.