home/dot_agents/skills/vitest-error-analysis/SKILL.md
Vitestのテスト結果からエラー情報を効率的に抽出・分析するスキル。テストが失敗した際、テストエラーの調査時、または「テストエラーを分析」「テスト失敗の原因」「test failed」などと言及された際に使用。
npx skillsauth add kryota-dev/dotfiles vitest-error-analysisInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Vitestテストの出力から効率的にエラー情報を抽出・分析するためのガイド。
Vitestの出力は非常に長くなることがあるため、直接読まずに一時ファイルに保存してからエラー情報のみを抽出する。
重要: 一時ファイルには必ずタイムスタンプを付与する(yyyy-mm-dd_hh-mm-ss形式)。
# セッション内で共通のタイムスタンプを使用
TS=$(date +%Y-%m-%d_%H-%M-%S)
# プロジェクト全体のテスト
pnpm test 2>&1 | tee /tmp/test-output_${TS}.txt
# 特定パッケージのテスト(monorepo)
pnpm -F @scope/package test 2>&1 | tee /tmp/test-output_${TS}.txt
# 特定ファイルのテスト
pnpm test src/path/to/file.spec.ts 2>&1 | tee /tmp/test-output_${TS}.txt
# 失敗テストの概要を抽出
grep -E "(FAIL|Failed Tests|AssertionError|Error:|Test Files.*failed|❯.*\.spec\.ts)" /tmp/test-output_${TS}.txt > /tmp/test-errors_${TS}.txt
# 結果を確認
cat /tmp/test-errors_${TS}.txt
# Failed Tests セクションから Test Files サマリーまでを抽出
awk '/Failed Tests/,/Test Files/' /tmp/test-output_${TS}.txt
# 特定ファイル名でフィルタリング
grep -A 30 "FAIL.*specific-file.spec.ts" /tmp/test-output_${TS}.txt
⎯⎯⎯⎯⎯⎯⎯ Failed Tests N ⎯⎯⎯⎯⎯⎯⎯ # 失敗テスト数
FAIL @scope/pkg <ファイルパス> > <テスト名> # 失敗したテストの特定
AssertionError: ... # エラー種類
- Expected # 期待値(緑色)
+ Received # 実際の値(赤色)
❯ <ファイル>:<行番号> # エラー発生箇所
Test Files N failed | M passed # サマリー
| パターン | 説明 | 対処法 |
|---------|------|--------|
| expected X to equal Y | 値の不一致 | Expected/Received の差分を確認 |
| expected X to have length Y | 配列長の不一致 | 配列の中身を確認 |
| expected X to deeply equal Y | オブジェクト構造の不一致 | プロパティ名・順序を確認 |
| TypeError: Cannot read property | undefined アクセス | nullチェック漏れを確認 |
| Test timed out | タイムアウト | 非同期処理の完了待ちを確認 |
- Expected # この行は期待値(テストコードで指定した値)
+ Received # この行は実際の値(テスト対象が返した値)
@@ -9,11 +9,12 @@ # 差分の位置情報
"type": "action", # 変更なし(コンテキスト)
- "categories": [ # 期待していたが存在しない
+ "itemGroups": [ # 代わりに存在する
大量のテストエラーがある場合の効率的な修正フロー:
# 0. タイムスタンプ設定(セッション開始時に1回)
TS=$(date +%Y-%m-%d_%H-%M-%S)
# 1. テスト実行
pnpm test 2>&1 | tee /tmp/test-output_${TS}.txt
# 2. エラー抽出
grep -E "(FAIL|Failed Tests|Test Files.*failed)" /tmp/test-output_${TS}.txt > /tmp/test-errors_${TS}.txt
# 3. エラー確認
cat /tmp/test-errors_${TS}.txt
# 4. 詳細確認(必要に応じて)
awk '/Failed Tests/,/Test Files/' /tmp/test-output_${TS}.txt
# 5. 修正後、タイムスタンプを更新して1に戻る
TS=$(date +%Y-%m-%d_%H-%M-%S)
# 失敗テストがあるか確認
if grep -q "Test Files.*failed" /tmp/test-output_${TS}.txt; then
echo "エラーあり - 修正を継続"
else
echo "全テスト成功"
fi
head -100 や tail -100 で絞り込む| sed 's/\x1b\[[0-9;]*m//g' で除去pnpm test -- --testNamePattern="テスト名"pnpm test -- --no-threads でデバッグしやすくするls -la /tmp/test-output_*.txt で一覧表示development
`cc-code-review` エージェントを起動して独立したコンテキストでコードレビューを実行する。 現在のセッションのバイアスのないフレッシュな視点で、プロジェクトの CLAUDE.md を踏まえたレビューを行う。 トリガー: "cc-code-review", "ccでレビュー", "別の視点でレビュー", "セカンドオピニオン" 使用場面: (1) PRのコードレビュー (2) ブランチ差分のレビュー (3) 特定ファイルのレビュー (4) 現在の変更のレビュー
tools
Comprehensive guide for the `wtp` (Worktree Plus) CLI by satococoa — an enhanced Git worktree manager. Use this whenever the user wants to create, list, remove, or navigate Git worktrees with wtp, mentions `wtp add`/`wtp cd`/`wtp list`/`wtp remove`/`wtp exec`, asks about automatic worktree paths from branch names, post-create hooks (copy/symlink/command) in `.wtp.yml`, branch tracking for worktrees, or shell integration (`wtp shell-init`, `wtp hook`, tab completion, auto-cd). Trigger this even when the user just describes the workflow — e.g. 'spin up a worktree for this feature branch', 'jump to my auth worktree', 'clean up the worktree and its branch' — without naming wtp explicitly, as long as wtp is the available tool.
tools
Use when doing ANY task involving Supabase. Triggers: Supabase products (Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues); client libraries and SSR integrations (supabase-js, @supabase/ssr) in Next.js, React, SvelteKit, Astro, Remix; auth issues (login, logout, sessions, JWT, cookies, getSession, getUser, getClaims, RLS); Supabase CLI or MCP server; schema changes, migrations, security audits, Postgres extensions (pg_graphql, pg_cron, pg_vector).
data-ai
Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.