swift-language

Apply modern Swift patterns to non-concurrent library and backend code.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill swift-language-dfly7
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swift-language
Source: https://github.com/DFly7/iOS-FastAPI-Supabase-AI/tree/main/.agents/skills/swift-language
Command: npx skills add https://github.com/DFly7/iOS-FastAPI-Supabase-AI --skill swift-language-dfly7

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

Many Swift codebases accumulate inconsistent patterns, fragile Codable handling, and manual looping or formatting that harm readability and correctness. This Skill helps apply modern Swift language features to core non-concurrency code so models, collections, and API layers are safer, clearer, and easier to review.

Core Features & Use Cases

  • If/Switch Expressions & Guard Patterns: Replace mutation-heavy conditionals with expressive expressions and early-exit guards to keep happy paths left-aligned.
  • Typed Throws & Never: Recommend typed throws for exhaustive handling and appropriate use of Never in generic contexts.
  • Result Builders & Property Wrappers: Provide patterns for DSLs, composition, and encapsulated storage with projected values.
  • Opaque vs Existential Types: Advise when to use some versus any for performance and type-safety tradeoffs.
  • Codable Best Practices & Nested Containers: Canonical CodingKeys, safe decodeIfPresent with defaults, nested container flattening, and lossy array strategies.
  • Regex Builders, Modern Collection APIs & FormatStyle: Suggest RegexBuilder usage, collection helpers (count(where:), compactMap, reduce(into:)), and .formatted() for dates, numbers, durations, and lists.
  • Review Checklist: Provide a compact checklist for code reviews focusing on type choices, collection APIs, formatting, and Codable correctness.
  • Use Case Example: Refactoring backend API models and serialization logic to be resilient across API changes while improving performance and testability.

Quick Start

Refactor this non-concurrent Swift module to apply Codable best practices, prefer some over any where possible, replace manual loops with modern collection APIs, and update date and number formatting to use FormatStyle.

Frequently Asked Questions about swift-language

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I refactor Codable models to handle nested containers and lossy arrays in Swift?

Refactor Swift Codable models by applying canonical CodingKeys, using decodeIfPresent with defaults, flattening nested containers, and adopting lossy array strategies for resilient serialization across API changes.

What is the best way to use some versus any for opaque and existential types in Swift?

Prefer some over any in Swift to optimize performance and type-safety tradeoffs, using opaque types to preserve concrete type information while reserving existential types for dynamic dispatch scenarios.

How do I apply typed throws and Never for exhaustive error handling in Swift 6?

Apply Swift 6 typed throws to specify exact error types for exhaustive handling, and use Never in generic contexts to indicate functions that cannot throw or return values.

How do I replace manual loops with modern Swift collection APIs and FormatStyle?

Replace manual loops by adopting Swift collection helpers like count(where:), compactMap, and reduce(into:), and use .formatted() with FormatStyle for dates, numbers, durations, and lists.

Can I use Swift RegexBuilder and result builders for non-SwiftUI backend modules?

Yes, you can use Swift RegexBuilder and result builders in non-SwiftUI backend modules to construct DSLs, encapsulate property wrapper storage, and process pattern matching safely.

Does this Swift refactoring approach support if and switch expressions for guard patterns?

Yes, this Swift refactoring approach supports if and switch expressions to replace mutation-heavy conditionals with expressive expressions and early-exit guards, keeping happy paths left-aligned.