Skip to content

feat: add Swift rules and SwiftUI patterns skill#244

Merged
affaan-m merged 3 commits into
affaan-m:mainfrom
maxdimitrov:feat/rules/swift
Feb 24, 2026
Merged

feat: add Swift rules and SwiftUI patterns skill#244
affaan-m merged 3 commits into
affaan-m:mainfrom
maxdimitrov:feat/rules/swift

Conversation

@maxdimitrov

@maxdimitrov maxdimitrov commented Feb 17, 2026

Copy link
Copy Markdown

Summary

  • Add 5 Swift rule files (rules/swift/) following the same pattern as TypeScript, Python, and Go rule sets
  • Each file extends its common/ counterpart with Swift-specific content covering Swift 6 strict concurrency, Swift Testing framework, protocol-oriented patterns, Keychain-based secrets, and SwiftFormat/SwiftLint hooks
  • Add swiftui-patterns skill with comprehensive coverage of @Observable state management, view composition, type-safe NavigationStack routing, performance optimization, and modern preview patterns
  • Update rules/README.md to include Swift in the directory tree, install script examples, and manual installation commands

New Files

File Content
rules/swift/coding-style.md SwiftFormat/SwiftLint, let over var, value types, Apple API naming, typed throws, strict concurrency
rules/swift/testing.md Swift Testing (@Test, #expect), parameterized tests, coverage
rules/swift/patterns.md Protocol-oriented design, enums with associated values, actors, protocol-based DI
rules/swift/security.md Keychain Services, ATS, ProcessInfo.environment, input validation
rules/swift/hooks.md PostToolUse for SwiftFormat/SwiftLint/swift build, print() warning
skills/swiftui-patterns/SKILL.md @Observable state management, view composition, NavigationStack routing, lazy containers, previews

Test plan

  • node scripts/ci/validate-rules.js passes (29 rule files)
  • node scripts/ci/validate-skills.js passes (44 skill directories)
  • markdownlint passes on all new files
  • Each rule file has YAML frontmatter with paths targeting **/*.swift and **/Package.swift
  • Each rule file opens with > This file extends [common/xxx.md] reference
  • References existing skills: swift-actor-persistence, swift-protocol-di-testing

Summary by CodeRabbit

  • New Features

    • Added comprehensive Swift development rules: coding style, design patterns, security guidance, testing practices, and SwiftUI architecture patterns.
    • Added Swift-specific editor/tool hooks for formatting, linting, and package checks.
  • Documentation

    • Updated installation and manual install instructions to include Swift rules.
    • Updated project structure to reflect multi-language layout including Swift.

Add 5 rule files for Swift following the established pattern used by
TypeScript, Python, and Go rule sets. Covers Swift 6 strict concurrency,
Swift Testing framework, protocol-oriented patterns, Keychain-based
secret management, and SwiftFormat/SwiftLint hooks.
@coderabbitai

coderabbitai Bot commented Feb 17, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

Adds a new Swift rules subtree with five Swift-specific guideline documents plus a Swift SKILL, and updates rules/README.md to include Swift in the language tree and installation instructions.

Changes

Cohort / File(s) Summary
README / installation
rules/README.md
Include Swift in the language tree; add install option install.sh swift and manual-copy guidance for rules/swift.
Swift coding style
rules/swift/coding-style.md
New file: Swift-specific formatting, immutability, naming, error handling, concurrency guidance and path globs for Swift sources and Package.swift.
Swift hooks
rules/swift/hooks.md
New file: Post-edit hooks for Swift (format, lint, package/type-check), configuration hints, and production logging guidance.
Swift patterns
rules/swift/patterns.md
New file: Protocol-oriented design, value-type recommendations, actor usage, DI patterns and code examples.
Swift security
rules/swift/security.md
New file: Secret management, transport security (ATS, cert pinning), input validation, and Swift-specific examples.
Swift testing
rules/swift/testing.md
New file: Swift testing practices, example tests, isolation, parameterized tests, and coverage commands.
Swift skill
skills/swiftui-patterns/SKILL.md
New file: SwiftUI architecture and patterns, state management, navigation, performance tips, and examples (large document).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • affaan-m

Poem

🐇 I hopped through folders, swift and spry,
New rules and patterns beneath the sky.
Actors hum and linters sing,
Keys kept safe — the builds take wing.
A tiny rabbit cheers "commit and fly!" 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely summarizes the main changes: adding Swift rules (five new rule files) and a SwiftUI patterns skill to the codebase.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
rules/swift/coding-style.md (1)

8-8: Consider hyphenating compound adjective (applies to all Swift rule files).

Static analysis correctly identified that "Swift specific" should be hyphenated as "Swift-specific" when used as a compound adjective. This same pattern appears in line 8 of all five Swift rule files (hooks.md, patterns.md, testing.md, security.md, coding-style.md).

📝 Proposed fix for consistent hyphenation

Apply this change to line 8 in all five Swift rule files:

-> This file extends [common/xxx.md](../common/xxx.md) with Swift specific content.
+> This file extends [common/xxx.md](../common/xxx.md) with Swift-specific content.

Files to update:

  • rules/swift/hooks.md:8
  • rules/swift/patterns.md:8
  • rules/swift/testing.md:8
  • rules/swift/security.md:8
  • rules/swift/coding-style.md:8
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@rules/swift/coding-style.md` at line 8, Replace instances of the unhyphenated
compound adjective "Swift specific" with the hyphenated form "Swift-specific" in
the five Swift rule files where it appears (e.g., the sentence that currently
reads "This file extends [common/coding-style.md] with Swift specific
content."); search for the exact phrase "Swift specific" in
rules/swift/hooks.md, patterns.md, testing.md, security.md, and coding-style.md
and update each occurrence to "Swift-specific" to ensure consistent compound
adjective hyphenation.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@rules/swift/coding-style.md`:
- Line 8: Replace instances of the unhyphenated compound adjective "Swift
specific" with the hyphenated form "Swift-specific" in the five Swift rule files
where it appears (e.g., the sentence that currently reads "This file extends
[common/coding-style.md] with Swift specific content."); search for the exact
phrase "Swift specific" in rules/swift/hooks.md, patterns.md, testing.md,
security.md, and coding-style.md and update each occurrence to "Swift-specific"
to ensure consistent compound adjective hyphenation.

Add comprehensive SwiftUI skill covering @observable state management,
view composition, type-safe NavigationStack routing, performance
optimization with lazy containers, and modern preview patterns.
@maxdimitrov maxdimitrov changed the title feat: add Swift language-specific rules feat: add Swift rules and SwiftUI patterns skill Feb 17, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@skills/swiftui-patterns/SKILL.md`:
- Around line 61-72: The view currently creates its own `@State` private var
viewModel = ItemListViewModel(), so preview .environment(...) injections are
ignored; change ItemListView to read the model from the environment (replace the
`@State` property with `@EnvironmentObject` var viewModel: ItemListViewModel and
remove the inline initializer) and update the previews to inject the mock with
.environmentObject(MockItemListViewModel()) (also fix the same pattern in the
other occurrence around lines 235-243), ensuring calls like await
viewModel.load() continue to work with the environment-provided instance.
- Around line 217-223: The current Equatable implementation on
ExpensiveChartView only compares dataPoints.count which can mark different
datasets as equal; update the static func == (in struct ExpensiveChartView) to
compare a stable identifier or lightweight content instead of just count — for
example compare dataPoints' IDs (e.g. dataPoints.map { $0.id }) or
compute/compare a small hash of the dataPoints contents, or, if DataPoint
conforms to Equatable, compare the arrays directly (dataPoints ==
other.dataPoints) so that real differences trigger re-renders.

Comment thread skills/swiftui-patterns/SKILL.md
Comment thread skills/swiftui-patterns/SKILL.md
Fix ItemListView to accept viewModel via init with default parameter
so previews can inject mocks. Fix ExpensiveChartView Equatable to
compare full array instead of only count.
@affaan-m affaan-m merged commit bbbb2d6 into affaan-m:main Feb 24, 2026
2 checks passed
FrancescoRosciano pushed a commit to FRosciano-Mambo/everything-claude-code that referenced this pull request Jun 1, 2026
LGTM — Swift rules and SwiftUI patterns skill. Pure documentation, no security concerns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants