writing-tests

Create TDD test suites for React/TypeScript, Go, and Rust.

88|4|Updated Oct 14, 2018
One-click install
npx skills add https://github.com/skanehira/dotfiles --skill writing-tests-skanehira
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: writing-tests
Source: https://github.com/skanehira/dotfiles/tree/main/claude/skills/writing-tests
Command: npx skills add https://github.com/skanehira/dotfiles --skill writing-tests-skanehira

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

テスト駆動開発の原則に従い、コロケーション・命名規則・テスト構造のベストプラクティスを適用して、信頼性の高いコードを促進します。React/TypeScript、Go、Rustの各言語で適切なパターンを使い分けます。

Core Features & Use Cases

  • コロケーション原則の徹底: 実装と同じディレクトリにテストを配置して理解と保守性を高めます。
  • 言語別パターンの適用: React/TypeScript、Go、Rustそれぞれの最適なテスト構造を提供します。
  • テスト命名と構造: AAAパターンやGiven-When-Thenを用いた明確なテスト名と組織を推奨します。

Quick Start

テスト対象のコードと同じディレクトリにテストファイルを追加し、1つのケースからAAAパターンで実装を検証します。テストはすべて実行可能で、独立して素早く実行できる状態を目指します。

Frequently Asked Questions about writing-tests

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write tests following the AAA pattern?

The AAA pattern structures tests into three stages: Arrange (set up test data and mocks), Act (execute the code being tested), and Assert (verify the results). This pattern clarifies test intent and makes each test case independently readable and maintainable across React/TypeScript, Go, and Rust.

Should I place test files in the same directory as my source code?

Yes, colocating tests with implementation in the same directory improves discoverability and maintenance. Language-specific naming patterns—such as `.test.ts` for React/TypeScript, `_test.go` for Go, and `#[cfg(test)]` modules for Rust—keep tests organized alongside their corresponding code.

How do I apply test-driven development to React components?

Write test cases first using the AAA pattern, then implement React/TypeScript components to pass those tests. Use co-located test files with `.test.ts` naming, mock external dependencies, and test component behavior through unit and integration test workflows.

What's the best way to structure tests for Go and Rust backends?

Structure backend tests with language-specific conventions: Go uses `_test.go` files with table-driven tests, while Rust uses `#[cfg(test)]` modules. Both enforce AAA pattern organization, co-location with source files, and separation of unit and integration test concerns.

Can I use mocking patterns across React, Go, and Rust projects?

Yes, mocking adapts to each language's testing framework. React/TypeScript uses Jest mocks, Go uses interfaces and test doubles, and Rust uses trait mocking. Each language applies consistent mocking workflow principles for isolating units under test and controlling external dependencies.

How do I ensure consistent test coverage across multiple languages?

Apply the AAA pattern uniformly, maintain co-located test files with language-specific naming conventions, and follow reference guides for React/TypeScript, Go, and Rust. This standardized structure makes test organization predictable and coverage measurable across your entire codebase.