# Self Refine Loop

> >

- **Type:** Skill
- **Install:** `agentstack add skill-stijnman-grok-custom-skills-self-refine-loop`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Stijnman](https://agentstack.voostack.com/s/stijnman)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Stijnman](https://github.com/Stijnman)
- **Source:** https://github.com/Stijnman/grok-custom-skills/tree/main/.grok/skills/self-refine-loop

## Install

```sh
agentstack add skill-stijnman-grok-custom-skills-self-refine-loop
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Stijnman](https://github.com/Stijnman)
- **Source:** [Stijnman/grok-custom-skills](https://github.com/Stijnman/grok-custom-skills)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-stijnman-grok-custom-skills-self-refine-loop
- Seller: https://agentstack.voostack.com/s/stijnman
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
