Skip to main content
ClaudeWave
Skill85 estrellas del repoactualizado 3mo ago

edge-case-generator

Automatically identify potential boundary and exception cases from requirements, specifications, or existing code, and generate comprehensive test cases targeting boundary conditions, edge cases, and uncommon scenarios. Use this skill when analyzing programs, code repositories, functions, or APIs to discover and test corner cases, null handling, overflow conditions, empty inputs, concurrent access patterns, and other exceptional scenarios that are often missed in standard testing.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/ArabelaTso/Skills-4-SE /tmp/edge-case-generator && cp -r /tmp/edge-case-generator/skills/edge-case-generator ~/.claude/skills/edge-case-generator
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# Edge Case Generator

Systematically identify boundary conditions, edge cases, and exceptional scenarios, then generate comprehensive tests to validate software behavior under uncommon conditions.

## Core Capabilities

### 1. Edge Case Identification

Analyze code, specifications, or requirements to identify:

- **Boundary values**: Min/max limits, zero, empty, first/last elements
- **Null and undefined**: Missing data, null pointers, undefined references
- **Type boundaries**: Integer overflow, floating-point precision, type mismatches
- **Collection edge cases**: Empty collections, single element, duplicates
- **State transitions**: Invalid state sequences, concurrent modifications
- **Resource limits**: Memory exhaustion, timeout scenarios, disk full
- **Special characters**: Unicode, whitespace, control characters
- **Concurrency issues**: Race conditions, deadlocks, thread safety

### 2. Test Generation

Generate tests in multiple formats:

- Unit tests (pytest, Jest, JUnit, Go testing, etc.)
- Integration test scenarios
- Property-based tests (Hypothesis, QuickCheck, fast-check)
- Mutation testing scenarios
- Fuzz testing inputs

### 3. Multi-Language Support

Support major programming languages:
- Python, JavaScript/TypeScript, Java, C/C++, Go, Rust, C#, Ruby, PHP, Swift, Kotlin

## Edge Case Analysis Workflow

### Step 1: Identify Input Domains

Analyze each input parameter or data structure:

**For numeric inputs:**
```
- Minimum value (e.g., INT_MIN, 0, -∞)
- Maximum value (e.g., INT_MAX, 255, +∞)
- Zero
- One (unit value)
- Negative one
- Just below/above boundaries
- Overflow/underflow values
```

**For collections (arrays, lists, sets):**
```
- Empty collection
- Single element
- Two elements (minimal interaction)
- Maximum size (if bounded)
- All identical elements
- All unique elements
- Sorted vs unsorted
- Contains duplicates
```

**For strings:**
```
- Empty string ("")
- Single character
- Very long string (10K+ chars)
- Unicode characters (emoji, RTL, special)
- Whitespace only ("   ")
- Null terminator issues
- Special characters (\n, \t, \0)
```

**For pointers/references:**
```
- Null/None/undefined
- Dangling pointer
- Self-reference (circular)
- Uninitialized
```

### Step 2: Identify State and Preconditions

**Object state:**
```
- Uninitialized state
- Partially initialized
- Valid operational state
- Invalid/corrupted state
- Locked/busy state
- Disposed/freed state
```

**Precondition violations:**
```
- Missing required parameters
- Parameters in wrong order
- Invalid combinations
- Violated invariants
```

### Step 3: Identify Output Scenarios

**Success cases:**
```
- Typical successful execution
- Boundary successful case
- Empty result (valid but empty)
```

**Failure cases:**
```
- Expected exceptions/errors
- Timeout scenarios
- Partial failures
- Resource exhaustion
```

### Step 4: Identify Interaction Patterns

**Temporal patterns:**
```
- First operation
- Last operation
- Repeated operations
- Alternating operations
- Concurrent operations
```

**Dependency patterns:**
```
- Missing dependencies
- Circular dependencies
- Incompatible versions
- Network failures
```

### Step 5: Generate Test Cases

For each identified edge case, generate:

1. **Test name**: Descriptive name indicating the edge case
2. **Setup**: Initialize necessary state/fixtures
3. **Input**: The specific boundary or edge case input
4. **Expected behavior**: What should happen (success, specific exception, etc.)
5. **Assertions**: Verify the expected behavior
6. **Cleanup**: Restore state if necessary

## Edge Case Categories

### Category 1: Numeric Boundaries

```python
# Example: Testing a function that calculates factorial
def test_factorial_edge_cases():
    # Zero (boundary)
    assert factorial(0) == 1

    # One (boundary)
    assert factorial(1) == 1

    # Negative (invalid input)
    with pytest.raises(ValueError):
        factorial(-1)

    # Large value (overflow risk)
    with pytest.raises(OverflowError):
        factorial(10000)

    # Non-integer (type boundary)
    with pytest.raises(TypeError):
        factorial(3.5)
```

### Category 2: Collection Boundaries

```javascript
// Example: Testing an array processing function
describe('processArray edge cases', () => {
  test('empty array', () => {
    expect(processArray([])).toEqual([]);
  });

  test('single element', () => {
    expect(processArray([1])).toEqual([1]);
  });

  test('null input', () => {
    expect(() => processArray(null)).toThrow(TypeError);
  });

  test('undefined input', () => {
    expect(() => processArray(undefined)).toThrow(TypeError);
  });

  test('all identical elements', () => {
    expect(processArray([5, 5, 5, 5])).toEqual([5, 5, 5, 5]);
  });

  test('very large array', () => {
    const largeArray = new Array(1000000).fill(1);
    expect(() => processArray(largeArray)).not.toThrow();
  });
});
```

### Category 3: String Boundaries

```java
// Example: Testing string validation
@Test
public void testValidateString_EdgeCases() {
    // Empty string
    assertThrows(ValidationException.class, () -> validateString(""));

    // Null
    assertThrows(NullPointerException.class, () -> validateString(null));

    // Single character
    assertTrue(validateString("a"));

    // Whitespace only
    assertFalse(validateString("   "));

    // Special characters
    assertTrue(validateString("hello@world!"));

    // Unicode
    assertTrue(validateString("你好世界"));

    // Very long string
    String longString = "a".repeat(100000);
    assertDoesNotThrow(() -> validateString(longString));

    // Control characters
    assertFalse(validateString("hello\0world"));
}
```

### Category 4: Pointer/Reference Boundaries

```c
// Example: Testing pointer operations
void test_pointer_edge_cases() {
    // Null pointer
    assert(safe_strlen(NULL) == -1);

    // Empty string
    assert(safe_strlen("") == 0);

    // Single character
    assert(safe_strlen("a") == 1);

    // Very long string
abstract-domain-explorerSkill

Applies abstract interpretation using different abstract domains (intervals, octagons, polyhedra, sign, congruence) to statically analyze program variables and infer invariants, value ranges, and relationships. Use when analyzing program properties, inferring loop invariants, detecting potential errors, or understanding variable relationships through static analysis.

abstract-invariant-generatorSkill

Uses abstract interpretation to automatically infer loop invariants, function preconditions, and postconditions for formal verification. Generates invariants that capture program behavior and support correctness proofs in Dafny, Isabelle, Coq, and other verification systems. Use when adding formal specifications to code, generating verification conditions, inferring contracts for functions, or discovering loop invariants for proofs.

abstract-state-analyzerSkill

Performs abstract interpretation over source code to infer possible program states, variable ranges, and data properties without executing the program. Reports potential runtime errors including out-of-bounds accesses, null dereferences, type inconsistencies, division by zero, and integer overflows. Use when analyzing code for potential runtime errors, performing static analysis, checking safety properties, or verifying program behavior without execution.

abstract-trace-summarizerSkill

Performs abstract interpretation to produce summarized execution traces and high-level program behavior representations. Highlights key control flow paths, variable relationships, loop invariants, function summaries, and potential runtime states using abstract domains (intervals, signs, nullness, etc.). Use when analyzing program behavior, understanding execution paths, computing loop invariants, tracking variable ranges, detecting potential runtime errors, or generating program summaries without concrete execution.

acsl-annotation-assistantSkill

Create ACSL (ANSI/ISO C Specification Language) formal annotations for C/C++ programs. Use this skill when working with formal verification, adding function contracts (requires/ensures), loop invariants, assertions, memory safety annotations, or any ACSL specifications. Supports Frama-C verification and generates comprehensive formal specifications for C/C++ code.

agent-browserSkill

CLI-based browser automation with persistent page state using ref-based element interaction. Use when users ask to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

ambiguity-detectorSkill

Detects and analyzes ambiguous language in software requirements and user stories. Use when reviewing requirements documents, user stories, specifications, or any software requirement text to identify vague quantifiers, unclear scope, undefined terms, missing edge cases, subjective language, and incomplete specifications. Provides detailed analysis with clarifying questions and suggested improvements.

api-design-assistantSkill

Design and review APIs with suggestions for endpoints, parameters, return types, and best practices. Use when designing new APIs from requirements, reviewing existing API designs, generating API documentation, or getting implementation guidance. Supports REST APIs with focus on endpoint structure, request/response schemas, authentication, pagination, filtering, versioning, and OpenAPI specifications. Triggers when users ask to design, review, document, or improve APIs.