testing-principles

テスト設計・レビュー・改善を、観測可能な振る舞いと決定性を軸に実行する。 テスト戦略の再設計、フレーキー修正、テストダブル方針の整理、回帰防止強化が必要な依頼で使用する。

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "testing-principles" with this command: npx skills add togswr/agent-skills/togswr-agent-skills-testing-principles

Testing Principles

観測可能な振る舞いを守りながら、回帰検知能力と保守性を高めるためのテスト支援スキル。

目的

  • テストの品質判断を「動くか」ではなく「壊れ方が正しいか」で行う。
  • 実装詳細への結合を減らし、リファクタリング耐性を上げる。
  • 決定的なテストを増やし、フレーキーの再発を防ぐ。

適用条件

  • テスト戦略を Unit / Integration / E2E のどこに置くべきか迷っている。
  • 過度なモックや brittle test が増え、レビューで指摘が繰り返される。
  • フレーキーが CI を不安定にしており、再発防止まで含めて整理したい。
  • バグ修正時の回帰防止テストを、最小コストで追加したい。
  • 外部 API やイベント連携をどこまで契約としてテストすべきか判断したい。
  • フロントエンドテスト(UI/React/DOM/RTL/Playwright/Cypress)方針を決めたい。

標準ワークフロー

  1. Scope
  • 対象機能、失敗コスト、外部契約の有無を定義する。
  • 期待する検知対象を「回帰」「仕様逸脱」「環境依存」に分解する。
  1. Strategy
  • リスクと変更頻度からテストサイズを決める。
  • カバレッジ数値ではなく、未検知リスクで優先度を付ける。
  • フロントエンド文脈を検出した場合は、設計前に必ず Frontend Testing Principles (Kent C. Dodds) を参照する。
  1. Design
  • AAA を基準にテストを組み立て、1 テスト 1 Act を守る。
  • Test Double は境界優先で選び、内部相互作用のモックを避ける。
  1. Verify
  • 再現テストを先に追加してから修正する。
  • 決定性チェック(時刻、乱数、I/O、並列性)を必ず通す。
  1. Improve
  • フレーキーは「隔離 -> 根因修正 -> 再発防止」で処理する。
  • 失敗を分類して、テスト設計か本番設計のどちらを直すべきか判定する。

成果物

  • テスト戦略メモ(対象、サイズ、境界、非対象)
  • 追加/修正テスト一覧(狙い、検知対象、依存制御)
  • フレーキー対応記録(原因、恒久対策、監視ポイント)
  • レビュー結果(重大順の指摘、修正提案、残リスク)

参照

検証

  • bash skill-creator/scripts/validate-skill.sh testing-principles
  • bunx markdown-link-check testing-principles/SKILL.md
  • find testing-principles -name "*.md" -exec bunx markdown-link-check {} \\;

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

vercel-composition-patterns

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

Repository Source
23K85.8K
vercel
Automation

vercel-react-native-skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

Repository Source
23K60.2K
vercel
Automation

supabase-postgres-best-practices

Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.

Repository Source
1.6K35K
supabase