swift-concurrency
Swift Concurrency 코드 현대화
Swift Concurrency 변경은 혼란스러운 경고, 데이터 레이스 위험, 마이그레이션 지연을 만들 수 있습니다. 이 스킬은 async/await, actors, Sendable, 테스트, 성능, Swift 6 도입을 위한 체계적인 지침을 제공합니다.
스킬 ZIP 다운로드
Claude에서 업로드
설정 → 기능 → 스킬 → 스킬 업로드로 이동
토글을 켜고 사용 시작
Agent용 리소스
AI Agent, 크롤러 또는 스크립트가 전체 페이지 대신 깔끔한 컨텍스트가 필요할 때 이 링크를 사용하세요.
테스트해 보기
"swift-concurrency" 사용 중입니다. A view model has @MainActor errors after adding async loading.
예상 결과:
응답은 해당 타입이 main-actor로 격리되어야 하는지 식별하고, 경계 교차를 설명하며, 테스트 단계가 포함된 집중적인 수정안을 제안합니다.
"swift-concurrency" 사용 중입니다. A Core Data model triggers Sendable warnings during Swift 6 migration.
예상 결과:
응답은 경계를 넘길 때 object IDs를 전달하고, context perform 메서드를 사용하며, managed objects에 unchecked Sendable을 피할 것을 권장합니다.
"swift-concurrency" 사용 중입니다. Async tests are flaky after using task groups.
예상 결과:
응답은 task completion, cancellation, error propagation, 결정적 스케줄링 옵션, assertion 배치를 검토합니다.
보안 감사
낮은 위험Static analysis reported many command, network, storage, reconnaissance, and weak-crypto patterns. Manual review found these are markdown code fences, Swift code examples, course links, and Swift terminology, with no executable scripts or prompt injection evidence. The skill is publishable with low risk because it is documentation-heavy and includes external educational links and sample network code.
낮은 위험 문제 (4)
품질 점수
만들 수 있는 것
Concurrency 진단 해결
actor isolation, Sendable, @MainActor, async 경계에 대한 Swift 컴파일러 경고를 진단합니다.
Swift 6 마이그레이션 계획
영향 범위를 제한하고 검증 단계를 포함하는 단계적 마이그레이션 계획을 만듭니다.
Async 테스트 안정화
async 코드, cancellation, actors, task groups에 대한 XCTest 또는 Swift Testing 커버리지를 개선합니다.
이 프롬프트를 사용해 보세요
Explain this Swift Concurrency warning in plain language. Identify the isolation boundary and suggest the smallest safe fix.
Review this closure-based Swift API and propose an async/await version. Include cancellation, error handling, and testing notes.
Audit this actor and @MainActor usage. Point out reentrancy risks, unnecessary actor hops, and safer isolation choices.
Build a Swift 6 strict concurrency migration plan for this module. Include settings to check, rollout order, escape-hatch rules, and verification steps.
모범 사례
- 마이그레이션 조언을 제공하기 전에 Swift 버전, strict concurrency 설정, default actor isolation을 확인합니다.
- structured concurrency를 선호하고 unstructured tasks 또는 escape hatches 사용이 있다면 설명합니다.
- 관련이 있을 때 concurrency 리팩터링을 집중적인 테스트, cancellation 검사, 성능 검증과 함께 진행합니다.
피하기
- 코드가 main actor에 속한다는 것을 입증하지 않고 @MainActor를 모든 곳에 적용하지 마세요.
- 안전성 불변 조건이 문서화되어 있지 않다면 @unchecked Sendable로 Sendable 문제를 숨기지 마세요.
- semaphores, sleeps, synchronous waits로 async contexts를 블로킹하지 마세요.