一键导入
mobile-verification
Automated testing workflow with pass@k metrics for mobile development. Detects flaky tests and ensures code reliability.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Automated testing workflow with pass@k metrics for mobile development. Detects flaky tests and ensures code reliability.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Core Android development patterns for Kotlin, including coroutines, lifecycle management, and functional programming idioms.
Apple Combine framework for reactive programming. Publishers, subscribers, operators, and error handling.
Pattern extraction and skill generation for mobile development sessions. Automatically learns from your coding patterns.
Instinct-based learning system with confidence scoring for mobile patterns. Automatically extracts and evolves patterns.
Core Data for iOS persistence. Data models, fetch requests, background contexts, and SwiftData migration.
Kotlin Coroutines and Flow patterns for structured concurrency, error handling, and async operations.
| name | mobile-verification |
| description | Automated testing workflow with pass@k metrics for mobile development. Detects flaky tests and ensures code reliability. |
Comprehensive testing workflow with pass@k metrics for Android development reliability.
Single test runs lie.
A test that passes once might fail tomorrow. Verification loops run tests multiple times to reveal:
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%)
Purpose: Fast feedback during development
Usage: /mobile-verify --k=2
Time: ~2 minutes
When: After small changes, before commit
Purpose: Standard confidence level
Usage: /mobile-verify --k=3
Time: ~5 minutes
When: Before push, after feature complete
Purpose: High confidence, flaky detection
Usage: /mobile-verify --k=5
Time: ~10 minutes
When: Before release, after refactor
Purpose: Maximum confidence
Usage: /mobile-verify --k=10
Time: ~20 minutes
When: Production release, critical bugs
Characteristics:
Target Pass@k: ≥ 0.95 (95%)
Common Flaky Causes:
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)
}
Characteristics:
Target Pass@k: ≥ 0.80 (80%)
Common Flaky Causes:
Fix Strategies:
// Register idling resources
@IdlingResource
val countingIdlingResource = CountingIdlingResource("api")
// Disable animations
@get:Rule
val disableAnimationsRule = DisableAnimationsRule()
Characteristics:
Target Pass@k: ≥ 0.90 (90%)
Common Flaky Causes:
Fix Strategies:
@Composable
fun TestComposable(content: @Composable () -> Unit) {
CompositionLocalProvider(
LocalInspectionMode provides true
) {
content()
}
}
# 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
# Verify changed modules only
/mobile-verify --module=$(git diff --name-only | head -1) --k=2
# Full verification
/mobile-verify --k=3
# Thorough verification with flaky detection
/mobile-verify --k=5 --flaky
| 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 |
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
| 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 |
/mobile-verify --flaky --k=10
Look for patterns in failures.
@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
}
Common fixes:
advanceUntilIdle() for coroutinesIdlingResource for network@UiThreadTest for main thread work/mobile-verify --class=FixedTest --k=5
Target: Pass@5 = 1.0
Create checkpoint before verification:
/mobile-checkpoint save pre-verify
/mobile-verify --k=3
Track pass@k in memory:
{
"test-coverage": {
"passAt3": 0.87,
"trend": "improving",
"flakyTests": []
}
}
Learn testing patterns:
{
"id": "test-coroutine-async",
"description": "Always use runTest + advanceUntilIdle for ViewModel tests",
"confidence": 0.95
}
| 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 |
Remember: A test that sometimes passes is worse than no test at all. It gives false confidence.