swift-code-reviewer-skill 1.1.1 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -162
- package/README.md +91 -21
- package/SKILL.md +107 -725
- package/bin/install.js +87 -22
- package/package.json +16 -2
- package/references/companion-skills.md +70 -0
- package/skills/README.md +43 -0
- package/skills/swift-concurrency/NOTICE.md +18 -0
- package/skills/swift-concurrency/SKILL.md +235 -0
- package/skills/swift-concurrency/references/actors.md +640 -0
- package/skills/swift-concurrency/references/async-await-basics.md +249 -0
- package/skills/swift-concurrency/references/async-sequences.md +635 -0
- package/skills/swift-concurrency/references/core-data.md +533 -0
- package/skills/swift-concurrency/references/glossary.md +96 -0
- package/skills/swift-concurrency/references/linting.md +38 -0
- package/skills/swift-concurrency/references/memory-management.md +542 -0
- package/skills/swift-concurrency/references/migration.md +721 -0
- package/skills/swift-concurrency/references/performance.md +574 -0
- package/skills/swift-concurrency/references/sendable.md +578 -0
- package/skills/swift-concurrency/references/tasks.md +604 -0
- package/skills/swift-concurrency/references/testing.md +565 -0
- package/skills/swift-concurrency/references/threading.md +452 -0
- package/skills/swift-expert/NOTICE.md +18 -0
- package/skills/swift-expert/SKILL.md +226 -0
- package/skills/swift-expert/references/async-concurrency.md +363 -0
- package/skills/swift-expert/references/memory-performance.md +380 -0
- package/skills/swift-expert/references/protocol-oriented.md +357 -0
- package/skills/swift-expert/references/swiftui-patterns.md +294 -0
- package/skills/swift-expert/references/testing-patterns.md +402 -0
- package/skills/swift-testing/NOTICE.md +18 -0
- package/skills/swift-testing/SKILL.md +295 -0
- package/skills/swift-testing/references/async-testing.md +245 -0
- package/skills/swift-testing/references/dump-snapshot-testing.md +265 -0
- package/skills/swift-testing/references/fixtures.md +193 -0
- package/skills/swift-testing/references/integration-testing.md +189 -0
- package/skills/swift-testing/references/migration-xctest.md +301 -0
- package/skills/swift-testing/references/parameterized-tests.md +171 -0
- package/skills/swift-testing/references/snapshot-testing.md +201 -0
- package/skills/swift-testing/references/test-doubles.md +243 -0
- package/skills/swift-testing/references/test-organization.md +231 -0
- package/skills/swiftui-expert-skill/NOTICE.md +18 -0
- package/skills/swiftui-expert-skill/SKILL.md +281 -0
- package/skills/swiftui-expert-skill/references/accessibility-patterns.md +151 -0
- package/skills/swiftui-expert-skill/references/animation-advanced.md +403 -0
- package/skills/swiftui-expert-skill/references/animation-basics.md +284 -0
- package/skills/swiftui-expert-skill/references/animation-transitions.md +326 -0
- package/skills/swiftui-expert-skill/references/charts-accessibility.md +135 -0
- package/skills/swiftui-expert-skill/references/charts.md +602 -0
- package/skills/swiftui-expert-skill/references/image-optimization.md +203 -0
- package/skills/swiftui-expert-skill/references/latest-apis.md +464 -0
- package/skills/swiftui-expert-skill/references/layout-best-practices.md +266 -0
- package/skills/swiftui-expert-skill/references/liquid-glass.md +414 -0
- package/skills/swiftui-expert-skill/references/list-patterns.md +394 -0
- package/skills/swiftui-expert-skill/references/macos-scenes.md +318 -0
- package/skills/swiftui-expert-skill/references/macos-views.md +357 -0
- package/skills/swiftui-expert-skill/references/macos-window-styling.md +303 -0
- package/skills/swiftui-expert-skill/references/performance-patterns.md +403 -0
- package/skills/swiftui-expert-skill/references/scroll-patterns.md +293 -0
- package/skills/swiftui-expert-skill/references/sheet-navigation-patterns.md +363 -0
- package/skills/swiftui-expert-skill/references/state-management.md +417 -0
- package/skills/swiftui-expert-skill/references/view-structure.md +389 -0
- package/skills/swiftui-ui-patterns/NOTICE.md +18 -0
- package/skills/swiftui-ui-patterns/SKILL.md +95 -0
- package/skills/swiftui-ui-patterns/references/app-wiring.md +201 -0
- package/skills/swiftui-ui-patterns/references/async-state.md +96 -0
- package/skills/swiftui-ui-patterns/references/components-index.md +50 -0
- package/skills/swiftui-ui-patterns/references/controls.md +57 -0
- package/skills/swiftui-ui-patterns/references/deeplinks.md +66 -0
- package/skills/swiftui-ui-patterns/references/focus.md +90 -0
- package/skills/swiftui-ui-patterns/references/form.md +97 -0
- package/skills/swiftui-ui-patterns/references/grids.md +71 -0
- package/skills/swiftui-ui-patterns/references/haptics.md +71 -0
- package/skills/swiftui-ui-patterns/references/input-toolbar.md +51 -0
- package/skills/swiftui-ui-patterns/references/lightweight-clients.md +93 -0
- package/skills/swiftui-ui-patterns/references/list.md +86 -0
- package/skills/swiftui-ui-patterns/references/loading-placeholders.md +38 -0
- package/skills/swiftui-ui-patterns/references/macos-settings.md +71 -0
- package/skills/swiftui-ui-patterns/references/matched-transitions.md +59 -0
- package/skills/swiftui-ui-patterns/references/media.md +73 -0
- package/skills/swiftui-ui-patterns/references/menu-bar.md +101 -0
- package/skills/swiftui-ui-patterns/references/navigationstack.md +159 -0
- package/skills/swiftui-ui-patterns/references/overlay.md +45 -0
- package/skills/swiftui-ui-patterns/references/performance.md +62 -0
- package/skills/swiftui-ui-patterns/references/previews.md +48 -0
- package/skills/swiftui-ui-patterns/references/scroll-reveal.md +133 -0
- package/skills/swiftui-ui-patterns/references/scrollview.md +87 -0
- package/skills/swiftui-ui-patterns/references/searchable.md +71 -0
- package/skills/swiftui-ui-patterns/references/sheets.md +155 -0
- package/skills/swiftui-ui-patterns/references/split-views.md +72 -0
- package/skills/swiftui-ui-patterns/references/tabview.md +114 -0
- package/skills/swiftui-ui-patterns/references/theming.md +71 -0
- package/skills/swiftui-ui-patterns/references/title-menus.md +93 -0
- package/skills/swiftui-ui-patterns/references/top-bar.md +49 -0
- package/templates/agents/swift-code-reviewer.md +78 -0
- package/templates/commands/review.md +56 -0
package/bin/install.js
CHANGED
|
@@ -38,16 +38,7 @@ function copyRecursive(src, dest) {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
function
|
|
42
|
-
log('\n Swift Code Reviewer Skill Installer', colors.cyan + colors.bright);
|
|
43
|
-
log(' ====================================\n', colors.cyan);
|
|
44
|
-
|
|
45
|
-
// Determine paths
|
|
46
|
-
const homeDir = os.homedir();
|
|
47
|
-
const skillsDir = path.join(homeDir, '.claude', 'skills');
|
|
48
|
-
const targetDir = path.join(skillsDir, SKILL_NAME);
|
|
49
|
-
|
|
50
|
-
// Find package root (where SKILL.md is located)
|
|
41
|
+
function findPackageRoot() {
|
|
51
42
|
let packageRoot = __dirname;
|
|
52
43
|
while (!fs.existsSync(path.join(packageRoot, 'SKILL.md'))) {
|
|
53
44
|
const parent = path.dirname(packageRoot);
|
|
@@ -57,14 +48,23 @@ function install() {
|
|
|
57
48
|
}
|
|
58
49
|
packageRoot = parent;
|
|
59
50
|
}
|
|
51
|
+
return packageRoot;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function install() {
|
|
55
|
+
log('\n Swift Code Reviewer Skill Installer', colors.cyan + colors.bright);
|
|
56
|
+
log(' ====================================\n', colors.cyan);
|
|
57
|
+
|
|
58
|
+
const homeDir = os.homedir();
|
|
59
|
+
const skillsDir = path.join(homeDir, '.claude', 'skills');
|
|
60
|
+
const targetDir = path.join(skillsDir, SKILL_NAME);
|
|
61
|
+
const packageRoot = findPackageRoot();
|
|
60
62
|
|
|
61
|
-
// Check if Claude Code skills directory exists
|
|
62
63
|
if (!fs.existsSync(skillsDir)) {
|
|
63
64
|
log(` Creating skills directory: ${skillsDir}`, colors.yellow);
|
|
64
65
|
fs.mkdirSync(skillsDir, { recursive: true });
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
// Check for existing installation
|
|
68
68
|
if (fs.existsSync(targetDir)) {
|
|
69
69
|
log(` Updating existing installation at:`, colors.yellow);
|
|
70
70
|
log(` ${targetDir}\n`, colors.yellow);
|
|
@@ -74,10 +74,8 @@ function install() {
|
|
|
74
74
|
log(` ${targetDir}\n`, colors.blue);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
// Create target directory
|
|
78
77
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
79
78
|
|
|
80
|
-
// Files to copy
|
|
81
79
|
const filesToCopy = [
|
|
82
80
|
'SKILL.md',
|
|
83
81
|
'README.md',
|
|
@@ -86,10 +84,8 @@ function install() {
|
|
|
86
84
|
'CHANGELOG.md'
|
|
87
85
|
];
|
|
88
86
|
|
|
89
|
-
|
|
90
|
-
const dirsToCopy = ['references'];
|
|
87
|
+
const dirsToCopy = ['references', 'skills', 'templates'];
|
|
91
88
|
|
|
92
|
-
// Copy files
|
|
93
89
|
for (const file of filesToCopy) {
|
|
94
90
|
const src = path.join(packageRoot, file);
|
|
95
91
|
const dest = path.join(targetDir, file);
|
|
@@ -100,7 +96,6 @@ function install() {
|
|
|
100
96
|
}
|
|
101
97
|
}
|
|
102
98
|
|
|
103
|
-
// Copy directories
|
|
104
99
|
for (const dir of dirsToCopy) {
|
|
105
100
|
const src = path.join(packageRoot, dir);
|
|
106
101
|
const dest = path.join(targetDir, dir);
|
|
@@ -111,10 +106,11 @@ function install() {
|
|
|
111
106
|
}
|
|
112
107
|
}
|
|
113
108
|
|
|
114
|
-
// Success message
|
|
115
109
|
log('\n Installation complete!', colors.green + colors.bright);
|
|
116
110
|
log('\n The skill is now available in Claude Code.', colors.reset);
|
|
117
|
-
log('
|
|
111
|
+
log(' To add the review agent and /review command to a project, run:', colors.reset);
|
|
112
|
+
log('\n npx swift-code-reviewer-skill init\n', colors.cyan);
|
|
113
|
+
log(' Or use it directly by asking Claude to:', colors.reset);
|
|
118
114
|
log('\n - "Review this PR"', colors.cyan);
|
|
119
115
|
log(' - "Review LoginView.swift"', colors.cyan);
|
|
120
116
|
log(' - "Review my uncommitted changes"', colors.cyan);
|
|
@@ -124,6 +120,69 @@ function install() {
|
|
|
124
120
|
log(' Documentation: https://github.com/Viniciuscarvalho/swift-code-reviewer-skill\n', colors.blue);
|
|
125
121
|
}
|
|
126
122
|
|
|
123
|
+
function init() {
|
|
124
|
+
log('\n Swift Code Reviewer — Project Setup', colors.cyan + colors.bright);
|
|
125
|
+
log(' =====================================\n', colors.cyan);
|
|
126
|
+
|
|
127
|
+
const packageRoot = findPackageRoot();
|
|
128
|
+
const cwd = process.cwd();
|
|
129
|
+
|
|
130
|
+
// Verify we're in a git repo (likely a real project)
|
|
131
|
+
if (!fs.existsSync(path.join(cwd, '.git'))) {
|
|
132
|
+
log(' Warning: Not a git repository. Running anyway.\n', colors.yellow);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
const claudeDir = path.join(cwd, '.claude');
|
|
136
|
+
const agentsDir = path.join(claudeDir, 'agents');
|
|
137
|
+
const commandsDir = path.join(claudeDir, 'commands');
|
|
138
|
+
|
|
139
|
+
const templateAgentSrc = path.join(packageRoot, 'templates', 'agents', 'swift-code-reviewer.md');
|
|
140
|
+
const templateCommandSrc = path.join(packageRoot, 'templates', 'commands', 'review.md');
|
|
141
|
+
|
|
142
|
+
// Check templates exist
|
|
143
|
+
if (!fs.existsSync(templateAgentSrc)) {
|
|
144
|
+
log(' Error: Agent template not found. Reinstall the skill with:', colors.red);
|
|
145
|
+
log(' npx swift-code-reviewer-skill\n', colors.cyan);
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
fs.mkdirSync(agentsDir, { recursive: true });
|
|
150
|
+
fs.mkdirSync(commandsDir, { recursive: true });
|
|
151
|
+
|
|
152
|
+
let created = 0;
|
|
153
|
+
let skipped = 0;
|
|
154
|
+
|
|
155
|
+
// Copy agent
|
|
156
|
+
const agentDest = path.join(agentsDir, 'swift-code-reviewer.md');
|
|
157
|
+
if (fs.existsSync(agentDest)) {
|
|
158
|
+
log(' Skipped: .claude/agents/swift-code-reviewer.md (already exists)', colors.yellow);
|
|
159
|
+
skipped++;
|
|
160
|
+
} else {
|
|
161
|
+
fs.copyFileSync(templateAgentSrc, agentDest);
|
|
162
|
+
log(' Created: .claude/agents/swift-code-reviewer.md', colors.green);
|
|
163
|
+
created++;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Copy command
|
|
167
|
+
const commandDest = path.join(commandsDir, 'review.md');
|
|
168
|
+
if (fs.existsSync(commandDest)) {
|
|
169
|
+
log(' Skipped: .claude/commands/review.md (already exists)', colors.yellow);
|
|
170
|
+
skipped++;
|
|
171
|
+
} else {
|
|
172
|
+
fs.copyFileSync(templateCommandSrc, commandDest);
|
|
173
|
+
log(' Created: .claude/commands/review.md', colors.green);
|
|
174
|
+
created++;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
log(`\n Done! ${created} file(s) created, ${skipped} skipped.`, colors.green + colors.bright);
|
|
178
|
+
|
|
179
|
+
if (created > 0) {
|
|
180
|
+
log('\n Usage:', colors.reset);
|
|
181
|
+
log(' /review — run a full code review before pushing', colors.cyan);
|
|
182
|
+
log(' @swift-code-reviewer — invoke the agent directly\n', colors.cyan);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
127
186
|
function uninstall() {
|
|
128
187
|
log('\n Uninstalling Swift Code Reviewer Skill', colors.yellow + colors.bright);
|
|
129
188
|
log(' ======================================\n', colors.yellow);
|
|
@@ -146,11 +205,13 @@ function showHelp() {
|
|
|
146
205
|
log(' Usage: npx swift-code-reviewer-skill [command]\n', colors.reset);
|
|
147
206
|
log(' Commands:', colors.bright);
|
|
148
207
|
log(' (none) Install the skill to ~/.claude/skills/', colors.reset);
|
|
208
|
+
log(' init Scaffold agent + /review command into current project', colors.reset);
|
|
149
209
|
log(' uninstall Remove the skill from ~/.claude/skills/', colors.reset);
|
|
150
210
|
log(' help Show this help message\n', colors.reset);
|
|
151
211
|
log(' Examples:', colors.bright);
|
|
152
|
-
log(' npx swift-code-reviewer-skill', colors.cyan);
|
|
153
|
-
log(' npx swift-code-reviewer-skill
|
|
212
|
+
log(' npx swift-code-reviewer-skill # install skill globally', colors.cyan);
|
|
213
|
+
log(' npx swift-code-reviewer-skill init # add agent + command to project', colors.cyan);
|
|
214
|
+
log(' npx swift-code-reviewer-skill uninstall # remove skill\n', colors.cyan);
|
|
154
215
|
}
|
|
155
216
|
|
|
156
217
|
// Parse command line arguments
|
|
@@ -158,6 +219,10 @@ const args = process.argv.slice(2);
|
|
|
158
219
|
const command = args[0];
|
|
159
220
|
|
|
160
221
|
switch (command) {
|
|
222
|
+
case 'init':
|
|
223
|
+
case 'setup':
|
|
224
|
+
init();
|
|
225
|
+
break;
|
|
161
226
|
case 'uninstall':
|
|
162
227
|
case 'remove':
|
|
163
228
|
uninstall();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swift-code-reviewer-skill",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Claude Code skill for comprehensive Swift/SwiftUI code reviews with multi-layer analysis",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
@@ -9,9 +9,21 @@
|
|
|
9
9
|
"swift",
|
|
10
10
|
"swiftui",
|
|
11
11
|
"code-review",
|
|
12
|
+
"code-quality",
|
|
13
|
+
"architecture-review",
|
|
14
|
+
"performance-audit",
|
|
15
|
+
"security-analysis",
|
|
16
|
+
"swift-6",
|
|
17
|
+
"async-await",
|
|
18
|
+
"sendable",
|
|
19
|
+
"concurrency",
|
|
12
20
|
"ios",
|
|
13
21
|
"macos",
|
|
14
|
-
"apple"
|
|
22
|
+
"apple",
|
|
23
|
+
"dependency-injection",
|
|
24
|
+
"testing",
|
|
25
|
+
"accessibility",
|
|
26
|
+
"best-practices"
|
|
15
27
|
],
|
|
16
28
|
"author": "Vinicius Carvalho",
|
|
17
29
|
"license": "MIT",
|
|
@@ -29,6 +41,8 @@
|
|
|
29
41
|
"files": [
|
|
30
42
|
"bin/",
|
|
31
43
|
"references/",
|
|
44
|
+
"skills/",
|
|
45
|
+
"templates/",
|
|
32
46
|
"SKILL.md",
|
|
33
47
|
"README.md",
|
|
34
48
|
"LICENSE",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Companion Skills Reference
|
|
2
|
+
|
|
3
|
+
Full attribution and update instructions: [`skills/README.md`](../skills/README.md)
|
|
4
|
+
Original authors: [@AvdLee](https://github.com/AvdLee), [@Dimillian](https://github.com/Dimillian), [@bocato](https://github.com/bocato)
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## swiftui-expert-skill · `skills/swiftui-expert-skill/`
|
|
9
|
+
|
|
10
|
+
| Reference file | When to consult |
|
|
11
|
+
| -------------------------------------- | ------------------------------------------------------------------------- |
|
|
12
|
+
| `references/state-management.md` | Property wrapper selection — @State, @Binding, @Observable, @Environment |
|
|
13
|
+
| `references/latest-apis.md` | Deprecation detection — always check before flagging an API as deprecated |
|
|
14
|
+
| `references/view-structure.md` | View extraction rules and composition depth limits |
|
|
15
|
+
| `references/performance-patterns.md` | Equatable conformance, body evaluation cost, lazy loading |
|
|
16
|
+
| `references/accessibility-patterns.md` | VoiceOver grouping, traits, Dynamic Type support |
|
|
17
|
+
| `references/liquid-glass.md` | iOS 26+ Liquid Glass adoption and availability gating |
|
|
18
|
+
| `references/animation-basics.md` | Implicit/explicit animation, withAnimation, matchedGeometryEffect |
|
|
19
|
+
| `references/macos-scenes.md` | macOS-specific Scene types, window styling, settings |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## swift-concurrency · `skills/swift-concurrency/`
|
|
24
|
+
|
|
25
|
+
| Reference file | When to consult |
|
|
26
|
+
| ---------------------------------- | ----------------------------------------------------------- |
|
|
27
|
+
| `references/sendable.md` | Sendable conformance, `@unchecked Sendable` justification |
|
|
28
|
+
| `references/actors.md` | Actor isolation, custom actors vs @MainActor |
|
|
29
|
+
| `references/async-await-basics.md` | Structured vs unstructured tasks, `Task.detached` rationale |
|
|
30
|
+
| `references/migration.md` | Swift 6 migration patterns, minimum blast-radius approach |
|
|
31
|
+
| `references/testing.md` | Concurrency-safe test patterns |
|
|
32
|
+
| `references/threading.md` | Thread safety, GCD interop, isolation boundaries |
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## swift-testing · `skills/swift-testing/`
|
|
37
|
+
|
|
38
|
+
| Reference file | When to consult |
|
|
39
|
+
| ----------------------------------- | ------------------------------------------------------------- |
|
|
40
|
+
| `references/test-organization.md` | @Suite hierarchy, naming, tagging |
|
|
41
|
+
| `references/test-doubles.md` | Dummy / Fake / Stub / Spy / Mock taxonomy |
|
|
42
|
+
| `references/async-testing.md` | `#expect(throws:)`, async confirmation patterns |
|
|
43
|
+
| `references/parameterized-tests.md` | `@Test(arguments:)` for data-driven tests |
|
|
44
|
+
| `references/migration-xctest.md` | XCTest → Swift Testing migration checklist |
|
|
45
|
+
| `references/fixtures.md` | Fixture placement with `#if DEBUG`, test target vs app target |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## swift-expert · `skills/swift-expert/`
|
|
50
|
+
|
|
51
|
+
| Reference file | When to consult |
|
|
52
|
+
| ---------------------------------- | --------------------------------------------------------------------- |
|
|
53
|
+
| `references/async-concurrency.md` | Cross-cutting concurrency patterns |
|
|
54
|
+
| `references/protocol-oriented.md` | Protocol hierarchies, associated types, existentials, `any` vs `some` |
|
|
55
|
+
| `references/memory-performance.md` | Value vs reference semantics, ARC, retain cycles |
|
|
56
|
+
| `references/swiftui-patterns.md` | Additional SwiftUI architectural guidance |
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## swiftui-ui-patterns · `skills/swiftui-ui-patterns/`
|
|
61
|
+
|
|
62
|
+
| Reference file | When to consult |
|
|
63
|
+
| -------------------------------- | --------------------------------------------------------- |
|
|
64
|
+
| `references/components-index.md` | Full component catalogue — start here for any UI pattern |
|
|
65
|
+
| `references/navigationstack.md` | Route enums, RouterPath, `navigationDestination` |
|
|
66
|
+
| `references/sheets.md` | Item-driven sheets, SheetDestination enum |
|
|
67
|
+
| `references/theming.md` | Semantic color enforcement via `@Environment(Theme.self)` |
|
|
68
|
+
| `references/async-state.md` | `.task(id:)`, LoadState enum, CancellationError |
|
|
69
|
+
| `references/tabview.md` | Tab architecture, per-tab independent navigation history |
|
|
70
|
+
| `references/grids.md` | LazyVGrid / LazyHGrid patterns and identity |
|
package/skills/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Bundled Companion Skills
|
|
2
|
+
|
|
3
|
+
This directory contains five companion skills vendored directly into `swift-code-reviewer-skill` so that reviewers have a complete, self-contained knowledge base after a single install or clone — no extra setup required.
|
|
4
|
+
|
|
5
|
+
## Thanks to the original authors
|
|
6
|
+
|
|
7
|
+
These skills are based on the public Swift/SwiftUI work of three community contributors:
|
|
8
|
+
|
|
9
|
+
| Author | GitHub | Known for |
|
|
10
|
+
| ------------------- | ------------------------------------------ | ------------------------------------------------------------- |
|
|
11
|
+
| Antoine van der Lee | [@AvdLee](https://github.com/AvdLee) | SwiftLee — concurrency, testing, Swift 6 migration |
|
|
12
|
+
| Thomas Ricouard | [@Dimillian](https://github.com/Dimillian) | IceCubesApp — SwiftUI architecture, Liquid Glass, UI patterns |
|
|
13
|
+
| Eduardo Bocato | [@bocato](https://github.com/bocato) | Clean Architecture, protocol-oriented Swift, Swift expert |
|
|
14
|
+
|
|
15
|
+
Attribution is best-effort — upstream folders carried no `LICENSE` or `AUTHORS` files. If you are one of the original authors and want the attribution corrected or content removed, please [open an issue](https://github.com/Viniciuscarvalho/swift-code-reviewer-skill/issues).
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Skills index
|
|
20
|
+
|
|
21
|
+
| Skill | Primary author | Description | References |
|
|
22
|
+
| ----------------------------------------------------- | -------------- | ----------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
|
|
23
|
+
| [swiftui-expert-skill](swiftui-expert-skill/SKILL.md) | @Dimillian | Write, review, or improve SwiftUI code: state management, view composition, Liquid Glass, macOS | [19 files](swiftui-expert-skill/references/) · [NOTICE](swiftui-expert-skill/NOTICE.md) |
|
|
24
|
+
| [swift-concurrency](swift-concurrency/SKILL.md) | @AvdLee | Expert guidance on actors, Sendable, async/await, Swift 6 migration, data races | [13 files](swift-concurrency/references/) · [NOTICE](swift-concurrency/NOTICE.md) |
|
|
25
|
+
| [swift-testing](swift-testing/SKILL.md) | @AvdLee | Modern Swift Testing framework: @Test, #expect, doubles, snapshots, XCTest migration | [9 files](swift-testing/references/) · [NOTICE](swift-testing/NOTICE.md) |
|
|
26
|
+
| [swift-expert](swift-expert/SKILL.md) | @bocato | Senior Swift 6+ specialist: protocol-oriented design, memory, concurrency, SwiftUI patterns | [5 files](swift-expert/references/) · [NOTICE](swift-expert/NOTICE.md) |
|
|
27
|
+
| [swiftui-ui-patterns](swiftui-ui-patterns/SKILL.md) | @Dimillian | Component-level SwiftUI patterns: navigation, lists, sheets, grids, theming, gestures | [32 files](swiftui-ui-patterns/references/) · [NOTICE](swiftui-ui-patterns/NOTICE.md) |
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Updating a skill
|
|
32
|
+
|
|
33
|
+
Each skill is a verbatim copy of its source. To refresh one:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
rsync -rL --exclude='.DS_Store' ~/.agents/skills/swiftui-expert-skill/ skills/swiftui-expert-skill/
|
|
37
|
+
rsync -rL --exclude='.DS_Store' ~/.claude/skills/swift-concurrency/ skills/swift-concurrency/
|
|
38
|
+
rsync -rL --exclude='.DS_Store' ~/.claude/skills/swift-testing/ skills/swift-testing/
|
|
39
|
+
rsync -rL --exclude='.DS_Store' ~/.maestro/skills/swift-expert/ skills/swift-expert/
|
|
40
|
+
rsync -rL --exclude='.DS_Store' ~/.maestro/skills/swiftui-ui-patterns/ skills/swiftui-ui-patterns/
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Do not edit files under `skills/` directly — changes will be overwritten on the next sync.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# swift-concurrency — Attribution Notice
|
|
2
|
+
|
|
3
|
+
Bundled into `swift-code-reviewer-skill` on 2026-04-21 from
|
|
4
|
+
`~/.claude/skills/swift-concurrency`.
|
|
5
|
+
|
|
6
|
+
Primary author (best-effort attribution): **Antoine van der Lee ([@AvdLee](https://github.com/AvdLee))**
|
|
7
|
+
Also credited: [@Dimillian](https://github.com/Dimillian), [@bocato](https://github.com/bocato)
|
|
8
|
+
|
|
9
|
+
These three authors' public Swift/SwiftUI content — including SwiftLee, IceCubesApp,
|
|
10
|
+
and their various open-source contributions — informed the skills bundled here.
|
|
11
|
+
|
|
12
|
+
License: the upstream folder did not contain a LICENSE file at the time of vendoring.
|
|
13
|
+
Content is reproduced here in good faith for reference alongside this MIT-licensed
|
|
14
|
+
project. If you are an upstream author and want the attribution corrected, the license
|
|
15
|
+
clarified, or the content removed, please open an issue at:
|
|
16
|
+
https://github.com/Viniciuscarvalho/swift-code-reviewer-skill/issues
|
|
17
|
+
|
|
18
|
+
Changes from upstream: none (verbatim copy; `.DS_Store` files excluded).
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: swift-concurrency
|
|
3
|
+
description: 'Expert guidance on Swift Concurrency best practices, patterns, and implementation. Use when developers mention: (1) Swift Concurrency, async/await, actors, or tasks, (2) "use Swift Concurrency" or "modern concurrency patterns", (3) migrating to Swift 6, (4) data races or thread safety issues, (5) refactoring closures to async/await, (6) @MainActor, Sendable, or actor isolation, (7) concurrent code architecture or performance optimization, (8) concurrency-related linter warnings (SwiftLint or similar; e.g. async_without_await, Sendable/actor isolation/MainActor lint).'
|
|
4
|
+
---
|
|
5
|
+
# Swift Concurrency
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This skill provides expert guidance on Swift Concurrency, covering modern async/await patterns, actors, tasks, Sendable conformance, and migration to Swift 6. Use this skill to help developers write safe, performant concurrent code and navigate the complexities of Swift's structured concurrency model.
|
|
10
|
+
|
|
11
|
+
## Agent Behavior Contract (Follow These Rules)
|
|
12
|
+
|
|
13
|
+
1. Analyze the project/package file to find out which Swift language mode (Swift 5.x vs Swift 6) and which Xcode/Swift toolchain is used when advice depends on it.
|
|
14
|
+
2. Before proposing fixes, identify the isolation boundary: `@MainActor`, custom actor, actor instance isolation, or nonisolated.
|
|
15
|
+
3. Do not recommend `@MainActor` as a blanket fix. Justify why main-actor isolation is correct for the code.
|
|
16
|
+
4. Prefer structured concurrency (child tasks, task groups) over unstructured tasks. Use `Task.detached` only with a clear reason.
|
|
17
|
+
5. If recommending `@preconcurrency`, `@unchecked Sendable`, or `nonisolated(unsafe)`, require:
|
|
18
|
+
- a documented safety invariant
|
|
19
|
+
- a follow-up ticket to remove or migrate it
|
|
20
|
+
6. For migration work, optimize for minimal blast radius (small, reviewable changes) and add verification steps.
|
|
21
|
+
7. Course references are for deeper learning only. Use them sparingly and only when they clearly help answer the developer’s question.
|
|
22
|
+
|
|
23
|
+
## Project Settings Intake (Evaluate Before Advising)
|
|
24
|
+
|
|
25
|
+
Concurrency behavior depends on build settings. Always try to determine:
|
|
26
|
+
|
|
27
|
+
- Default actor isolation (is the module default `@MainActor` or `nonisolated`?)
|
|
28
|
+
- Strict concurrency checking level (minimal/targeted/complete)
|
|
29
|
+
- Whether upcoming features are enabled (especially `NonisolatedNonsendingByDefault`)
|
|
30
|
+
- Swift language mode (Swift 5.x vs Swift 6) and SwiftPM tools version
|
|
31
|
+
|
|
32
|
+
### Manual checks (no scripts)
|
|
33
|
+
|
|
34
|
+
- SwiftPM:
|
|
35
|
+
- Check `Package.swift` for `.defaultIsolation(MainActor.self)`.
|
|
36
|
+
- Check `Package.swift` for `.enableUpcomingFeature("NonisolatedNonsendingByDefault")`.
|
|
37
|
+
- Check for strict concurrency flags: `.enableExperimentalFeature("StrictConcurrency=targeted")` (or similar).
|
|
38
|
+
- Check tools version at the top: `// swift-tools-version: ...`
|
|
39
|
+
- Xcode projects:
|
|
40
|
+
- Search `project.pbxproj` for:
|
|
41
|
+
- `SWIFT_DEFAULT_ACTOR_ISOLATION`
|
|
42
|
+
- `SWIFT_STRICT_CONCURRENCY`
|
|
43
|
+
- `SWIFT_UPCOMING_FEATURE_` (and/or `SWIFT_ENABLE_EXPERIMENTAL_FEATURES`)
|
|
44
|
+
|
|
45
|
+
If any of these are unknown, ask the developer to confirm them before giving migration-sensitive guidance.
|
|
46
|
+
|
|
47
|
+
## Quick Decision Tree
|
|
48
|
+
|
|
49
|
+
When a developer needs concurrency guidance, follow this decision tree:
|
|
50
|
+
|
|
51
|
+
1. **Starting fresh with async code?**
|
|
52
|
+
- Read `references/async-await-basics.md` for foundational patterns
|
|
53
|
+
- For parallel operations → `references/tasks.md` (async let, task groups)
|
|
54
|
+
|
|
55
|
+
2. **Protecting shared mutable state?**
|
|
56
|
+
- Need to protect class-based state → `references/actors.md` (actors, @MainActor)
|
|
57
|
+
- Need thread-safe value passing → `references/sendable.md` (Sendable conformance)
|
|
58
|
+
|
|
59
|
+
3. **Managing async operations?**
|
|
60
|
+
- Structured async work → `references/tasks.md` (Task, child tasks, cancellation)
|
|
61
|
+
- Streaming data → `references/async-sequences.md` (AsyncSequence, AsyncStream)
|
|
62
|
+
|
|
63
|
+
4. **Working with legacy frameworks?**
|
|
64
|
+
- Core Data integration → `references/core-data.md`
|
|
65
|
+
- General migration → `references/migration.md`
|
|
66
|
+
|
|
67
|
+
5. **Performance or debugging issues?**
|
|
68
|
+
- Slow async code → `references/performance.md` (profiling, suspension points)
|
|
69
|
+
- Testing concerns → `references/testing.md` (XCTest, Swift Testing)
|
|
70
|
+
|
|
71
|
+
6. **Understanding threading behavior?**
|
|
72
|
+
- Read `references/threading.md` for thread/task relationship and isolation
|
|
73
|
+
|
|
74
|
+
7. **Memory issues with tasks?**
|
|
75
|
+
- Read `references/memory-management.md` for retain cycle prevention
|
|
76
|
+
|
|
77
|
+
## Triage-First Playbook (Common Errors -> Next Best Move)
|
|
78
|
+
|
|
79
|
+
- SwiftLint concurrency-related warnings
|
|
80
|
+
- Use `references/linting.md` for rule intent and preferred fixes; avoid dummy awaits as “fixes”.
|
|
81
|
+
- SwiftLint `async_without_await` warning
|
|
82
|
+
- Remove `async` if not required; if required by protocol/override/@concurrent, prefer narrow suppression over adding fake awaits. See `references/linting.md`.
|
|
83
|
+
- "Sending value of non-Sendable type ... risks causing data races"
|
|
84
|
+
- First: identify where the value crosses an isolation boundary
|
|
85
|
+
- Then: use `references/sendable.md` and `references/threading.md` (especially Swift 6.2 behavior changes)
|
|
86
|
+
- "Main actor-isolated ... cannot be used from a nonisolated context"
|
|
87
|
+
- First: decide if it truly belongs on `@MainActor`
|
|
88
|
+
- Then: use `references/actors.md` (global actors, `nonisolated`, isolated parameters) and `references/threading.md` (default isolation)
|
|
89
|
+
- "Class property 'current' is unavailable from asynchronous contexts" (Thread APIs)
|
|
90
|
+
- Use `references/threading.md` to avoid thread-centric debugging and rely on isolation + Instruments
|
|
91
|
+
- XCTest async errors like "wait(...) is unavailable from asynchronous contexts"
|
|
92
|
+
- Use `references/testing.md` (`await fulfillment(of:)` and Swift Testing patterns)
|
|
93
|
+
- Core Data concurrency warnings/errors
|
|
94
|
+
- Use `references/core-data.md` (DAO/`NSManagedObjectID`, default isolation conflicts)
|
|
95
|
+
|
|
96
|
+
## Core Patterns Reference
|
|
97
|
+
|
|
98
|
+
### When to Use Each Concurrency Tool
|
|
99
|
+
|
|
100
|
+
**async/await** - Making existing synchronous code asynchronous
|
|
101
|
+
```swift
|
|
102
|
+
// Use for: Single asynchronous operations
|
|
103
|
+
func fetchUser() async throws -> User {
|
|
104
|
+
try await networkClient.get("/user")
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
**async let** - Running multiple independent async operations in parallel
|
|
109
|
+
```swift
|
|
110
|
+
// Use for: Fixed number of parallel operations known at compile time
|
|
111
|
+
async let user = fetchUser()
|
|
112
|
+
async let posts = fetchPosts()
|
|
113
|
+
let profile = try await (user, posts)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
**Task** - Starting unstructured asynchronous work
|
|
117
|
+
```swift
|
|
118
|
+
// Use for: Fire-and-forget operations, bridging sync to async contexts
|
|
119
|
+
Task {
|
|
120
|
+
await updateUI()
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Task Group** - Dynamic parallel operations with structured concurrency
|
|
125
|
+
```swift
|
|
126
|
+
// Use for: Unknown number of parallel operations at compile time
|
|
127
|
+
await withTaskGroup(of: Result.self) { group in
|
|
128
|
+
for item in items {
|
|
129
|
+
group.addTask { await process(item) }
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
**Actor** - Protecting mutable state from data races
|
|
135
|
+
```swift
|
|
136
|
+
// Use for: Shared mutable state accessed from multiple contexts
|
|
137
|
+
actor DataCache {
|
|
138
|
+
private var cache: [String: Data] = [:]
|
|
139
|
+
func get(_ key: String) -> Data? { cache[key] }
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**@MainActor** - Ensuring UI updates on main thread
|
|
144
|
+
```swift
|
|
145
|
+
// Use for: View models, UI-related classes
|
|
146
|
+
@MainActor
|
|
147
|
+
class ViewModel: ObservableObject {
|
|
148
|
+
@Published var data: String = ""
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Common Scenarios
|
|
153
|
+
|
|
154
|
+
**Scenario: Network request with UI update**
|
|
155
|
+
```swift
|
|
156
|
+
Task { @concurrent in
|
|
157
|
+
let data = try await fetchData() // Background
|
|
158
|
+
await MainActor.run {
|
|
159
|
+
self.updateUI(with: data) // Main thread
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Scenario: Multiple parallel network requests**
|
|
165
|
+
```swift
|
|
166
|
+
async let users = fetchUsers()
|
|
167
|
+
async let posts = fetchPosts()
|
|
168
|
+
async let comments = fetchComments()
|
|
169
|
+
let (u, p, c) = try await (users, posts, comments)
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Scenario: Processing array items in parallel**
|
|
173
|
+
```swift
|
|
174
|
+
await withTaskGroup(of: ProcessedItem.self) { group in
|
|
175
|
+
for item in items {
|
|
176
|
+
group.addTask { await process(item) }
|
|
177
|
+
}
|
|
178
|
+
for await result in group {
|
|
179
|
+
results.append(result)
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Swift 6 Migration Quick Guide
|
|
185
|
+
|
|
186
|
+
Key changes in Swift 6:
|
|
187
|
+
- **Strict concurrency checking** enabled by default
|
|
188
|
+
- **Complete data-race safety** at compile time
|
|
189
|
+
- **Sendable requirements** enforced on boundaries
|
|
190
|
+
- **Isolation checking** for all async boundaries
|
|
191
|
+
|
|
192
|
+
For detailed migration steps, see `references/migration.md`.
|
|
193
|
+
|
|
194
|
+
## Reference Files
|
|
195
|
+
|
|
196
|
+
Load these files as needed for specific topics:
|
|
197
|
+
|
|
198
|
+
- **`async-await-basics.md`** - async/await syntax, execution order, async let, URLSession patterns
|
|
199
|
+
- **`tasks.md`** - Task lifecycle, cancellation, priorities, task groups, structured vs unstructured
|
|
200
|
+
- **`threading.md`** - Thread/task relationship, suspension points, isolation domains, nonisolated
|
|
201
|
+
- **`memory-management.md`** - Retain cycles in tasks, memory safety patterns
|
|
202
|
+
- **`actors.md`** - Actor isolation, @MainActor, global actors, reentrancy, custom executors, Mutex
|
|
203
|
+
- **`sendable.md`** - Sendable conformance, value/reference types, @unchecked, region isolation
|
|
204
|
+
- **`linting.md`** - Concurrency-focused lint rules and SwiftLint `async_without_await`
|
|
205
|
+
- **`async-sequences.md`** - AsyncSequence, AsyncStream, when to use vs regular async methods
|
|
206
|
+
- **`core-data.md`** - NSManagedObject sendability, custom executors, isolation conflicts
|
|
207
|
+
- **`performance.md`** - Profiling with Instruments, reducing suspension points, execution strategies
|
|
208
|
+
- **`testing.md`** - XCTest async patterns, Swift Testing, concurrency testing utilities
|
|
209
|
+
- **`migration.md`** - Swift 6 migration strategy, closure-to-async conversion, @preconcurrency, FRP migration
|
|
210
|
+
|
|
211
|
+
## Best Practices Summary
|
|
212
|
+
|
|
213
|
+
1. **Prefer structured concurrency** - Use task groups over unstructured tasks when possible
|
|
214
|
+
2. **Minimize suspension points** - Keep actor-isolated sections small to reduce context switches
|
|
215
|
+
3. **Use @MainActor judiciously** - Only for truly UI-related code
|
|
216
|
+
4. **Make types Sendable** - Enable safe concurrent access by conforming to Sendable
|
|
217
|
+
5. **Handle cancellation** - Check Task.isCancelled in long-running operations
|
|
218
|
+
6. **Avoid blocking** - Never use semaphores or locks in async contexts
|
|
219
|
+
7. **Test concurrent code** - Use proper async test methods and consider timing issues
|
|
220
|
+
|
|
221
|
+
## Verification Checklist (When You Change Concurrency Code)
|
|
222
|
+
|
|
223
|
+
- Confirm build settings (default isolation, strict concurrency, upcoming features) before interpreting diagnostics.
|
|
224
|
+
- After refactors:
|
|
225
|
+
- Run tests, especially concurrency-sensitive ones (see `references/testing.md`).
|
|
226
|
+
- If performance-related, verify with Instruments (see `references/performance.md`).
|
|
227
|
+
- If lifetime-related, verify deinit/cancellation behavior (see `references/memory-management.md`).
|
|
228
|
+
|
|
229
|
+
## Glossary
|
|
230
|
+
|
|
231
|
+
See `references/glossary.md` for quick definitions of core concurrency terms used across this skill.
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
**Note**: This skill is based on the comprehensive [Swift Concurrency Course](https://www.swiftconcurrencycourse.com?utm_source=github&utm_medium=agent-skill&utm_campaign=skill-footer) by Antoine van der Lee.
|