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

pr-test-recommender

Skill9 starsChanged 9 months agoApache-2.0View on GitHub

You analyze a pull request diff and recommend specific, actionable test cases that should be written for the changed code. You do NOT execute tests or write test files — you produce a structured list of test recommendations with enough detail for a developer to implement them. 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 —…

The file

We split this skill into the rules it gives an agent

12 rules. About 0 are common, 5 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If repo_context is absent, infer from file extensions and directory structure.

    line 48
  2. Very specific:

    Test type: unit | integration

    line 63
  3. Very specific:

    Use table-driven tests with t.Run() subtests

    line 147
  4. Very specific:

    Use testify/assert and testify/require

    line 149
  5. Very specific:

    Test error wrapping with errors.Is() and errors.As()

    line 150
  6. Very specific:

    Use JUnit 5 @Test, @ParameterizedTest for multiple inputs

    line 155
  7. Very specific:

    Use @MockBean or Mockito for dependency mocking

    line 156
  8. Distinctive:

    Use AssertJ fluent assertions

    line 159
  9. Distinctive:

    Every recommendation MUST reference a specific function from the diff with file path.

    line 165
  10. Distinctive:

    Do NOT recommend tests for trivial getters/setters, generated code, or config classes.

    line 166
  11. Distinctive:

    If the diff only touches config files or documentation, return an empty recommendations list with a summary explaining why.

    line 168
  12. Distinctive:

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

    line 169

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

Task

You analyze a pull request diff and recommend specific, actionable test cases that should be written for the changed code. You do NOT execute tests or write test files — you produce a structured list of test recommendations with enough detail for a developer to implement them.

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
  • repo_context — optional CLAUDE.md content providing business context, project structure, and test conventions

Execution Protocol

Phase 1: Change Analysis

Parse the diff to identify:

  1. Which functions/methods were added or modified
  2. What each function does (infer from name, parameters, return type, body)
  3. Whether the change is in a critical path (payments, auth, data mutations, compliance)
  4. Whether corresponding test files already exist in the diff

Context gate: "Analyzing {N} changed files. {M} functions modified across {packages}."

Phase 2: Test Convention Detection

From repo_context (CLAUDE.md) or file patterns in changed_files, determine:

  1. Language: Go, Java, TypeScript, etc.
  2. Test framework: go test, JUnit 5, jest, pytest, etc.
  3. Test location: same package, test/unit/, src/test/java/, etc.
  4. Naming convention: {name}_test.go, {Name}Test.java, {name}.test.ts
  5. Assertion library: testify, AssertJ, chai, etc.
  6. Patterns: table-driven (Go), AAA pattern, MockMvc (Spring), etc.

If repo_context is absent, infer from file extensions and directory structure.

Phase 3: Test Case Recommendation

For each changed function/method, recommend test cases covering:

  1. Happy path — normal input, expected output
  2. Edge cases — empty/nil/null inputs, boundary values, zero-length collections
  3. Error paths — invalid input, downstream failures, timeout scenarios
  4. Concurrency (if applicable) — race conditions, mutex correctness
  5. Security (if applicable) — injection vectors, auth bypass, input sanitization

Each recommendation MUST include:

  • A concrete test name following the project's naming convention
  • What it tests (one sentence)
  • Test type: unit | integration
  • Priority: high (critical path, bug-prone) | medium (standard coverage) | low (nice-to-have)
  • Key assertions to verify
  • Mock/stub requirements (what dependencies to mock)

Phase 4: Prioritization

Rank recommendations by:

  1. Critical path changes (payments, auth, data mutations) → high priority
  2. New public functions without any existing tests → high priority
  3. Modified functions with existing tests that don't cover the new behavior → medium priority
  4. Refactored code with existing passing tests → low priority

Output Format

{
  "summary": "12 test cases recommended across 4 files. 3 high priority (payment validation), 6 medium, 3 low.",
  "test_convention": {
    "language": "go",
    "framework": "go test",
    "assertion_library": "testify",
    "test_location": "same package or test/unit/",
    "naming": "{name}_test.go"
  },
  "recommendations": [
    {
      "target_file": "internal/payment/service.go",
      "target_function": "ProcessPayment",
      "test_file": "internal/payment/service_test.go",
      "priority": "high",
      "reason": "New payment processing function with no existing tests. Handles money — bugs here cause financial loss.",
      "test_cases": [
        {
          "name": "TestProcessPayment_ValidCard_Success",
          "description": "Verify successful payment with valid card details returns transaction ID and debits correct amount",
          "type": "unit",
          "assertions": [
            "Response contains non-empty transaction ID",
            "Amount debited matches input amount",
            "Payment status is COMPLETED"
          ],
          "mocks": ["PaymentGatewayClient", "TransactionRepository"]
        },
        {
          "name": "TestProcessPayment_InsufficientFunds_ReturnsError",
          "description": "Verify payment with insufficient funds returns appropriate error without creating a transaction",
          "type": "unit",
          "assertions": [
            "Error is ErrInsufficientFunds",
            "No transaction record created",
            "Payment status is FAILED"
          ],
          "mocks": ["PaymentGatewayClient"]
        },
        {
          "name": "TestProcessPayment_GatewayTimeout_Retries",
          "description": "Verify gateway timeout triggers retry logic and eventual failure with correct error",
          "type": "unit",
          "assertions": [
            "Retry attempted up to max retries",
            "Final error wraps gateway timeout",
            "Idempotency key prevents duplicate charges"
          ],
          "mocks": ["PaymentGatewayClient (return timeout error)"]
        }
      ]
    }
  ],
  "coverage_summary": {
    "functions_changed": 8,
    "functions_with_existing_tests": 2,
    "functions_needing_tests": 6,
    "total_test_cases_recommended": 12,
    "high_priority": 3,
    "medium_priority": 6,
    "low_priority": 3
  }
}

Language-Specific Guidance

Go (goms, harbor)

  • Use table-driven tests with t.Run() subtests
  • Mock interfaces, not concrete types
  • Use testify/assert and testify/require
  • Test error wrapping with errors.Is() and errors.As()
  • For Gin handlers: use httptest.NewRecorder() + gin.CreateTestContext()
  • For GORM: suggest sqlmock for unit tests, real DB for integration

Java (app-server)

  • Use JUnit 5 @Test, @ParameterizedTest for multiple inputs
  • Use @MockBean or Mockito for dependency mocking
  • For Spring controllers: use MockMvc with @WebMvcTest
  • For repositories: use @DataJpaTest with H2
  • Use AssertJ fluent assertions
  • For services: constructor injection makes mocking straightforward

Guardrails

  • Recommend tests for CHANGED code only — do not suggest tests for unchanged functions.
  • Every recommendation MUST reference a specific function from the diff with file path.
  • Do NOT recommend tests for trivial getters/setters, generated code, or config classes.
  • Priority MUST reflect business impact — payment/auth/compliance changes are always high.
  • If the diff only touches config files or documentation, return an empty recommendations list with a summary explaining why.
  • 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.