by Apeironics
Agent Skill that silently refines prompts for the currently running model
# Add to your Claude Code skills
git clone https://github.com/Apeironics/prompt-refine-skillGuides for using ai agents skills like prompt-refine-skill.
prompt-refine-skill is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by Apeironics. Agent Skill that silently refines prompts for the currently running model. It has 85 GitHub stars.
prompt-refine-skill's catalog security scan is still queued. You can run an instant dependency and prompt-injection check now with the "Scan for vulnerabilities" button above.
Clone the repository with "git clone https://github.com/Apeironics/prompt-refine-skill" and add it to your Claude Code skills directory (see the Installation section above). prompt-refine-skill ships a SKILL.md manifest, so compatible agents can discover and load it automatically.
prompt-refine-skill is primarily written in Python. It is open-source under Apeironics on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh prompt-refine-skill against similar tools.
No comments yet. Be the first to share your thoughts!
Unlocks once the catalog security scan passes (runs nightly).
The deep catalog scan for this skill is still queued. Run an instant dependency check now instead.
You are a prompt-optimization layer for the model that is currently running you. While active, you silently rewrite each user request into the structure your own model family handles best, then answer the rewritten version. The user sees only the final answer (unless verbose mode is on).
strategies/universal.md over guessing wrong — a confident
wrong match (e.g. a fine-tune that misreports its identity) is worse than the fallback.| If you are running as… | Load |
|---|---|
| GPT / GPT-5 (OpenAI) | strategies/openai.md |
| Claude (Anthropic) | strategies/anthropic.md |
| Gemini (Google) | strategies/google-gemini.md |
| Llama (Meta) | strategies/meta-llama.md |
| DeepSeek V4 (+ R1) | strategies/deepseek.md |
| Mistral / Codestral | strategies/mistral.md |
| Qwen / 通义千问 (Alibaba) | strategies/qwen.md |
| Grok (xAI) | strategies/xai-grok.md |
| Perplexity / Sonar | strategies/perplexity.md |
| Kimi (Moonshot AI) | strategies/kimi.md |
| GLM (Z.ai) | strategies/zai-glm.md |
| MiniMax M-series | strategies/minimax.md |
| AI21 Jamba | strategies/ai21-jamba.md |
| Command R / R+ (Cohere) | strategies/cohere.md |
| Nova (Amazon) | strategies/amazon-nova.md |
| Phi (Microsoft) | strategies/microsoft-phi.md |
| Any other / unknown model | strategies/universal.md |
If the user sends a standalone activation command, reply briefly, e.g.:
✓ Refine mode on — optimizing for <your model>. Ask anything. Add
— verbose: you'll see each before/after. when verbose is requested. If activation is
combined with a real task, do not interrupt the task with a status line; activate and
answer the task.
Invoke this skill to activate — on most tools type / and pick prompt-refine
(e.g. /prompt-refine). Once active, you interpret the following as plain-text controls
for the rest of the conversation:
| Control | Behavior |
|---|---|
/prompt-refine · /refine |
Enter on mode; silently refine future prompts |
/refine verbose |
Enter verbose mode; show a compact original→refined diff before each answer |
/refine off |
Enter off mode; stop refining future prompts |
Scope is conversational, not a stored flag. "Session-level" means: while these instructions remain in context you refine every prompt. There is no persistent state — if the user types
/refine offyou stop; if the conversation is compacted and refining lapses, the user re-invokes/prompt-refine. For hard enforcement on Claude Code, see the optional hook inhooks/.
| Current state | Input | Next state | Visible behavior |
|---|---|---|---|
off |
standalone /prompt-refine or /refine |
on |
One short confirmation |
off |
/prompt-refine plus a task |
on |
No confirmation; answer the task refined |
on |
normal user prompt | on |
Silent refinement; final answer only |
on |
/refine verbose |
verbose |
One short confirmation, then show compact diffs |
verbose |
normal user prompt | verbose |
Show compact diff, then final answer |
on or verbose |
/refine off |
off |
One short confirmation if standalone |
off |
normal user prompt | off |
Answer normally |
When the optional Claude Code hook is installed and the agent can edit local files, keep
the hook flag in sync with this state machine: create hooks/.refine-active on
/prompt-refine, /refine, or /refine verbose; remove it on /refine off. If the
agent cannot manage files, the conversation state still applies and the user can toggle
the flag manually.
For every request while active:
Original → Refined diff, then answer.<role>, <task>, <constraints>, XML tags,
rewritten prompts, or internal checklists. Those are private working notes. The visible
response must contain ONLY the final answer to the user.strategies/universal.md.Prompt Refine is a lightweight, cross-platform Agent Skill. After activation, it detects which model is currently running the conversation and applies that model family's prompting strategy before answering.
The core design is simple but important: route by host model, not by task. If Claude is answering, Prompt Refine uses the Anthropic strategy for the whole conversation. If GPT is answering, it uses the OpenAI strategy. A coding task never switches Claude into GPT-style prompting, and a writing task never switches GPT into Claude-style XML.
That makes the skill useful anywhere Agent Skills are supported: Claude Code, Cursor, OpenAI Codex, Gemini CLI, GitHub Copilot, Windsurf, CodeBuddy, and other compatible tools.
It is context-aware: follow-up requests can inherit the relevant goal, constraints, terminology, and preferences from the conversation, while the newest user instruction still wins.
It is intentionally lightweight: no runtime dependencies, no app server, no extra optimizer call, and only a short skill file plus one selected strategy file in context. The goal is better structure without spending a pile of extra tokens.
The same user request gets a different internal shape depending on the host model. These examples show the hidden rewrite style; in normal mode the user only sees the final answer.
User request:
Help me analyze this market.
Anthropic Claude shape:
<role>You are a senior market analyst specializing in competitive intelligence.</role>
<context>
The user has not named the market, geography, customer segment, or timeframe.
Preserve uncertainty; make practical assumptions explicit instead of inventing facts.
</context>
<task>
Analyze the competitive landscape for the most likely intended market.
</task>
<constraints>
- Start by naming assumptions about market, audience, geography, and timeframe.
- Separate confident analysis from unknowns.
- Do not claim current market data unless it was provided or can be verified.
- Ask only the one or two follow-up questions that would most improve the analysis.
</constraints>
<format>
Use these sections: Assumptions, Competitive Map, Barriers And Switching Costs,
Strategic Implications, Unknowns, Next Questions.
</format>
<success_criteria>
The answer should be useful before the user clarifies the market, while making clear
which parts depend on assumptions.
</success_criteria>
OpenAI GPT shape:
Goal: Turn an underspecified market-analysis request into a useful first-pass competitive landscape.
User request:
"""Help me analyze this market."""
Relevant context:
- Market, geography, audience, and timeframe are missing.
- Preserve uncertainty and make assumptions explicit.
Instructions:
1. State the assumed market scope first.
2. Identify likely player categories and competitive dynamics.
3. Compare barriers, switching costs, and strategic implications.
4. Flag unknowns instead of inventing facts.
Hard constraints:
- Do not claim current market data unless it was provided or can be verified.
- Ask only 1-2 follow-up questions.
Output format: Markdown headings for Assumptions, Competitive Map, Barriers,
Strategic Implications, Unknowns, and Next Questions.
User request:
Write a 5-item npm release checklist. Keep each item under 8 words.
Anthropic Claude shape:
<context>
The user gave a tightly constrained formatting request. Do not expand the task.
</context>
<task>Write exactly five npm release checklist items.</task>
<constraints>
- Each item must be under 8 words.
- Cover package.json, README, LICENSE, version, and dry-run publishing.
- Return checklist items only; no intro or explanation.
</constraints>
<format>Use a numbered list with one short imperative phrase per item.</format>
<success_criteria>
Exactly 5 items, each under 8 words, with all requested topics covered.
</success_criteria>
OpenAI GPT shape:
Task: Write exactly five npm release checklist items.
Context: The user already provided clear hard constraints, so preserve them and do not add scope.
Hard constraints:
- Under 8 words per item.
- Cover package.json, README, LICENSE, version, and dry-run publishing.
- Return only the checklist.
Output contract:
- Numbered list.
- Exactly 5 lines.
- No intro or outro.
Quality check before answering: each item is under 8 words and covers one requested release topic.
Only the final answer. The rewrite stays silent unless /refine verbose is enabled. For clear prompts, Prompt Refine should stay minimal and protect the user's exact constraints.
The strategy always follows the host model, not the topic: Claude gets Claude-shaped structure, GPT gets GPT-shaped structure.
Install this repository into your tool's project-level skills directory. For Claude Code:
git clone https://github.com/Li-Bailiang/prompt-refine-skill.git .claude/skills/prompt-refine
To avoid copying the .git folder, use a release archive or:
npx degit Li-Bailiang/prompt-refine-skill .claude/skills/prompt-refine
The skill is also published on npm as
prompt-refine-skill (versioned
releases). npm does not auto-register an Agent Skill; use it as a versioned source and
unpack the package into your tool's skills directory:
mkdir -p .agents/skills/prompt-refine
npm pack prompt-refine-skill
tar -xzf prompt-refine-skill-*.tgz --strip-components=1 -C .agents/skills/prompt-refine
The git clone and degit commands above place the files directly in your tool's skills
directory.
Activate it in a conversation:
/prompt-refine
Available in-session controls:
/refine verbose # Show a compact original -> refined diff before each answer
/refine off # Stop refining for the rest of the conversation
/prompt-refine # Re-activate after context compaction or a new session
| Tool | Project-level skill path |
|---|---|
| Claude Code | .claude/skills/prompt-refine |
| Cursor | .cursor/skills/prompt-refine or .agents/skills/prompt-refine |
| OpenAI Codex | .agents/skills/prompt-refine |
| Gemini CLI | .gemini/skills/prompt-refine or .agents/skills/prompt-refine |
| GitHub Copilot (VS Code) | .github/skills/prompt-refine or .agents/skills/prompt-refine |
| Windsurf | .windsurf/skills/prompt-refine |
| CodeBuddy | .codebuddy/skills/prompt-refine |
Most tools also accept the shared .agents/skills/ convention. User-level paths differ by platform, so use each tool's official docs when installing globally.
| Host model | Strategy file | Source family |
|---|---|---|
| OpenAI GPT (GPT-5 family) | strategies/openai.md |
OpenAI prompting guidance |
| Anthropic Claude | strategies/anthropic.md |
Anthropic prompt engineering |
| Google Gemini | strategies/google-gemini.md |
Gemini prompt design |
| Meta Llama | strategies/meta-llama.md |
Llama prompting guidance |
| DeepSeek V4 (+ R1) | strategies/deepseek.md |
DeepSeek prompt library |
| Mistral / Codestral | strategies/mistral.md |
Mistral best practices |
| Qwen | strategies/qwen.md |
Alibaba Model Studio guidance |
| xAI Grok | strategies/xai-grok.md |
xAI Grok prompting references |
| Perplexity Sonar | strategies/perplexity.md |
Perplexity prompt guide |
| Kimi / Moonshot AI | strategies/kimi.md |
Kimi prompt best practices |
| Z.ai GLM | strategies/zai-glm.md |
Z.ai GLM official docs |
| MiniMax M-series | strategies/minimax.md |
MiniMax official docs |
| AI21 Jamba | strategies/ai21-jamba.md |
AI21 Jamba official docs |
| Cohere Command | strategies/cohere.md |
Cohere docs |
| Amazon Nova | strategies/amazon-nova.md |
Nova prompt guide |
| Microsoft Phi | strategies/microsoft-phi.md |
Phi Cookbook |
| Unknown host | strategies/universal.md |
Conservative fallback |
Prompt Refine was evaluated in a blind, position-swapped A/B test on 120 vague prompts (60 English, 60 C