Swift style and tooling
Read .swiftformat, .swiftlint.yml, and references/style-guide.md. Read references/tooling-policy.md when formatter/linter configuration, suppressions, tool versions, or quality-gate wiring changes. Use this skill when writing Swift, changing style configuration, resolving lint failures, or reviewing readability.
Principles
- Readability, simplicity, and correctness outrank brevity.
- Formatting rules should be autocorrectable and behaviour-preserving.
- Lint rules should target correctness, unsafe patterns, or conventions without safe automatic replacement.
- Follow the Swift API Design Guidelines; local rules supplement rather than contradict them.
- Do not create noisy rules that train developers to ignore warnings.
Workflow
- Write clear code before optimising line count.
- Run
make format after Swift edits when SwiftFormat and SwiftLint are installed.
- Review formatter changes; autocorrection is not a substitute for understanding.
- Run
make lint; commit with zero warnings or errors.
- If suppressing a rule, narrow it to one line/scope and explain why the code is safe.
- Change config and representative code/tests in the same commit.
Guardrails
- No direct
print, debugPrint, dump, or _printChanges in committed application code; use os.Logger with privacy annotations.
- No
@unchecked Sendable without a narrow suppression and safety proof.
- Use
#fileID by default, #filePath only when the full path matters.
- No force unwrap/try, implicitly unwrapped optionals, stale disables, or committed secrets.
- Keep generated/build/vendor directories excluded.
Output
Distinguish formatter output, lint violations, and human-review guidance. Record tool versions when relevant. Do not call a personal preference a project rule unless it appears in configuration or this skill.
1---2name: swift-style-tooling3description: Apply or review Swift naming, readability, file organisation, formatter/linter policy, logging hygiene, and automated quality gates for this template.4license: MIT5---67# Swift style and tooling89Read `.swiftformat`, `.swiftlint.yml`, and `references/style-guide.md`. Read `references/tooling-policy.md` when formatter/linter configuration, suppressions, tool versions, or quality-gate wiring changes. Use this skill when writing Swift, changing style configuration, resolving lint failures, or reviewing readability.1011## Principles1213- Readability, simplicity, and correctness outrank brevity.14- Formatting rules should be autocorrectable and behaviour-preserving.15- Lint rules should target correctness, unsafe patterns, or conventions without safe automatic replacement.16- Follow the Swift API Design Guidelines; local rules supplement rather than contradict them.17- Do not create noisy rules that train developers to ignore warnings.1819## Workflow20211. Write clear code before optimising line count.222. Run `make format` after Swift edits when SwiftFormat and SwiftLint are installed.233. Review formatter changes; autocorrection is not a substitute for understanding.244. Run `make lint`; commit with zero warnings or errors.255. If suppressing a rule, narrow it to one line/scope and explain why the code is safe.266. Change config and representative code/tests in the same commit.2728## Guardrails2930- No direct `print`, `debugPrint`, `dump`, or `_printChanges` in committed application code; use `os.Logger` with privacy annotations.31- No `@unchecked Sendable` without a narrow suppression and safety proof.32- Use `#fileID` by default, `#filePath` only when the full path matters.33- No force unwrap/try, implicitly unwrapped optionals, stale disables, or committed secrets.34- Keep generated/build/vendor directories excluded.3536## Output3738Distinguish formatter output, lint violations, and human-review guidance. Record tool versions when relevant. Do not call a personal preference a project rule unless it appears in configuration or this skill.