swift-testing-pro
하는 일
이 스킬은 AI가 Swift Testing 프레임워크를 쓰는 Swift 테스트를 작성하고 점검하도록 돕습니다. 최신 관례를 따르는 테스트를 원하는 Swift 개발자를 위한 것입니다.
사용하는 경우
- ✓Swift 프로젝트에 새 단위 또는 통합 테스트를 작성하고 있을 때.
- ✓오래된 XCTest 테스트를 Swift Testing으로 옮기고 싶을 때.
- ✓비동기 테스트, 확인(confirmation), 시간 제한에 도움이 필요할 때.
스킬 링크
https://github.com/jacklandrin/OnlySwitch/blob/main/doc/skills/swift-testing-pro/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 로그인 뷰 모델에 대한 Swift Testing 테스트를 실패 사례까지 포함해서 작성해 주세요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 테스트 구조, 단언, 의존성에 관한 Swift Testing 관례를 따르고, 기존 테스트에서 실제 문제만 보고합니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
Write and review Swift Testing code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems - do not nitpick or invent issues.
Review process:
- Ensure tests follow core Swift Testing conventions using
references/core-rules.md. - Validate test structure, assertions, dependency injection, and other best practices using
references/writing-better-tests.md. - Check async tests, confirmations, time limits, actor isolation, and networking mocks using
references/async-tests.md. - Ensure new features like raw identifiers, test scopes, exit tests, and attachments are used correctly using
references/new-features.md. - If migrating from XCTest, follow the conversion guidance in
references/migrating-from-xctest.md.
If doing partial work, load only the relevant reference files.
Core Instructions
- Target Swift 6.2 or later, using modern Swift concurrency.
- As a Swift Testing developer, the user wants all new unit and integration tests to be written using Swift Testing, and they may ask for help migrating existing XCTest code to Swift Testing.
- Swift Testing does not support UI tests – XCTest must be used there.
- Use a consistent project structure, with folder layout determined by app features.
Swift Testing evolves with each Swift release, so expect three to four releases each year, each introducing new features. This means existing training data you have will naturally be outdated or missing key features.
This skill specifically draws upon the very latest Swift and Swift Testing code, which means it will suggest things you are not aware of. Treat the user’s installed toolchain as authoritative, but there's a fairly high chance Apple's documentation about the APIs will be stale, so treat them carefully.
Output Format
If the user asks for a review, organize findings by file. For each issue:
- State the file and relevant line(s).
- Name the rule being violated.
- Show a brief before/after code fix.
Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.
If the user asks you to write or improve tests, follow the same rules above but make the changes directly instead of returning a findings report.
Example output:
UserTests.swift
Line 5: Use struct, not class, for test suites.
// Before
class UserTests: XCTestCase {
// After
struct UserTests {
Line 12: Use #expect instead of XCTAssertEqual.
// Before
XCTAssertEqual(user.name, "Taylor")
// After
#expect(user.name == "Taylor")
Line 30: Use #require for preconditions, not #expect.
// Before
#expect(users.isEmpty == false)
let first = users.first!
// After
let first = try #require(users.first)
Summary
- Fundamentals (high): Test suite on line 5 should be a struct, not a class inheriting from
XCTestCase. - Migration (medium):
XCTAssertEqualon line 12 should be migrated to#expect. - Assertions (medium): Force-unwrap on line 30 should use
#requireto unwrap safely and stop the test early on failure.
End of example.
References
references/core-rules.md- core Swift Testing rules: structs over classes,init/deinitover setUp/tearDown, parallel execution, parameterized tests,withKnownIssue, and tags.references/writing-better-tests.md- test hygiene, structuring tests, hidden dependencies,#expectvs#require,Issue.record(),#expect(throws:), and verification methods.references/async-tests.md- serialized tests,confirmation(), time limits, actor isolation, testing pre-concurrency code, and mocking networking.references/new-features.md- raw identifiers, range-based confirmations, test scoping traits, exit tests, attachments,ConditionTrait.evaluate(), and the updated#expect(throws:)return value.references/migrating-from-xctest.md- XCTest-to-Swift Testing conversion steps, assertion mappings, and floating-point tolerance via Swift Numerics.
자주 묻는 질문
UI 테스트에도 XCTest를 대체하나요?
아니요. Swift Testing이 UI 테스트를 지원하지 않으므로 UI 테스트에는 여전히 XCTest가 필요합니다.
오래된 테스트를 변환할 수 있나요?
네. XCTest에서 옮기는 방법에 대한 안내가 들어 있습니다.
어떤 Swift 버전을 가정하나요?
Swift 6.2 이상과 최신 Swift 동시성을 전제로 합니다.
상세 정보
작성자의 원본 설명
Writes, reviews, and improves Swift Testing code using modern APIs and best practices. Use when reading, writing, or reviewing projects that use Swift Testing.
repo: jacklandrin/OnlySwitch
인기도
- GitHub 스타
- 6.0k
- 순위
- #14452
- 라이선스
- MIT
- 업데이트
- 2026. 11. 1.
댓글
- …
이 저장소의 다른 스킬
onlyswitch-deeplink
6.0k에이전트가 딥링크로 휴지통 비우기, 화면 깨어 있기, 다크 모드 전환 같은 Mac의 OnlySwitch 동작을 실행하게 합니다.
app-store-review
6.0k에이전트가 Apple 앱 코드를 App Store 심사 지침과 대조해, 제출 전에 거절될 수 있는 문제를 찾도록 돕습니다.
swift-concurrency-pro
6.0k에이전트가 Swift 비동기 코드를 검토해 동시성 실수, 액터 문제, 오래된 비동기 패턴을 찾도록 돕습니다.
비슷한 스킬
test-driven-development
311k에이전트가 기능이나 수정을 만들기 전에 실패하는 테스트를 먼저 쓰고, 그것을 통과시키는 가장 작은 코드를 작성하도록 가르칩니다.
verification-before-completion
311k에이전트가 작업, 수정, 빌드가 완료되었거나 통과했다고 말하기 전에 실제 점검을 실행하고 결과를 읽도록 가르칩니다.
migrate-to-shoehorn
310k테스트 파일의 위험한 타입 캐스팅을 shoehorn 라이브러리로 바꿔, 테스트가 일부 데이터만 써도 타입 검사를 통과하도록 돕습니다.