ForkFree

Prompts / Coding

Plan First, Then Verify Each Step

It makes the AI investigate and agree a plan before touching your code, then prove each fix with real checks. Giving it clear pass or fail targets stops it declaring victory as soon as the code merely compiles.

Struggled in our testThe reply skipped the required read-only exploration (it said it had no tools) and gave hypotheses instead of traced findings. It also broke the "Findings paragraph and numbered plan only" format by adding bullets and a closing request. It did stop before editing and drew up a sensible plan that covered all the checks.

The prompt

Act as a careful senior software engineer who never calls a job finished until it has been checked.

Task: Fix the problem described below in the codebase. Do not change any code until I approve your plan.

Problem file: {file_name}
Symptom: {symptom}
Expected behaviour: {expected_behaviour}
Checks that must pass: {verification_checks}

Steps:
1. Explore read-only first. Read the relevant files and trace the cause. Do not edit anything yet.
2. Write a short numbered plan of the changes, naming each file, and stop so I can review it.
3. After I approve, make the changes one step at a time, running the relevant check after each step.
4. Run every item in the checks list and report the actual result of each, not an assumption.
5. If any check fails, diagnose and fix it, then run all the checks again.

Output: First reply: a "Findings" paragraph and the numbered plan only. Final reply: a table of each check with PASS or FAIL and the evidence, then a list of files changed with one line on why.

Change the parts in curly braces. Use it for bugs or changes that touch several files, where a quick one-line fix request would tempt the AI to guess.

What happened when we ran it

We sent

Act as a careful senior software engineer who never calls a job finished until it has been checked.

Task: Fix the problem described below in the codebase. Do not change any code until I approve your plan.

Problem file: src/middleware/auth.js
Symptom: Logged-in users are redirected to /login every time they refresh the dashboard page. The session cookie is set correctly in the browser, but the server seems to ignore it. This started after we added the rate limiter last week.
Expected behaviour: A user with a valid session cookie stays on the dashboard after a refresh and receives a 200 response. A user without a cookie is still redirected to /login.
Checks that must pass: Run npm test and confirm all tests in tests/auth.test.js pass. Confirm the session middleware is registered before the rate limiter in src/app.js. Request /dashboard with curl using a valid cookie and confirm a 200 response.

Steps:
1. Explore read-only first. Read the relevant files and trace the cause. Do not edit anything yet.
2. Write a short numbered plan of the changes, naming each file, and stop so I can review it.
3. After I approve, make the changes one step at a time, running the relevant check after each step.
4. Run every item in the checks list and report the actual result of each, not an assumption.
5. If any check fails, diagnose and fix it, then run all the checks again.

Output: First reply: a "Findings" paragraph and the numbered plan only. Final reply: a table of each check with PASS or FAIL and the evidence, then a list of files changed with one line on why.

The model replied

**Findings:** I haven't read any files yet because I have no file or shell tools in this session, so I can't confirm the root cause. Everything below is a hypothesis from the symptom, not a verified finding. The pattern (cookie present in the browser, server ignores it, started when the rate limiter was added) suggests an ordering or interaction problem in `src/app.js`. The likely causes are: - The rate limiter is registered before the session/cookie-parsing middleware and rejects or short-circuits requests before `req.session` is populated. - The limiter is keyed or configured in a way that interferes with the session, such as a `trust proxy` setting missing so `secure` cookies aren't recognized behind a proxy, or the limiter's own store or cookie colliding with the session cookie name. - `src/middleware/auth.js` reads `req.session` or `req.cookies` before it is set, and redirects to `/login` when it finds nothing. I'll confirm which of these is true by reading the files before proposing anything final. **Plan (provisional, no changes made):** 1. Read-only: open `src/app.js`, `src/middleware/auth.js`, the rate limiter module, and `tests/auth.test.js` to trace the middleware order and how auth reads the session. Then run `npm test` to get a baseline. 2. `src/app.js`: register the session (and cookie-parser, if used) middleware before the rate limiter, and set `trust proxy` here if the investigation shows it's needed. 3. `src/middleware/auth.js`: only if the trace shows it reads the session incorrectly, fix it to check the correct session/cookie property. Otherwise leave it untouched. 4. `tests/auth.test.js`: add a regression test only if none covers a valid cookie returning 200 after the limiter is in place. 5. Verify after each step. Run `npm test` and confirm all of `tests/auth.test.js` passes. Confirm the registration order in `src/app.js`. Run `curl -i --cookie "<name>=<valid value>" http://localhost:<port>/dashboard` and confirm a 200. Also curl without a cookie and confirm the redirect to `/login`. To proceed, either enable file and shell access or paste `src/app.js` and `src/middleware/auth.js`. I'll then replace the hypotheses with real findings and stop for your approval before editing anything.

Run on Claude Sonnet 5.5, 10 Nov 2026. Automatic check: 2 out of 5.

Mentioned for

Claude Code, Claude, ChatGPT, Cursor

Where it came from

Found on Web, shared by Josphat Mutai (ComputingForGeeks), updated 9 Nov 2026: Claude Code Cheat Sheet: Commands, Shortcuts and Flags.

This is our own version of the idea, written and tested by us. The original may differ.

More coding prompts

Coding Worked in our test
Generate Strict JSON Spec From Description

You get a clean, machine-readable JSON object that matches your rules on the first try. It works because the model reads the rules first, then checks its own answer against each one before replying.

Found on GitHub, shared by DominikScholz
Coding Partly worked
Match Ownership Wording to Change Size

You get a tightly scoped code change, plus a separate list of things the AI spotted but left alone. It works because you state how far the AI may go, so a sense of "ownership" does not trigger unrequested refactoring.

Found on Web, shared by explainx.ai
Coding Worked in our test
Turn Vague Bug Reports Into Concrete Objectives

You get a bug fix broken into a reproduction, a minimal change and a regression test, each checked against clear objectives. Concrete objectives stop the model drifting into large rewrites or guessing at what "fixed" means.

Found on Web, shared by David Ch (@chhddavid)