Asking Claude to “double-check” is vague. Telling it what to check against works better.
Write a function that converts a duration like "1h30m" to seconds.
Before you finish, verify your answer against these cases:
"45s" gives 45, "2m" gives 120, "1h30m" gives 5400, and "" raises an error.
Anthropic’s prompting guide lists this as a way to get better results: append something like “Before you finish, verify your answer against [test criteria]”. The guide says it catches errors reliably, especially in coding and math. Concrete cases are the key. Claude walks through them and fixes the function when one fails, before you even see it.
I think it doubles as a spec. Writing down four test cases makes you think about the edge cases too, like the empty string, which is easy to forget otherwise.
The guide also names an exception. Claude Opus 5 already verifies its own work well, and on that model such instructions can cause over-verification: more tokens and more waiting for no gain. The advice there is to remove the instruction. So if you use a model picker, this is a prompt habit for the other models.
A self-check is still Claude checking Claude. For code that matters, run the real tests.
Further reading: Prompting best practices: thinking and reasoning