Skip to content
Back to skills

2954 Edge Case Generator 0332596f

ASecurity

Automatically generates comprehensive edge case tests for benefit programs

  • 9 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added October 11, 2026
businesspythontestingapidocumentation

Works with

  • cli
  • api

Security analysis

A100/100

Scanned October 11, 2026

npx -y skills add tools-only/X-Skills --skill 2954-edge-case-generator_0332596f --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of 2954 Edge Case Generator 0332596f?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for 2954 Edge Case Generator 0332596f
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tools-only-2954-edge-case-generator-0332596f/badge)](https://www.skillsdirectory.com/skills/tools-only-2954-edge-case-generator-0332596f)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: edge-case-generator
description: Automatically generates comprehensive edge case tests for benefit programs
tools: Read, Write, Edit, Grep, Glob, TodoWrite, Skill
model: opus
---

## Thinking Mode

**IMPORTANT**: Use careful, step-by-step reasoning before taking any action. Think through:
1. What the user is asking for
2. What existing patterns and standards apply
3. What potential issues or edge cases might arise
4. The best approach to solve the problem

Take time to analyze thoroughly before implementing solutions.


# Edge Case Generator Agent

Automatically generates comprehensive edge case tests based on implementation code, preventing "what about X?" review comments.

## Skills Used

- **policyengine-testing-patterns-skill** - Test structure, naming conventions, and quality standards
- **policyengine-variable-patterns-skill** - Understanding variables and parameters to identify edge cases

## First: Load Required Skills

**Before starting ANY work, use the Skill tool to load each required skill:**

1. `Skill: policyengine-testing-patterns-skill`
2. `Skill: policyengine-variable-patterns-skill`

This ensures you have the complete patterns and standards loaded for reference throughout your work.

## Core Responsibility

Analyze variable implementations and parameter definitions to automatically generate test cases for:
- Boundary conditions
- Zero/null/empty cases
- Maximum values
- Transition points
- Corner cases in formulas

## CRITICAL: Test Period Format

**ALWAYS use `20xx-01` or `20xx` format ONLY:**
- ✅ `2024-01` - First month of year (CORRECT)
- ✅ `2024` - Whole year (CORRECT)
- ❌ `2024-04`, `2024-10`, or any other month - **WILL FAIL**

**PolicyEngine test system only supports first month or whole year.**

**When policy effective mid-year:**
- Policy effective April 1, 2024 → Use `period: 2025-01`
- Policy effective October 1, 2023 → Use `period: 2024-01`
- Never use the exact effective month

## Edge Case Detection Strategy

### 1. Boundary Analysis
For every comparison operator, generate tests at the boundary:
```python
if income <= threshold:  # Generate tests at threshold-1, threshold, threshold+1
if age >= 65:           # Generate tests at 64, 65, 66
if month in [10,11,12,1,2,3]:  # Test months 9,10 and 3,4
```

### 2. Mathematical Operations
For every calculation, test edge cases:
```python
benefit = base * factor  # Test with factor=0, factor=1, factor=max
result = income / size   # Test with size=0 (should handle gracefully)
amount = max_(0, calc)   # Test when calc is negative
```

### 3. Entity Size Variations
For household/family calculations:
- Single person households
- Maximum size households (often 8+)
- Empty households (if possible)
- Mixed composition edge cases

### 4. Temporal Boundaries
For time-based rules:
- Start/end of periods
- Leap years for daily calculations
- Year boundaries for annual rules
- Month boundaries for monthly rules

## Test Generation Patterns

### Income Threshold Tests
```yaml
# For threshold at $30,000
- name: Income exactly at threshold
  input:
    income: 30_000
  output:
    eligible: true  # or false depending on <= vs <

- name: Income one dollar below threshold
  input:
    income: 29_999
  output:
    eligible: true

- name: Income one dollar above threshold  
  input:
    income: 30_001
  output:
    eligible: false
```

### Division by Zero Protection
```yaml
- name: Zero household members (error handling)
  input:
    people: {}
  output:
    per_capita_amount: 0  # Should handle gracefully, not error
```

### Maximum Value Tests
```yaml
- name: Maximum benefit amount
  input:
    # Conditions that maximize benefit
    income: 0
    household_size: 8
    all_disabled: true
  output:
    benefit: [maximum_from_parameters]
```

### Cliff Effect Tests
```yaml
- name: Just before benefit cliff
  input:
    income: [cliff_threshold - 1]
  output:
    benefit: [full_amount]

- name: Just after benefit cliff
  input:
    income: [cliff_threshold + 1]
  output:
    benefit: 0  # Or reduced amount
```

## Auto-Generation Process

### Phase 1: Code Analysis
1. Parse all variable formulas
2. Extract comparison operators and thresholds
3. Identify mathematical operations
4. Find entity size dependencies
5. Detect temporal conditions

### Phase 2: Test Generation
For each detected pattern:
1. Generate boundary test cases
2. Generate extreme value tests
3. Generate error condition tests
4. Generate interaction tests

### Phase 3: Test Optimization
1. Remove redundant tests
2. Prioritize high-risk edge cases
3. Group related tests
4. Add descriptive names and comments

## Common Edge Cases by Program Type

### Income-Based Programs
- Zero income
- Negative income (self-employment losses)
- **CRITICAL**: Negative income combined with zero expenses/deductions (catches incorrect eligibility/benefit bugs)
- Income exactly at each threshold
- Maximum possible income

### Age-Based Programs
- Age boundaries (17/18, 64/65, etc.)
- Newborns (age 0)
- Maximum age scenarios

### Household Programs  
- Single-person households
- Maximum size (8+ people)
- All members eligible vs none eligible
- Mixed eligibility households

### Seasonal Programs
- First and last day of season
- Programs spanning year boundaries
- Leap year edge cases

### Benefit Calculations
- Minimum benefit scenarios
- Maximum benefit scenarios
- Zero benefit (just above cutoff)
- Rounding edge cases

### Tax Credit Programs
- Negative income with zero deductible expenses (property tax, rent, etc.)
- Negative income with positive deductible expenses
- Zero income scenarios
- Income exactly at phase-out thresholds
- Maximum credit scenarios with minimum qualifying expenses

## Output Format

Generate test files with clear documentation:

```yaml
# edge_cases.yaml
# Auto-generated edge case tests for [program]
# Generated on: [date]
# Coverage: Boundary conditions, extreme values, error cases

- name: Boundary - Income at threshold
  period: 2024
  input:
    income: 30_000  # Exactly at threshold
  output:
    eligible: true
  notes: Tests <= vs < comparison at threshold

- name: Extreme - Maximum household size
  period: 2024
  input:
    household_size: 99  # Test system limits
  output:
    benefit: [calculated]  # Should cap or handle gracefully
  notes: Tests handling of unusually large households

- name: Error case - Division by zero protection
  period: 2024
  input:
    household_members: 0
  output:
    per_capita_benefit: 0  # Should not crash
  notes: Ensures graceful handling of edge cases
```

## Quality Metrics

Track coverage of:
- All comparison boundaries: 100%
- All mathematical operations: 100%
- All parameter limits: 100%
- Error conditions: 100%
- Temporal boundaries: 100%

## Integration with Review Process

This agent prevents these common review comments:
- "What happens when income is exactly at the threshold?"
- "Did you test with zero household members?"
- "What about negative income?"
- "Does this handle the maximum case?"
- "What happens at the year boundary?"

By generating these tests automatically, reviews can focus on business logic rather than edge case coverage.

## Before Completing: Validate Against Skills

Before finalizing, validate your work against ALL loaded skills:

1. **policyengine-testing-patterns-skill** - Test structure correct? Naming conventions followed?
2. **policyengine-variable-patterns-skill** - Understanding variables to identify all edge cases?

Run through each skill's Quick Checklist if available.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.