LLM apps & APIs
Draft-critique-revise writer
A writing tool that drafts, then critiques its own draft against a rubric, then revises in a loop so the final piece is measurably better than the first attempt.
Copy or download the full plan and paste it into your AI coding agent to build it.
Why build it
A single LLM call gives you a first draft, and first drafts are mediocre. The technique that lifts quality is a self-improvement loop: the model drafts, then switches roles to critique that draft against an explicit rubric, then revises using the critique, repeating until it stops improving. This teaches you two ideas you will use everywhere: separating generation from evaluation so the model can be its own harsh editor, and defining a rubric so 'better' is concrete rather than vibes. It is also a gentle introduction to agentic loops, where the model's own output feeds its next step under a stopping condition you control.
Who it's for: You want to go beyond single-shot prompting into iterative, self-correcting generation. Any writer or developer who wants higher-quality output.
What you'll build
Core (MVP)
- Take a brief plus a rubric of quality criteria
- Generate a first draft
- Critique the draft against each rubric criterion with specific, actionable notes
- Revise the draft using the critique
- Loop critique and revise until quality plateaus or a max iteration count
- Show every version and critique so the improvement is visible
Stretch
- Score each draft numerically per criterion and stop when the score stops rising
- Let the user edit the rubric and rerun
- Add a separate factuality-check pass that flags unsupported claims
- Diff consecutive drafts to highlight exactly what changed
Step-by-step build
- 1
Define the rubric as data
Write the quality criteria as a structured list, for example clarity, structure, specificity, and tone, each with a one-line definition. Making the rubric data rather than prose means the critic can address each criterion explicitly and you can display scores against it later.
- 2
Generate the first draft
Prompt the model as a writer with the brief and the rubric, asking for a complete first draft. Keep this prompt focused purely on producing content; do not ask it to self-evaluate in the same call, because mixing the roles weakens both.
- 3
Critique in a separate role
In a new call, prompt the model as a strict editor: given the draft and the rubric, produce specific, actionable critique for each criterion, pointing at concrete sentences. Ask it to be genuinely critical rather than congratulatory, since a soft critique produces no improvement.
- 4
Revise from the critique
Prompt the model as a reviser with the current draft and the critique, asking it to apply the feedback and return an improved draft. Instruct it to make the specific changes the critique called for, not to rewrite from scratch and lose what worked.
- 5
Close the loop with a stop condition
Wrap critique and revise in a loop that runs until a maximum iteration count or until the critique reports no meaningful issues left. A hard cap is essential so the loop cannot run forever or burn your free quota. Two or three iterations usually captures most of the gain.
- 6
Add numeric scoring
For a stronger stop condition, have the critic also emit a score per rubric criterion. Stop when the total stops rising between iterations. This turns 'looks better' into a number you can show and reason about.
- 7
Surface the whole history
Render every draft, its critique, and its score in sequence so a user can watch the piece improve. Seeing draft one next to the final version, with the critiques between, is the clearest possible proof the loop works.
- 8
Test that later drafts beat earlier ones
Run several briefs and confirm the final draft genuinely improves on the first against the rubric, not just changes. If the loop is not helping, sharpen the critic prompt to be harsher and more specific. Ship once improvement is consistent.
Done when
- ✓For several briefs, the final draft is clearly better than the first against the rubric, not merely different.
- ✓The critic produces specific, actionable notes tied to the rubric, not vague praise.
- ✓The loop always terminates via the max-iteration cap or a no-issues-left signal.
- ✓With numeric scoring on, the score rises across iterations and the stop triggers when it plateaus.
- ✓The live URL shows the full draft, critique, and revision history for a fresh brief.
Ship it
Deploy the Next.js app to Vercel on the free tier with your Groq key in the environment. Ship a live URL and a README that puts the first draft beside the final draft for one brief, with the critiques in between, so the quality lift is obvious at a glance. Note the rubric and stop condition as the mechanism.
What it proves: You understand self-improving generation loops: separating generation from evaluation, driving revision with an explicit rubric, and controlling an agentic loop with a real stopping condition, which is the core idea behind reflection and agentic quality patterns.
Hand it to your AI agent
Paste this into Cursor, Claude, or ChatGPT and build it step by step.
You are my senior AI engineer pair. Help me build "Draft-critique-revise writer" step by step. The idea is a self-improvement loop: the model drafts, then acts as a critic scoring the draft against a rubric (an explicit list of quality criteria), then revises from that critique, repeating under a stop condition. Separating the generation role from the evaluation role is what makes it work. Stack: Next.js (UI + API route), Groq (Llama 3.3 70B) for all three roles, a rubric defined as structured data, a max-iteration and score-plateau stop condition, Vercel hosting. Requirements: 1. Define the rubric as data, each criterion with a short definition. 2. Generate a first draft from the brief and rubric in a focused writer prompt. 3. Critique in a separate call as a strict editor, giving specific per-criterion notes and a score. 4. Revise from the critique, applying the changes rather than rewriting wholesale. 5. Loop critique and revise until max iterations or the score plateaus, and display every draft, critique, and score. Work in this order: define the rubric, then the draft prompt, then the critic prompt, then the revise prompt, then the loop and stop condition, then numeric scoring, then the history UI. Give me the commands and code for each step and STOP after each so I can test. Do not write the whole app at once.
More in LLM apps & APIs
Structured data extractor
Turn messy unstructured text like invoices, emails, and resumes into clean JSON that matches a schema you define and validate.
Text-to-SQL with guardrails
Let anyone ask a database questions in plain English and get a safe, schema-aware, read-only SQL query that is validated before it ever runs.
Meeting summarizer with action items
Drop in a meeting recording and get back a clean summary plus a list of decisions and action items with an owner and a due date each.
Building this? I post a new AI project plan on LinkedIn most weeks. Follow along and share what you ship.