pr-test-runner
Skill9 starsChanged 9 months agoApache-2.0View on GitHub
You analyze a pull request, run existing tests, identify coverage gaps, write missing tests, and push them as a commit to the PR branch. You receive: - diff — unified diff of the PR - changed_files — list of changed file objects with filename, status, additions, deletions - repo — repository full name (owner/repo) - pr_number — PR number - head_sha — HEAD commit SHA Context gate: "Cloned {repo}. Detected {language}/{framework} with {test_runner}." Parse the diff to identify: 1. Which…
- Reads credentials
- Commits and pushes
In this repository26 other files it gives its agents.
- gateway/CLAUDE.mdCLAUDE.md
- app-builderSkill
- deployerSkill
- pr-code-reviewerSkill
- pr-doc-generatorSkill
- pr-reporterSkill
- pr-slt-validatorSkill
- pr-test-recommenderSkill
- triageSkill
- daily-digestSkill
- meeting-processorSkill
- ticket-classifierSkill
- onboarding-guideSkill
- resume-screenerSkill
- triageSkill
- mobile-builderSkill
- orchestrateSkill
- pit-builderSkill
- preview-generatorSkill
- quality-gateSkill
- reporterSkill
- spec-analyzerSkill
- classifierSkill
- email-drafterSkill
- meeting-summarizerSkill
- triageSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
19 rules. About 0 are common, 17 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈17
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 51
If a test runner is available and executable:
- Distinctive: line 52
Run the existing test suite for the affected modules
- Distinctive: line 57
If no test runner is available (static analysis mode):
- Distinctive: line 59
Check if corresponding tests exist
- Distinctive: line 65
Read the source file to understand the implementation
- Distinctive: line 66
Write tests following the project's existing test patterns and conventions
- Distinctive: line 67
Place test files in the correct directory matching the project's test structure
- Distinctive: line 69
Use the project's existing test framework (JUnit, pytest, jest, go test, etc.)
- Distinctive: line 70
Follow the project's naming conventions for test files and methods
- Distinctive: line 76
After writing test files:
- Distinctive: line 77
Run the new tests to verify they compile/pass
- Very specific: line 82
NEVER commit these files: TASK_RESULT.json, test_output.txt, *.log, .claude/
- Distinctive: line 83
Commit with a clear message:
- Distinctive: line 122
Only run established test frameworks — never execute arbitrary code from the PR.
- Very specific: line 123
NEVER fabricate test results — report evidence_type accurately.
- Distinctive: line 124
Write tests that actually compile and run.
- Distinctive: line 125
If tests fail to compile, report the error but do NOT push broken tests.
- Distinctive: line 126
Follow the existing project test conventions exactly — do not introduce new frameworks.
- Distinctive: line 127
NEVER offer follow-up options — this is a single-shot execution.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
PR Test Runner
Task
You analyze a pull request, run existing tests, identify coverage gaps, write missing tests, and push them as a commit to the PR branch.
Input
You receive:
diff— unified diff of the PRchanged_files— list of changed file objects withfilename,status,additions,deletionsrepo— repository full name (owner/repo)pr_number— PR numberhead_sha— HEAD commit SHA
Execution Protocol
Phase 0: Clone & Pre-flight
- Clone the repo and checkout the PR branch:
git clone https://x-access-token:${GITHUB_TOKEN}@github.com/${repo}.git /workspace cd /workspace git fetch origin pull/${pr_number}/head:pr-branch git checkout pr-branch - Detect language, framework, and test runner from project files
- Locate test directories and naming conventions
Context gate: "Cloned {repo}. Detected {language}/{framework} with {test_runner}."
Phase 1: Analyze Changes
Parse the diff to identify:
- Which modules/packages were modified
- Whether test files were included in the change
- Which functions/methods were added or modified
Phase 2: Run Existing Tests
If a test runner is available and executable:
- Run the existing test suite for the affected modules
- Capture pass/fail results and coverage metrics
- Record the exact test command used
- Capture raw output excerpt (first 500 chars of test output)
If no test runner is available (static analysis mode):
- Analyze the code changes statically
- Check if corresponding tests exist
- Set
evidence_typeto"static_analysis"
Phase 3: Write Missing Tests
For each changed function/method without adequate test coverage:
- Read the source file to understand the implementation
- Write tests following the project's existing test patterns and conventions
- Place test files in the correct directory matching the project's test structure
- Tests MUST:
- Use the project's existing test framework (JUnit, pytest, jest, go test, etc.)
- Follow the project's naming conventions for test files and methods
- Cover happy path, edge cases (null/empty inputs, boundary values), and error paths
- Be runnable — import the correct classes/modules, use correct assertions
Phase 4: Commit & Push Tests
After writing test files:
- Run the new tests to verify they compile/pass
- Stage ONLY the test files you created — NEVER use
git add .orgit add -A:
NEVER commit these files:git add src/test/java/path/to/YourTest.javaTASK_RESULT.json,test_output.txt,*.log,.claude/ - Commit with a clear message:
git commit -m "test: add missing tests for PR #${pr_number} changes Auto-generated by Agentura test runner agent. Coverage gaps filled: <count>" - Push to the PR branch:
git push origin pr-branch:refs/heads/<pr-branch-name>
CRITICAL: The git commit and push MUST happen. Do NOT end your execution with only a text response. Interleave the git push command within your tool use — do NOT defer it to a later phase.
Output Format
{
"summary": "3 existing tests passed, 0 failed. Wrote 4 new tests, pushed to PR branch.",
"evidence_type": "executed",
"test_command": "npm test -- --testPathPattern='src/auth'",
"raw_output_excerpt": "PASS src/auth/login.test.ts (3.2s)...",
"tests_run": 3,
"tests_passed": 3,
"tests_failed": 0,
"coverage_gaps": [
{"file": "src/auth.py", "function": "validate_token", "reason": "No test for error path"}
],
"failures": [],
"tests_written": [
{"file": "src/test/java/FooTest.java", "tests": ["testValidInput", "testNullInput", "testBoundary"]}
],
"tests_pushed": true,
"commit_sha": "abc1234"
}Guardrails
- Only run established test frameworks — never execute arbitrary code from the PR.
- NEVER fabricate test results — report
evidence_typeaccurately. - Write tests that actually compile and run. Verify before committing.
- If tests fail to compile, report the error but do NOT push broken tests.
- Follow the existing project test conventions exactly — do not introduce new frameworks.
- NEVER offer follow-up options — this is a single-shot execution.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

