refine

refine is a skill for Claude Code from cdeust/session-optimizer. It costs 118 tokens per session (3,577 once invoked), scanned A, original, MIT.

A prompt-refinement procedure that turns short, frustrated, or ambiguous requests into a clear work agreement before coding begins. It connects vague references to actual files or other concrete project artifacts.

In plain words
What is it for?
Use it to clarify fixes, builds, improvements, and bug reports, identify the relevant code, define the intended outcome, and establish checks that can verify the work.
Why use it?
It reduces the risk of an agent misunderstanding what the request refers to and building the wrong thing. It also brings earlier decisions and lessons into the plan.

Skill for Claude Code

Written for Claude Code: UserPromptSubmit hook event. Also seen: mentions CLAUDE.md; mentions subagents; mentions Claude Code.

Part of the refine-gate plugin — 1 skill shipped together

Good fit Use it to clarify fixes, builds, improvements, and bug reports, identify the relevant code, define the intended outcome, and establish checks that can verify the work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/cdeust/session-optimizer/refine
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add cdeust/session-optimizer --skill refine
Clone the repo
git clone --depth 1 https://github.com/cdeust/session-optimizer

Made for: Claude Code.

Or install refine-gate, the plugin that ships this one along with the rest of its 1 skill.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for refine

README.md
[![agentmods](https://agentmods.dev/badge/skills/cdeust/session-optimizer/refine/github.svg)](https://agentmods.dev/skills/cdeust/session-optimizer/refine)
Your own site
<a href="https://agentmods.dev/skills/cdeust/session-optimizer/refine"><img src="https://agentmods.dev/badge/skills/cdeust/session-optimizer/refine/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for refine

Your own site · 80×15
<a href="https://agentmods.dev/skills/cdeust/session-optimizer/refine"><img src="https://agentmods.dev/badge/skills/cdeust/session-optimizer/refine.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,577 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00118 $0.03577
Opus 5.5 $0.00047 $0.01431
Sonnet 5.5 $0.00024 $0.00715
Haiku 4.5 $0.00012 $0.00358

Measured 1mo ago against content hash 2e310374441c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

refine scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/refine-gate/skills/refine/SKILL.md · 223 lines

How it starts

The opening of the file, as written. The whole thing — 223 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Automation

On Claude Code, a UserPromptSubmit hook (hooks/refine_gate.py, wired by this plugin's hooks/hooks.json) applies this skill automatically on two tiers. Codex and Gemini load the same skill explicitly or by description; their packages do not claim to install the Claude-specific hook.

  • Tier 1 — reference markers: prior-artifact shorthand, "exactly as/like", repeat-failure phrasing → inject the full binding-table instruction naming the matched marker classes.
  • Tier 2 — ungrounded work request (the generic net): the prompt asks for work (fix/build/improve/problem/bug/should/…) but contains NO concrete anchor — no file path, no commit sha, no line ref. Any named system/variable/concept ("the memory system", "the heat variable") must then be bound to its actual code artifact before reasoning. Prompts the user grounded themselves (a path in the prompt) pass through untouched.

Explicit /refine remains for prompts both heuristics miss.

Purpose

Communication failures cost more than code failures. A terse prompt like "it must work exactly as the SSE solution" carries a precise intent that the model can mis-bind to the wrong artifact and then build the wrong thing — correctly. This skill makes the binding explicit and cheap to correct BEFORE work starts, instead of expensive to redo after.

Procedure

1. Capture — never paraphrase away the original

Quote the raw prompt verbatim at the top of the contract. The user's exact words are evidence; frustration markers ("still", "again", "back to square one") signal a REPEATED failure — treat those as pointers to prior attempts that must be recalled, not as noise to sanitize away.

2. Bind every reference — the core move

Two reference classes need binding, and BOTH go in the table:

Deictic/temporal — "it", "the X solution", "like before", "the last release", "that file", "the same way": shorthand for prior work.

Domain-entity — "the memory system", "the wiki system", "the heat variable", "recall scores": names of systems, components, variables, and concepts. These feel concrete to the user but map to MANY possible code artifacts ("heat" alone: the memory row field, thermodynamics.py, decay_cycle.py, the WRRF heat signal, the viz heat display). Picking the wrong one solves the wrong problem correctly.

Read the full file on GitHub · 223 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 223 lines · 118 tokens per session scan A 2e310374441c

Subscribe to this mod's changes

refine is a skill published in the GitHub repository cdeust/session-optimizer (1 stars, last pushed 5d ago), licensed MIT. It adds 118 tokens to every session and 3,577 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

llm-eng-checks

Use when building or hardening an LLM feature — prompt design, RAG, eval harness, model/provider selection, guardrails, and token/cost budgeting — with omp-native tools (bash for real API round-trips, read/grep for the repo's own client, no vendor-plugin dependency, provider-agnostic). PRIME RULE — no LLM feature is…

jhlee0409/omni-harness-kit · 181 tokens

cursor-prompting

Internal guidance for composing compact, operator-style prompts for cursor-agent across coding, review, diagnosis, and research tasks.

Armert-Labs/cursor-plugin · 27 tokens

nativeprompt

A prompt editor that adapts a user's request to the rules of a selected coding model, such as Claude Code, Codex, Gemini CLI, or GPT-5.

edvardgrishin27/nativeprompt · 147 tokens

cortex-prompt

Build a production-ready prompt package — system prompt, few-shot examples, output format, edge case handling, eval criteria. Use when asked to "prompt engineering", "build a prompt", "write a system prompt", or "improve this prompt".

tonone-ai/tonone · 55 tokens

structured-prompt-writer

Structured AI prompt writing tool with 395+ built-in prompt templates. Supports both detailed mode and simple mode. Used for creating professional AI persona prompts, system prompts, or task prompts. Use this skill when the user needs to: (1) create a new AI prompt (2) design an AI persona (3) write a system prompt…

opencue/cuecards · 0 tokens

agy-prompting

Internal helper — how to tighten a user request into a sharp prompt for the Antigravity CLI (agy / Gemini 3.x with native web search and agentic tools).

MarcosNahuel/antigravity-plugin-cc · 40 tokens