/swift:designing-swift-apisfrom Swift
Designs clear, idiomatic Swift API names, argument labels, signatures, and documentation contracts following Apple's API Design Guidelines. Useful when adding, changing, or reviewing Swift APIs for call-site clarity.
Ships in Swift. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill provides guidance on designing clear, idiomatic Swift APIs following Apple's official design guidelines.
Match the requested design scope. For naming-only work, preserve types and behavior and confine recommendations to names, argument labels, and call sites. Clarify weakly typed parameters with role nouns; reserve type-modeling or architectural recommendations for a request that includes those concerns.
Clarity at the point of use is the most important goal. APIs are declared once but used repeatedly—optimize for the reader at the call site.
Write a documentation comment for every declaration. If describing functionality is difficult, the API may need redesign.
For a worked example, read summary format.
Use recognized symbol documentation commands to provide structured information beyond the summary:
For a worked example, read documentation markup.
Key commands: Parameter(s), Returns, Throws, Complexity, Precondition, Postcondition, Note, Important, SeeAlso.
Include all words needed to avoid ambiguity at the use site:
For a worked example, read include necessary words.
Remove words that repeat type information:
For a worked example, read omit needless words.
Name variables and parameters by their role, not their type constraints:
For a worked example, read name by role, not type.
When using Any, AnyObject, Int, or String, add nouns describing the role:
For a worked example, read compensate for weak types.
Method names should form grammatical English phrases:
For a worked example, read grammatical phrases.
Begin factory methods with make:
For a worked example, read factory methods.
First argument should not form a phrase with the base name:
For a worked example, read initializers.
x.distance(to: y), x.successor())print(x), x.sort(), x.append(y))When a verb describes the operation:
| Mutating | Nonmutating |
|---|---|
x.sort() | z = x.sorted() |
x.append(y) | z = x.appending(y) |
x.reverse() | z = x.reversed() |
x.stripNewlines() | z = x.strippingNewlines() |
Use past participle (-ed) when grammatical, present participle (-ing) otherwise.
When a noun describes the operation:
| Nonmutating | Mutating |
|---|---|
x = y.union(z) | y.formUnion(z) |
j = c.successor(i) | c.formSuccessor(&i) |
Should read as assertions about the receiver:
For a worked example, read boolean properties and methods.
Collection, Sequence)-able, -ible, or -ing suffixes (Equatable, ProgressReporting)URL is fine, bg is not)Array over List, sin(x) over verbose alternatives — match what experienced developers expectUpperCamelCaselowerCamelCaseFor a worked example, read case conventions.
Document the complexity of computed properties that are not O(1).
Methods may share a base name when they have the same basic meaning and operate in distinct domains:
For a worked example, read method overloading.
Avoid overloading on return type alone — it causes ambiguities with type inference.
Choose names that make documentation read naturally:
For a worked example, read parameter names for documentation.
min(number1, number2)Int64(someUInt32)UInt32(truncating: source)x.removeBoxes(havingLength: 12)view.dismiss(animated: false)Start label at the preposition, except when arguments represent a single abstraction:
For a worked example, read prepositional phrases.
Label tuple members and name closure parameters for clarity:
For a worked example, read tuple members and closure parameters.
When using Any or unconstrained generics, be explicit to avoid ambiguity:
For a worked example, read unconstrained polymorphism.
Read the relevant section of examples when a naming, argument-label, or documentation rule needs a concrete call site. Before finishing, check the changed API against the rules above.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub kylehughes/agent-plugins-for-making-good-software --plugin swift10 skills in this plugin
/modeling-swift-types-for-correctnessModel Swift invariants, validated decoding, legal transitions, ownership, and generic relationships. Load before assessing or changing enforcement boundaries; not ordinary output tests or naming./ordering-symbolsOrder Swift members by declaration kind, access, and name when semantics permit. Use proactively when adding or moving members; preserve initialization, enum, UI, and other meaningful order./organizing-swift-typesOrganize Swift types, conformances, extensions, access control, and files. Use proactively when adding or restructuring declarations; apply repository conventions before the suggested layout./structuring-swift-packagesStructure Swift package boundaries, dependencies, exports, and composition roots. Use proactively for module placement or dependency cycles; preserve the repository’s architecture and naming./testing-async-swift-codeMake Swift async tests deterministic. Use proactively for timing, observer readiness, completion, cancellation, cleanup, or flaky tests; not general test organization./testing-swift-codePlan or write Swift unit tests with Swift Testing. Use proactively for regression coverage, assertions, suites, traits, or migration; async timing has its own skill and UI tests use XCTest.Other plugins' skills for the same job