Refine

From Chanw-research/claude-code-paper-writing · View interactive version

Refine is an AI agent skill from the GitHub repository Chanw-research/claude-code-paper-writing. General-purpose multi-round iterative improvement — repeatedly calls /review on any research artifact, parses feedback, applies fixes, updates wiki, until the target score is reached

How to use this skill

Skill file

/refine

General-purpose multi-round iterative improvement loop for any research artifact

(idea, proposal, experiment plan, paper draft).

Each round calls /review for structured feedback → parses actionable items → Claude fixes the artifact →

updates wiki entities → re-reviews, until the score reaches the target or the maximum rounds are exhausted.

Outputs an improvement history and the final review score.

Inputs

Outputs

Wiki Interaction

Reads

Writes

Graph edges created

Workflow

Precondition: confirm working directory is the wiki project root (containing wiki/, raw/, tools/).

Step 1: Initialize

  1. Locate artifact:
  1. Read current content: load full artifact text
  2. Initialize tracking variables:

Step 2: Iteration Loop

Repeat the following steps until the termination condition is met:

Round N (N = 1, 2, ..., max-rounds):

2a. Call /review
Skill: review
Args: "<artifact-path-or-content>" --difficulty {difficulty} --focus {focus}

Parse the review output and extract:

2b. Check Termination Conditions
2c. Classify Actionable Items and Apply Fixes

Classify and handle each actionable item:

Category A — Method/content issues (Claude fixes directly):

Category B — Wiki knowledge gaps (suggest external operations):

Category C — Claim status updates (Claude fixes wiki):

Category D — Out of scope (skip):

2d. Update Tracking
2e. Rebuild Derived Data (if wiki was changed)

If this round had wiki changes (Category C):

python3 tools/research_wiki.py rebuild-context-brief wiki/
python3 tools/research_wiki.py rebuild-open-questions wiki/

Step 3: Final Report

After iteration ends, generate the REFINE_REPORT:

# Refine Loop Report: {artifact title}

## Summary
- **Artifact**: {slug or path}
- **Rounds**: {N} / {max-rounds}
- **Score trajectory**: {score_history, e.g., 5 → 6 → 7 → 8}
- **Final score**: {final_score}/10
- **Final verdict**: {verdict}
- **Termination reason**: {target reached / converged / max rounds / rethink}

## Issues Fixed ({count})

| Round | Issue | Severity | Fix applied |
|-------|-------|----------|-------------|
| 1 | Method description too vague | major | Added specific algorithm steps |
| 1 | Claim confidence too high | major | Lowered [[claim-slug]] confidence 0.8→0.6 |
| 2 | Missing ablation design | minor | Added ablation plan |

## Wiki Changes Made

| Page | Change | Round |
|------|--------|-------|
| `wiki/claims/{slug}.md` | confidence 0.8 → 0.6 | 1 |
| `wiki/graph/edges.jsonl` | +1 edge (addresses_gap) | 2 |

## Unresolved Issues ({count})

| Issue | Severity | Suggested action |
|-------|----------|------------------|
| Missing experimental validation | critical | Run `/exp-design {slug}` |
| Missing comparison paper | major | Run `/ingest` for {paper-title} |

## Next Steps
- {based on verdict and unresolved issues}

Append log:

python3 tools/research_wiki.py log wiki/ \
  "refine | {artifact-slug} | {N} rounds | score {initial}→{final} | verdict: {verdict}"

Constraints

Error Handling

Dependencies

Tools(via Bash)

Skills(via Skill tool)

Claude Code Native

Shared References

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.