self-refine-loop

self-refine-loop is a skill for Claude Code, Codex from Stijnman/grok-custom-skills. It costs 38 tokens per session (411 once invoked), scanned A, original, MIT.

An iterative writing process that generates an answer, critiques it, and revises it against stated quality requirements.

In plain words
What is it for?
Use it to refine agent outputs, apply feedback, score confidence, and keep revisions within a controlled length.
Why use it?
It helps catch weaknesses in an initial answer and improve it through several focused revisions.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to refine agent outputs, apply feedback, score confidence, and keep revisions within a controlled length.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/stijnman/grok-custom-skills/self-refine-loop
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 Stijnman/grok-custom-skills --skill self-refine-loop
Clone the repo
git clone --depth 1 https://github.com/Stijnman/grok-custom-skills

Made for: Claude Code, Codex.

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 self-refine-loop

README.md
[![agentmods](https://agentmods.dev/badge/skills/stijnman/grok-custom-skills/self-refine-loop/github.svg)](https://agentmods.dev/skills/stijnman/grok-custom-skills/self-refine-loop)
Your own site
<a href="https://agentmods.dev/skills/stijnman/grok-custom-skills/self-refine-loop"><img src="https://agentmods.dev/badge/skills/stijnman/grok-custom-skills/self-refine-loop/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 self-refine-loop

Your own site · 80×15
<a href="https://agentmods.dev/skills/stijnman/grok-custom-skills/self-refine-loop"><img src="https://agentmods.dev/badge/skills/stijnman/grok-custom-skills/self-refine-loop.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 38 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 411 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.00038 $0.00411
Opus 5 $0.00019 $0.00205
Sonnet 5 $0.00008 $0.00082
Haiku 4.5 $0.00004 $0.00041

Measured 9d ago against content hash 2635d785c161, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-12, from the pricing page.

Security

Grade A, and why

self-refine-loop 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 9d 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.

.grok/skills/self-refine-loop/SKILL.md · 51 lines

What it actually says

Self Refine Loop

When to Use

  • User says self refine or task matches this capability
  • User says reflexion loop or task matches this capability
  • User says critique and revise or task matches this capability
  • User says improve output or task matches this capability

Workflow

  1. Capture the current output and the user's quality criteria.
  2. Generate a critique listing specific weaknesses (max 5 bullets).
  3. Revise the output addressing every critique point.
  4. Score confidence 0-10 on whether criteria are met.
  5. Repeat until confidence >= 8 or 5 iterations; return best version with changelog.

Integrations

  • goal-verifier
  • agentic-uncertainty-quantifier
  • dspy-prompt-optimizer

Error Handling

Failure Response
No criteria given Ask user for 1-3 success criteria before looping.
Confidence stuck below 5 Stop early; report blocker and ask for guidance.
Output grows unbounded Cap revisions to prior length + 20%.

Gotchas

  • Do not loop on trivial typos; one-pass fix is enough.

Example

Input: User request matching triggers above. Output: Structured result per workflow with integrations invoked as needed.

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. 9d ago First seen · 51 lines · 38 tokens per session scan A 2635d785c161

Subscribe to this mod's changes

self-refine-loop is a skill published in the GitHub repository Stijnman/grok-custom-skills (9 stars, last pushed yesterday), licensed MIT. It adds 38 tokens to every session and 411 once invoked, about $0.0002 per session on Opus 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-09-03.

Related

Other skills, from other repositories

goal-meta-skill

A guide for turning an unclear or complex task into a reviewable /goal instruction for coding agents.

bahayonghang/my-ai-cli-toolkit · 190 tokens

workflow-to-skill

Turn a goal and existing CLI, MCP, HTTP, API, or external workflow capabilities into one reviewable reusable Agent Skill. Use when the user asks to create or revise a workflow SKILL.md without a dedicated interface for invocation or result presentation. A webpage, UI, image, or report produced as workflow output does…

ailiheizi/workflow-to-skill · 104 tokens

rss-digest

Collect RSS or Atom sources and produce a traceable intelligence digest through the configured Weft workflow.

ailiheizi/workflow-to-skill · 23 tokens

workflow-docs-sync

A project-documentation synchronisation workflow for rebuilding project facts from a local Git folder, GitHub repository, or current working directory, then updating core workflow documents.

wlvh/coding-workflow · 119 tokens

workflow-to-skill-with-surface

Create or revise one reusable workflow Skill plus an optional harness-native Prompt Surface that maps a dedicated form, Page, button set, command UI, or result view to ordinary Skill messages and Harness results. Use only when the user explicitly requests a dedicated interface for invoking the Skill or presenting its…

ailiheizi/workflow-to-skill · 91 tokens

setup-matt-pocock-skills

A setup skill that configures engineering skills for a repository, including its issue tracker, labels, and documentation layout. A repository is the project folder managed by version control.

devcxl/mattpocock-skills-zh · 43 tokens