@heyai-rules/pilo-masterkit 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agent/agents/PILO_MASTER.md +77 -0
- package/.agent/agents/architect.md +211 -0
- package/.agent/agents/backend-specialist.md +263 -0
- package/.agent/agents/build-error-resolver.md +114 -0
- package/.agent/agents/chief-of-staff.md +151 -0
- package/.agent/agents/code-archaeologist.md +106 -0
- package/.agent/agents/code-reviewer.md +237 -0
- package/.agent/agents/cpp-build-resolver.md +90 -0
- package/.agent/agents/cpp-reviewer.md +72 -0
- package/.agent/agents/database-architect.md +226 -0
- package/.agent/agents/database-reviewer.md +91 -0
- package/.agent/agents/debugger.md +225 -0
- package/.agent/agents/devops-engineer.md +242 -0
- package/.agent/agents/doc-updater.md +107 -0
- package/.agent/agents/docs-lookup.md +68 -0
- package/.agent/agents/documentation-writer.md +104 -0
- package/.agent/agents/e2e-runner.md +107 -0
- package/.agent/agents/explorer-agent.md +73 -0
- package/.agent/agents/flutter-reviewer.md +243 -0
- package/.agent/agents/frontend-specialist.md +593 -0
- package/.agent/agents/game-developer.md +162 -0
- package/.agent/agents/go-build-resolver.md +94 -0
- package/.agent/agents/go-reviewer.md +76 -0
- package/.agent/agents/harness-optimizer.md +35 -0
- package/.agent/agents/java-build-resolver.md +153 -0
- package/.agent/agents/java-reviewer.md +92 -0
- package/.agent/agents/kotlin-build-resolver.md +118 -0
- package/.agent/agents/kotlin-reviewer.md +159 -0
- package/.agent/agents/loop-operator.md +36 -0
- package/.agent/agents/mobile-developer.md +377 -0
- package/.agent/agents/orchestrator.md +416 -0
- package/.agent/agents/penetration-tester.md +188 -0
- package/.agent/agents/performance-optimizer.md +187 -0
- package/.agent/agents/planner.md +212 -0
- package/.agent/agents/product-manager.md +112 -0
- package/.agent/agents/product-owner.md +95 -0
- package/.agent/agents/project-planner.md +406 -0
- package/.agent/agents/python-reviewer.md +98 -0
- package/.agent/agents/pytorch-build-resolver.md +120 -0
- package/.agent/agents/qa-automation-engineer.md +103 -0
- package/.agent/agents/refactor-cleaner.md +85 -0
- package/.agent/agents/rust-build-resolver.md +148 -0
- package/.agent/agents/rust-reviewer.md +94 -0
- package/.agent/agents/security-auditor.md +170 -0
- package/.agent/agents/security-reviewer.md +108 -0
- package/.agent/agents/seo-specialist.md +111 -0
- package/.agent/agents/tdd-guide.md +91 -0
- package/.agent/agents/test-engineer.md +158 -0
- package/.agent/agents/typescript-reviewer.md +112 -0
- package/.agent/rules/ARCHITECTURAL_BLUEPRINTS.md +62 -0
- package/.agent/rules/CODE_CRAFTSMANSHIP.md +69 -0
- package/.agent/rules/CORE_RULES.md +72 -0
- package/.agent/rules/PROJECT_MAP.md +58 -0
- package/.agent/rules/QUALITY_ASSURANCE.md +54 -0
- package/.agent/rules/SECURITY_ARMOR.md +44 -0
- package/.agent/rules/VERSION_ORCHESTRATION.md +64 -0
- package/.agent/rules/WORKFLOW_ORCHESTRATION.md +55 -0
- package/.agent/scripts/auto_preview.py +148 -0
- package/.agent/scripts/checklist.py +217 -0
- package/.agent/scripts/session_manager.py +120 -0
- package/.agent/scripts/verify_all.py +327 -0
- package/.agent/skills/api-patterns/SKILL.md +81 -0
- package/.agent/skills/api-patterns/api-style.md +42 -0
- package/.agent/skills/api-patterns/auth.md +24 -0
- package/.agent/skills/api-patterns/documentation.md +26 -0
- package/.agent/skills/api-patterns/graphql.md +41 -0
- package/.agent/skills/api-patterns/rate-limiting.md +31 -0
- package/.agent/skills/api-patterns/response.md +37 -0
- package/.agent/skills/api-patterns/rest.md +40 -0
- package/.agent/skills/api-patterns/scripts/api_validator.py +211 -0
- package/.agent/skills/api-patterns/security-testing.md +122 -0
- package/.agent/skills/api-patterns/trpc.md +41 -0
- package/.agent/skills/api-patterns/versioning.md +22 -0
- package/.agent/skills/app-builder/SKILL.md +75 -0
- package/.agent/skills/app-builder/agent-coordination.md +71 -0
- package/.agent/skills/app-builder/feature-building.md +53 -0
- package/.agent/skills/app-builder/project-detection.md +34 -0
- package/.agent/skills/app-builder/scaffolding.md +118 -0
- package/.agent/skills/app-builder/tech-stack.md +41 -0
- package/.agent/skills/app-builder/templates/SKILL.md +39 -0
- package/.agent/skills/app-builder/templates/astro-static/TEMPLATE.md +76 -0
- package/.agent/skills/app-builder/templates/chrome-extension/TEMPLATE.md +92 -0
- package/.agent/skills/app-builder/templates/cli-tool/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/electron-desktop/TEMPLATE.md +88 -0
- package/.agent/skills/app-builder/templates/express-api/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/flutter-app/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/monorepo-turborepo/TEMPLATE.md +90 -0
- package/.agent/skills/app-builder/templates/nextjs-fullstack/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-saas/TEMPLATE.md +122 -0
- package/.agent/skills/app-builder/templates/nextjs-static/TEMPLATE.md +169 -0
- package/.agent/skills/app-builder/templates/nuxt-app/TEMPLATE.md +134 -0
- package/.agent/skills/app-builder/templates/python-fastapi/TEMPLATE.md +83 -0
- package/.agent/skills/app-builder/templates/react-native-app/TEMPLATE.md +119 -0
- package/.agent/skills/architecture/SKILL.md +55 -0
- package/.agent/skills/architecture/context-discovery.md +43 -0
- package/.agent/skills/architecture/examples.md +94 -0
- package/.agent/skills/architecture/pattern-selection.md +68 -0
- package/.agent/skills/architecture/patterns-reference.md +50 -0
- package/.agent/skills/architecture/trade-off-analysis.md +77 -0
- package/.agent/skills/bash-linux/SKILL.md +199 -0
- package/.agent/skills/behavioral-modes/SKILL.md +242 -0
- package/.agent/skills/brainstorming/SKILL.md +163 -0
- package/.agent/skills/brainstorming/dynamic-questioning.md +350 -0
- package/.agent/skills/clean-code/SKILL.md +201 -0
- package/.agent/skills/code-review-checklist/SKILL.md +109 -0
- package/.agent/skills/database-design/SKILL.md +52 -0
- package/.agent/skills/database-design/database-selection.md +43 -0
- package/.agent/skills/database-design/indexing.md +39 -0
- package/.agent/skills/database-design/migrations.md +48 -0
- package/.agent/skills/database-design/optimization.md +36 -0
- package/.agent/skills/database-design/orm-selection.md +30 -0
- package/.agent/skills/database-design/schema-design.md +56 -0
- package/.agent/skills/database-design/scripts/schema_validator.py +172 -0
- package/.agent/skills/deployment-procedures/SKILL.md +241 -0
- package/.agent/skills/doc.md +177 -0
- package/.agent/skills/documentation-templates/SKILL.md +194 -0
- package/.agent/skills/frontend-design/SKILL.md +452 -0
- package/.agent/skills/frontend-design/animation-guide.md +331 -0
- package/.agent/skills/frontend-design/color-system.md +311 -0
- package/.agent/skills/frontend-design/decision-trees.md +418 -0
- package/.agent/skills/frontend-design/motion-graphics.md +306 -0
- package/.agent/skills/frontend-design/scripts/accessibility_checker.py +183 -0
- package/.agent/skills/frontend-design/scripts/ux_audit.py +722 -0
- package/.agent/skills/frontend-design/typography-system.md +345 -0
- package/.agent/skills/frontend-design/ux-psychology.md +1116 -0
- package/.agent/skills/frontend-design/visual-effects.md +383 -0
- package/.agent/skills/game-development/2d-games/SKILL.md +119 -0
- package/.agent/skills/game-development/3d-games/SKILL.md +135 -0
- package/.agent/skills/game-development/SKILL.md +167 -0
- package/.agent/skills/game-development/game-art/SKILL.md +185 -0
- package/.agent/skills/game-development/game-audio/SKILL.md +190 -0
- package/.agent/skills/game-development/game-design/SKILL.md +129 -0
- package/.agent/skills/game-development/mobile-games/SKILL.md +108 -0
- package/.agent/skills/game-development/multiplayer/SKILL.md +132 -0
- package/.agent/skills/game-development/pc-games/SKILL.md +144 -0
- package/.agent/skills/game-development/vr-ar/SKILL.md +123 -0
- package/.agent/skills/game-development/web-games/SKILL.md +150 -0
- package/.agent/skills/geo-fundamentals/SKILL.md +156 -0
- package/.agent/skills/geo-fundamentals/scripts/geo_checker.py +289 -0
- package/.agent/skills/i18n-localization/SKILL.md +154 -0
- package/.agent/skills/i18n-localization/scripts/i18n_checker.py +241 -0
- package/.agent/skills/intelligent-routing/SKILL.md +335 -0
- package/.agent/skills/lint-and-validate/SKILL.md +45 -0
- package/.agent/skills/lint-and-validate/scripts/lint_runner.py +184 -0
- package/.agent/skills/lint-and-validate/scripts/type_coverage.py +173 -0
- package/.agent/skills/mcp-builder/SKILL.md +176 -0
- package/.agent/skills/mobile-design/SKILL.md +394 -0
- package/.agent/skills/mobile-design/decision-trees.md +516 -0
- package/.agent/skills/mobile-design/mobile-backend.md +491 -0
- package/.agent/skills/mobile-design/mobile-color-system.md +420 -0
- package/.agent/skills/mobile-design/mobile-debugging.md +122 -0
- package/.agent/skills/mobile-design/mobile-design-thinking.md +357 -0
- package/.agent/skills/mobile-design/mobile-navigation.md +458 -0
- package/.agent/skills/mobile-design/mobile-performance.md +767 -0
- package/.agent/skills/mobile-design/mobile-testing.md +356 -0
- package/.agent/skills/mobile-design/mobile-typography.md +433 -0
- package/.agent/skills/mobile-design/platform-android.md +666 -0
- package/.agent/skills/mobile-design/platform-ios.md +561 -0
- package/.agent/skills/mobile-design/scripts/mobile_audit.py +670 -0
- package/.agent/skills/mobile-design/touch-psychology.md +537 -0
- package/.agent/skills/nextjs-react-expert/1-async-eliminating-waterfalls.md +351 -0
- package/.agent/skills/nextjs-react-expert/2-bundle-bundle-size-optimization.md +240 -0
- package/.agent/skills/nextjs-react-expert/3-server-server-side-performance.md +490 -0
- package/.agent/skills/nextjs-react-expert/4-client-client-side-data-fetching.md +264 -0
- package/.agent/skills/nextjs-react-expert/5-rerender-re-render-optimization.md +581 -0
- package/.agent/skills/nextjs-react-expert/6-rendering-rendering-performance.md +432 -0
- package/.agent/skills/nextjs-react-expert/7-js-javascript-performance.md +684 -0
- package/.agent/skills/nextjs-react-expert/8-advanced-advanced-patterns.md +150 -0
- package/.agent/skills/nextjs-react-expert/9-cache-components.md +103 -0
- package/.agent/skills/nextjs-react-expert/SKILL.md +293 -0
- package/.agent/skills/nextjs-react-expert/scripts/convert_rules.py +222 -0
- package/.agent/skills/nextjs-react-expert/scripts/react_performance_checker.py +252 -0
- package/.agent/skills/nodejs-best-practices/SKILL.md +333 -0
- package/.agent/skills/parallel-agents/SKILL.md +175 -0
- package/.agent/skills/performance-profiling/SKILL.md +143 -0
- package/.agent/skills/performance-profiling/scripts/lighthouse_audit.py +76 -0
- package/.agent/skills/plan-writing/SKILL.md +152 -0
- package/.agent/skills/powershell-windows/SKILL.md +167 -0
- package/.agent/skills/python-patterns/SKILL.md +441 -0
- package/.agent/skills/red-team-tactics/SKILL.md +199 -0
- package/.agent/skills/rust-pro/SKILL.md +176 -0
- package/.agent/skills/seo-fundamentals/SKILL.md +129 -0
- package/.agent/skills/seo-fundamentals/scripts/seo_checker.py +219 -0
- package/.agent/skills/server-management/SKILL.md +161 -0
- package/.agent/skills/systematic-debugging/SKILL.md +109 -0
- package/.agent/skills/tailwind-patterns/SKILL.md +269 -0
- package/.agent/skills/tdd-workflow/SKILL.md +149 -0
- package/.agent/skills/testing-patterns/SKILL.md +178 -0
- package/.agent/skills/testing-patterns/scripts/test_runner.py +219 -0
- package/.agent/skills/ui-ux-pro-max/SKILL.md +292 -0
- package/.agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/.agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/.agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/.agent/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/.agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/.agent/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/.agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/.agent/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/.agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/.agent/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/.agent/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
- package/.agent/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
- package/.agent/skills/ui-ux-pro-max/scripts/__pycache__/search.cpython-314.pyc +0 -0
- package/.agent/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/.agent/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/.agent/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/.agent/skills/vulnerability-scanner/SKILL.md +276 -0
- package/.agent/skills/vulnerability-scanner/checklists.md +121 -0
- package/.agent/skills/vulnerability-scanner/scripts/security_scan.py +458 -0
- package/.agent/skills/web-design-guidelines/SKILL.md +57 -0
- package/.agent/skills/webapp-testing/SKILL.md +187 -0
- package/.agent/skills/webapp-testing/scripts/playwright_runner.py +173 -0
- package/.agent/tasks/lessons.md +40 -0
- package/.agent/tasks/todo.md +33 -0
- package/.agent/workflows/aside.md +164 -0
- package/.agent/workflows/brainstorm.md +113 -0
- package/.agent/workflows/build-fix.md +62 -0
- package/.agent/workflows/checkpoint.md +74 -0
- package/.agent/workflows/claw.md +51 -0
- package/.agent/workflows/code-review.md +40 -0
- package/.agent/workflows/context-budget.md +29 -0
- package/.agent/workflows/cpp-build.md +173 -0
- package/.agent/workflows/cpp-review.md +132 -0
- package/.agent/workflows/cpp-test.md +251 -0
- package/.agent/workflows/create.md +59 -0
- package/.agent/workflows/debug.md +103 -0
- package/.agent/workflows/deploy.md +176 -0
- package/.agent/workflows/devfleet.md +92 -0
- package/.agent/workflows/docs.md +31 -0
- package/.agent/workflows/e2e.md +365 -0
- package/.agent/workflows/enhance.md +63 -0
- package/.agent/workflows/eval.md +120 -0
- package/.agent/workflows/evolve.md +178 -0
- package/.agent/workflows/go-build.md +183 -0
- package/.agent/workflows/go-review.md +148 -0
- package/.agent/workflows/go-test.md +268 -0
- package/.agent/workflows/gradle-build.md +70 -0
- package/.agent/workflows/harness-audit.md +71 -0
- package/.agent/workflows/init-docs.md +46 -0
- package/.agent/workflows/instinct-export.md +66 -0
- package/.agent/workflows/instinct-import.md +114 -0
- package/.agent/workflows/instinct-status.md +59 -0
- package/.agent/workflows/kotlin-build.md +174 -0
- package/.agent/workflows/kotlin-review.md +140 -0
- package/.agent/workflows/kotlin-test.md +312 -0
- package/.agent/workflows/learn-eval.md +116 -0
- package/.agent/workflows/learn.md +70 -0
- package/.agent/workflows/loop-start.md +32 -0
- package/.agent/workflows/loop-status.md +24 -0
- package/.agent/workflows/model-route.md +26 -0
- package/.agent/workflows/multi-backend.md +158 -0
- package/.agent/workflows/multi-execute.md +315 -0
- package/.agent/workflows/multi-frontend.md +158 -0
- package/.agent/workflows/multi-plan.md +268 -0
- package/.agent/workflows/multi-workflow.md +191 -0
- package/.agent/workflows/orchestrate.md +231 -0
- package/.agent/workflows/plan.md +115 -0
- package/.agent/workflows/pm2.md +272 -0
- package/.agent/workflows/preview.md +81 -0
- package/.agent/workflows/projects.md +39 -0
- package/.agent/workflows/promote.md +41 -0
- package/.agent/workflows/prompt-optimize.md +38 -0
- package/.agent/workflows/prune.md +31 -0
- package/.agent/workflows/python-review.md +297 -0
- package/.agent/workflows/quality-gate.md +29 -0
- package/.agent/workflows/refactor-clean.md +80 -0
- package/.agent/workflows/resume-session.md +156 -0
- package/.agent/workflows/rules-distill.md +11 -0
- package/.agent/workflows/rust-build.md +187 -0
- package/.agent/workflows/rust-review.md +142 -0
- package/.agent/workflows/rust-test.md +308 -0
- package/.agent/workflows/save-session.md +275 -0
- package/.agent/workflows/sessions.md +333 -0
- package/.agent/workflows/setup-pm.md +80 -0
- package/.agent/workflows/skill-create.md +174 -0
- package/.agent/workflows/skill-health.md +54 -0
- package/.agent/workflows/status.md +86 -0
- package/.agent/workflows/tdd.md +328 -0
- package/.agent/workflows/test-coverage.md +69 -0
- package/.agent/workflows/test.md +144 -0
- package/.agent/workflows/ui-ux-pro-max.md +296 -0
- package/.agent/workflows/update-codemaps.md +72 -0
- package/.agent/workflows/update-docs.md +84 -0
- package/.agent/workflows/verify.md +59 -0
- package/LICENSE +176 -0
- package/README.md +136 -0
- package/RELEASE.md +36 -0
- package/package.json +79 -0
- package/scripts/release-check.js +55 -0
- package/src/bin/cli.js +78 -0
- package/src/lib/installer.js +140 -0
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Fix Kotlin/Gradle build errors, compiler warnings, and dependency issues incrementally. Invokes the kotlin-build-resolver agent for minimal, surgical fixes.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Kotlin Build and Fix
|
|
6
|
+
|
|
7
|
+
This command invokes the **kotlin-build-resolver** agent to incrementally fix Kotlin build errors with minimal changes.
|
|
8
|
+
|
|
9
|
+
## What This Command Does
|
|
10
|
+
|
|
11
|
+
1. **Run Diagnostics**: Execute `./gradlew build`, `detekt`, `ktlintCheck`
|
|
12
|
+
2. **Parse Errors**: Group by file and sort by severity
|
|
13
|
+
3. **Fix Incrementally**: One error at a time
|
|
14
|
+
4. **Verify Each Fix**: Re-run build after each change
|
|
15
|
+
5. **Report Summary**: Show what was fixed and what remains
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
Use `/kotlin-build` when:
|
|
20
|
+
- `./gradlew build` fails with errors
|
|
21
|
+
- Kotlin compiler reports errors
|
|
22
|
+
- `./gradlew detekt` reports violations
|
|
23
|
+
- Gradle dependency resolution fails
|
|
24
|
+
- After pulling changes that break the build
|
|
25
|
+
|
|
26
|
+
## Diagnostic Commands Run
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Primary build check
|
|
30
|
+
./gradlew build 2>&1
|
|
31
|
+
|
|
32
|
+
# Static analysis
|
|
33
|
+
./gradlew detekt 2>&1 || echo "detekt not configured"
|
|
34
|
+
./gradlew ktlintCheck 2>&1 || echo "ktlint not configured"
|
|
35
|
+
|
|
36
|
+
# Dependency issues
|
|
37
|
+
./gradlew dependencies --configuration runtimeClasspath 2>&1 | head -100
|
|
38
|
+
|
|
39
|
+
# Optional deep refresh when caches or dependency metadata are suspect
|
|
40
|
+
./gradlew build --refresh-dependencies
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Example Session
|
|
44
|
+
|
|
45
|
+
````text
|
|
46
|
+
User: /kotlin-build
|
|
47
|
+
|
|
48
|
+
Agent:
|
|
49
|
+
# Kotlin Build Resolution
|
|
50
|
+
|
|
51
|
+
## Initial Diagnostics
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
$ ./gradlew build
|
|
55
|
+
e: src/main/kotlin/com/example/service/UserService.kt:25:15 Unresolved reference: UserRepository
|
|
56
|
+
e: src/main/kotlin/com/example/routes/UserRoutes.kt:42:9 Type mismatch: inferred type is String but Int was expected
|
|
57
|
+
e: src/main/kotlin/com/example/routes/UserRoutes.kt:58:5 'when' expression must be exhaustive
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Errors found: 3
|
|
61
|
+
|
|
62
|
+
## Fix 1: Unresolved Reference
|
|
63
|
+
|
|
64
|
+
File: src/main/kotlin/com/example/service/UserService.kt:25
|
|
65
|
+
Error: Unresolved reference: UserRepository
|
|
66
|
+
Cause: Missing import
|
|
67
|
+
|
|
68
|
+
```kotlin
|
|
69
|
+
// Added import
|
|
70
|
+
import com.example.repository.UserRepository
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
$ ./gradlew build
|
|
75
|
+
# 2 errors remaining
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Fix 2: Type Mismatch
|
|
79
|
+
|
|
80
|
+
File: src/main/kotlin/com/example/routes/UserRoutes.kt:42
|
|
81
|
+
Error: Type mismatch: inferred type is String but Int was expected
|
|
82
|
+
|
|
83
|
+
```kotlin
|
|
84
|
+
// Changed
|
|
85
|
+
val count = call.parameters["count"]
|
|
86
|
+
// To
|
|
87
|
+
val count = call.parameters["count"]?.toIntOrNull()
|
|
88
|
+
?: return@get call.respond(HttpStatusCode.BadRequest, "Invalid count")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
$ ./gradlew build
|
|
93
|
+
# 1 error remaining
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Fix 3: Non-Exhaustive When
|
|
97
|
+
|
|
98
|
+
File: src/main/kotlin/com/example/routes/UserRoutes.kt:58
|
|
99
|
+
Error: 'when' expression must be exhaustive
|
|
100
|
+
|
|
101
|
+
```kotlin
|
|
102
|
+
// Added missing branch
|
|
103
|
+
when (user.role) {
|
|
104
|
+
Role.ADMIN -> handleAdmin(user)
|
|
105
|
+
Role.USER -> handleUser(user)
|
|
106
|
+
Role.MODERATOR -> handleModerator(user) // Added
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
$ ./gradlew build
|
|
112
|
+
# Build successful!
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Final Verification
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
$ ./gradlew detekt
|
|
119
|
+
# No issues
|
|
120
|
+
|
|
121
|
+
$ ./gradlew test
|
|
122
|
+
# All tests passed
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Summary
|
|
126
|
+
|
|
127
|
+
| Metric | Count |
|
|
128
|
+
|--------|-------|
|
|
129
|
+
| Build errors fixed | 3 |
|
|
130
|
+
| Detekt issues fixed | 0 |
|
|
131
|
+
| Files modified | 2 |
|
|
132
|
+
| Remaining issues | 0 |
|
|
133
|
+
|
|
134
|
+
Build Status: ✅ SUCCESS
|
|
135
|
+
````
|
|
136
|
+
|
|
137
|
+
## Common Errors Fixed
|
|
138
|
+
|
|
139
|
+
| Error | Typical Fix |
|
|
140
|
+
|-------|-------------|
|
|
141
|
+
| `Unresolved reference: X` | Add import or dependency |
|
|
142
|
+
| `Type mismatch` | Fix type conversion or assignment |
|
|
143
|
+
| `'when' must be exhaustive` | Add missing sealed class branches |
|
|
144
|
+
| `Suspend function can only be called from coroutine` | Add `suspend` modifier |
|
|
145
|
+
| `Smart cast impossible` | Use local `val` or `let` |
|
|
146
|
+
| `None of the following candidates is applicable` | Fix argument types |
|
|
147
|
+
| `Could not resolve dependency` | Fix version or add repository |
|
|
148
|
+
|
|
149
|
+
## Fix Strategy
|
|
150
|
+
|
|
151
|
+
1. **Build errors first** - Code must compile
|
|
152
|
+
2. **Detekt violations second** - Fix code quality issues
|
|
153
|
+
3. **ktlint warnings third** - Fix formatting
|
|
154
|
+
4. **One fix at a time** - Verify each change
|
|
155
|
+
5. **Minimal changes** - Don't refactor, just fix
|
|
156
|
+
|
|
157
|
+
## Stop Conditions
|
|
158
|
+
|
|
159
|
+
The agent will stop and report if:
|
|
160
|
+
- Same error persists after 3 attempts
|
|
161
|
+
- Fix introduces more errors
|
|
162
|
+
- Requires architectural changes
|
|
163
|
+
- Missing external dependencies
|
|
164
|
+
|
|
165
|
+
## Related Commands
|
|
166
|
+
|
|
167
|
+
- `/kotlin-test` - Run tests after build succeeds
|
|
168
|
+
- `/kotlin-review` - Review code quality
|
|
169
|
+
- `/verify` - Full verification loop
|
|
170
|
+
|
|
171
|
+
## Related
|
|
172
|
+
|
|
173
|
+
- Agent: `agents/kotlin-build-resolver.md`
|
|
174
|
+
- Skill: `skills/kotlin-patterns/`
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Comprehensive Kotlin code review for idiomatic patterns, null safety, coroutine safety, and security. Invokes the kotlin-reviewer agent.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Kotlin Code Review
|
|
6
|
+
|
|
7
|
+
This command invokes the **kotlin-reviewer** agent for comprehensive Kotlin-specific code review.
|
|
8
|
+
|
|
9
|
+
## What This Command Does
|
|
10
|
+
|
|
11
|
+
1. **Identify Kotlin Changes**: Find modified `.kt` and `.kts` files via `git diff`
|
|
12
|
+
2. **Run Build & Static Analysis**: Execute `./gradlew build`, `detekt`, `ktlintCheck`
|
|
13
|
+
3. **Security Scan**: Check for SQL injection, command injection, hardcoded secrets
|
|
14
|
+
4. **Null Safety Review**: Analyze `!!` usage, platform type handling, unsafe casts
|
|
15
|
+
5. **Coroutine Review**: Check structured concurrency, dispatcher usage, cancellation
|
|
16
|
+
6. **Generate Report**: Categorize issues by severity
|
|
17
|
+
|
|
18
|
+
## When to Use
|
|
19
|
+
|
|
20
|
+
Use `/kotlin-review` when:
|
|
21
|
+
- After writing or modifying Kotlin code
|
|
22
|
+
- Before committing Kotlin changes
|
|
23
|
+
- Reviewing pull requests with Kotlin code
|
|
24
|
+
- Onboarding to a new Kotlin codebase
|
|
25
|
+
- Learning idiomatic Kotlin patterns
|
|
26
|
+
|
|
27
|
+
## Review Categories
|
|
28
|
+
|
|
29
|
+
### CRITICAL (Must Fix)
|
|
30
|
+
- SQL/Command injection vulnerabilities
|
|
31
|
+
- Force-unwrap `!!` without justification
|
|
32
|
+
- Platform type null safety violations
|
|
33
|
+
- GlobalScope usage (structured concurrency violation)
|
|
34
|
+
- Hardcoded credentials
|
|
35
|
+
- Unsafe deserialization
|
|
36
|
+
|
|
37
|
+
### HIGH (Should Fix)
|
|
38
|
+
- Mutable state where immutable suffices
|
|
39
|
+
- Blocking calls inside coroutine context
|
|
40
|
+
- Missing cancellation checks in long loops
|
|
41
|
+
- Non-exhaustive `when` on sealed types
|
|
42
|
+
- Large functions (>50 lines)
|
|
43
|
+
- Deep nesting (>4 levels)
|
|
44
|
+
|
|
45
|
+
### MEDIUM (Consider)
|
|
46
|
+
- Non-idiomatic Kotlin (Java-style patterns)
|
|
47
|
+
- Missing trailing commas
|
|
48
|
+
- Scope function misuse or nesting
|
|
49
|
+
- Missing sequence for large collection chains
|
|
50
|
+
- Redundant explicit types
|
|
51
|
+
|
|
52
|
+
## Automated Checks Run
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Build check
|
|
56
|
+
./gradlew build
|
|
57
|
+
|
|
58
|
+
# Static analysis
|
|
59
|
+
./gradlew detekt
|
|
60
|
+
|
|
61
|
+
# Formatting check
|
|
62
|
+
./gradlew ktlintCheck
|
|
63
|
+
|
|
64
|
+
# Tests
|
|
65
|
+
./gradlew test
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Example Usage
|
|
69
|
+
|
|
70
|
+
````text
|
|
71
|
+
User: /kotlin-review
|
|
72
|
+
|
|
73
|
+
Agent:
|
|
74
|
+
# Kotlin Code Review Report
|
|
75
|
+
|
|
76
|
+
## Files Reviewed
|
|
77
|
+
- src/main/kotlin/com/example/service/UserService.kt (modified)
|
|
78
|
+
- src/main/kotlin/com/example/routes/UserRoutes.kt (modified)
|
|
79
|
+
|
|
80
|
+
## Static Analysis Results
|
|
81
|
+
✓ Build: Successful
|
|
82
|
+
✓ detekt: No issues
|
|
83
|
+
⚠ ktlint: 2 formatting warnings
|
|
84
|
+
|
|
85
|
+
## Issues Found
|
|
86
|
+
|
|
87
|
+
[CRITICAL] Force-Unwrap Null Safety
|
|
88
|
+
File: src/main/kotlin/com/example/service/UserService.kt:28
|
|
89
|
+
Issue: Using !! on nullable repository result
|
|
90
|
+
```kotlin
|
|
91
|
+
val user = repository.findById(id)!! // NPE risk
|
|
92
|
+
```
|
|
93
|
+
Fix: Use safe call with error handling
|
|
94
|
+
```kotlin
|
|
95
|
+
val user = repository.findById(id)
|
|
96
|
+
?: throw UserNotFoundException("User $id not found")
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
[HIGH] GlobalScope Usage
|
|
100
|
+
File: src/main/kotlin/com/example/routes/UserRoutes.kt:45
|
|
101
|
+
Issue: Using GlobalScope breaks structured concurrency
|
|
102
|
+
```kotlin
|
|
103
|
+
GlobalScope.launch {
|
|
104
|
+
notificationService.sendWelcome(user)
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
Fix: Use the call's coroutine scope
|
|
108
|
+
```kotlin
|
|
109
|
+
launch {
|
|
110
|
+
notificationService.sendWelcome(user)
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Summary
|
|
115
|
+
- CRITICAL: 1
|
|
116
|
+
- HIGH: 1
|
|
117
|
+
- MEDIUM: 0
|
|
118
|
+
|
|
119
|
+
Recommendation: ❌ Block merge until CRITICAL issue is fixed
|
|
120
|
+
````
|
|
121
|
+
|
|
122
|
+
## Approval Criteria
|
|
123
|
+
|
|
124
|
+
| Status | Condition |
|
|
125
|
+
|--------|-----------|
|
|
126
|
+
| ✅ Approve | No CRITICAL or HIGH issues |
|
|
127
|
+
| ⚠️ Warning | Only MEDIUM issues (merge with caution) |
|
|
128
|
+
| ❌ Block | CRITICAL or HIGH issues found |
|
|
129
|
+
|
|
130
|
+
## Integration with Other Commands
|
|
131
|
+
|
|
132
|
+
- Use `/kotlin-test` first to ensure tests pass
|
|
133
|
+
- Use `/kotlin-build` if build errors occur
|
|
134
|
+
- Use `/kotlin-review` before committing
|
|
135
|
+
- Use `/code-review` for non-Kotlin-specific concerns
|
|
136
|
+
|
|
137
|
+
## Related
|
|
138
|
+
|
|
139
|
+
- Agent: `agents/kotlin-reviewer.md`
|
|
140
|
+
- Skills: `skills/kotlin-patterns/`, `skills/kotlin-testing/`
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce TDD workflow for Kotlin. Write Kotest tests first, then implement. Verify 80%+ coverage with Kover.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Kotlin TDD Command
|
|
6
|
+
|
|
7
|
+
This command enforces test-driven development methodology for Kotlin code using Kotest, MockK, and Kover.
|
|
8
|
+
|
|
9
|
+
## What This Command Does
|
|
10
|
+
|
|
11
|
+
1. **Define Types/Interfaces**: Scaffold function signatures first
|
|
12
|
+
2. **Write Kotest Tests**: Create comprehensive test specs (RED)
|
|
13
|
+
3. **Run Tests**: Verify tests fail for the right reason
|
|
14
|
+
4. **Implement Code**: Write minimal code to pass (GREEN)
|
|
15
|
+
5. **Refactor**: Improve while keeping tests green
|
|
16
|
+
6. **Check Coverage**: Ensure 80%+ coverage with Kover
|
|
17
|
+
|
|
18
|
+
## When to Use
|
|
19
|
+
|
|
20
|
+
Use `/kotlin-test` when:
|
|
21
|
+
- Implementing new Kotlin functions or classes
|
|
22
|
+
- Adding test coverage to existing Kotlin code
|
|
23
|
+
- Fixing bugs (write failing test first)
|
|
24
|
+
- Building critical business logic
|
|
25
|
+
- Learning TDD workflow in Kotlin
|
|
26
|
+
|
|
27
|
+
## TDD Cycle
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
RED -> Write failing Kotest test
|
|
31
|
+
GREEN -> Implement minimal code to pass
|
|
32
|
+
REFACTOR -> Improve code, tests stay green
|
|
33
|
+
REPEAT -> Next test case
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Example Session
|
|
37
|
+
|
|
38
|
+
````text
|
|
39
|
+
User: /kotlin-test I need a function to validate user registration requests
|
|
40
|
+
|
|
41
|
+
Agent:
|
|
42
|
+
# TDD Session: Registration Validator
|
|
43
|
+
|
|
44
|
+
## Step 1: Define Interface
|
|
45
|
+
|
|
46
|
+
```kotlin
|
|
47
|
+
// validator/RegistrationValidator.kt
|
|
48
|
+
package com.example.validator
|
|
49
|
+
|
|
50
|
+
data class RegistrationRequest(
|
|
51
|
+
val name: String,
|
|
52
|
+
val email: String,
|
|
53
|
+
val password: String,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
sealed class ValidationResult {
|
|
57
|
+
data object Valid : ValidationResult()
|
|
58
|
+
data class Invalid(val errors: List<String>) : ValidationResult()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fun validateRegistration(request: RegistrationRequest): ValidationResult {
|
|
62
|
+
TODO("not implemented")
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Step 2: Write Kotest Tests (RED)
|
|
67
|
+
|
|
68
|
+
```kotlin
|
|
69
|
+
// validator/RegistrationValidatorTest.kt
|
|
70
|
+
package com.example.validator
|
|
71
|
+
|
|
72
|
+
import io.kotest.core.spec.style.FunSpec
|
|
73
|
+
import io.kotest.matchers.shouldBe
|
|
74
|
+
import io.kotest.matchers.types.shouldBeInstanceOf
|
|
75
|
+
|
|
76
|
+
class RegistrationValidatorTest : FunSpec({
|
|
77
|
+
test("valid registration returns Valid") {
|
|
78
|
+
val request = RegistrationRequest(
|
|
79
|
+
name = "Alice",
|
|
80
|
+
email = "alice@example.com",
|
|
81
|
+
password = "SecureP@ss1",
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
val result = validateRegistration(request)
|
|
85
|
+
|
|
86
|
+
result.shouldBeInstanceOf<ValidationResult.Valid>()
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
test("blank name returns Invalid") {
|
|
90
|
+
val request = RegistrationRequest(
|
|
91
|
+
name = "",
|
|
92
|
+
email = "alice@example.com",
|
|
93
|
+
password = "SecureP@ss1",
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
val result = validateRegistration(request)
|
|
97
|
+
|
|
98
|
+
val invalid = result.shouldBeInstanceOf<ValidationResult.Invalid>()
|
|
99
|
+
invalid.errors shouldBe listOf("Name is required")
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
test("invalid email returns Invalid") {
|
|
103
|
+
val request = RegistrationRequest(
|
|
104
|
+
name = "Alice",
|
|
105
|
+
email = "not-an-email",
|
|
106
|
+
password = "SecureP@ss1",
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
val result = validateRegistration(request)
|
|
110
|
+
|
|
111
|
+
val invalid = result.shouldBeInstanceOf<ValidationResult.Invalid>()
|
|
112
|
+
invalid.errors shouldBe listOf("Invalid email format")
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
test("short password returns Invalid") {
|
|
116
|
+
val request = RegistrationRequest(
|
|
117
|
+
name = "Alice",
|
|
118
|
+
email = "alice@example.com",
|
|
119
|
+
password = "short",
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
val result = validateRegistration(request)
|
|
123
|
+
|
|
124
|
+
val invalid = result.shouldBeInstanceOf<ValidationResult.Invalid>()
|
|
125
|
+
invalid.errors shouldBe listOf("Password must be at least 8 characters")
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
test("multiple errors returns all errors") {
|
|
129
|
+
val request = RegistrationRequest(
|
|
130
|
+
name = "",
|
|
131
|
+
email = "bad",
|
|
132
|
+
password = "short",
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
val result = validateRegistration(request)
|
|
136
|
+
|
|
137
|
+
val invalid = result.shouldBeInstanceOf<ValidationResult.Invalid>()
|
|
138
|
+
invalid.errors.size shouldBe 3
|
|
139
|
+
}
|
|
140
|
+
})
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Step 3: Run Tests - Verify FAIL
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
$ ./gradlew test
|
|
147
|
+
|
|
148
|
+
RegistrationValidatorTest > valid registration returns Valid FAILED
|
|
149
|
+
kotlin.NotImplementedError: An operation is not implemented
|
|
150
|
+
|
|
151
|
+
FAILED (5 tests, 0 passed, 5 failed)
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
✓ Tests fail as expected (NotImplementedError).
|
|
155
|
+
|
|
156
|
+
## Step 4: Implement Minimal Code (GREEN)
|
|
157
|
+
|
|
158
|
+
```kotlin
|
|
159
|
+
// validator/RegistrationValidator.kt
|
|
160
|
+
package com.example.validator
|
|
161
|
+
|
|
162
|
+
private val EMAIL_REGEX = Regex("^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}$")
|
|
163
|
+
private const val MIN_PASSWORD_LENGTH = 8
|
|
164
|
+
|
|
165
|
+
fun validateRegistration(request: RegistrationRequest): ValidationResult {
|
|
166
|
+
val errors = buildList {
|
|
167
|
+
if (request.name.isBlank()) add("Name is required")
|
|
168
|
+
if (!EMAIL_REGEX.matches(request.email)) add("Invalid email format")
|
|
169
|
+
if (request.password.length < MIN_PASSWORD_LENGTH) add("Password must be at least $MIN_PASSWORD_LENGTH characters")
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
return if (errors.isEmpty()) ValidationResult.Valid
|
|
173
|
+
else ValidationResult.Invalid(errors)
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Step 5: Run Tests - Verify PASS
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
$ ./gradlew test
|
|
181
|
+
|
|
182
|
+
RegistrationValidatorTest > valid registration returns Valid PASSED
|
|
183
|
+
RegistrationValidatorTest > blank name returns Invalid PASSED
|
|
184
|
+
RegistrationValidatorTest > invalid email returns Invalid PASSED
|
|
185
|
+
RegistrationValidatorTest > short password returns Invalid PASSED
|
|
186
|
+
RegistrationValidatorTest > multiple errors returns all errors PASSED
|
|
187
|
+
|
|
188
|
+
PASSED (5 tests, 5 passed, 0 failed)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
✓ All tests passing!
|
|
192
|
+
|
|
193
|
+
## Step 6: Check Coverage
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
$ ./gradlew koverHtmlReport
|
|
197
|
+
|
|
198
|
+
Coverage: 100.0% of statements
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
✓ Coverage: 100%
|
|
202
|
+
|
|
203
|
+
## TDD Complete!
|
|
204
|
+
````
|
|
205
|
+
|
|
206
|
+
## Test Patterns
|
|
207
|
+
|
|
208
|
+
### StringSpec (Simplest)
|
|
209
|
+
|
|
210
|
+
```kotlin
|
|
211
|
+
class CalculatorTest : StringSpec({
|
|
212
|
+
"add two positive numbers" {
|
|
213
|
+
Calculator.add(2, 3) shouldBe 5
|
|
214
|
+
}
|
|
215
|
+
})
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### BehaviorSpec (BDD)
|
|
219
|
+
|
|
220
|
+
```kotlin
|
|
221
|
+
class OrderServiceTest : BehaviorSpec({
|
|
222
|
+
Given("a valid order") {
|
|
223
|
+
When("placed") {
|
|
224
|
+
Then("should be confirmed") { /* ... */ }
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Data-Driven Tests
|
|
231
|
+
|
|
232
|
+
```kotlin
|
|
233
|
+
class ParserTest : FunSpec({
|
|
234
|
+
context("valid inputs") {
|
|
235
|
+
withData("2026-01-15", "2026-12-31", "2000-01-01") { input ->
|
|
236
|
+
parseDate(input).shouldNotBeNull()
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
})
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Coroutine Testing
|
|
243
|
+
|
|
244
|
+
```kotlin
|
|
245
|
+
class AsyncServiceTest : FunSpec({
|
|
246
|
+
test("concurrent fetch completes") {
|
|
247
|
+
runTest {
|
|
248
|
+
val result = service.fetchAll()
|
|
249
|
+
result.shouldNotBeEmpty()
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
})
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Coverage Commands
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
# Run tests with coverage
|
|
259
|
+
./gradlew koverHtmlReport
|
|
260
|
+
|
|
261
|
+
# Verify coverage thresholds
|
|
262
|
+
./gradlew koverVerify
|
|
263
|
+
|
|
264
|
+
# XML report for CI
|
|
265
|
+
./gradlew koverXmlReport
|
|
266
|
+
|
|
267
|
+
# Open HTML report
|
|
268
|
+
open build/reports/kover/html/index.html
|
|
269
|
+
|
|
270
|
+
# Run specific test class
|
|
271
|
+
./gradlew test --tests "com.example.UserServiceTest"
|
|
272
|
+
|
|
273
|
+
# Run with verbose output
|
|
274
|
+
./gradlew test --info
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Coverage Targets
|
|
278
|
+
|
|
279
|
+
| Code Type | Target |
|
|
280
|
+
|-----------|--------|
|
|
281
|
+
| Critical business logic | 100% |
|
|
282
|
+
| Public APIs | 90%+ |
|
|
283
|
+
| General code | 80%+ |
|
|
284
|
+
| Generated code | Exclude |
|
|
285
|
+
|
|
286
|
+
## TDD Best Practices
|
|
287
|
+
|
|
288
|
+
**DO:**
|
|
289
|
+
- Write test FIRST, before any implementation
|
|
290
|
+
- Run tests after each change
|
|
291
|
+
- Use Kotest matchers for expressive assertions
|
|
292
|
+
- Use MockK's `coEvery`/`coVerify` for suspend functions
|
|
293
|
+
- Test behavior, not implementation details
|
|
294
|
+
- Include edge cases (empty, null, max values)
|
|
295
|
+
|
|
296
|
+
**DON'T:**
|
|
297
|
+
- Write implementation before tests
|
|
298
|
+
- Skip the RED phase
|
|
299
|
+
- Test private functions directly
|
|
300
|
+
- Use `Thread.sleep()` in coroutine tests
|
|
301
|
+
- Ignore flaky tests
|
|
302
|
+
|
|
303
|
+
## Related Commands
|
|
304
|
+
|
|
305
|
+
- `/kotlin-build` - Fix build errors
|
|
306
|
+
- `/kotlin-review` - Review code after implementation
|
|
307
|
+
- `/verify` - Run full verification loop
|
|
308
|
+
|
|
309
|
+
## Related
|
|
310
|
+
|
|
311
|
+
- Skill: `skills/kotlin-testing/`
|
|
312
|
+
- Skill: `skills/tdd-workflow/`
|