inspire-code-android
Android stack conventions: layering, tests, forbidden patterns, quality gates, build commands and seed conventions. Use when writing or testing code in a Android package.
- License 许可
- MIT
- 最近更新
- 2026-11-13
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- inspire-code-android
- layer
- frontend
- stack
- android
- description
- Android stack conventions: layering, tests, forbidden patterns, quality gates, build commands and seed conventions. Use when writing or testing code in a Android package.
03 SKILL.md 正文
Layering
Not yet formulated for this stack — deliberately deferred to an Android iteration that exercises real module boundaries, rather than transcribed untested from another stack's rules. The contract in _references/stack-skills.md still applies; this line is the deferral, not the answer. The test-level table below implies the working shape (ViewModel / UseCase / Repository / DataSource), but the boundary rules are unwritten.
Test conventions
-
JUnit 5 with one mock framework per project — MockK or Mockito, chosen once, never mixed in a suite.
-
GIVEN/WHEN/THEN structure, backtick test names describing behavior:
@Test fun `should return user when found by id`() { // GIVEN val userId = "user-123" val expectedUser = UserMother.random(id = userId) coEvery { repository.findById(userId) } returns expectedUser // WHEN val result = runTest { viewModel.loadUser(userId) } // THEN assertEquals(expectedUser, result) coVerify(exactly = 1) { repository.findById(userId) } } -
Test-data builders (
UserMother.random(...)) — specify only the significant fields. -
Verify collaborator calls with exact counts (
coVerify(exactly = 1)/verify(repository, times(1))), not just the returned value. -
Levels:
Layer Framework Mock strategy ViewModel / state machine JUnit 5 + mock framework mock repository, use TestDispatcherUse case JUnit 5 + mock framework mock repository Repository JUnit 5 + mock framework mock DataSource/API Compose UI Compose Testing createComposeRule()Fragments/Activities Espresso launchFragmentInContainer -
Coroutines:
runTest+TestDispatcher; assert emitted states in order (uiState.take(n).toList()), not just the final value.
Forbidden patterns
Not yet formulated for this stack — same deferral as Layering.
Review focus
Not yet formulated for this stack — same deferral as Layering.
Quality gates
Not yet formulated for this stack — the backend profile's gates were measured on a
real codebase and this stack has had no equivalent iteration
(quality-gates.md Rule 2 forbids transcribing
untested). The rules themselves still bind: a project on this stack derives its own
gates (detekt/ktlint rule set, a coverage floor via the jacoco report) from an
iteration that exercises each rule before writing it down. This section is the
deferral, not the answer.
Build & verify
unit: ./gradlew test (debug only: ./gradlew testDebugUnitTest) ·
instrumented: ./gradlew connectedAndroidTest · coverage: ./gradlew jacocoTestReport
04 同仓库更多 Skills
update
Update this project's INSPIRE runtime to the installed plugin's version: report drift, re-materialize unchanged files, and refuse to clobber local edits. Use after /plugin update inspire reports a newer base.
migrate
Move this project's knowledge base from the layered layout (01_adr, 02_modules, 03_features, 04_domain, 05_screens and the surface roster) to the concept layout under inspire_kb/01_spec/, where every artifact has a typed extension, and convert its [[wikilinks]] to relative Markdown links. Run once, on purpose, after /inspire:update reports the layered layout or counts wikilinks. Rebuilds nothing that is already built.
init
Install the INSPIRE runtime into this repository: materialize the skills, validators, hooks and knowledge-base skeleton, register the hooks, and freeze the runtime version. Run once per project. Use when setting up INSPIRE in a new or existing repo.
inspire-workspace
Workspace-level validation: the global pre-PR review (orchestrating module + cross-module checks) and vault-structure validation. Use for the required pre-merge gate and top-level structure checks. ADR lifecycle lives in /inspire-adr; the task tracker in /inspire-task.
inspire-task
Task tracker: create / update / close / list / show tickets in inspire_kb/99_tracker/. A plain-file kanban (one Markdown file per ticket, no external tool) for tracking work, drift, and skill-feedback. Use to open, advance, close, or query tickets.
inspire-spike
Vertical spikes: register and harvest external functional-prototype repos. A spike is a narrow, deep, throwaway build in its OWN repo that answers 'can we build it as we think?'. Use to register such a repo (name/reference it, set up its learnings hygiene) and to capture its learnings into the vault as a gap analysis against the current project.