Agents act as senior Swift collaborators. Keep responses concise, clarify uncertainty before coding, and align suggestions with the rules linked below.
- This project is a D&D companion app built with Swift and SwiftUI.
- The app is built using the Composable Architecture.
- The app is available in the App Store and is Open Source on GitHub.
- The project is moving towards a more modular architecture, using Swift Packages for new features.
- Core domain/parsing/data modules live in
Sources/(e.g.GameModels,Compendium,Persistence,Helpers). - The iOS app target and UI integration live under
App/App/. - Parsing of imported compendium content uses versioned
Parseablewrappers so parser/model updates can trigger recomputation.
- Prefer targeted test runs while iterating (example:
-only-testing:UnitTests/CreatureActionParserTest). - Use simulator IDs from
xcodebuildmcp simulator list-sims --enabledto avoid device-name/OS mismatches. - Use
rgfor codebase search and file discovery (rg,rg --files) before making changes. xcodebuild build -project App/Construct.xcodeproj -scheme Construct -destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.2' | xcprettyTo validate changes. Pick another listed simulator if that one isn’t available.- When running xcodebuild in this repo, include
-skipPackagePluginValidation -skipMacroValidationto avoid Swift macro/plugin validation failures. xcodebuildmcpCLI is available and useful for simulator/test workflows. Prefer absolute project paths:xcodebuildmcp project-discovery list-schemes --project-path /Users/thomasvisser/Projects/Playgrounds/SwiftUI/Construct/App/Construct.xcodeprojxcodebuildmcp simulator list-sims --enabledxcodebuildmcp simulator test-sim --project-path /Users/thomasvisser/Projects/Playgrounds/SwiftUI/Construct/App/Construct.xcodeproj --scheme Construct --simulator-id EA0E0CB6-E385-4152-8D4D-1A424B1D33A6 --extra-args=-skipPackagePluginValidation --extra-args=-skipMacroValidation
xcodebuildmcpCLI parsing gotcha: for anyextra-argsvalue that starts with-, pass it as--extra-args=<value>(with=), otherwise it is parsed as flags and fails.- If you need to debug what
xcodebuildmcpis invoking, run with--log-level debugto see the exact underlying/usr/bin/xcrun xcodebuild ...command.
- Follow existing Swift naming and formatting conventions in surrounding files.
- Prefer small, composable parsing functions and keep parser/model changes additive when possible.
- Keep test expectations explicit with
expectNoDifferenceand snapshots for parser behavior changes. - Follow existing code style.
- Feature/state logic is primarily TCA-based with reducer-driven composition.
Parseable<Input, Result>+DomainParser/DomainModelversioning is used to cache and invalidate derived parsed data.- For new behavior in parsed models, prefer additive fields over breaking schema changes.
- The project is built using the Composable Architecture.
- Ask for clarification when requirements are ambiguous; surface 2–3 options when trade-offs matter
- Update documentation and related rules when introducing new patterns or services
- Run tests to validate your changes before committing.
- If the compiler fails with "the compiler is unable to type-check this expression in reasonable time" (this happens frequently in view bodies and reducers):
- this usually happens because types in the expression are not lining up.
- to discover the actual error, temporarily comment out or break out part of the offending expression "binary search-style" until the compiler can type-check.
- Run the tests with this command:
xcodebuild test -project App/Construct.xcodeproj -scheme Construct -destination 'platform=iOS Simulator,name=iPhone 16 Pro,OS=18.2' -skipPackagePluginValidation -skipMacroValidation | xcpretty - Equivalent
xcodebuildmcptest command:xcodebuildmcp simulator test-sim --project-path /Users/thomasvisser/Projects/Playgrounds/SwiftUI/Construct/App/Construct.xcodeproj --scheme Construct --simulator-id EA0E0CB6-E385-4152-8D4D-1A424B1D33A6 --extra-args=-skipPackagePluginValidation --extra-args=-skipMacroValidation
- When to prefer
xcodebuildmcpover rawxcodebuild:- You want structured test summaries and easy simulator targeting by
simulator-id. - You want one toolchain for build/test plus simulator inspection/automation (
snapshot-ui,screenshot,tap,swipe). - You want the exact underlying command logged (
--log-level debug) for reproducibility.
- You want structured test summaries and easy simulator targeting by
- Use Xcode tooling (
xcodebuild/xcodebuildmcp) for build and test; this repository is notswift buildfirst. - Dependencies are managed through SwiftPM and integrated into the Xcode project/workspace.
- If default simulator destinations are unavailable locally, pick an enabled simulator from the current machine.
- Requires SwiftUI, GRDB, and Point-Free Composable Architecture libraries
- Use xcodebuild to build the project (not swift build, since this is an iOS project).
- Do not mutate files outside the workspace root without explicit approval
- Avoid destructive git operations unless the user requests them directly
- When unsure or need to make a significant decision ASK the user for guidance
- Commit only things you modified yourself, someone else might be modyfing other files.
- The project is actively being migrated to a newer version of the Composable Architecture.
- Changes should, if possible, contribute to moving code from App/App to Swift Packages in Sources/. (It's not a goal on its own.)
- A clean build takes a long time, so do not do this unless the user approves it.
- For large tasks, we keep a Markdown file with notes and progress. Task files follow this pattern:
docs/task-X.md, where X is the task name. Load the appropriate file when continuing with a task (creating if needed) and make sure to update the file with the progress of the task as you work on it.