Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By perrystreetsoftwarev0.2.0Apache-2.0In 1 marketplace
Lets you write Swift architecture rules as unit tests, run them to get machine-readable violation reports, and have AI agents fix what they flag. Works with Quick, XCTest or Swift Testing; an empty .harmonize.yaml in the project root is required.
Trending plugins
7-day copy clicks
Claude loads one when your task matches it, or you run it by name.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
🎤 Harmonize is coming to a conference near you! We'll be presenting it at NSSpain (Logroño, September 16–18, 2026) and Swift Connection (Paris, November 2–3, 2026). Come say hi!
Harmonize is a modern linter for Swift that allows you to assert, validate, and harmonize your code’s structure and architecture by writing lint rules as unit tests—using Quick, XCTest, or Swift Testing.
This allows your team to keep your codebase clean, maintainable, and consistent as it grows, without relying on manual code reviews.
Harmonize aims to solve the limitations of regex-based linters such as SwiftLint, which focus primarily on Swift style and simple conventions. Inspired by Konsist for Kotlin and ArchUnit for Java, Harmonize provides a richer, semantic way to enforce your project's architecture and structural guidelines.
AI-generated code can help teams move faster, but it can also introduce architectural flaws and subtle bugs that are hard to spot in manual code reviews. Harmonize gives your codebase deterministic guardrails by turning your team’s architectural and structural rules into unit tests. When AI-generated code violates those rules, the tests fail, giving your AI agent clear feedback to fix its own mistakes.
Harmonize can also provide the rules to AI agents before agents write any code. See Integrate Harmonize with AI agents.
With Harmonize, you can write a lint rule similarly as you would write a unit test:
import Harmonize
import Quick
final class ViewModelsInheritBaseViewModelSpec: QuickSpec {
override func spec() {
describe("ViewModels") {
let viewModels = Harmonize.productionCode().classes()
.withNameEndingWith("ViewModel")
it("should inherit from BaseViewModel") {
viewModels.assertTrue(rule: Self.rule) {
$0.inherits(from: "BaseViewModel")
}
}
}
}
private static let rule = Rule(
title: "ViewModels must inherit from BaseViewModel.",
category: "viewmodel",
rationale: "BaseViewModel owns the lifecycle and the error handling.",
howToFix: "Declare the class as `final class MyViewModel: BaseViewModel`.",
badExample: "final class MyViewModel: ObservableObject { }",
goodExample: "final class MyViewModel: BaseViewModel { }"
)
}
import Harmonize
import XCTest
final class ViewModelsInheritBaseViewModelSpec: XCTestCase {
func testViewModels() throws {
let viewModels = Harmonize.productionCode().classes()
.withNameEndingWith("ViewModel")
viewModels.assertTrue(rule: Self.rule) {
$0.inherits(from: "BaseViewModel")
}
}
private static let rule = Rule(/* the same fields as in the Quick example */)
}
import Harmonize
import Testing
private let rule = Rule(/* the same fields as in the Quick example */)
@Test
func viewModelsInheritBaseViewModel() {
let viewModels = Harmonize.productionCode().classes()
.withNameEndingWith("ViewModel")
viewModels.assertTrue(rule: rule) {
$0.inherits(from: "BaseViewModel")
}
}
This lint rule enforces all ViewModels to inherit from BaseViewModel. Since it runs as a unit test, it will fail once it detects a violation. The failure shows the Rule metadata: the title, the rationale, the fix and the two examples (see What a failure shows). To exclude a declaration from a rule, use the withoutName function:
let viewModels = Harmonize.productionCode().classes()
.withNameEndingWith("ViewModel")
.withoutName(["LegacyViewModel"])
To accept known violations, pass their names to the baseline: parameter of the assertion. Harmonize reports an error when a baseline entry passes the rule. This prevents stale entries:
viewModels.assertTrue(rule: Self.rule, baseline: ["LegacyViewModel"]) {
$0.inherits(from: "BaseViewModel")
}
You can create similar rules for any architectural or structural pattern that you want to enforce.
Built from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
Plugins from other owners that cover similar ground
npx claudepluginhub perrystreetsoftware/harmonize --plugin harmonize