A walkthrough of using AI Agent Skills combined with code coverage tooling to deterministically debug flaky tests. The approach records per-line hit counts from IntelliJ IDEA's coverage agent across multiple test runs, diffs the results to find lines with varying execution counts, and uses that to pinpoint race conditions like TOCTOU bugs. The entire procedure is then packaged into a reusable SKILL.md file so an AI agent can follow the same steps autonomously in future sessions without manual prompting. The coverage agent update (v1.0.774) adding text output is already published, and the Skill is available on GitHub.
Table of contents
The problemExample projectThe intuitionBuild the toolsTurning it into a SkillTesting the SkillSummarySort: