Implementing

165 documents

Code Quality

Architecture

Use MVVM with [CommunityToolkit.Mvvm](https://learn.microsoft.com/en-us/dotnet/communitytoolkit/mvvm/) — source-gener...

Completeness: finish the work, don't defer by default

Deliver the full agreed scope. Don't silently mark work out of scope, declare done prematurely, or invoke YAGNI to skip required work.

Dependency Injection

Constructor injection via `Microsoft.Extensions.DependencyInjection`. Use interface types for dependencies, not concr...

File paths

Use `pathlib.Path`, not `os.path`. All path manipulation should go through `pathlib`.

python

Hilt dependency injection for Android

Use Hilt with KSP and constructor injection for Android DI; scope bindings to the correct Hilt component and reserve @Singleton for app-scoped state.

kotlin

Linting before the first PR

All projects MUST have linting configured and passing before the first pull request.

csharpkotlinswifttypescriptweb

Naming

- `PascalCase` for types, methods, properties, public fields, constants, namespaces

No external dependencies in core libraries

`roadmap_lib` uses the standard library only. Do not add PyYAML, requests, or other third-party packages to core libr...

Nullable Reference Types

Enable `<Nullable>enable</Nullable>` in all projects. Treat warnings as design signals — `string` means non-null, `st...

Scope discipline

Only modify what was requested. State the goal before starting. Note but do not fix adjacent issues.

Shell scripts

Shell script `main()` functions must only call other functions — no inline logic. Keep scripts composable and testable.

Small, atomic commits

One logical change per commit. A change may touch multiple files if they are part of the same concept. Commits should...

Type hints

Type hints are welcome but not required. Maintain Python 3.9 compatibility — use `from __future__ import annotations`...

python

TypeScript strictness configuration

Set strict: true on every new TypeScript project and adopt the stricter index/module flags incrementally.

typescript

Use roadmap_lib

Use functions from `roadmap_lib` for all roadmap operations (reading state, parsing frontmatter, finding steps, etc.)...

Value objects over primitive obsession

Wrap domain primitives that carry invariants in small immutable value objects so validation lives in one place and invalid instances cannot be constructed.

Verification harnesses as agent guardrails

Give every agent a runnable pass/fail check it can run on itself, and enforce correctness through deterministic gates rather than prompt text.

Writing code for the AI reader

Favor explicit, greppable, locally-readable code so AI agents can find and modify behavior on the first pass — without sacrificing human readability.

YAML frontmatter

Parse YAML frontmatter with the built-in frontmatter parser in `roadmap_lib`. Do not add a PyYAML dependency. The par...

Data

Access Pattern Analysis

Rules for analyzing query access patterns to drive schema and index decisions, covering read-heavy vs write-heavy tradeoffs, designing for WHERE/JOIN/ORDER BY, identifying missing indexes, and sync-specific batch sizing and transaction patterns.

sqlitepostgresql

Advanced database indexing

Match the Postgres index type to the access pattern, build on live tables with CONCURRENTLY, and validate with EXPLAIN ANALYZE.

Clock Systems for Sync

How to choose the right clock system for distributed sync: physical clocks, Lamport timestamps, vector clocks, Hybrid Logical Clocks, and server-assigned monotonic versions.

sqlitepostgresql

Conflict Resolution

How to choose and implement a conflict resolution strategy for sync: LWW, server-wins, field-level merge, CRDTs, Operational Transformation, and manual conflict queues.

sqlitepostgresql

Connection pooling for server and serverless backends

Front Postgres with a transaction-mode pooler for serverless or many-instance backends, and never depend on session-scoped state.

Constraints and validation

CHECK constraints for SQLite: evaluation rules, enum-like constraints, boolean enforcement, range and pattern validation, NULL truthiness, and limitations.

sqlitepostgresql

Data retention and deletion

Define a retention schedule per data category and automate deletion or anonymization that cascades to every derived store.

Data types and type affinity

SQLite type affinity rules, the STRING gotcha, STRICT tables, and type mapping between SQLite and PostgreSQL for cross-database compatibility.

sqlitepostgresql

Database

Use SQLite with WAL mode for concurrent read access. No ORM — use direct SQL via the `sqlite3` standard library module.

python

Database backup and recovery

Prescriptive rules for SQLite backup methods, corruption prevention, integrity checking, recovery procedures, VACUUM strategy, and database size management.

sqlitepostgresql

Database naming conventions

Snake_case naming rules for tables, columns, primary keys, foreign keys, indexes, constraints, and triggers — including reserved word avoidance.

sqlitepostgresql

Deterministic IDs

Always use the roadmap file's own UUID from its YAML frontmatter. Never generate random UUIDs. IDs must be determinis...

Foreign keys and referential integrity

Enabling and declaring foreign keys in SQLite, ON DELETE/UPDATE actions, deferred constraints, indexing FK columns, and common pitfalls.

sqlitepostgresql

Indexing

Rules for creating effective indexes in SQLite and PostgreSQL, covering B-tree fundamentals, composite ordering, covering indexes, partial and expression indexes, sync metadata indexes, and when not to index.

sqlitepostgresql

JSON columns and generated columns

JSON storage and extraction in SQLite, json_each for array iteration, generated columns for indexing JSON fields, and when JSON is a schema design smell.

sqlitepostgresql

Normalization and denormalization

Start normalized (3NF), denormalize only measured hotspots. SQLite-specific tradeoffs and sync-safe denormalization guidance.

sqlitepostgresql

Offline-First Architecture

Design rules for offline-first apps: WAL as the foundation, operation queues, optimistic UI updates, rollback on rejection, offline schema migrations, data expiry, and connectivity-aware sync scheduling.

sqlitepostgresql

Primary key strategies

Choosing between INTEGER PRIMARY KEY, AUTOINCREMENT, UUID, and WITHOUT ROWID — including sync compatibility and cross-database PK design.

sqlitepostgresql

Query Optimization

Rules for writing efficient SQLite and PostgreSQL queries, including query planner behavior, anti-patterns that cause full table scans, JSON query performance, subquery elimination, and CTE vs subquery tradeoffs.

sqlitepostgresql

Relationship patterns

One-to-many, many-to-many, polymorphic FKs, self-referential tables, and tree hierarchy patterns with tradeoffs and SQLite-specific guidance.

sqlitepostgresql

Room persistence on Android

Use Room with KSP, Flow-returning observable reads, suspend writes, and @Transaction-wrapped multi-step operations on Android.

kotlin

Schema evolution and migrations

Migration strategies for SQLite: PRAGMA user_version, ALTER TABLE limitations, the 12-step recreate procedure, and sync-compatible migration rules.

sqlitepostgresql

SQLite Sync Tooling

Comparison and selection guide for SQLite sync tools: Session Extension, cr-sqlite, Litestream, ElectricSQL, PowerSync, Turso/libSQL, and sqlite-sync — with a decision matrix and selection criteria.

sqlitepostgresql

Sync Engine Design

How to design a client-side sync engine: layered architecture, entity-agnostic Syncable interface, the six-step sync cycle, scheduling strategies, snapshot rebuilding, and error handling with circuit breakers.

sqlitepostgresql

Sync Protocol

Rules for designing the sync protocol between client and server: push/pull direction, full vs incremental sync, change tracking, batching, idempotency, the outbox pattern, and retry with backoff.

sqlitepostgresql

Sync Schema Design

Schema design rules for databases that sync across devices: UUID primary keys, timestamp columns, soft deletes, dirty tracking, version columns, and sync metadata tables.

sqlitepostgresql

Table partitioning and time-series data

Partition large tables only when a measured size or retention need justifies the operational cost, and apply time-series patterns deliberately.

Transaction isolation and serialization-failure retry

Choose an isolation level per transaction and retry serialization failures with bounded, idempotent backoff.

Transactions and Concurrency

Rules for transaction management and concurrency in SQLite, covering WAL mode, journal mode selection, BEGIN IMMEDIATE vs DEFERRED, connection strategies, busy_timeout, PRAGMA tuning, and WAL benefits for sync workloads.

sqlitepostgresql

Zero-downtime migrations: expand and contract

Migrate a live database with expand-and-contract: every step backward-compatible with the running app, indexes built concurrently.

Networking

AI Cost Management

AI API calls cost $0.01-$0.10+ each. Systems MUST treat AI calls as a managed resource with budgets, caching, and fallback strategies.

API Design

Use REST with consistent conventions. Follow the platform API guidelines (Microsoft, Google,

Be strict and maintain: Postel reconsidered (RFC 9413)

Parse protocol and API inputs strictly, reject violations loudly, and actively co-evolve spec and implementation instead of tolerating drift.

Caching

Use HTTP caching headers. The server controls cache policy; the client honors it.

typescriptweb

Error Responses

Use [RFC 9457 Problem Details](https://www.rfc-editor.org/rfc/rfc9457) format with

HTTP conditional requests and optimistic concurrency

Use ETags with If-None-Match for efficient reads and If-Match for optimistic concurrency on writes to prevent lost updates.

Idempotency keys for write APIs

Accept a client-supplied Idempotency-Key on write endpoints so retries are safe, and reject key reuse with different parameters.

MCP server design

Design MCP servers by choosing the right primitive and giving each tool a precise name, output schema, and annotations.

Offline and Connectivity

For apps that must work offline, design for local-first with background sync.

web

Pagination

Prefer **cursor pagination** for most APIs — stable under concurrent mutations, consistent

Rate Limiting

Respect server rate limits. Handle 429 responses gracefully.

Real-Time Communication

Choose the simplest technique that meets your needs.

web

Retry and Resilience

Not every failure is permanent. Retry transient failures with exponential backoff and jitter.

typescriptweb

Timeouts

Always set both connection and read timeouts. Never use infinite timeouts.

Web services

Use Flask for web services. The dashboard service runs on Flask with a REST API and SSE/polling for live updates.

pythonweb

Observability

Platform Integration

App Intents

Expose key app actions and data as App Intents so Siri, Shortcuts, Spotlight, widgets, and the system can invoke them.

swiftiosmacos

Background tasks

Apps that sync data, process uploads, or maintain state SHOULD use platform background execution APIs rather than relying on foreground presence.

iosmacosandroidwindowsweb

Deep linking

All significant feature points and views MUST be deep linkable using the platform's native URL/deep link mechanism:

kotlinswifttypescriptwebwindows

Handoff and continuity

Apps available on multiple devices SHOULD support continuity features so users can start work on one device and resume on another.

iosmacosandroidweb

Notifications

Apps SHOULD use the platform notification system for timely, actionable alerts that respect user preferences.

iosmacosandroidwindowsweb

Scriptable and automatable

Components and flows SHOULD be scriptable where the platform supports it:

csharpioskotlinmacosswiftwebwindows

Search integration

App content SHOULD be discoverable through the platform's system search, enabling users to find content without opening the app.

iosmacosandroidwindowsweb

Share and inter-app data flow

Apps SHOULD participate in the platform's share and inter-app data exchange mechanisms to integrate with other apps and workflows.

iosmacosandroidwindowsweb

Use AppKit and UIKit, not SwiftUI

Use AppKit (macOS) and UIKit (iOS) for all UI. Use SwiftUI only where Apple requires it.

iosmacos

Widgets and glanceable surfaces

Apps with time-sensitive or frequently checked data SHOULD provide widgets and glanceable surfaces on platforms that support them.

iosmacosandroidweb

Security

Agent guardrails

Wrap agents in deterministic input/output guardrails, least-privilege tool access, human confirmation for irreversible actions, and a kill switch.

Authentication

Use OAuth 2.0 / OpenID Connect with PKCE for all public clients. The Implicit flow is

csharpioskotlintypescriptwebwindows

Authorization

**Server-side authorization is the only real authorization.** Client-side checks (hiding

typescriptweb

Consent management

Capture granular, versioned, withdrawable consent in an auditable log and gate all non-essential processing on it.

Content Security Policy

Prevent XSS and injection with a strict CSP. Web apps only.

typescriptweb

CORS

Cross-Origin Resource Sharing — get it right or don't enable it.

web

Data subject rights (DSAR)

Architect every personal-data store to be enumerable, exportable, and deletable by subject id so DSARs are satisfied within the legal SLA.

Dependency Security

Your dependencies are your attack surface. Manage them actively.

pythontypescript

Input Validation

**Never trust client input.** Client-side validation is a UX feature, not a security control.

typescriptweb

LLM and agentic application security

Treat all model output as untrusted, defend against direct and indirect prompt injection, and constrain tool agency.

MCP server security

Harden MCP servers against tool poisoning, rug-pulls, token passthrough, confused-deputy, session hijacking, and SSRF.

MCP tool input validation

Treat every MCP tool argument as untrusted model-supplied input: schema-validate, authorize per call, and bound resource access.

Passkeys and WebAuthn

Implement phishing-resistant passwordless auth with passkeys/WebAuthn, prefer them over passwords and SMS-OTP, and plan recovery.

PII handling and classification

Classify PII at the schema level, minimize collection, encrypt at rest and in transit, and never write it to logs.

Privacy and security by default

Collect only what is needed. Prefer on-device processing.

kotlinswifttypescript

Secure Storage

Tokens, credentials, and any sensitive data MUST use platform secure storage. Never store secrets in plaintext config...

kotlinswiftwindows

Security Headers Checklist

Every web application should set these response headers:

web

Sender-constrained access tokens

Bind access tokens to the client with DPoP or mTLS so a stolen token cannot be replayed by another party.

Sensitive Data

Minimize what you collect, encrypt what you keep, never log what you shouldn't.

typescriptweb

Token Handling

Short-lived (5-15 min). Include only necessary claims — no PII in JWTs

kotlintypescriptwebwindows

Transport Security

**TLS 1.2 minimum**, prefer TLS 1.3. Disable TLS 1.0 and 1.1 entirely.

typescriptweb

Skills And Agents

Ui

Always show progress

When the UI is waiting on an async task:

Android edge-to-edge and window insets

Render Android apps edge-to-edge and consume WindowInsets so content is never hidden behind the status bar, navigation bar, or IME.

kotlin

Android navigation in Compose

Use type-safe Navigation Compose with serializable routes, single-activity architecture, and hoisted nav state.

kotlin

Android predictive back

Migrate off deprecated back handling to OnBackPressedDispatcher and support the predictive back gesture with progress-driven animations.

kotlin

Animation & Motion

Motion should be purposeful — guide attention, show spatial relationships, and provide

windows

Apple design language and widgets

Adopt the system Apple design language and materials over custom chrome, and version-gate brand-new design APIs like Liquid Glass.

swiftiosmacos

Color

Use color with intention — never as the sole means of conveying information.

typescriptwebwindows

Core Web Vitals and performance budgets

Target LCP <= 2.5s, INP <= 200ms, CLS <= 0.1 at field p75, and enforce a performance budget in CI.

webtypescript

Cross-platform token adaptation

Share one semantic token source across platforms, then render values in each platform's native units, type scale, and idioms.

swiftkotlintypescriptcsharpweb

Dashboard service is display-only

The dashboard service is a generic API and UI layer. It has no knowledge of git, files, or roadmap structure. Agents ...

Data Display

Choose the right pattern for the content type and user task.

Design token distribution

Generate per-platform token artifacts from one source via a build step; never hand-edit the generated outputs.

swiftkotlintypescriptcsharpweb

Design-Time Data

- Use `d:DataContext` and `d:DesignInstance` for XAML designer preview data

csharpwindows

Feedback Patterns

Every user action should have visible feedback. The weight of the feedback should match

Fluent Design

Use built-in WinUI 3 controls — they implement Fluent 2 natively. Never custom-draw what a standard control can do.

csharpwindows

Form Design

Forms are where users do real work. Reduce friction at every step.

web

High DPI / Display Scaling

XAML layout uses effective pixels (epx) — scaling is automatic for all XAML-rendered content.

csharpwindows

Iconography

Icons supplement text — they do not replace it (except for universally understood symbols

windows

Jetpack Compose performance and stability

Minimize Compose recomposition with stable types, deferred state reads, lazy-list keys, and release-build measurement.

kotlin

Jetpack Compose side effects

Run side effects through the correct keyed Compose effect API, never directly inside composition.

kotlin

Jetpack Compose: state hoisting and unidirectional data flow

Hoist UI state to its lowest common owner or the ViewModel, keep composables stateless, and enforce state-down/events-up unidirectional flow.

kotlin

Layout

Design for the content, not a fixed screen size. Layouts should adapt gracefully from

typescriptwebwindows

Material 3 theming on Android

Theme Compose UIs with Material 3 color roles, ColorScheme, type and shape scales, and full dark support.

kotlin

Modern CSS layout and Baseline-driven adoption

Adopt modern interoperable CSS features (container queries, @layer, :has(), subgrid, nesting, view transitions) gated on Baseline status with fallbacks.

web

Platform Design Languages

Defer to these canonical sources before applying the defaults in this file:

kotlinwebwindows

Previews

All UI components MUST include preview declarations for rapid visual verification during development. Previews should...

kotlinswift

Progressive Web App installability

Ship a Web App Manifest plus a service worker with an explicit caching strategy, and account for iOS install/push/storage limits.

webtypescript

Spacing

Use a consistent spatial scale based on a **4px base unit** (8px primary grid). All spacing,

windows

State Design

Every view that loads data or can be empty must handle all four states explicitly. Never

typescriptweb

Theming

WinUI 3 supports tri-state theming: Light, Dark, and High Contrast.

csharpwindows

Theming with tokens

Implement themes as alternate value sets for the same semantic tokens; swap the active set, never the component code.

swiftkotlintypescriptcsharpweb

Touch & Click Targets

Interactive elements MUST be large enough to tap or click accurately. Defer to the platform

ioskotlintypescriptwebwindows

Typography

Use the platform's system font. Establish a type scale with clear roles — don't invent

ioskotlinmacostypescriptwebwindows

Visual Hierarchy

Establish clear importance through size, weight, color, and spacing. Every screen should

windows

Windows 11 materials (Mica and Acrylic)

Apply Mica as the backdrop of long-lived windows and Acrylic for transient surfaces, honoring user theme and system settings.

windowscsharp