Imported from faimin/ZDAppleDevelopSkills (
templates/ios-project/AGENTS.md). Install upstream withnpx skills add faimin/ZDAppleDevelopSkills --skill ios-project. Copyright stays with the author.
iOS Project — Agent Instructions
This file configures AI agent behavior for this iOS project. Generated by faimin/ZDAppleDevelopSkills.
Skills
This project uses four locally installed iOS skills: uikit-modern, objective-c-patterns, swift-modern, project-structure-architecture.
If a skill is not available locally, apply the conventions in the Code Conventions and Architecture Defaults sections below as a fallback — do not fetch remote URLs.
Project Stack
This is a UIKit-first iOS project with Swift/Objective-C mixed codebase. SwiftUI is used as a secondary UI layer where appropriate.
Skill Routing
When working on this project, load the relevant skill before answering. Skills apply to ALL code changes — not only new pages, but also adding features, modifying logic, or fixing bugs in existing pages:
| Task | Skill |
|---|---|
| UIKit screens, collection views, diffable data source, compositional layout, keyboard, navigation, scenes | uikit-modern |
| Objective-C code, blocks, ARC, retain cycles, runtime, swizzling, KVO, category, mixed-language | objective-c-patterns |
Swift language, async/await, Combine, Codable, @Observable, Swift Testing, SwiftUI state |
swift-modern |
| Architecture selection, project structure, SPM/CocoaPods, third-party library choice, module boundaries | project-structure-architecture |
Load the matching skill first, then answer. For tasks that span multiple areas, identify the dominant layer and load that skill first.
Architecture Defaults
- UI layer: UIKit-first; SwiftUI for new standalone screens when deployment target allows.
- Objective-C modules: MVP (Presenter owns logic, ViewController is passive).
- Swift (UIKit) modules: MVI (Intent enum + Combine state pipeline).
- SwiftUI modules: MVVM with
@Observable. - App-level cross-feature state: TCA when shared state and testability pressure justify it.
- Concurrency:
async/awaitand structured concurrency for new Swift APIs. - Dependency management: SPM preferred; CocoaPods for legacy modules or unavailable packages.
Code Conventions
- When modifying code, only make changes directly related to the request. Do not auto-format, restyle, or refactor surrounding code that was not asked to be changed.
- All new or modified code must include Chinese comments explaining the implementation approach and key logic so other team members can maintain the code. This applies to every code change without exception. Write comments directly in Chinese without explicitly labeling them as "中文注释".
- Category methods must use the project's prefix (e.g.
xx_), not a hardcoded abbreviation. - In Objective-C getters, build the object into a local variable and assign
_ivarlast. - Wrap multi-property Objective-C object initialization in
({ })statement expressions. - Always check
respondsToSelector:before calling optional delegate methods. - Prefer
RACObserveover raw KVO when the project uses ReactiveObjC. - Prefer inheritance over swizzling; use swizzling only when no override or delegate hook exists.
- Page communication: Swift↔Swift uses Combine
PassthroughSubject/CurrentValueSubjectwith enum associated values (MVI-style event bus); Swift↔ObjC or ObjC↔ObjC uses closure/block callbacks.
Security
- Do not hardcode secrets, API keys, or private endpoints.
- Verify privacy permission descriptions exist before using camera, microphone, location, or photos.
- Follow App Store Review Guidelines when touching payments, user data, or platform capabilities.