mobile-verification
モバイルアプリ開発におけるテストを自動化し、合格率などの指標を用いて品質を評価、不安定なテストを検出し、コードの信頼性を高めるのを支援するSkill。
📜 元の英語説明(参考)
Automated testing workflow with pass@k metrics for mobile development. Detects flaky tests and ensures code reliability.
🇯🇵 日本人クリエイター向け解説
モバイルアプリ開発におけるテストを自動化し、合格率などの指標を用いて品質を評価、不安定なテストを検出し、コードの信頼性を高めるのを支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o mobile-verification.zip https://jpskill.com/download/16433.zip && unzip -o mobile-verification.zip && rm mobile-verification.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/16433.zip -OutFile "$d\mobile-verification.zip"; Expand-Archive "$d\mobile-verification.zip" -DestinationPath $d -Force; ri "$d\mobile-verification.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
mobile-verification.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
mobile-verificationフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Mobile Verification Skill
Android 開発の信頼性向上のための、pass@k メトリクスを用いた包括的なテストワークフローです。
哲学
一度のテスト実行は嘘をつく。
一度パスしたテストが、明日には失敗するかもしれません。検証ループは、テストを複数回実行することで、以下を明らかにします。
- 不安定なテスト (タイミングの問題、非同期処理の問題)
- 断続的な失敗 (リソース競合)
- 信頼性の傾向 (改善 vs 悪化)
Pass@k の説明
Pass@k = パスしたテストイテレーションの割合
Pass@3(test) = tests_passed / 3
testLogin(): ✓✓✓ → Pass@3 = 3/3 = 1.0 (100%)
testLogout(): ✓✓✗ → Pass@3 = 2/3 = 0.67 (67%)
testRefresh(): ✗✗✗ → Pass@3 = 0/3 = 0.0 (0%)
検証レベル
簡易検証 (k=2)
目的: 開発中の迅速なフィードバック
使用法: /mobile-verify --k=2
時間: ~2 分
タイミング: 小さな変更後、コミット前
標準検証 (k=3)
目的: 標準的な信頼性レベル
使用法: /mobile-verify --k=3
時間: ~5 分
タイミング: プッシュ前、機能完了後
詳細検証 (k=5)
目的: 高い信頼性、不安定なテストの検出
使用法: /mobile-verify --k=5
時間: ~10 分
タイミング: リリース前、リファクタリング後
リリース検証 (k=10)
目的: 最大限の信頼性
使用法: /mobile-verify --k=10
時間: ~20 分
タイミング: 製品リリース、重大なバグ
テストタイプ戦略
ユニットテスト (JUnit)
特徴:
- 高速: テストあたり ~1-2 秒
- 独立: Android への依存関係なし
- 信頼性: Pass@k = 1.0 であるべき
目標 Pass@k: ≥ 0.95 (95%)
不安定なテストの一般的な原因:
- 適切な待機がない非同期操作
- 日付/時刻の依存関係
- ランダムなデータ生成
- 静的な状態のリーク
修正戦略:
// 悪い例: 不安定
@Test
fun testLoadData() {
viewModel.loadData()
assert(viewModel.state.value is Loaded)
}
// 良い例: 安定
@Test
fun testLoadData() = runTest {
viewModel.loadData()
advanceUntilIdle()
assert(viewModel.state.value is Loaded)
}
UI テスト (Espresso)
特徴:
- 低速: テストあたり ~5-10 秒
- デバイス依存: エミュレーター/デバイスが必要
- 脆弱: UI の変更でテストが失敗する
目標 Pass@k: ≥ 0.80 (80%)
不安定なテストの一般的な原因:
IdlingResourceが登録されていない- アニメーションの干渉
- 画面の回転
- ネットワークタイムアウト
修正戦略:
// アイドリングリソースの登録
@IdlingResource
val countingIdlingResource = CountingIdlingResource("api")
// アニメーションの無効化
@get:Rule
val disableAnimationsRule = DisableAnimationsRule()
Compose テスト
特徴:
- 高速: テストあたり ~1-3 秒
- UI レベル: Composable の動作をテスト
- 現代的: Compose Testing フレームワークを使用
目標 Pass@k: ≥ 0.90 (90%)
不安定なテストの一般的な原因:
- 再コンポジションのタイミング
- 状態の巻き上げの問題
- アニメーションの干渉
修正戦略:
@Composable
fun TestComposable(content: @Composable () -> Unit) {
CompositionLocalProvider(
LocalInspectionMode provides true
) {
content()
}
}
検証ワークフロー
開発中
# 1. テストの作成
# 2. 簡易検証
/mobile-verify --class=NewTest --k=2
# 3. 失敗した場合の修正
# 4. 標準検証
/mobile-verify --class=NewTest --k=3
コミット前
# 変更されたモジュールのみを検証
/mobile-verify --module=$(git diff --name-only | head -1) --k=2
プッシュ前
# 完全な検証
/mobile-verify --k=3
リリース前
# 不安定なテストの検出を含む詳細な検証
/mobile-verify --k=5 --flaky
結果の解釈
Pass@k スコア
| スコア | 意味 | アクション |
|---|---|---|
| 1.0 | 完璧 | 祝う |
| 0.8-0.9 | 優秀 | 監視する |
| 0.6-0.7 | 良好 | 調査する |
| 0.4-0.5 | 普通 | 修正が必要 |
| 0.0-0.3 | 不良 | リリースをブロック |
傾向
Pass@k を経時的に追跡します。
Week 1: Pass@3 = 0.85
Week 2: Pass@3 = 0.87 ↗ 改善
Week 3: Pass@3 = 0.82 ↘ 悪化 - 調査!
Week 4: Pass@3 = 0.88 ↗ 回復
不安定なテストのパターン
| パターン | 考えられる原因 |
|---|---|
| 最初のイテレーションでのみ失敗する | コールドスタートの問題 |
| ランダムに失敗する | 非同期のタイミング |
| 特定のイテレーションで失敗する | リソースリーク |
| 並列でのみ失敗する | 共有状態 |
不安定なテストの修正
ステップ 1: パターンの特定
/mobile-verify --flaky --k=10
失敗のパターンを探します。
ステップ 2: 診断の追加
@Test
fun flakyTest() = runTest {
val startTime = System.currentTimeMillis()
// ... テストコード ...
val duration = System.currentTimeMillis() - startTime
Log.d("Test", "Duration: $duration ms") // タイミングの問題を確認
}
ステップ 3: 修正の適用
一般的な修正:
- コルーチンの場合は
advanceUntilIdle()を追加 - ネットワークの場合は
IdlingResourceを追加 - UI テストの場合はアニメーションを無効化
- メインスレッドの処理には
@UiThreadTestを使用 - 非同期操作には明示的な待機を追加
ステップ 4: 修正の検証
/mobile-verify --class=FixedTest --k=5
目標: Pass@5 = 1.0
統合
チェックポイントとの連携
検証前にチェックポイントを作成します。
/mobile-checkpoint save pre-verify
/mobile-verify --k=3
メモリとの連携
Pass@k をメモリに追跡します。
{
"test-coverage": {
"passAt3": 0.87,
"trend": "improving",
"flakyTests": []
}
}
Instincts との連携
テストパターンを学習します。
{
"id": "test-coroutine-async",
"description": "ViewModel テストには常に runTest + advanceUntilIdle を使用する",
"confidence": 0.95
}
コンテキストごとの閾値
| コンテキスト | Pass@k 閾値 | 根拠 |
|---|---|---|
| ユニットテスト | 0.95 | 決定論的であるべき |
| UI テスト | 0.80 | より脆弱で、デバイスに依存する |
| Compose テスト | 0.90 | Espresso より優れており、より安定している |
| 統合テスト | 0.70 | 複雑で、より多くの変数がある |
| E2E テスト | 0.60 | フルシステムで、多くの変数がある |
ベストプラクティス
- 高く始めて、低くする: 調査には k=5 を、ルーチンには k=3 を使用します。
- 不安定なテストを迅速に修正する: 不安定なテストを許容しないでください。
- 傾向を追跡する:
(原文がここで切り詰められています)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Mobile Verification Skill
Comprehensive testing workflow with pass@k metrics for Android development reliability.
Philosophy
Single test runs lie.
A test that passes once might fail tomorrow. Verification loops run tests multiple times to reveal:
- Flaky tests (timing issues, async problems)
- Intermittent failures (resource contention)
- Reliability trends (improving vs degrading)
Pass@k Explained
Pass@k = proportion of test iterations that passed
Pass@3(test) = tests_passed / 3
testLogin(): ✓✓✓ → Pass@3 = 3/3 = 1.0 (100%)
testLogout(): ✓✓✗ → Pass@3 = 2/3 = 0.67 (67%)
testRefresh(): ✗✗✗ → Pass@3 = 0/3 = 0.0 (0%)
Verification Levels
Quick Verification (k=2)
Purpose: Fast feedback during development
Usage: /mobile-verify --k=2
Time: ~2 minutes
When: After small changes, before commit
Standard Verification (k=3)
Purpose: Standard confidence level
Usage: /mobile-verify --k=3
Time: ~5 minutes
When: Before push, after feature complete
Thorough Verification (k=5)
Purpose: High confidence, flaky detection
Usage: /mobile-verify --k=5
Time: ~10 minutes
When: Before release, after refactor
Release Verification (k=10)
Purpose: Maximum confidence
Usage: /mobile-verify --k=10
Time: ~20 minutes
When: Production release, critical bugs
Test Type Strategies
Unit Tests (JUnit)
Characteristics:
- Fast: ~1-2 seconds per test
- Isolated: No Android dependencies
- Reliable: Should be Pass@k = 1.0
Target Pass@k: ≥ 0.95 (95%)
Common Flaky Causes:
- Async operations without proper waiting
- Date/time dependencies
- Random data generation
- Static state leakage
Fix Strategies:
// Bad: Flaky
@Test
fun testLoadData() {
viewModel.loadData()
assert(viewModel.state.value is Loaded)
}
// Good: Stable
@Test
fun testLoadData() = runTest {
viewModel.loadData()
advanceUntilIdle()
assert(viewModel.state.value is Loaded)
}
UI Tests (Espresso)
Characteristics:
- Slow: ~5-10 seconds per test
- Device-dependent: Need emulator/device
- Fragile: UI changes break tests
Target Pass@k: ≥ 0.80 (80%)
Common Flaky Causes:
- Idling resource not registered
- Animation interference
- Screen rotation
- Network timeouts
Fix Strategies:
// Register idling resources
@IdlingResource
val countingIdlingResource = CountingIdlingResource("api")
// Disable animations
@get:Rule
val disableAnimationsRule = DisableAnimationsRule()
Compose Tests
Characteristics:
- Fast: ~1-3 seconds per test
- UI-level: Tests Composable behavior
- Modern: Uses Compose Testing framework
Target Pass@k: ≥ 0.90 (90%)
Common Flaky Causes:
- Recomposition timing
- State hoisting issues
- Animation interference
Fix Strategies:
@Composable
fun TestComposable(content: @Composable () -> Unit) {
CompositionLocalProvider(
LocalInspectionMode provides true
) {
content()
}
}
Verification Workflow
During Development
# 1. Write test
# 2. Quick verify
/mobile-verify --class=NewTest --k=2
# 3. Fix if fails
# 4. Standard verify
/mobile-verify --class=NewTest --k=3
Before Commit
# Verify changed modules only
/mobile-verify --module=$(git diff --name-only | head -1) --k=2
Before Push
# Full verification
/mobile-verify --k=3
Before Release
# Thorough verification with flaky detection
/mobile-verify --k=5 --flaky
Interpreting Results
Pass@k Scores
| Score | Meaning | Action |
|---|---|---|
| 1.0 | Perfect | Celebrate |
| 0.8-0.9 | Excellent | Monitor |
| 0.6-0.7 | Good | Investigate |
| 0.4-0.5 | Fair | Fix needed |
| 0.0-0.3 | Poor | Block release |
Trends
Track pass@k over time:
Week 1: Pass@3 = 0.85
Week 2: Pass@3 = 0.87 ↗ Improving
Week 3: Pass@3 = 0.82 ↘ Degraded - investigate!
Week 4: Pass@3 = 0.88 ↗ Recovered
Flaky Test Patterns
| Pattern | Likely Cause |
|---|---|
| Fails on iteration 1 only | Cold start issue |
| Fails randomly | Async timing |
| Fails on specific iteration | Resource leak |
| Fails in parallel only | Shared state |
Fixing Flaky Tests
Step 1: Identify Pattern
/mobile-verify --flaky --k=10
Look for patterns in failures.
Step 2: Add Diagnostics
@Test
fun flakyTest() = runTest {
val startTime = System.currentTimeMillis()
// ... test code ...
val duration = System.currentTimeMillis() - startTime
Log.d("Test", "Duration: $duration ms") // Check for timing issues
}
Step 3: Apply Fix
Common fixes:
- Add
advanceUntilIdle()for coroutines - Add
IdlingResourcefor network - Disable animations for UI tests
- Use
@UiThreadTestfor main thread work - Add explicit waits for async operations
Step 4: Verify Fix
/mobile-verify --class=FixedTest --k=5
Target: Pass@5 = 1.0
Integration
With Checkpoints
Create checkpoint before verification:
/mobile-checkpoint save pre-verify
/mobile-verify --k=3
With Memory
Track pass@k in memory:
{
"test-coverage": {
"passAt3": 0.87,
"trend": "improving",
"flakyTests": []
}
}
With Instincts
Learn testing patterns:
{
"id": "test-coroutine-async",
"description": "Always use runTest + advanceUntilIdle for ViewModel tests",
"confidence": 0.95
}
Thresholds by Context
| Context | Pass@k Threshold | Rationale |
|---|---|---|
| Unit tests | 0.95 | Should be deterministic |
| UI tests | 0.80 | More fragile, device-dependent |
| Compose tests | 0.90 | Better than Espresso, more stable |
| Integration tests | 0.70 | Complex, more variables |
| E2E tests | 0.60 | Full system, many variables |
Best Practices
- Start High, Go Low: Use k=5 for investigation, k=3 for routine
- Fix Flaky Fast: Don't tolerate flaky tests
- Track Trends: Monitor pass@k over time
- Context Matters: UI tests can have lower thresholds than unit
- Block Release: Failed verification should block releases
Remember: A test that sometimes passes is worse than no test at all. It gives false confidence.