Write test cases

From juicesharp/rpiv-pi · View interactive version

Write test cases is an AI agent skill from the GitHub repository juicesharp/rpiv-pi. Generate manual test case specifications for a single feature by analyzing code in parallel. Consumes outline-test-cases _meta.md when available for warm-start. Produces flow-based test cases with regression suite and project-wide coverage map. Outputs to .rpiv/test-cases/{feature}/ in the target pr

How to use this skill

Skill file

Write Test Cases

You are tasked with generating manual test case specifications for a single feature by analyzing code in parallel and producing flow-based test case documents for QA teams.

Initial Setup

When this command is invoked, respond with:

I'll generate test cases for this feature. Let me discover the relevant code and analyze it.

Then proceed to Step 1.

Steps

Step 1: Determine Feature Scope

Parse the user's input to determine the feature under test. Handle these input forms:

  1. _meta.md path (e.g., .rpiv/test-cases/users/_meta.md):
  1. Feature folder or slug (e.g., .rpiv/test-cases/order-management/ or order-management):
  1. Source code path (e.g., src/orders/ or src/api/controllers/OrdersController.ts):
  1. Feature name with optional instructions (e.g., Order Management focus on refund edge cases):
  1. No arguments provided:

```

I'll help you generate test cases. Please provide either:

1. A feature name: /skill:write-test-cases Order Management

2. A component path: /skill:write-test-cases src/orders/

3. A feature slug: /skill:write-test-cases order-management

4. A _meta.md path: /skill:write-test-cases .rpiv/test-cases/orders/_meta.md

Add instructions after the feature: /skill:write-test-cases Order Management focus on refund edge cases

```

Then wait for input.

Warm-Start from _meta.md

When _meta.md is available, read it FULLY and extract:

Report:

[Warm-start]: Found _meta.md for "{feature}" ({module}, {portal}). {N} routes, {M} endpoints.

When no _meta.md, detect the project's technology stack before spawning agents: check package.json for framework indicators (see Framework Detection Reference at end of document). If no package.json, check for .csproj/.sln (.NET), pyproject.toml/requirements.txt (Python). Use the detected framework to adapt Agent A's prompt in Step 2.

Step 2: Discover Feature Code (parallel agents)

Spawn the following agents in parallel using the Agent tool:

Agent A — Web Layer Discovery:

{framework_hint} is " in this {Framework} project" when a framework is detected (e.g., " in this Angular project"), or empty string if none detected. See Framework Detection Reference at end of document.

Agent B — Existing Test Cases:

Wait for both agents to complete before proceeding.

Step 3: Analyze Feature Code (parallel agents)

Using the entry points discovered in Step 2 (validated against _meta.md when available), spawn analysis agents in parallel. When _meta.md is available, enrich prompts: append scope exclusions from ## Scope Decisions as {scope_context}, domain rules from ## Domain Context as {domain_context}, and endpoint list as {endpoint_scope}. When no _meta.md, omit these.

Agent C — Code Analysis:

Agent D — Postcondition Discovery:

Wait for ALL agents to complete before proceeding.

Step 4: Synthesize Findings

Compile all agent results into a feature analysis:

  1. Map user flows — Group the discovered endpoints/pages into logical user journeys:
  1. Enrich with postconditions — For each flow, attach the side effects discovered by the integration-scanner:
  1. Check for duplicates — Cross-reference synthesized flows against existing TCs from test-case-locator:
  1. Assign priorities:
  1. Determine test case IDs:

Do NOT write test cases yet — proceed to the developer checkpoint first.

Step 5: Developer Checkpoint

Present a flow summary, then ask grounded questions one at a time.

Flow summary (under 20 lines):

## Feature: [Feature Name]

Entry points: [N] endpoints across [M] web layers
Postconditions: [K] side effects discovered
Existing TCs: [X] found (will skip duplicates)

### Proposed Test Cases:
1. TC-{MOD}-001: {Flow title} (priority: high)
   Steps: {brief flow summary — e.g., "browse -> add to cart -> checkout -> payment -> confirm"}
2. TC-{MOD}-002: {Flow title} (priority: medium)
   Steps: {brief flow summary}
[etc.]

Flows skipped (already covered): [list or "none"]

When _meta.md is available, prepend:

### Prior Scope Decisions (from outline):
- {decision 1}
- {decision 2}
These are carried forward. I'll only ask about new findings.

Then ask grounded questions — one at a time. Use a ❓ Question: prefix so the developer knows their input is needed. Each question must reference real findings with file:line evidence and pull NEW information from the developer. Focus on:

When _meta.md is available: skip questions already answered in ## Checkpoint History. Only ask about new findings not covered by prior decisions.

CRITICAL: Ask ONE question at a time. Wait for the answer before asking the next. Lead with your most significant finding.

Choosing question format:

"❓ Question: Integration scanner found no background job registration for this area. Is that expected, or is there async processing I'm not seeing?"

Batching: When you have 2-4 independent questions (answers don't depend on each other), you MAY batch them in a single ask_user_question call. Keep dependent questions sequential.

Classify each response:

Corrections (e.g., "that flow doesn't exist", "wrong priority"):

Missing flows (e.g., "you missed the bulk export feature"):

Scope adjustments (e.g., "skip admin flows, focus on customer portal"):

Confirmations (e.g., "looks good", "yes proceed"):

Step 6: Generate Test Case Documents

Read the templates before writing:

See examples/order-placement-flow.md (e-commerce order flow), examples/customer-auth-flow.md (authentication flow), and examples/team-management-flow.md (SaaS team management flow) for well-formed test case examples.

What makes these examples good:

See examples/order-management-suite.md and examples/team-management-suite.md for well-formed regression suite examples.

What makes these examples good:

For each confirmed flow, generate a test case document:

After all TCs, generate the regression suite document:

Step 7: Write Files & Update Artifacts

  1. Determine output directory:
  1. Write all files at once using the Write tool:
  1. Update _meta.md (when it exists):
  1. Rebuild root coverage map at .rpiv/test-cases/_coverage-map.md:
  1. Present summary:

```

## Test Cases Written

| File | Priority | Flow |

|------|----------|------|

| TC-ORD-001_place-order.md | high | Place and confirm order |

| TC-ORD-002_cancel-order.md | medium | Cancel order before fulfillment |

| _regression-suite.md | — | Feature summary (N TCs, ~Xm execution) |

| _coverage-map.md | — | Project-wide coverage (N features, M TCs) |

Output: .rpiv/test-cases/{feature-slug}/

Total: [N] test cases + 1 regression suite + 1 coverage map

Review the generated test cases and let me know if you'd like adjustments.

```

Step 8: Handle Follow-ups

On any TC change: always regenerate _regression-suite.md and _coverage-map.md to keep them in sync.

Framework Detection Reference

| Indicator | Framework | Detection |

|-----------|-----------|-----------|

| @angular/core | Angular | package.json dependencies |

| react-router-dom / react-router / @react-router | React | package.json dependencies |

| next | Next.js | package.json dependencies |

| vue-router | Vue Router | package.json dependencies |

| nuxt | Nuxt | package.json dependencies |

| .csproj / .sln | .NET | File presence in project root |

| pyproject.toml / requirements.txt with Django/Flask/FastAPI | Python | File presence + dependency check |

| None found | Backend-only | Fallback — omit framework hint |

Important Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.