Smallest Safe Solution Code Reviewer
You get a much shorter version of your code that still keeps validation, security and accessibility. It works because the AI must check what already exists before writing anything new, and must say what it skipped.
The prompt
Act as a veteran senior developer who dislikes unnecessary code but never compromises on safety.
Task: Review the code below and replace it with the smallest solution that still meets the requirement.
Requirement: {requirement}
Code: {existing_code}
Existing tools already in the project: {available_tools}
Steps:
1. Read the code and the requirement, then trace what the code actually does before suggesting any change.
2. Check whether the project's existing tools, the language's standard library or the browser already do the job.
3. Write the shortest replacement that reuses them.
4. Confirm the replacement keeps input validation, error handling, security and accessibility. Never cut these.
5. If the logic has a branch, loop, parser or money calculation, add one small test.
Output:
- The replacement code in one block.
- A one-line count: lines before versus lines after.
- A short "Skipped or unchecked" list with any risks I should know about.
Change the parts in curly braces. Use it when an AI-generated solution feels bloated or pulls in a library for something simple.
What happened when we ran it
We sent
Act as a veteran senior developer who dislikes unnecessary code but never compromises on safety.
Task: Review the code below and replace it with the smallest solution that still meets the requirement.
Requirement: Let customers pick a delivery date on the checkout form. The date must be at least two days from today and no more than 30 days ahead.
Code: import React, { useState } from 'react';
import Calendar from './CustomCalendar';
export function DeliveryPicker({ onChange }) {
const [month, setMonth] = useState(new Date().getMonth());
const [year, setYear] = useState(new Date().getFullYear());
const [selected, setSelected] = useState(null);
const days = new Date(year, month + 1, 0).getDate();
function pick(d) { setSelected(d); onChange(new Date(year, month, d)); }
return (<div><button onClick={() => setMonth(month - 1)}>Prev</button><button onClick={() => setMonth(month + 1)}>Next</button><Calendar days={days} selected={selected} onPick={pick} /></div>);
}
Existing tools already in the project: React 18, an existing Input component in components/Input.jsx that accepts type, min, max, label and onChange props, and no date libraries installed.
Steps:
1. Read the code and the requirement, then trace what the code actually does before suggesting any change.
2. Check whether the project's existing tools, the language's standard library or the browser already do the job.
3. Write the shortest replacement that reuses them.
4. Confirm the replacement keeps input validation, error handling, security and accessibility. Never cut these.
5. If the logic has a branch, loop, parser or money calculation, add one small test.
Output:
- The replacement code in one block.
- A one-line count: lines before versus lines after.
- A short "Skipped or unchecked" list with any risks I should know about.
The model replied
Run on Claude Sonnet 5.5, 26 Oct 2026. Automatic check: 4 out of 5.
Mentioned for
Claude Code, Claude, ChatGPT, Codex
Where it came from
Found on GitHub, shared by DietrichGebert: DietrichGebert/ponytail.
This is our own version of the idea, written and tested by us. The original may differ.