programming-swift
Skill6 starsChanged 8 months agoApache-2.0View on GitHub
Swift practices: value semantics, API design, actor isolation, task ownership, package compatibility. Use when writing or reviewing Swift code.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- kylehughes/the-unofficial-swift-programming-language-skilltheir own version, first seen Apr 6, 2026
- nonameplum/agent-skillstheir own version, first seen Feb 9, 2026
- Shada01245/the-unofficial-swift-programming-language-skilltheir own version, first seen Nov 21, 2025
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- kylehughes/the-unofficial-swift-programming-language-skill★ 46same name
- nonameplum/agent-skills★ 17same name
- Shada01245/the-unofficial-swift-programming-language-skill★ 2same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository141 other files it gives its agents.
- AGENTS.mdAGENTS.md
- ad-bingSkill
- ad-frameworksSkill
- ad-googleSkill
- ad-linkedinSkill
- ad-metaSkill
- ad-redditSkill
- ad-tiktokSkill
- ad-xSkill
- ad-youtubeSkill
- ai-agent-designSkill
- ai-cost-finopsSkill
- ai-evals-designSkill
- ai-prompt-injection-defenseSkill
- ai-rag-patternsSkill
- analytical-reportSkill
- ats-optimizationSkill
- browser-backlink-submissionSkill
- browser-social-account-maintenanceSkill
- chef-budget-mealsSkill
- coaching-frameworksSkill
- code-review-lensesSkill
- code-reviewSkill
- content-auditSkill
- content-formatsSkill
- content-geoSkill
- content-groundingSkill
- content-humanizeSkill
- content-locale-humanize-arSkill
- content-locale-humanize-deSkill
- content-locale-humanize-esSkill
- content-locale-humanize-frSkill
- content-locale-humanize-hiSkill
- content-locale-humanize-itSkill
- content-locale-humanize-jaSkill
- content-locale-humanize-koSkill
- content-locale-humanize-ptSkill
- content-locale-humanizeSkill
- content-locale-humanize-thSkill
- content-locale-humanize-zhSkill
- content-translateSkill
- content-voiceSkill
- cover-letterSkill
- device-computer-automationSkill
- device-mobile-automationSkill
- document-exportSkill
- geo-visibility-auditSkill
- git-workflowSkill
- issue-diagnosisSkill
- learning-scienceSkill
- marketing-social-gtmSkill
- markup-landing-pageSkill
- octomind-cliSkill
- octomind-configSkill
- octomind-runtimeSkill
- octomind-supervisorSkill
- octomind-workflowSkill
- os-alpineSkill
- os-debianSkill
- os-fedoraSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 6 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Use for Swift language implementation and review across packages, services, and apps.
- Distinctive: line 34
Prefer structs for independent values and enums with associated values for distinct states.
- Very specific: line 36
Read APIs at their call sites.
- Very specific: line 37
Use generics or some Protocol when one concrete type remains statically determined.
- Distinctive: line 38
Add protocols where substitution or a boundary is useful, not for every concrete type.
- Very specific: line 45
Prefer async let and task groups for child work that belongs to the current operation.
- Distinctive: line 54
Follow existing formatters and tests.
- Distinctive: line 55
Test actor reentrancy, cancellation, and invalid input when affected.
- Distinctive: line 59
Keep an actor's invariant inside a non-suspending operation:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Overview
Use for Swift language implementation and review across packages, services, and apps. Keep platform UI, persistence, and distribution decisions in their platform context; focus here on values, APIs, concurrency, and explicit failures.
Mental model
Value semantics control mutation; actor isolation controls access; task structure controls lifetime. None substitutes for the others. Make these contracts visible instead of quieting compiler diagnostics with unchecked annotations or detached tasks.
Version and isolation gate
As of 2026-10: Swift 6.4 is the current release (September 2026, shipped in Xcode 27). Check the repository's toolchain, swift-tools-version, language mode, upcoming-feature flags, default isolation, and deployment targets separately. A Swift 6 compiler can compile in Swift 5 language mode.
- Swift 6 language mode enables data-race safety checks. Migrate boundaries deliberately; don't assume a toolchain upgrade changes the package's language mode.
- Swift 6.2 adds opt-in default MainActor isolation and
NonisolatedNonsendingByDefault, under which nonisolated async functions inherit caller isolation. Read actual settings before inferring where a function runs.asyncdoes not mean background execution. @concurrenton supported toolchains explicitly moves eligible async work to the concurrent executor. Use it for computation that must leave an actor, not as an annotation on every async function.- Swift 6.2 also introduces
InlineArrayandSpan; use them for demonstrated fixed-storage or borrowing requirements. Swift 6.3 adds@cinteroperability; prefer supported declarations over underscored attributes when the compiler and C contract permit them. - Swift 6.4 adds
withTaskCancellationShield(SE-0504) for cleanup that must finish despite cancellation, awaited async calls indefer(SE-0493),@diagnosefor in-source warning control (SE-0522), module selectors (Module::name, SE-0491), and noncopyable containers (UniqueBox,UniqueArray). Shield only bounded cleanup, not ordinary work; don't use@diagnoseto silence a diagnostic whose cause is unresolved.
Values and API design
- Prefer structs for independent values and enums with associated values for distinct states. Use classes for identity or shared lifecycle; don't impose reference semantics merely to enable inheritance.
- A struct containing a mutable class reference is not deeply independent. Keep mutation private, and validate invariants at creation rather than distributing checks through callers.
- Read APIs at their call sites. Labels should distinguish meaning (
remove(at:)versusremove(_:)); expose minimal access and document non-obvious ownership, failure, or complexity contracts. - Use generics or
some Protocolwhen one concrete type remains statically determined. Useany Protocolfor a heterogeneous existential contract; neither guarantees value semantics. - Add protocols where substitution or a boundary is useful, not for every concrete type. Keep computed properties predictable; expensive or failing work usually deserves an explicit method.
- Model valid absence with Optional. Use
throwsfor failures and typed throws only when a stable error set benefits callers; don't replace informative failures withtry?, sentinel values, or empty collections.
Concurrency and resource lifetime
- Actors protect isolated mutable state. Actor references can cross isolation boundaries; accessing isolated members requires the appropriate isolation, often
await. Transfer data using Sendable values or valid ownership transfer, not unsafe shared references. - An actor method can interleave with other work at each await. Recheck state after suspension when correctness depends on it; serial access does not make a multi-await operation atomic.
- Prefer
async letand task groups for child work that belongs to the current operation. Bound large fan-out. ATask {}is unstructured and may inherit actor context; retain its handle when explicit cancellation or result observation is needed. Task.detachedloses inherited context and structured cancellation. Use only for a deliberate independent boundary, with explicit lifetime and failure handling.- Cancellation is cooperative. Propagate cancellation rather than displaying it as failure; check it in long computations and before publishing stale results. Don't assume cancellation guarantees an underlying callback or I/O operation stopped.
- Checked continuations must resume exactly once on every path; bridge cancellation and callback lifetimes explicitly. Use
deferfor synchronous cleanup and deliberate asynchronous cleanup where necessary. @unchecked Sendable,nonisolated(unsafe), and force operations require a documented invariant; don't use them to bypass an unresolved ownership problem.
Packages and checks
- Preserve the dependency manager and target layout. Create an SPM target only for a real reusable or independently testable boundary; macros require their supported compiler-plugin setup. Swift 6.4 makes Swift Build SwiftPM's default build system; if a package build changes behavior after a toolchain upgrade, check that first.
- Follow existing formatters and tests. Swift Testing supports modern unit tests; XCTest remains appropriate for existing suites, UI automation, and XCTest-specific facilities. On Swift 6.4,
XCTAssertworks inside Swift Testing and#expectinside XCTest, so suites can migrate incrementally; don't migrate tests merely for syntax. - Test actor reentrancy, cancellation, and invalid input when affected. Distinguish source review from checks actually executed under the supported toolchain.
Example
Keep an actor's invariant inside a non-suspending operation:
actor Inventory {
private var available = 10
func reserve(_ quantity: Int) -> Bool {
guard quantity > 0, quantity <= available else { return false }
available -= quantity
return true
}
}A caller uses await inventory.reserve(2) across isolation. If remote authorization is added before mutation, state must be revalidated after that await or reserved with an explicit rollback protocol.
Checklist
- Compiler, language mode, isolation flags, and deployment target are known.
- Value ownership and actor access remain correct across suspension.
- Every task and callback bridge has a lifetime and failure path.
- Absence, cancellation, and failure remain distinct.
- Relevant checks were run when authorized; skipped checks are stated.
References
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

