typescript-test
について
このClaudeスキルは、JestベースのTypeScriptテストに関する専門知識を提供し、テスト構造、モッキング戦略、非同期処理、カバレッジ最適化のベストプラクティスを提案します。単体テスト/結合テスト、Jestのモッキングパターン、スナップショットテスト、Testing Libraryを使用したUIコンポーネントテストを専門としています。TypeScriptテストファイルの作成、テスト構造の設計、モックの実装、TypeScriptプロジェクト向けのJest設定を行う際にご利用ください。
クイックインストール
Claude Code
推奨/plugin add https://github.com/KubrickCode/ai-config-toolkitgit clone https://github.com/KubrickCode/ai-config-toolkit.git ~/.claude/skills/typescript-testこのコマンドをClaude Codeにコピー&ペーストしてスキルをインストールします
ドキュメント
TypeScript Testing Code Guide
Test File Structure
One-to-one matching with the file under test. Test files should be located in the same directory as the target file.
File Naming
Format: {target-file-name}.spec.ts.
Example: user.service.ts → user.service.spec.ts
Test Framework
Use Jest. Maintain consistency within the project.
Test Hierarchy
Organize by method (function) unit as major sections, and by test case as minor sections. Complex methods can have intermediate sections by scenario.
Test Coverage Selection
Omit obvious or overly simple logic (simple getters, constant returns). Prioritize testing business logic, conditional branches, and code with external dependencies.
Test Case Composition
At least one basic success case is required. Focus primarily on failure cases, boundary values, edge cases, and exception scenarios.
Test Independence
Each test should be executable independently. No test execution order dependencies. Initialize shared state for each test.
Given-When-Then Pattern
Structure test code in three stages—Given (setup), When (execution), Then (assertion). Separate stages with comments or blank lines for complex tests.
Test Data
Use hardcoded meaningful values. Avoid random data as it causes unreproducible failures. Fix seeds if necessary.
Mocking Principles
Mock external dependencies (API, DB, file system). For modules within the same project, prefer actual usage; mock only when complexity is high.
Test Reusability
Extract repeated mocking setups, fixtures, and helper functions into common utilities. Be careful not to harm test readability through excessive abstraction.
Integration/E2E Testing
Unit tests are the priority. Write integration/E2E tests when complex flows or multi-module interactions are difficult to understand from code alone. Place in separate directories (tests/integration, tests/e2e).
Test Naming
Test names should clearly express "what is being tested". Recommended format: "should do X when Y". Focus on behavior rather than implementation details.
Assertion Count
Multiple related assertions in one test are acceptable, but separate tests when validating different concepts.
Structure
Group methods/functionality with describe, write individual cases with it. Can classify scenarios with nested describe.
Mocking
Utilize Jest's jest.mock(), jest.spyOn(). Mock external modules at the top level; change behavior per test with mockReturnValue, mockImplementation.
Async Testing
Use async/await. Test Promise rejection with await expect(fn()).rejects.toThrow() form.
Setup/Teardown
Use beforeEach, afterEach for common setup/cleanup. Use beforeAll, afterAll only for heavy initialization (DB connection, etc.).
Type Safety
Type check test code too. Minimize as any or @ts-ignore. Use type guards or type assertions explicitly when needed.
Test Utils Location
For single-file use, place at bottom of same file. For multi-file sharing, use __tests__/utils or test-utils directory.
Coverage
Code coverage is a reference metric. Focus on meaningful test coverage rather than blindly pursuing 100%.
GitHub リポジトリ
関連スキル
content-collections
メタThis skill provides a production-tested setup for Content Collections, a TypeScript-first tool that transforms Markdown/MDX files into type-safe data collections with Zod validation. Use it when building blogs, documentation sites, or content-heavy Vite + React applications to ensure type safety and automatic content validation. It covers everything from Vite plugin configuration and MDX compilation to deployment optimization and schema validation.
creating-opencode-plugins
メタThis skill provides the structure and API specifications for creating OpenCode plugins that hook into 25+ event types like commands, files, and LSP operations. It offers implementation patterns for JavaScript/TypeScript modules that intercept and extend the AI assistant's lifecycle. Use it when you need to build event-driven plugins for monitoring, custom handling, or extending OpenCode's capabilities.
evaluating-llms-harness
テストThis Claude Skill runs the lm-evaluation-harness to benchmark LLMs across 60+ standardized academic tasks like MMLU and GSM8K. It's designed for developers to compare model quality, track training progress, or report academic results. The tool supports various backends including HuggingFace and vLLM models.
sglang
メタSGLang is a high-performance LLM serving framework that specializes in fast, structured generation for JSON, regex, and agentic workflows using its RadixAttention prefix caching. It delivers significantly faster inference, especially for tasks with repeated prefixes, making it ideal for complex, structured outputs and multi-turn conversations. Choose SGLang over alternatives like vLLM when you need constrained decoding or are building applications with extensive prefix sharing.
