write-swift SKILL.md skillA

write-swift from suge8/friedbun is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.

Install it, pinned
mdr add suge8/friedbun/write-swift@git:20261012.7466c71

Pins git:20261012.7466c71 in mdr.lock. Pin the fingerprint instead.

Audit grade
A, 17 of 17 checks passed
Kind
SKILL.md skill
Repository
suge8/friedbun
Path
skills/development/write-swift/SKILL.md
Versions recorded
1
Latest version
git:20261012.7466c71, committed Oct 12, 2026
Size
3,330 bytes
Repository stars
12
License
MIT

写、审查或迁移 Swift 时读:Swift 6.2 起的并发规则、默认主线程隔离、数据竞争的修法,以及模型常写成旧样子的新写法.

Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.

What the file says

# Write Swift

以项目工具链为准:下文到 Swift 6.3 都可用;标 ⚠ 的属于未发布的 6.4,确认工具链后才用。

## 默认

从最简单、最静态、单线程的写法起步,说得出理由才往下走一档:

- `struct`/`enum` 优先于 `class`;互斥状态用一个 `enum`,不用一组可选属性。
- 具体类型优先;出现跨类型的重复代码才抽协议,没有逐类型定制的协议改成约束扩展。
- `some P` 优先;要存放异构类型才用 `any P`。
- 主线程同步代码优先;Instruments 显示卡顿才 `async` → `@concurrent` → `actor`。

## 并发(Swift 6.2 起)

- `async` 不再自动离开当前 actor,在调用处的隔离上运行。把自己的计算挪到后台用 `@concurrent`;库 API 用 `nonisolated`,让调用方决定在哪跑。
- App 与界面模块开 Approachable Concurrency 和 Default Actor Isolation = MainActor(包里 `.defaultIsolation(MainActor.self)`);通用库不开。开了之后类型与函数上不再写 `@MainActor`,只在默认隔离管不到处写:函数类型与回调参数、`nonisolated` 类型里的成员、非主线程回调里起的 `Task`。
- 修数据竞争按顺序:不共享(每个并发任务用自己的实例)→ 改成 Sendable 值类型 → 隔离到 actor → 最后才用 `Synchronization` 的 `Mutex`/`Atomic`(放在 `let` 里)或 `@unchecked Sendable`。不用 `NSLock`、`DispatchSemaphore`;跨 `await` 不持锁。
- 每个 `await` 都是挂起点,回来后重新检查前提;actor 的状态修改放在同步段里,actor 不保证先进先出。
- 结构化并发优先:固定个数用 `async let`,动态个数用有上限的 `withTaskGroup`,无返回值用 `withDiscardingTaskGroup`;`Task {}` 只给挂在界面事件上的工作,几乎不用 `Task.detached`。取消是协作的,开始昂贵工作前检查。
- 回调桥接:`withCheckedContinuation` 每条路径恰好 resume 一次;委托式 API 包成 `AsyncStream`,在 `onTermination` 里清理。
…

Read the whole file at its exact version.

How to install

The exact contents, by fingerprint
mdr add suge8/friedbun/write-swift@sha256:00f311bddadf2656

The line at the top of this page pins the label git:20261012.7466c71, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.

Badge

mdr badge

[![mdr](https://markdownregistry.com/badge/art_6mssw5qwclt6dlf4.svg)](https://markdownregistry.com/a/art_6mssw5qwclt6dlf4)

1 badge image fetches in 30 days. What the badge shows.

Versions

The registry has recorded 1 version of this file, committed on Oct 12, 2026.

versioncommittedcommitsizeaudit
git:20261012.7466c71 latest2026-10-12 7466c71 3,330 BA view

Audit of the latest version

A  17 of 17 checks passed. Fixed automatic checks with no AI involved, so the same checks give the same answer every run.
  • pass: Frontmatter block present
  • pass: Frontmatter declares a name
  • pass: Frontmatter declares a description
  • pass: Size between 200 bytes and 200 KB (3330 bytes)
  • pass: No zero-width or bidi control characters
  • pass: No instruction hidden inside an HTML comment
  • pass: No link to an exfiltration or paste host
  • pass: No credential-shaped string
  • pass: No instruction to send local credentials anywhere
  • pass: No text hidden with inline styles
  • pass: No prompt-injection phrasing
  • pass: No curl or wget piped into a shell
  • pass: No recursive delete of root, home or parent
  • pass: No instruction to read or print local credentials
  • pass: No base64 blob over 200 characters
  • pass: No link to a raw IP address
  • pass: No script tag

Source

GitHub

suge8/friedbun · 12 stars · license MIT · pushed 2026-10-21 · branch main

API

GET https://markdownregistry.com/api/v1/artifacts/art_6mssw5qwclt6dlf4
GET https://markdownregistry.com/api/v1/resolve?ref=suge8/friedbun/write-swift
GET https://markdownregistry.com/api/v1/blob/00f311bddadf2656f8bca23376c532d4f3e8eafb57f4e395b364f29485e757f2

Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.

Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.

More from suge8/friedbun

AGENTS.md@skills AGENTS.md file
suge8/friedbun · skills/AGENTS.md
git:20261011.f56249e · audit A · 12 stars
copywriting SKILL.md skill
suge8/friedbun · skills/creative/copywriting/SKILL.md · 撰写或优化以转化为目标的网站和产品文案:标题、Hero、CTA、价值主张、落地页、定价页、功能页和产品描述
git:20261008.80eac82 · audit A · 12 stars
gpt-image SKILL.md skill
suge8/friedbun · skills/creative/gpt-image/SKILL.md · 通过 gptimage 模型生成优美 AI 图片、海报、插图或 Logo
git:20261011.7f79f8f · audit A · 12 stars
post SKILL.md skill
suge8/friedbun · skills/creative/post/SKILL.md · 把实测数据或经验写成社媒帖:核数、按平台语言写文案、出数据图、排期发布并回查
git:20261008.9ccea24 · audit A · 12 stars
promo SKILL.md skill
suge8/friedbun · skills/creative/promo/SKILL.md · 制作项目宣传物料:Hero/OG/社媒图、商店截图、README 配图和演示 GIF/视频。根据项目现状产出到 design/promo/;应用 UI 用 ui-craft,单独 Logo 用 gpt-image。
git:20261008.662804f · audit A · 12 stars
video SKILL.md skill
suge8/friedbun · skills/creative/video/SKILL.md · 视频统一入口:把主题策划成运动优先的动画,用 Remotion 实现、配声音、检查并渲染成片,或通过 Grok/Seedance 直接生成带音轨 MP4
git:20261011.f56249e · audit A · 12 stars
architecture-audit SKILL.md skill
suge8/friedbun · skills/development/architecture-audit/SKILL.md · 架构体检:找出该合并加深的浅模块,用 eli5 图解呈现,再为选中的一项并行设计几种接口。
git:20261009.443953a · audit A · 12 stars
better-test SKILL.md skill
suge8/friedbun · skills/development/better-test/SKILL.md · 验证改动、写测试、审查或清理测试时使用:验证方法、什么测试值得留、端到端测试写法、DELETE/REWRITE/KEEP 判决。
git:20261009.443953a · audit A · 12 stars
eli5 SKILL.md skill
suge8/friedbun · skills/development/eli5/SKILL.md · 把话题讲到没读过代码的技术读者也能准确理解,默认 HTML 图解
git:20261008.a717a7c · audit A · 12 stars
fan-out SKILL.md skill
suge8/friedbun · skills/development/fan-out/SKILL.md · 调研、审计、设计探索拆给子代理并行的低中高三档;research、grilling、architecture-audit、better-test 按档引用,用户也可直接点档位。
git:20261008.3911d61 · audit A · 12 stars
pr SKILL.md skill
suge8/friedbun · skills/development/pr/SKILL.md · 写 PR 描述时使用。
git:20261008.3911d61 · audit A · 12 stars
project-setup SKILL.md skill
suge8/friedbun · skills/development/project-setup/SKILL.md · 项目体检:新项目开工、半途补缺、开源前检查或“这个项目缺什么”。盘点文档骨架、工单约定与验证链,报告缺口,确认后补齐。
git:20261008.b610344 · audit A · 12 stars

Every file in suge8/friedbun

Other files named write-swift

write-swift SKILL.md skill
emilkowalski/skills · skills/write-swift/SKILL.md · How to write modern Swift well — modeling with value types, Swift 6 data-race safety and approachable concurrency…
git:20260915.85e8e23 · audit A · 47,883 stars
write-swift SKILL.md skill
asymmetric-al/core · .agents/skills/write-swift/SKILL.md · How to write modern Swift well — modeling with value types, Swift 6 data-race safety and approachable concurrency…
git:20260930.a2d2b08 · audit A · 379 stars
write-swift SKILL.md skill
nebutra/nebutra-sailor · .agents/skills/write-swift/SKILL.md · How to write modern Swift well — modeling with value types, Swift 6 data-race safety and approachable concurrency…
git:20260827.ca77bd1 · audit A · 5 stars

Browse by kind, by grade A, or by owner.