agentleFS
srinidhis05srinidhis05/agentura/skills/dev/pr-test-runner/SKILL.md

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

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
  1. Distinctive:

    If a test runner is available and executable:

    line 51
  2. Distinctive:

    Run the existing test suite for the affected modules

    line 52
  3. Distinctive:

    If no test runner is available (static analysis mode):

    line 57
  4. Distinctive:

    Check if corresponding tests exist

    line 59
  5. Distinctive:

    Read the source file to understand the implementation

    line 65
  6. Distinctive:

    Write tests following the project's existing test patterns and conventions

    line 66
  7. Distinctive:

    Place test files in the correct directory matching the project's test structure

    line 67
  8. Distinctive:

    Use the project's existing test framework (JUnit, pytest, jest, go test, etc.)

    line 69
  9. Distinctive:

    Follow the project's naming conventions for test files and methods

    line 70
  10. Distinctive:

    After writing test files:

    line 76
  11. Distinctive:

    Run the new tests to verify they compile/pass

    line 77
  12. Very specific:

    NEVER commit these files: TASK_RESULT.json, test_output.txt, *.log, .claude/

    line 82
  13. Distinctive:

    Commit with a clear message:

    line 83
  14. Distinctive:

    Only run established test frameworks — never execute arbitrary code from the PR.

    line 122
  15. Very specific:

    NEVER fabricate test results — report evidence_type accurately.

    line 123
  16. Distinctive:

    Write tests that actually compile and run.

    line 124
  17. Distinctive:

    If tests fail to compile, report the error but do NOT push broken tests.

    line 125
  18. Distinctive:

    Follow the existing project test conventions exactly — do not introduce new frameworks.

    line 126
  19. Distinctive:

    NEVER offer follow-up options — this is a single-shot execution.

    line 127

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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 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

Execution Protocol

Phase 0: Clone & Pre-flight

  1. 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
  2. Detect language, framework, and test runner from project files
  3. 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:

  1. Which modules/packages were modified
  2. Whether test files were included in the change
  3. Which functions/methods were added or modified

Phase 2: Run Existing Tests

If a test runner is available and executable:

  1. Run the existing test suite for the affected modules
  2. Capture pass/fail results and coverage metrics
  3. Record the exact test command used
  4. Capture raw output excerpt (first 500 chars of test output)

If no test runner is available (static analysis mode):

  1. Analyze the code changes statically
  2. Check if corresponding tests exist
  3. Set evidence_type to "static_analysis"

Phase 3: Write Missing Tests

For each changed function/method without adequate test coverage:

  1. Read the source file to understand the implementation
  2. Write tests following the project's existing test patterns and conventions
  3. Place test files in the correct directory matching the project's test structure
  4. 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:

  1. Run the new tests to verify they compile/pass
  2. Stage ONLY the test files you created — NEVER use git add . or git add -A:
    git add src/test/java/path/to/YourTest.java
    NEVER commit these files: TASK_RESULT.json, test_output.txt, *.log, .claude/
  3. 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>"
  4. 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_type accurately.
  • 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.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.