{
  "id": 10004820,
  "title": "Claude Code said \"Done.\" My tests said otherwise. Here's the 20-line fix.",
  "url": "https://urgent.news/2026/09/26/claude-code-said-done-my-tests-said-otherwise-heres-the-20-line-fix",
  "topic": "ai",
  "section": "AI",
  "published": "2026-09-26T15:08:37.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/elijahmanlockedin112/claude-code-said-done-my-tests-said-otherwise-heres-the-20-line-fix-jc"
  },
  "original_language": "en",
  "account": "Claude Code is a tool that integrates Claude's language model with the coding process. When using Claude Code, users have observed that partial refunds are implemented, but subsequent tests reveal issues. The problem arises because Claude stops once it appears to have completed its task, without any indication that tests have failed. To address this, a 20-line fix has been developed to ensure Claude runs tests before declaring a task complete. This solution leverages hooks in Claude Code, which are scripts executed at specific points in the tool's loop. By implementing a Stop hook, Claude is forced to perform the verification process before allowing the task to be marked as finished. The hook checks for test failures by running a specified command and evaluating its exit code. If the command fails, Claude is stopped and prompted to fix the issues before proceeding. This approach enhances the quality of the output generated by Claude Code by incorporating automated testing, improving reliability by a factor of 2-3 times. However, the effectiveness of the fix depends on the appropriateness of the verification command specified in the .claude/verify.txt file. A well-designed command should exit with a non-zero status on failure, run without prompts, and be fast enough to run at each stop. Additionally, the check should cover the relevant part of the code being worked on and ideally combine typechecking with the necessary tests for comprehensive validation. One potential limitation is that the 20-line version may not be sufficient for complex projects or extensive testing suites, as it relies on a single verification command. A more robust solution might involve running multiple checks or integrating with existing CI/CD pipelines for a more thorough verification process.",
  "summary": "If you use Claude Code, you've seen this: claude: Done! Partial refunds are implemented. ✅ Then you run the tests yourself and four of them fail. Claude isn't lying. It stops when the work looks done, because it has no other signal. If nothing tells it the tests are red, \"looks done\" is all it has. So you become the test runner: you check, paste the errors back, wait, and check again. This post…",
  "key_points": [
    "Claude Code stops tasks prematurely without testing results",
    "20-line fix adds Stop hook to verify tests before completion",
    "Enhanced reliability by 2-3 times with appropriate verification command"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}