Bylaws

Architecture linter for Swift. You write project rules in Swift and enforce them in tests, the CLI or a SwiftPM plugin. Aimed at teams using agents.

View on GitHub ↗
Stars
★ 48
Last commit
18 Oct 2026
Maintenance
Active
Licence
MIT
Category
Other
GitHub
theblixguy/swift-bylaws

Overview

Bylaws is an architectural linter for Swift, built for developers and coding agents. You write project rules in Swift that the compiler cannot enforce, such as which layers may depend on each other, and Bylaws reports violations with the file, line and rule. Rules run from a CLI or as part of your Swift Testing suite.

Features

  • Rules inspect declarations, function calls and other Swift syntax
  • Checks where files and types belong and restricts references between files, folders or modules
  • Compares Package.swift with the imports in your sources and finds dependency cycles
  • Most rules run without a build; some can read the compiler index
  • Run from the CLI with bylaws lint or as Swift Testing tests

Requirements

The source doesn't list any requirements, so check the project's own docs before you install.

Install

  1. Install the CLI and run your rules from the project root

    brew install theblixguy/tap/bylaws
    bylaws lint
  2. Or add the Bylaws product to a test target and run rules with swift test

Example

Write a rule that keeps print calls inside your logging layer; bylaws lint then fails and points at any stray print in Sources.

Works with

Claude CodeCursorCodex

Listed in

swiftskills.dev

Read the code before you install anything. SwiftAgents doesn't review or endorse the tools listed here. Active: a commit in the last 90 days. Slowing: last commit within the past year. Stale: older than a year, or archived.

More in this category