AGENT SKILL

generate-tests

Generate comprehensive tests for specified code

License 许可
MIT
最近更新
2026-10-18
Stars
★ 0
Forks
2

01 前言 Front Matter

name
generate-tests
effort
medium
description
Generate comprehensive tests for specified code
when_to_use
Use when adding test coverage for a function, module, or feature.
argument-hint
<file_or_module> [--framework jest|vitest|pytest]
disable-model-invocation
true

03 SKILL.md 正文

Generate tests

Generate comprehensive tests for specified code.

Instructions

  1. Read the target file(s)
  2. Identify testable units (functions, classes, methods)
  3. Generate tests following project conventions
  4. Ensure high coverage of edge cases

Test generation process

1. Analyze target

  • Identify public interfaces
  • Understand dependencies
  • Note edge cases and boundaries

2. Detect test framework

Check for:

  • jest.config.js → Jest
  • vitest.config.ts → Vitest
  • pytest.ini → pytest
  • mocha in package.json → Mocha

3. Generate tests

Follow the detected framework conventions.

Test categories

Happy path

Normal expected behavior with valid input.

Edge cases

  • Empty inputs
  • Null/undefined values
  • Boundary values (0, -1, MAX_INT)
  • Single item vs multiple items

Error cases

  • Invalid input types
  • Missing required parameters
  • Network/IO failures
  • Timeout scenarios

Integration points

  • Database interactions
  • External API calls
  • File system operations

Output format

describe('[ComponentName]', () => {
  describe('[methodName]', () => {
    // Happy path
    it('should [expected behavior] when [condition]', () => {
      // Arrange
      // Act
      // Assert
    });

    // Edge cases
    it('should handle empty input', () => {});
    it('should handle null values', () => {});

    // Error cases
    it('should throw when [invalid condition]', () => {});
  });
});

Conventions

  • One assertion per test (when practical)
  • Descriptive test names
  • AAA pattern (Arrange-Act-Assert)
  • No test interdependence
  • Mock external dependencies

Usage

/generate-tests src/utils/calculator.ts
/generate-tests src/services/

$ARGUMENTS

04 同仓库更多 Skills

313DEVGRP
313DEVGRP/Java-Service-Tree-Framework-Multi-Agent-Workspace

voice-refine

Transform verbose voice input into structured, token-efficient Claude prompts. Use when cleaning up voice memos, dictation output, or speech-to-text transcriptions that contain filler words, repetitions, and unstructured thoughts.

★ 0
313DEVGRP
313DEVGRP/Java-Service-Tree-Framework-Multi-Agent-Workspace

validate-changes

Evaluate staged changes using LLM-as-a-Judge before committing

★ 0
313DEVGRP
313DEVGRP/Java-Service-Tree-Framework-Multi-Agent-Workspace

update-threat-db

Delegate threat-intelligence research and updates to AgentSec, then validate the guide and landing mirrors.

★ 0
313DEVGRP
313DEVGRP/Java-Service-Tree-Framework-Multi-Agent-Workspace

token-audit

Audit Claude Code configuration to measure fixed-context token overhead and produce a prioritized action plan. Use when hitting rate limits, experiencing early context compression, or after adding significant config files.

★ 0
313DEVGRP
313DEVGRP/Java-Service-Tree-Framework-Multi-Agent-Workspace

talk-stage6-revision

Produces revision sheets with quick navigation by act, a master concept-to-URL table, Q&A cheat-sheet with 6-10 anticipated questions, glossary, and external resources list. Use when preparing for a talk with Q&A, creating shareable reference material for attendees, or building a safety-net glossary for live delivery.

★ 0
313DEVGRP
313DEVGRP/Java-Service-Tree-Framework-Multi-Agent-Workspace

talk-stage5-script

Produces a complete 5-act pitch with speaker notes, a slide-by-slide specification, and a ready-to-paste Kimi prompt for AI slide generation. Requires validated angle and title from Stage 4. Use when you have a confirmed talk angle and need the full script, slide spec, and AI-generated presentation prompt.

★ 0