スキル一覧に戻る
ririnto

generate-tests

by ririnto

0🍴 0📅 2026年1月22日
GitHubで見るManusで実行

SKILL.md


name: generate-tests description: 'Generate comprehensive, maintainable test suites through code analysis. Use when the user asks to write tests, create unit tests, add test cases, test a function, or improve test coverage.' compatibility: Requires test framework and code read/write tools allowed-tools: - Bash(node:, npm:, npx:, pnpm:, yarn:, python:, pip:, pytest:, go:, cargo:, mvn:, ./mvnw:, gradle:, ./gradlew:, make:, cmake:, g++:, gcc:, clang:*) - Glob - Grep - Read - Write - mcp__context7 - mcp__fetch - mcp__jetbrains - mcp__markitdown - mcp__serena

Test Generation Skill

Generate comprehensive, maintainable tests through code analysis.

Test Generation Process

  1. Analyze code: signature/I-O, branches, deps/side effects. Tools: mcp__serena__find_symbol(signatures), mcp__context7__get-library-docs(framework docs).
  2. Check existing patterns:
    • find . -name "*.test.*" -o -name "*_test.*" -o -name "test_*"
    • grep -r "describe\\|it\\|test\\|expect" --include="*.test.*" | head -5
  3. Design cases:
    • AAA: Arrange → Act → Assert.
    • Coverage: happy path, edge(boundary/empty/null), error(invalid/exception), integration interactions.

Framework Templates

Load only the framework you need:

  • Jest(JS/TS): references/jest.md
  • Vitest(JS/TS): references/vitest.md
  • pytest(Python): references/pytest.md
  • Go: references/go.md
  • JUnit(Java): references/java-junit.md
  • Kotlin test: references/kotlin-test.md

Test Naming Conventions

Descriptive test names

  • should_return_expected_result_when_valid_input
  • returns_empty_array_for_empty_input
  • throws_error_for_negative_input

Mocking Guidelines

What to Mock

  • External API calls
  • Database operations
  • File system access
  • Time-related functions
  • Random functions

Mocking Principles

  • Use minimal mocking
  • Configure to behave like real implementation
  • Mock at interface boundaries
  • Test behavior, not implementation details

Output Format

## Test Generation Result

### Target

- File: `path/to/file`
- Function: `functionName`

### Generated Tests

- Total N test cases
- Happy Path: N
- Edge Cases: N
- Error Cases: N

### Test File

`path/to/test/file`

### How to Run

```bash
npm test -- --testPathPattern="filename"
pytest path/to/test_file.py -v
go test ./... -run TestFunctionName
```

Coverage Improvement Suggestions

  • [Additional test case suggestions]

Edge Cases

  • No test file exists: Create new test file
  • Existing tests: Maintain consistent style, add only new cases
  • Untestable code: Suggest refactoring
  • Complex mocking required: Offer integration test alternative

Notes

  • MCP tools are optional; omit if unavailable or add others as needed

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です