kotlin/running_gradle_tests
> Executes and diagnoses Gradle tests with high-precision `--tests` filtering, surgical per-test failure isolation, and full stack traces; ALWAYS use instead of `./gradlew test` for test execution, failure investigation, and post-mortem analysis. Do NOT use for general build lifecycle tasks (use `running_gradle_builds`) or dependency auditing.
npx skills add https://github.com/Kotlin/kotlinx-rpc --skill running_gradle_tests
Executes tests with deep diagnostic tools to isolate and fix failures fast, ensuring maximum code quality and build reliability.
gradle tool instead of ./gradlew via shell.--tests flag for surgical test selection to minimize feedback loops.projectRoot.background: true for managed background orchestration when context isolation and non-blocking exploration are required.inspect_build for all test diagnostics. It provides isolated output and full stack traces that are often truncated in the main console.inspect_build with mode: "details" and testName="..." to access full test output and stack traces.taskPath or captureTaskOutput to investigate specific test failures; these provide the overall task log which is often truncated and lacks per-test isolation.inspect_buildWhen tests fail, inspect_build is your most powerful diagnostic tool. It provides isolated output and full stack traces that are often truncated in the main console.
Use testOutcome="FAILED" to quickly see which tests failed without being overwhelmed by logs.
inspect_build(buildId="ID", testOutcome="FAILED")CRITICAL: ALWAYS use mode="details" and testName to see the complete stdout, stderr, and stack trace for a specific test.
testName="com.example.MyTest" instead of the full FQN). If the prefix is unique, the tool will automatically select the test. If ambiguous, it willreturn a list of matching names for refinement.
inspect_build(buildId="ID", mode="details", testName="com.example.MyTest.myMethod")Use testName with the default mode="summary" to see all executions of a test (e.g., across different projects or iterations).
inspect_build(buildId="ID", testName="MyTest")Use timeout, waitFor, or waitForTask to block until a condition is met in a background test run.
inspect_build(buildId="ID", timeout=60, waitForTask=":app:test")timeout is set without a wait condition, the tool waits for the build to finish.immediately call inspect_build(timeout=...).
background: true ONLY for test suites that take a long time to run and you explicitly intend to perform independent research while they proceed.gradle tool uses progressive disclosure to provide concise summaries and structured results, keeping session history clean and efficient.inspect_build: Use inspect_build to check the status of background test runs or to retrieve structured output and stack traces for failed tests.inspect_build(failures={}) to check for compilation or configuration issues.testName option in inspect_build with mode="details" to isolate specific failure details. For detailed diagnostic workflows, see the test_diagnostics.md reference.The --tests flag supports powerful, high-precision filtering. Use these patterns to minimize execution time and context noise.
--tests com.example.MyTest--tests com.example.MyTest.myTestMethod--tests com.example.MyTest.test* (Runs all methods starting with 'test')* and ?)--tests com.example.service.* (Runs all tests in the 'service' package)--tests *IntegrationTest (Runs all classes ending in 'IntegrationTest')--tests com.example.Test? (Matches Test1, TestA, etc.)--tests flags to run a specific selection of tests.gradle(commandLine=["test", "--tests", "ClassA", "--tests", "ClassB"])Understanding how to target tests in a multi-project build is critical to avoid running more tests than necessary.
Providing test without a leading colon executes the test task in every project (root and all subprojects) that has one.
gradle(commandLine=["test", "--tests", "MyTest"]) -> Searches for and runs 'MyTest' in all projects.Providing a path with a leading colon targets a single specific project.
gradle(commandLine=[":test", "--tests", "MyTest"])gradle(commandLine=[":app:test", "--tests", "MyTest"])--tests) to minimize feedback loops.:app) and the test filter (e.g., com.example.MyTestClass*).gradle with commandLine including --tests.BuildId from the result.inspect_build(buildId=ID, testOutcome="FAILED") to list all failed tests.inspect_build(buildId=ID, mode="details", testName=TNAME) to see the full output and stack trace for a specific test.taskPath or captureTaskOutput for this.{
"commandLine": [":module-a:test", "--tests", "com.example.service.MyServiceTest"]
}
// Reasoning: Using an absolute task path and exact class filter for the fastest possible feedback loop.
{
"buildId": "build_20240301_130000_def456",
"testOutcome": "FAILED"
}
// Reasoning: Using inspect_build to isolate only the failures from a large test suite.
### Look up details for a specific failed test
{
"buildId": "build_20240301_130000_def456",
"mode": "details",
"testName": "com.example.a.MyTest.shouldFail"
}
// Reasoning: Retrieving the full stack trace and isolated stdout/stderr for a specific failure.
invocationArguments: { envSource: "SHELL" } if Gradle cannot find expected env vars (e.g., JAVA_HOME).Take kotlin/running_gradle_tests from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.