Imported from LexChien/BabyGrowthApp (
iOS/BabyGrowth/AGENTS.md). Install upstream withnpx skills add LexChien/BabyGrowthApp --skill BabyGrowth. Copyright stays with the author.
Repository Guidelines
Project Structure & Module Organization
Source lives under BabyGrowth/ with feature folders such as App, Models, Services, ViewModels, and Views; shared SwiftUI components stay in Views/Components. Store data fixtures, localized strings, and PDF templates in Resources/, and keep asset catalogs in BabyGrowth/Resources/Assets.xcassets. Place unit tests in Tests/ and UI automation in UITests/, mirroring production filenames (e.g., ChildDetailView.swift ↔︎ ChildDetailViewTests.swift).
Build, Test, and Development Commands
Run xed . to open the workspace with all required schemes. Use xcodebuild -scheme BabyGrowth -configuration Debug for a clean CLI build, adding -destination 'platform=iOS Simulator,name=iPhone 16' when targeting that simulator. Execute xcodebuild test -scheme BabyGrowth -destination 'platform=iOS Simulator,name=iPhone 16' to run the XCTest suite; append -enableCodeCoverage YES when collecting coverage.
Coding Style & Naming Conventions
Adopt Swift 6 defaults: 4-space indentation, trailing commas in multiline literals, and type inference when intent is clear. Keep types in UpperCamelCase and members in lowerCamelCase, and ensure SwiftUI view filenames end with View. Prefer small, focused views with grouped modifiers, and run Xcode “Format” (Ctrl+I) before committing.
Testing Guidelines
Use XCTest for unit and UI coverage. Name suites <Type>Tests and methods test_<Behavior>_When_<Context>(). Prioritize data transforms (e.g., LMS percentile calculations) and persistence boundaries using SwiftData previews or in-memory stores. Target ≥80% coverage for calculation-heavy modules.
Commit & Pull Request Guidelines
Follow Conventional Commits (e.g., feat(growth-chart): add percentile bands) in imperative mood. Pull requests should describe the change, list validation steps (simulator/device), attach UI screenshots or recordings for visual updates, and link issues with Closes #123. Document data model migrations or schema bumps in the PR body.
Security & Configuration Tips
Never commit real family data; rely on anonymized samples in Resources/Fixtures/. Keep secrets in untracked .xcconfig files and provide .xcconfig.example templates for new keys. Before release, confirm file protection stays .complete and document required iCloud entitlements.