Skip to content
Agent Friendly Code

Test suites: why AI coding agents need tests they can find

This check looks for tests an agent could run: a test directory, or test-named files in each language.

By Himanshu Singh · Updated · How we score →

How many repos have a test suite?

Of the 434 repos on the leaderboard, 423 pass in full (97%), 0 pass in part (0%) and 11 fail (3%).

Why do AI coding agents need tests?

Tests tell an agent whether its change worked. With them it edits, runs and corrects itself; without them it hands back code nobody has run. Claude Code's profile weighs tests as heavily as AGENTS.md.

How do I get Claude Code and other agents to test their work?

  • Put the test command, and how to run one test file, in AGENTS.md or CLAUDE.md. Claude Code's docs call the command that runs your check the most useful line in CLAUDE.md.
  • For a bug, ask for a failing test first: the docs' example prompt has Claude write a test reproducing it, then fix it.
  • Ask it to run the tests until they pass. With a pass-or-fail check, the agent makes the change, runs it, and fixes what broke.
  • To enforce it, a Stop hook in .claude/settings.json exiting with code 2 sends Claude back to work until the command passes.
  • Ask for evidence: the command it ran and its output. "All tests pass" alone tells you little.

423 of 434 leaderboard repos pass this check in full (97%). Sources: code.claude.com/best-practices (new tab).

What counts as a test suite?

  • Full pass: a tests/, test/, __tests__/, spec/, specs/, testsuite/ or src/test/ directory; a tests/, test/, __tests__/, spec/ or src/test/ in a top-level folder, or a source set such as app/src/test/ or src/commonTest/; or a test project such as .NET's App.Tests/ or Xcode's AppTests/.
  • Full pass: test-named files within four folder levels, such as *.test.ts, *_test.go, test_*.py, *Test.java, *_spec.rb, *_unittest.cc, Perl's t/*.t or a root test.js. Tests kept beside the code are a suite too.
  • 70%: no test files, but package.json has a test script other than npm's placeholder or a bare exit, true or echo.
  • Fail: none of these. We check that tests exist, not that they pass.

How checks become a score: methodology.

How do I make tests easy for AI agents to find?

Keep tests where your language expects them and put the command that runs them in AGENTS.md.

Which AI coding agents weigh tests most?

Pass rate by language

Top-scoring repos that pass

Popular repos that fail it

Every check, grouped into what to do first: how to make your repo ready for AI coding agents.