Configure and enforce SwiftLint through build-tool plugins, Xcode scripts, Swift Package plugins, or CI. Use for rule configuration, suppressions, baselines, autocorrection, reporters, strictness, multi-config setups, and staged rollout in existing Swift projects.
91%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Enforce Swift style, formatting, and conventions using SwiftLint. Covers build-tool plugins, .swiftlint.yml configuration, staged rollouts, baselines, and CI integration.
Scope Boundary: SwiftLint is a linting and style enforcement tool. For underlying API naming, conventions, and architectural rules, see
swift-api-design-guidelinesandswift-code-review.
Prefer the build tool plugin from SimplyDanny/SwiftLintPlugins for Xcode projects and Swift Packages. It avoids global machine installs and runs automatically during target compilation:
// Package.swift
dependencies: [
.package(url: "https://github.com/SimplyDanny/SwiftLintPlugins", from: "0.58.0")
],
targets: [
.target(
name: "MyFeature",
plugins: [
.plugin(name: "SwiftLintBuildToolPlugin", package: "SwiftLintPlugins")
]
)
]Place .swiftlint.yml in the project root:
included:
- Sources
- Tests
excluded:
- Pods
- .build
- DerivedData
opt_in_rules:
- empty_count
- missing_docs
- fatal_error_message
disabled_rules:
- line_length
- todo
line_length:
warning: 120
error: 160Adopt rules incrementally in existing codebases:
swiftlint --fix.Suppress legitimate exceptions in code:
// swiftlint:disable:next force_cast
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as! CustomCell
// Entire block suppression
// swiftlint:disable cyclomatic_complexity
func complexAlgorithm() { ... }
// swiftlint:enable cyclomatic_complexityFor legacy codebases, capture existing violations into a baseline to prevent regressions without blocking existing files: swiftlint analyze --compiler-log-path xcodebuild.log.
Run in CI before running unit tests:
# Lint with strict error exit codes
swiftlint --strict --reporter github-actions-logging
# Automatically fix whitespace and mechanical violations locally
swiftlint --fixPods/ or .build/ dramatically slows down compilation.// swiftlint:disable:next rule_id over disabling rules for entire files.--strict..swiftlint.yml excludes derived data and third-party dependencies--strictthienqo/ios-skills
6bf8b62
Canonical home
since May 23, 2026
Also appears in
on Sep 6, 2026
since May 22, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.