---
description: "Convention fallback defaults for /multi-agent:analysis Phase 2b Pass B. Activated only when repo evidence is none and standards binding is silent. Each application of a default opens a risk row in Section 20."
---

# Convention Defaults - Pass B Fallback Reference

<!-- toc -->
- [How the fallback chain works](#how-the-fallback-chain-works)
- [C1 - Folder Structure](#c1---folder-structure)
- [C2 - Class Naming](#c2---class-naming)
- [C3 - UI State Model](#c3---ui-state-model)
- [C4 - Test Method Naming](#c4---test-method-naming)
- [C5 - Accessibility Identifier](#c5---accessibility-identifier)
- [C6 - Localization Key](#c6---localization-key)
- [C8 - SwiftUI Preview macro (iOS only)](#c8---swiftui-preview-macro-ios-only)
- [C7 - Dependency Injection](#c7---dependency-injection)
- [Risk row template (Section 20)](#risk-row-template-section-20)
- [Maintenance](#maintenance)
- [Locked decisions that govern this file](#locked-decisions-that-govern-this-file)
<!-- /toc -->

`/multi-agent:analysis` Phase 1c extracts conventions from each selected repo (folder structure, class naming, state model, test naming, accessibility identifier, localization key, DI registration). When `confidence == "none"` AND the standards binding source (`evidence.standards[]`) does not provide an explicit rule, Pass B falls back to the platform defaults catalogued here. Every applied default emits a row in Section 20 Risks of the rendered document.

> **Language**: This file is read as a system prompt. Prose stays English. Examples carry generic placeholder names (`Foo`, `Bar`); the runtime substitutes the actual feature slug.

> **Locked decision 23**: Applying a default is never silent. Pass B writes a footnote on the rendered cell pointing to this file and lists "convention fallback applied" in Section 20.

## How the fallback chain works

```
Phase 1c extract -> confidence == "none" or "low"
   |
   v
Read evidence.standards[]
   |
   +--- match found: cite standards file, use that pattern
   |
   v
Read conventions-defaults.md (this file)
   |
   v
Apply platform default + open Section 20 risk row
```

## C1 - Folder Structure

| Platform | Default pattern | Example | Rationale |
|---|---|---|---|
| iOS | feature-first + clean arch | `Features/<Feature>/Sources/<Feature>/{Common,Data,Domain,Presentation}/` | Mirrors SwiftPM module boundaries; keeps each feature self-contained |
| Android | feature module + clean arch | `feature/<feature>/src/main/java/<package>/{data,domain,ui}/` | Standard Now-in-Android pattern, aligns with Gradle module isolation |
| Backend | layered | `src/{api,services,repositories,schemas,models}/<feature>/` | Standard FastAPI / Express layering, predictable for new contributors |
| Web | feature folder | `src/features/<feature>/{components,hooks,api,types}/` | Standard Next.js / React feature-folder convention |

## C2 - Class Naming

### C2a stateHolderNaming

| Platform | Default pattern | Example |
|---|---|---|
| iOS | `<Feature>ViewModel` | `OrderSummaryViewModel` |
| Android | `<Feature>ViewModel` | `OrderSummaryViewModel` |
| Backend | not applicable | (services replace state holders) |
| Web | `use<Feature>` hook | `useOrderSummary` |

### C2b viewNaming

| Platform | Default pattern | Example |
|---|---|---|
| iOS | `<Feature>View` | `OrderSummaryView` |
| Android | `<Feature>Screen` | `OrderSummaryScreen` |
| Backend | not applicable | |
| Web | `<Feature>Page` | `OrderSummaryPage` |

### C2c navigatorNaming

| Platform | Default pattern | Example | Notes |
|---|---|---|---|
| iOS | `<Feature>Coordinator` | `OrderSummaryCoordinator` | Conforms to `<Domain>Router` protocol if present |
| Android | `<Feature>Navigator` | `OrderSummaryNavigator` | Compose Navigation destination |
| Backend | not applicable | | |
| Web | route file under `app/` | `app/order-summary/page.tsx` | Next.js App Router default |

### C2d useCaseNaming

| Platform | Default pattern | Example |
|---|---|---|
| iOS | `<Verb><Feature>UseCase` | `FetchOrderSummaryUseCase` |
| Android | `<Verb><Feature>UseCase` | `FetchOrderSummaryUseCase` |
| Backend | `<Feature>Service` | `OrderSummaryService` |
| Web | hook with side effect | `useOrderSummaryQuery` |

### C2e repositoryNaming

| Platform | Default pattern | Example |
|---|---|---|
| iOS | `<Feature>Repository` (protocol) + `<Feature>RepositoryImpl` (class) | `OrderSummaryRepository`, `OrderSummaryRepositoryImpl` |
| Android | `<Feature>Repository` (interface) + `<Feature>RepositoryImpl` (class) | same |
| Backend | `<Feature>Repository` | `OrderSummaryRepository` |
| Web | `<feature>Api` | `orderSummaryApi` |

### C2f dtoNaming

| Platform | Default pattern | Example |
|---|---|---|
| iOS | `<Feature>RequestDTO`, `<Feature>ResponseDTO` | `OrderSummaryRequestDTO`, `OrderSummaryResponseDTO` |
| Android | `<Feature>Dto` | `OrderSummaryDto` |
| Backend | Pydantic `<Feature>In`, `<Feature>Out` | `OrderSummaryIn`, `OrderSummaryOut` |
| Web | TypeScript `<Feature>Dto` | `OrderSummaryDto` |

## C3 - UI State Model

| Platform | Default | Example |
|---|---|---|
| iOS | sealed enum | `enum OrderSummaryUIState { case loading, idle(...), error(...) }` |
| Android | sealed interface | `sealed interface OrderSummaryUiState { data object Loading; data class Idle(...); data class Error(...) }` |
| Backend | not applicable | services do not hold UI state |
| Web | discriminated union | `type OrderSummaryState = { kind: 'loading' } | { kind: 'idle'; ... } | { kind: 'error'; ... }` |

## C4 - Test Method Naming

| Platform | Default pattern | Example |
|---|---|---|
| iOS Swift Testing | `@Test func <scenario>_<expected>()` | `@Test func fetch_validInput_returnsIdle()` |
| iOS XCTest fallback | `test<Scenario>_<Expected>()` | `testFetch_ValidInput_ReturnsIdle()` |
| Android JUnit5 | `fun <funName>_<scenario>_<expectedBehavior>()` | `fun fetch_validInput_returnsIdle()` |
| Backend pytest | `def test_<scenario>_<expected>():` | `def test_fetch_valid_input_returns_idle():` |
| Web Vitest | `it('<does X> when <condition>', ...)` | `it('returns idle when input is valid', ...)` |

## C5 - Accessibility Identifier

| Platform | Default pattern | Example | Rationale |
|---|---|---|---|
| iOS | dot notation `<feature>.<element>` | `orderSummary.continueButton` | XCUITest query syntax friendliness |
| Android | camelCase testTag | `orderSummaryContinueButton` | Compose testTag convention |
| Backend | OpenAPI operationId camelCase | `fetchOrderSummary` | Code generation friendly |
| Web | kebab data-testid `<feature>-<element>` | `order-summary-continue-button` | DOM attribute readability |

## C6 - Localization Key

| Platform | Default pattern | Example | Notes |
|---|---|---|---|
| iOS | hierarchical dot PascalCase | `OrderSummary.ContinueButton` | Matches `Localizable.xcstrings` convention |
| Android | flat snake_case | `order_summary_continue_button` | Matches `strings.xml` convention |
| Backend | not applicable (server-side messages live in error code tables) | | |
| Web | hierarchical dot camelCase | `orderSummary.continueButton` | i18next + ICU MessageFormat default |

Where the catalogue is shared across platforms (authored once, mirrored into each app), the shared source's key is the name on every platform and these defaults apply only to keys it does not hold. Two keys under different conventions with the same display text are one string: match on the value, and reuse before adding (`features/localization-reuse.md`).

## C8 - SwiftUI Preview macro (iOS only)

| Platform | Default pattern | Example | Rationale |
|---|---|---|---|
| iOS Swift 5.9+ | `#Preview` macro | `#Preview("Default") { FooView(viewModel: .preview(.idle)) }` | Modern Xcode 15+ Canvas binding, less boilerplate, supports named previews |
| iOS legacy | `PreviewProvider` struct | `struct FooView_Previews: PreviewProvider { static var previews: some View { FooView(viewModel: .preview(.idle)) } }` | Pre-Swift 5.9 fallback |
| Android | not applicable | (Compose `@Preview` is handled under C3 / C4 conventions, no separate field) | |
| Backend | not applicable | | |
| Web | not applicable | (Storybook stories live in `.stories.tsx` files, tracked under C2 conventions) | |

Detection: scan up to 10 SwiftUI view files in the candidate set; majority pick wins. Confidence `high` if 5+ matching examples, `medium` if 3-4, `low` if 2, `none` if 0 SwiftUI views found (Pass B then omits Section 13.6 with `(N/A: UIKit-only feature)` note per Locked 28).

## C7 - Dependency Injection

| Platform | Default | Example | Rationale |
|---|---|---|---|
| iOS | Manual configurator | `<Domain>DependencyRegistrar.register<Feature>()` | Avoids framework lock-in; testable |
| Android | Hilt module | `@Module @InstallIn(SingletonComponent::class) class <Feature>Module` | Standard Android DI |
| Backend FastAPI | `Depends(get_<feature>_service)` | `service: OrderSummaryService = Depends(get_order_summary_service)` | Native FastAPI pattern |
| Web | hook factory | `useOrderSummaryApi()` returns a memoized client | No framework DI needed |

## Risk row template (Section 20)

When Pass B applies any default from this file, it emits the following row in Section 20 Risks of the rendered document:

```markdown
| <Cell name>: convention fallback applied | Pass B (auto) | Open |
```

With a follow-up question in the cell footnote:

```
^[fallback: conventions-defaults.md:C<n>; repo evidence none, standards binding silent. Confirm or override before dev.]
```

The follow-up triggers a human decision: keep the default, override to a different pattern, or update the standards binding source so the question disappears next time.

## Maintenance

When the team standardizes on a different default, update this file directly and rebuild the affected analyses. Avoid storing defaults inline in `analysis-template.md` or `analysis.md`; the indirection through this file keeps the source of truth visible and reviewable.

## Locked decisions that govern this file

- Locked 21: platform-agnostic template + Pass B render
- Locked 22: convention extraction required (Phase 1c)
- Locked 23: convention fallback opens a risk row
- Locked 24: every Pass B cell carries a footnote
- Locked 27: SwiftUI Preview block required for iOS SwiftUI views (Section 13.6, C8 convention)
