# Pr Test Recommender

> A Claude skill from srinidhis05/agentura.

- **Type:** Skill
- **Install:** `agentstack add skill-srinidhis05-agentura-pr-test-recommender`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [srinidhis05](https://agentstack.voostack.com/s/srinidhis05)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** Apache-2.0
- **Upstream author:** [srinidhis05](https://github.com/srinidhis05)
- **Source:** https://github.com/srinidhis05/agentura/tree/main/skills/dev/pr-test-recommender
- **Website:** https://agenturaai.tech

## Install

```sh
agentstack add skill-srinidhis05-agentura-pr-test-recommender
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# 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

```json
{
  "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.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [srinidhis05](https://github.com/srinidhis05)
- **Source:** [srinidhis05/agentura](https://github.com/srinidhis05/agentura)
- **License:** Apache-2.0
- **Homepage:** https://agenturaai.tech

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-srinidhis05-agentura-pr-test-recommender
- Seller: https://agentstack.voostack.com/s/srinidhis05
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
