AgentSkillsCN

running-tests

运行测试并处理失败。触发条件:测试执行、验证、测试失败、CI检查。

SKILL.md
--- frontmatter
name: running-tests
description: >
  Runs tests and handles failures.
  Triggered when: test execution, verification, test failures, CI checks.
allowed-tools: Read, Bash, Glob, Grep

Test Command Detection

  1. Check CLAUDE.md for project-specific test command
  2. Auto-detect if not specified:
FileCommand
package.jsonnpm test
Cargo.tomlcargo test
justfilejust test
Makefilemake test
pyproject.tomlpytest
go.modgo test ./...
  1. Ask user if not found

Test Execution

Run the detected command and report:

  • Pass/Fail status
  • Failed test names (if any)
  • Error messages (if any)

Failure Handling

  1. Analyze failure cause
  2. Determine root cause:
CauseAction
Implementation bugFix and commit
Test bugFix test and commit
Environment issueReport to manager
  1. Re-run tests after fix
  2. Confirm all tests pass

Completion Report

  • Test result (pass/fail)
  • Test count
  • Fixes applied (if any)
  • Additional commits (if any)