Agent skill

Refinement Loop

by lexler in lexler/skill-factory

Iterative refinement through multiple passes. An agent skill from lexler/skill-factory.

Apache-2.0Auto-check passed

Install Refinement Loop

skills CLI
$ npx skills add lexler/skill-factory --skill refinement-loop -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install lexler/skill-factory refinement-loop --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/lexler/skill-factory.git skills-src && mkdir -p .claude/skills && cp -r skills-src/output_skills/practices/refinement-loop .claude/skills/refinement-loop && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
refinement-loop
GitHub stars
239
Token cost
~700 tokens
SKILL.md length
363 words
Files
1
Skills in repo
25
Repo updated
First seen
Licence
Apache-2.0

At a glance

Iterative refinement through multiple passes. An agent skill from lexler/skill-factory.

  • Works in 4 steps: Clarify Goal (if the user hasn't defined… → Capture Starting Point → Iterate → …
  • The user asks to meditate on
  • SKILL.md covers Setup, Process and Principles
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Refinement Loop is an agent skill from lexler/skill-factory. Iterative refinement through multiple passes. Use when the user asks to 'meditate on', 'distill', 'refine', or 'iterate on' something, or proactively when a problem benefits from multiple passes rather than a single attempt.

Its SKILL.md is about 700 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The licence is Apache-2.0.

When your agent uses it

  • The user asks to meditate on
  • Iterate on something
  • Proactively when a problem benefits from multiple passes rather than a single attempt

Example prompts

  • “meditate on”
  • “distill”
  • “refine”
  • “/refinement-loop”

Workflow steps

4 steps, taken from the step headings in SKILL.md.

  1. Clarify Goal (if the user hasn't defined it for you already earlier in the conversation)
  2. Capture Starting Point
  3. Iterate
  4. Present Final

What it can do on your machine

Read from SKILL.md and the folder at commit 8017333. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Refinement Loop loads about 700 tokens when it runs. Until then it costs about 60 tokens; SKILL.md has 363 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~60
When it runs · the whole SKILL.md, loaded when a task matches
~700

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from lexler/skill-factory at commit 8017333, republished under its Apache-2.0 licence (© lexler). 363 words, ~700 tokens.

Download SKILL.mdSave it as .claude/skills/refinement-loop/SKILL.md (or your agent's skills folder).
name
refinement-loop
description
Iterative refinement through multiple passes. Use when the user asks to 'meditate on', 'distill', 'refine', or 'iterate on' something, or proactively when a problem benefits from multiple passes rather than a single attempt.

Refinement Loop

STARTER_CHARACTER = 🔄

Iterative refinement through file artifacts. Each pass removes one layer of noise, revealing the next.

Setup

Ensure playground/ exists and is in .gitignore. All iteration files go there.

Process

1. Clarify Goal (if the user hasn't defined it for you already earlier in the conversation)

Ask the user:

  • What are you refining and what is the goal of refinement?
  • Derive a short tag that we'll use as filename for iterating: {goal}-{subject} (e.g., gist-nullables, simplify-api, distill-auth-docs)
2. Capture Starting Point

Write original to: playground/{goal}-{subject}-0.md

3. Iterate

Loop:

  1. Read back the current file (forces fresh perspective)
  2. Reflect critically: What's missing? What's weak? What could be clearer?
  3. If improvements found: Write improved version to playground/{goal}-{subject}-{N+1}.md, then loop again
Before Stopping - Exhaustive Check

When you think you're done, you're probably not. Run through this:

  1. List everything that could still be improved - even small things (formatting, word choice, structure, clarity)
  2. Consider what we haven't considered - what angles did we miss? What would someone else notice?
  3. Try improving in a new direction - not just polishing what's there, but questioning assumptions
  4. Read as if seeing it for the first time - does it immediately make sense? Is anything unclear?

Only stop when you've gone through this checklist extensively multiple times and genuinely found nothing. There is no "good enough" - someone will use this later and shouldn't waste time on mediocre results.

Show full SKILL.md (130 more words)Show less
4. Present Final

Show the user the final version with a brief summary of the refinement journey and number of iterations you used. If deeper issues or questions surfaced, present them to the user as well.

Principles

  • Read back forces fresh eyes: Reading from file breaks the "I just wrote this" blindness
  • No "good enough": Every detail matters. Formatting, word choice, structure - all of it
  • Consider the unconsidered: What angles haven't we explored? What would someone else see? Is there something that the user hasn't even considered, too? (you can surface it as questions at the end)
  • Files force iterative improvement: Writing to files prevents "pretend" iteration in conversation. Real iteration gets to much better results.
  • Earn the stop: Run the exhaustive check. If you find nothing, you've earned stopping.

© lexler, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in output_skills/practices/refinement-loop of lexler/skill-factory.

Open the folder on GitHubat commit 8017333

Compare with similar skills

Refinement Loop next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Refinement Loop compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Refinement Loop this skilllexler/skill-factory239—~700Automated safety check: PassApache-2.0
Iterative Retrievalaffaan-m/ECC274k7 repos~1.6kAutomated safety check: PassMIT
Agent Refinementruvnet/ruflo74k2 repos~3.5kAutomated safety check: PassMIT
Iterate Refinement Notesproduct-on-purpose/pm-skills713—~855Automated safety check: PassApache-2.0
Refinewindmill-labs/windmill18k—~420Automated safety check: PassCustom licence
Refiner AutomationComposioHQ/awesome-claude-skills77k3 repos~730Automated safety check: PassNone

Similar skills

  • Pattern for progressively refining context retrieval to solve the subagent context problem.

    274k GitHub starsUsed in 7 repos~1.6k tokens
    Agent WorkflowsAuto-check passed
  • Agent Refinement

    ruvnet/ruflo

    Agent skill for refinement - invoke with $agent-refinement. An agent skill from ruvnet/ruflo.

    74k GitHub starsUsed in 2 repos~3.5k tokens
    DevelopmentAuto-check passed
  • Iterate Refinement Notes

    product-on-purpose/pm-skills

    Documents backlog refinement session outcomes including stories refined, estimates, questions raised, and decisions made.

    713 GitHub stars~855 tokensUpdated 2 days ago
    Product & Project ManagementAuto-check passed
  • Refine

    windmill-labs/windmill

    End-of-session reflection. An agent skill from windmill-labs/windmill.

    18k GitHub stars~420 tokensUpdated today
    Auto-check passed
  • Refiner Automation

    ComposioHQ/awesome-claude-skills

    Automate Refiner tasks via Rube MCP (Composio). An agent skill from ComposioHQ/awesome-claude-skills.

    77k GitHub starsUsed in 3 repos~730 tokens
    Productivity & AutomationAuto-check passed
  • Sparc Refine

    ruvnet/ruflo

    Run the SPARC Refinement and Completion phases — review code, improve test coverage, validate against specification, and generate documentation

    74k GitHub stars~1.5k tokensUpdated today
    Testing & QAAuto-check: notes

More from lexler/skill-factory

All 25 skills in this repo
  • C4 Architecture Diagrams

    lexler/skill-factory

    Creates C4 model diagrams at every zoom level, from system landscape to code, in ASCII, Mermaid or Structurizr, for designing or documenting software architecture.

    239 GitHub stars~2.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Launching Agent Teams

    lexler/skill-factory

    Plans and launches Claude Code agent teams with distinct roles, right-sized tasks and detailed spawn prompts, and says when subagents or worktrees fit better.

    239 GitHub stars~1.3k tokensUpdated 1 mo ago
    Auto-check passed
  • Claude Code Statusline Writer

    lexler/skill-factory

    Guides writing and debugging Claude Code status line scripts that read session JSON from stdin and print one line of text.

    239 GitHub stars~872 tokensUpdated 1 mo ago
    Auto-check passed
  • Catalog of obstacles, anti-patterns and patterns for working with AI coding agents, covering context management and reliability, from a published patterns collection.

    239 GitHub stars~1.5k tokensUpdated 1 mo ago
    Auto-check passed
  • Approval Testing Toolkit

    lexler/skill-factory

    Writes snapshot-style approval tests in Python, JavaScript, TypeScript or Java, comparing output against an approved file instead of writing individual assertions.

    239 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed
  • Hotspots

    lexler/skill-factory

    Find where a codebase actually costs time by mining its git history (Tornhill hotspot analysis).

    239 GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed

Questions about Refinement Loop

What does Refinement Loop do?

Iterative refinement through multiple passes. An agent skill from lexler/skill-factory. Refinement Loop is an agent skill from lexler/skill-factory. Iterative refinement through multiple passes.

When should I use Refinement Loop?

Refinement Loop fits situations like: the user asks to meditate on; iterate on something; proactively when a problem benefits from multiple passes rather than a single attempt.

How do I install Refinement Loop in Claude Code?

Run `npx skills add lexler/skill-factory --skill refinement-loop -a claude-code`. Or copy the skill folder (output_skills/practices/refinement-loop in lexler/skill-factory) into .claude/skills/refinement-loop in your project. Claude Code loads it when a task matches its description.

How do I install Refinement Loop in Codex?

Run `npx skills add lexler/skill-factory --skill refinement-loop -a codex`. Or copy the skill folder (output_skills/practices/refinement-loop in lexler/skill-factory) into .agents/skills/refinement-loop in your project. Codex loads it when a task matches its description.

Can I use Refinement Loop in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add lexler/skill-factory --skill refinement-loop -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/refinement-loop, .gemini/skills/refinement-loop, .github/skills/refinement-loop and .opencode/skills/refinement-loop in your project.

What does Refinement Loop need to run?

SKILL.md names no scripts, command-line tools or credentials: Refinement Loop is instructions for the agent only.

Does Refinement Loop access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Refinement Loop safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Refinement Loop use?

Refinement Loop is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Refinement Loop use?

About 700 tokens (SKILL.md is roughly 2.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Refinement Loop?

Skills that share tags, products or a category with Refinement Loop: Iterative Retrieval (affaan-m/ECC, 274k stars), Agent Refinement (ruvnet/ruflo, 74k stars), Iterate Refinement Notes (product-on-purpose/pm-skills, 713 stars) and Refine (windmill-labs/windmill, 18k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Refinement Loop?

lexler (a GitHub user) maintains it in lexler/skill-factory, which has 239 GitHub stars. The repository holds 25 skills in this directory. The repository was last updated on August 26, 2026.

Source: lexler/skill-factory on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.