Imported from SwapnanilDhol/SwapFoundationKit (
AGENTS.md). Install upstream withnpx skills add SwapnanilDhol/SwapFoundationKit. Copyright stays with the author.
AGENTS.md
Purpose
This repository ships an LLM-friendly workflow for:
- Discovering whether SFK already covers a host-app feature before implementation
- Auditing host apps for redundant implementations after adopting
SwapFoundationKit - Migrating host app code to use SFK capabilities
- Adding or updating capabilities within the SFK package itself
Source of Truth
Read files in this order:
Docs/capabilities.yaml— Agent-first capability catalogDocs/migration/catalog.yaml— Curated audit catalog with tiers- Module READMEs under
Sources/SwapFoundationKit/— Per-module API references README.md— Quick reference with module indexSKILL.md— Trigger keywords and quick capability lookup
Feature Discovery Workflow
When tasked with "build a feature in a host app" or "check whether SFK already has this":
Step 1: Read the Capabilities Catalog
Read Docs/capabilities.yaml
Step 2: Match the Request to a Domain
Check whether the request falls into a documented reusable domain:
| Domain | Docs |
|---|---|
| settings | Sources/SwapFoundationKit/UI/README.md |
| buttons | Sources/SwapFoundationKit/UI/README.md — Buttons section |
| onboarding | Sources/SwapFoundationKit/UI/README.md — Onboarding section |
| pickers | Sources/SwapFoundationKit/UI/README.md — Pickers section |
| alerts / confirmations | Sources/SwapFoundationKit/UI/README.md — Alerts section |
| sync / shared storage | Sources/SwapFoundationKitSync/ItemSync/README.md |
| watch sync | Sources/SwapFoundationKitSync/WatchSync/README.md |
| haptics, logging, analytics | Sources/SwapFoundationKit/Services/README.md |
| networking, security, backup | Sources/SwapFoundationKit/Core/README.md |
| currency, exchange rates | Sources/SwapFoundationKitCurrency/Currency/README.md |
| image processing | Sources/SwapFoundationKitMedia/ImageProcessor/README.md |
| notifications | Sources/SwapFoundationKit/Services/README.md — SFKNotificationService |
| pro gating | Sources/SwapFoundationKit/Services/README.md — SFKAccessGate |
| environment / launch args | Sources/SwapFoundationKit/Utilities/README.md |
| appearance / typography | Sources/SwapFoundationKit/UI/README.md — Appearance section |
| debounce / throttle | Sources/SwapFoundationKit/Utilities/README.md |
| extensions | Sources/SwapFoundationKit/Extensions/README.md |
| protocols | Sources/SwapFoundationKit/Protocols/README.md |
Step 3: Decide the Reuse Strategy
- use_sfk_directly: the public SFK API already fits
- wrap_sfk: SFK provides the primitive, but the host app needs domain logic on top
- keep_custom: SFK does not fit or the host app intentionally diverges
Step 4-5: Implement and State Decision
Only implement custom host-app code if no documented SFK public API fits. State which domain(s) were checked, which API was selected, and the reuse strategy.
Audit Workflow
When tasked with "audit a host app for overlap with SFK":
- Read
Docs/migration/catalog.yaml - Start with
audit_tier: exactcapabilities only - For each: search host app for
host_search_terms, checksuspicious_file_patterns, respectkeep_custom_when - Classify: replace / review / keep
- Cite file paths from both repos
- Only expand to
heuristic/manualtiers if requested
Structured Output
## Audit Summary
- X exact-tier capabilities checked
- Y findings: A replace, B review, C keep
## Replace (migrate first)
1. [Capability ID] — host file → SFK replacement
## Review (evaluate case-by-case)
1. [Capability ID] — host file → SFK replacement (note: keep wrapper if...)
## Keep (domain-specific)
1. [Capability ID] — host file (reason: ...)
Migration Workflow
When tasked with "migrate [capability] to SFK":
- Find the capability in
Docs/migration/catalog.yaml - Read the relevant module README for API details
- Verify the host app doesn't fall under "keep custom when"
- Replace local implementations with SFK equivalents
- Delete old local implementation files
- Build and verify
Adding a New Capability
- Place source files under the appropriate
Sources/SwapFoundationKit/subdirectory - Follow conventions:
SFKprefix for public UI types- No prefix for protocols
*Service,*Manager,*Helpersuffix for services*+Extensions.swiftfor type extensions- Doc comments with
## Usagecode examples
- Create or update the module README under the subdirectory
- Update
Docs/migration/catalog.yamlwith new capability entry - Update
Docs/capabilities.yamlwith new domain (if applicable) - Update
SKILL.mdtrigger keywords and lookup table
Maintenance Rules
- Update
Docs/migration/catalog.yamlwhenever public API is added, removed, or renamed - Do not advertise internal-only helpers as host-app replacements
- Keep module READMEs in sync with source files
- Prefer false negatives over noisy false positives in audits
- Audit against public API only
- For SwiftUI UI, prefer semantic Dynamic Type text styles such as
.body,.subheadline,.footnote, and.captionover hardcoded font sizes for titles, subtitles, and values.
File Structure Reference
SwapFoundationKit/
├── README.md ← Parent index linking to modules
├── AGENTS.md ← This file — LLM workflow document
├── SKILL.md ← Environment trigger + quick lookup
├── Package.swift
├── Docs/
│ ├── README.md ← Documentation index
│ ├── capabilities.yaml ← Feature discovery catalog
│ ├── migration/
│ │ ├── catalog.yaml ← Audit catalog
│ │ └── migration-guide.md
│ ├── guides/ ← In-depth guides
│ ├── reference/ ← Audit checklists
│ └── development/
│ ├── agents.md ← (Legacy) agent workflows
│ ├── feature-discovery.md
│ └── refactoring-todo.md
└── Sources/SwapFoundationKit/
├── Core/README.md ← Networking, security, backup
├── Services/README.md ← Haptics, logging, analytics, etc.
├── UI/README.md ← Buttons, settings, onboarding, etc.
├── Extensions/README.md ← Date, String, Collection, etc.
├── Utilities/README.md ← Debouncer, Throttler, environment
├── Currency/README.md ← Currency + exchange rates
├── ImageProcessor/README.md ← Image processing + compression
├── ItemSync/README.md ← App Group sync
├── WatchSync/README.md ← Watch Connectivity
├── Protocols/README.md ← Coordinator, AppMetaData
├── Compatibility/README.md ← iOS 26+ wrappers
└── Ads/README.md ← Google Mobile Ads