prompt-optimization
Boosts accuracy on structured tasks for Haiku-based models by automatically repeating the user prompt during the prefill stage.
Install
mkdir -p .claude/skills/prompt-optimization && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/2826" && unzip -o skill.zip -d .claude/skills/prompt-optimization && rm skill.zipInstalls to .claude/skills/prompt-optimization
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Applies prompt repetition to improve accuracy for non-reasoning LLMsKey capabilities
- →Apply prompt repetition for Haiku agents
- →Improve accuracy on structured tasks
- →Configure repetition count
- →Enable/disable optimization via environment variables
- →Track optimization metrics
How it works
Automatically repeats the input prompt for Haiku agents during the prefill stage to enhance attention and accuracy without increasing latency.
Inputs & outputs
When to use prompt-optimization
- →Improving unit test execution results
- →Enhancing data parsing and extraction accuracy
- →Increasing reliability for list operations
- →Better code linting outcomes
About this skill
Prompt Optimization Skill
Overview
Automatically applies prompt repetition for Haiku agents to improve accuracy by 4-5x on structured tasks.
Research Source: "Prompt Repetition Improves Non-Reasoning LLMs" (arXiv 2512.14982v1)
When to Activate
This skill activates automatically for:
- Haiku agents executing structured tasks
- Unit test execution
- Linting and formatting
- Parsing and extraction
- List operations (find, filter, count)
How It Works
BEFORE:
prompt = "Run unit tests in tests/ directory"
AFTER (with skill):
prompt = "Run unit tests in tests/ directory\n\nRun unit tests in tests/ directory"
The repeated prompt enables bidirectional attention within the parallelizable prefill stage, improving accuracy without latency penalty.
Performance Impact
| Task Type | Without Skill | With Skill | Improvement |
|---|---|---|---|
| Unit tests | 65% accuracy | 95% accuracy | +46% |
| Linting | 72% accuracy | 98% accuracy | +36% |
| Parsing | 58% accuracy | 94% accuracy | +62% |
Latency: Zero impact (occurs in prefill, not generation)
Configuration
Enable/Disable
# Enabled by default for Haiku agents
LOKI_PROMPT_REPETITION=true
# Disable if needed
LOKI_PROMPT_REPETITION=false
Repetition Count
# 2x repetition (default)
LOKI_PROMPT_REPETITION_COUNT=2
# 3x repetition (for position-critical tasks)
LOKI_PROMPT_REPETITION_COUNT=3
Agent Instructions
When you are a Haiku agent and the task involves:
- Running tests
- Executing linters
- Parsing structured data
- Finding items in lists
- Counting or filtering
Your prompt will be automatically repeated 2x to improve accuracy. No action needed from you.
If you are an Opus or Sonnet agent, this skill does NOT apply (reasoning models see no benefit from repetition).
Metrics
Track prompt optimization impact:
.loki/metrics/prompt-optimization/
├── accuracy-improvement.json
└── cost-benefit.json
References
See references/prompt-repetition.md for full documentation.
Version: 1.0.0
When not to use it
- →With reasoning models like Opus or Sonnet
Prerequisites
Limitations
- →Only effective for non-reasoning LLMs
- →Requires Haiku agent activation
How it compares
Uses prompt repetition to improve performance on non-reasoning models, whereas reasoning models do not benefit from this technique.
Compared to similar skills
prompt-optimization side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| prompt-optimization (this skill) | 3 | 7mo | Review | Beginner |
| command-development | 16 | 9mo | Review | Intermediate |
| prpm-development | 6 | 8mo | Review | Intermediate |
| rule-identifier | 5 | 9mo | Review | Beginner |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by asklokesh
View all by asklokesh →You might also like
command-development
anthropics
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
prpm-development
pr-pm
Use when developing PRPM (Prompt Package Manager) - comprehensive knowledge base covering architecture, format conversion, package types, collections, quality standards, testing, and deployment
rule-identifier
anthropics
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
autonomous-agent-patterns
davila7
Design patterns for building autonomous coding agents. Covers tool integration, permission systems, browser automation, and human-in-the-loop workflows. Use when building AI agents, designing tool APIs, implementing permission systems, or creating autonomous coding assistants.
example-skill
anthropics
This skill should be used when the user asks to "demonstrate skills", "show skill format", "create a skill template", or discusses skill development patterns. Provides a reference template for creating Claude Code plugin skills.
command-creator
davila7
This skill should be used when creating a Claude Code slash command. Use when users ask to "create a command", "make a slash command", "add a command", or want to document a workflow as a reusable command. Essential for creating optimized, agent-executable slash commands with proper structure and best practices.