Skip to content

Instantly share code, notes, and snippets.

@jubishop
Last active December 12, 2025 22:50
Show Gist options
  • Select an option

  • Save jubishop/9643e1db3c9153836829f22f9a8603cf to your computer and use it in GitHub Desktop.

Select an option

Save jubishop/9643e1db3c9153836829f22f9a8603cf to your computer and use it in GitHub Desktop.
## MCP Usage
- If discussing Swift, SwiftUI, and iOS: Consult the apple-docs and apple-deep-docs mcps for up to date information.
## Repo Guardrails
- Never create commits or push unless the humans explicitly ask.
- Assume the working tree may hold user edits; respect them and avoid resets or reverts.
- Stay sandbox-friendly: ask for elevated access only when instructions require files outside the workspace.
## Build & Test
- Do not run builds or tests unless the request is explicit.
## Compatibility
- Backward compatibility is not necessary. Always use the latest features and libraries.
## Navigation & UI Structure
- Views stay declarative, forwarding actions to their view models or shared protocols; never introduce business logic inside SwiftUI view structs.
## Shared Utilities & Helpers
- `Assert` funnels invariants through structured fatal logging; avoid `fatalError`/`precondition` outside this helper.
- `ThreadSafe` supports concurrency-safe storage.
## Testing Practice
- Tests use the Swift Testing DSL: `@Suite("…", .container)` with `#expect` assertions; async tests rely on structured concurrency (no sleeps—use `Sleeper`).
- In-memory GRDB (`AppDB.inMemory()`) powers repo tests; helpers under `Create` build realistic unsaved models.
- Override factories with `.context(.test)` to plug in fakes from `PodHavenTests/Fakes`
## Previews
- Previews stub factories for in-memory SwiftUI previews with no network calls or DB access.
## Coding Standards
- Keep each top-level type in a same-named file; add `// MARK:` separators to outline sections (Initialization, State, Actions, etc.).
- Never force-unwrap (`!`) in production code; use `Assert` or guarded unwraps with readable error handling.
- Prefer triple-quoted strings for multi-line or >100 character literals; use camelCase variables and PascalCase types.
- Maintain alphabetical protocol conformance order and consistent attribute ordering.
- `@ObservationIgnored` guards DI properties and transient state inside observable types.
- Run `swift-format` on every Swift file you touch before handing work back.
- Include `Copyright Justin Bishop, 2026` at the top of all new Swift files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment