スキル一覧に戻る
lexicalninja

test-writer

by lexicalninja

A collection of Cursor subagents and Claude skills to help build things together

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

SKILL.md


name: test-writer description: Writes comprehensive test cases including unit tests, integration tests, and E2E tests. Use when implementing test requirements from tasks. Creates tests that cover happy paths, edge cases, error conditions, and follow testing best practices.

Test Writer Skill

Instructions

  1. Analyze test requirements from task
  2. Identify what needs to be tested (functions, components, endpoints)
  3. Write unit tests for individual functions/components
  4. Write integration tests for component interactions
  5. Write E2E tests for user flows (if applicable)
  6. Cover happy paths, edge cases, and error conditions
  7. Ensure tests are independent and isolated
  8. Return test implementation with:
    • Test files
    • Test cases covering all scenarios
    • Setup and teardown
    • Mocking where needed
    • Assertions and expectations

Examples

Input: "Write tests for calculateTotal function" Output:

// tests/utils.test.js
describe('calculateTotal', () => {
    test('calculates total for valid items array', () => {
        const items = [
            { price: 10.00 },
            { price: 20.00 },
            { price: 5.00 }
        ];
        expect(calculateTotal(items)).toBe(35.00);
    });

    test('returns 0 for empty array', () => {
        expect(calculateTotal([])).toBe(0);
    });

    test('returns 0 for null input', () => {
        expect(calculateTotal(null)).toBe(0);
    });

    test('returns 0 for undefined input', () => {
        expect(calculateTotal(undefined)).toBe(0);
    });

    test('handles items with zero price', () => {
        const items = [
            { price: 10.00 },
            { price: 0 },
            { price: 5.00 }
        ];
        expect(calculateTotal(items)).toBe(15.00);
    });
});

Test Types

  • Unit Tests: Test individual functions/components in isolation
  • Integration Tests: Test component interactions, API integrations
  • E2E Tests: Test complete user flows
  • Snapshot Tests: Test component rendering (if applicable)
  • Performance Tests: Test performance characteristics (if needed)

Test Coverage Areas

  • Happy Paths: Normal, expected behavior
  • Edge Cases: Boundary conditions, empty inputs, null values
  • Error Conditions: Invalid inputs, error handling
  • State Changes: Component state transitions
  • User Interactions: Click, input, navigation
  • API Responses: Success and error responses

Best Practices

  • Independent Tests: Each test should be independent
  • Clear Names: Descriptive test names
  • Arrange-Act-Assert: Follow AAA pattern
  • Mock External Dependencies: Mock APIs, databases, etc.
  • Test One Thing: Each test should test one behavior
  • Fast Tests: Tests should run quickly
  • Maintainable: Tests should be easy to understand and maintain

スコア

総合スコア

55/100

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

SKILL.md

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

+20
LICENSE

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

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

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

0/5
Issue管理

オープンIssueが50未満

+5
言語

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

0/5
タグ

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

0/5

レビュー

💬

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