skills/automatic-stateful-prompt-improver/SKILL.md
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).
npx skillsauth add curiositech/windags-skills automatic-stateful-prompt-improverInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
PROMPT ASSESSMENT:
├── Simple question/command (what, when, how)
│ └── Skip optimization → Answer directly
├── Complex task (multi-step, reasoning, technical)
│ ├── Token budget < 1000
│ │ └── APE: 3-5 iterations
│ ├── Token budget 1000-5000
│ │ └── OPRO: 5-10 iterations
│ └── Token budget > 5000
│ └── DSPy compilation: 10-20 iterations
└── Reusable template/system prompt
└── Full optimization with historical retrieval
OPTIMIZATION TECHNIQUE SELECTION:
├── Instruction rewriting needed
│ └── Use APE (Automatic Prompt Engineer)
├── Parameter tuning with constraints
│ └── Use OPRO (Optimization by PROmpting)
├── Complex pipeline with multiple modules
│ └── Use DSPy compilation patterns
└── Unknown/exploratory domain
└── Hybrid APE→OPRO→DSPy cascade
ITERATION CONTROL:
├── Improvement < 1% for 3 rounds → STOP
├── Quality score > 0.95 → STOP
├── Max iterations reached → STOP
├── User satisfaction confirmed → STOP
└── Continue → Next iteration
FEEDBACK INTEGRATION:
├── Task successful (user confirms/metrics good)
│ └── Record positive feedback + embed for retrieval
├── Task failed/poor quality
│ └── Record negative feedback + analyze failure mode
└── Unclear outcome
└── Ask user for explicit feedback before recording
Over-Optimization Spiral
Template Obsession
Historical Overfitting
Capability Misjudgment
Measurement Blindness
Original: "Make this code better"
def process_data(data):
results = []
for item in data:
if item > 0:
results.append(item * 2)
return results
Decision Point Navigation:
What Novice Misses: Vague "make better" doesn't specify criteria What Expert Catches: Need explicit dimensions (performance, style, edge cases)
Result: Clear analysis of list comprehension opportunity, edge case handling, type hints
Original: "Help me think through this decision"
Decision Point Navigation:
Optimized Template:
Decision Analysis Framework:
1. SITUATION: State the decision clearly with constraints
2. STAKEHOLDERS: List affected parties and their interests
3. OPTIONS: Generate 3-5 distinct alternatives
4. CRITERIA: Define success metrics and weighting
5. TRADE-OFFS: Analyze each option against criteria
6. RECOMMENDATION: Select best option with confidence level
Quality Gates Applied: Template completeness, reusability score, user satisfaction
Original: "Set up monitoring"
Decision Point Navigation:
Optimized Prompt: "Design monitoring setup by specifying: (1) Infrastructure scope (servers, containers, applications), (2) Key metrics (performance, availability, business), (3) Alert thresholds and escalation, (4) Technology stack constraints, (5) Budget/complexity limits. Provide implementation roadmap with priorities."
Before/After Trade-offs:
Pre-execution checklist before calling optimize_prompt:
Post-optimization validation:
Quality scoring rubric (0-100):
Do NOT use this skill for:
Delegate instead:
Gray areas requiring judgment:
data-ai
license: Apache-2.0 NOT for unrelated tasks outside this domain.
development
Use when designing caching strategies (cache-aside, write-through, write-behind), implementing distributed locks, building rate limiters, leaderboards, real-time streams (XADD/consumer groups), pub/sub, or tuning eviction policies. Triggers: thundering-herd on cache miss, dogpile on key expiry, Redlock vs SET-NX-PX choice, sliding-window rate limiter, hot-key on a single cluster slot, big-key blowup, MULTI/EXEC across slots, KEYS in production. NOT for Redis Cluster operations/admin (different domain), embedded KV (SQLite, leveldb), in-process LRU caches, or Memcached.
tools
Drawing the `'use client'` boundary correctly in React Server Components apps (Next.js App Router, RSC frameworks) — leaf-pushing, slot composition, serialization rules, and environment poisoning prevention. Grounded in react.dev and Next.js 16 docs.
development
Use when designing rate limiting for an API, choosing between token bucket / sliding window / leaky bucket / fixed window, implementing it in Redis, deciding edge (Cloudflare/Upstash) vs origin enforcement, sizing per-user vs per-IP vs per-endpoint quotas, returning the right 429 response with Retry-After, or fixing the boundary-burst bug in fixed-window limiters. Triggers: 429 too many requests, INCR + EXPIRE, ZADD + ZREMRANGEBYSCORE + ZCARD, X-RateLimit-Remaining header, Cloudflare WAF rate limiting rules, Upstash @upstash/ratelimit, leaky bucket shaping vs policing, distributed rate limiter consistency. NOT for DDoS mitigation specifically (different scale), CAPTCHA / bot management, full WAF design, or per-user quota billing.