Test

From InugamiDev/ultrathink-oss · View interactive version

Test is an AI agent skill from the GitHub repository InugamiDev/ultrathink-oss. Test planning, generation, and execution -- unit, integration, and end-to-end testing workflows

How to use this skill

Skill file

Test Skill

Purpose

Plan, generate, and execute tests that verify code correctness, prevent regressions, and document expected behavior. This skill covers the full testing lifecycle from strategy through execution.

Tests are not bureaucracy. Tests are executable documentation that proves your code works.

Workflow

Mode 1: Test Planning

Use when you need to decide WHAT to test before writing tests.

  1. Identify the testing target -- What code/feature needs tests?
  2. Read the target code -- Understand what it does, its inputs, outputs, and edge cases.
  3. Detect existing test infrastructure
  1. Categorize test needs:
  1. Produce the test plan:
# Test Plan: [Target]

## Target
[What is being tested]

## Test Infrastructure
- **Framework**: [name + version]
- **Runner command**: [command]
- **Test location**: [where tests should go]

## Unit Tests
| Test | Input | Expected Output | Edge Case? |
|------|-------|----------------|------------|
| [function] handles valid input | [input] | [output] | No |
| [function] handles empty input | [] | [] or error | Yes |
| [function] handles null | null | throws TypeError | Yes |

## Integration Tests
| Test | Components | Scenario |
|------|-----------|----------|
| [feature] happy path | A + B + C | [description] |
| [feature] error propagation | A + B | [description] |

## Edge Cases to Cover
- [edge case 1]
- [edge case 2]

## Not Testing (and why)
- [thing]: [reason -- e.g., "covered by upstream tests"]

Mode 2: Test Generation

Use when you need to WRITE tests.

  1. Read the target code thoroughly.
  2. Read existing tests in the same area to match conventions.
  3. Generate tests following these principles:
  1. Test file structure:
describe('[ModuleName]', () => {
  describe('[functionName]', () => {
    // Setup shared across this function's tests
    beforeEach(() => { /* ... */ });

    it('does X when given Y', () => {
      // Arrange
      const input = createTestInput();

      // Act
      const result = functionName(input);

      // Assert
      expect(result).toEqual(expectedOutput);
    });

    it('throws when given invalid input', () => {
      expect(() => functionName(null)).toThrow(ValidationError);
    });

    it('handles edge case: empty array', () => {
      const result = functionName([]);
      expect(result).toEqual([]);
    });
  });
});
  1. Mocking strategy:
  1. Write the test file using the Write tool (new file) or Edit tool (adding to existing).

Mode 3: Test Execution

Use when you need to RUN tests and interpret results.

  1. Determine the test command from project configuration.
  2. Run tests:
  1. Interpret results:
  1. If tests fail:

Mode 4: Coverage Analysis

  1. Run with coverage enabled.
  2. Identify uncovered areas:
  1. Prioritize coverage gaps by risk:
  1. Generate additional tests for high-priority gaps.

Usage

Plan tests

/test Plan tests for the authentication module

Write tests

/test Write unit tests for src/lib/utils/formatDate.ts

Run tests

/test Run the test suite and report results

After a fix

/test Write a regression test for the bug fixed in src/lib/orders.ts

Coverage improvement

/test Improve test coverage for the payment processing module

Examples

Example: Unit test generation

Target: formatCurrency(amount: number, currency: string): string

Generated tests:

Example: Integration test

Target: User registration flow (API endpoint + database + email)

Generated tests:

Guidelines

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.