---
name: stijnman/self-refine-loop
source: https://app.decimal.ai/s/stijnman-self-refine-loop@1/SKILL.md
source_sha256: 8e0ffda0b47e
---

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