explaingit

nenadvulic/solid-like-a-rock

13SwiftAudience · developerComplexity · 3/5LicenseSetup · easy

TLDR

A Swift command-line tool that enforces Clean Architecture layer boundaries in your iOS or macOS project, catching forbidden imports automatically on every build and in CI, especially useful for catching AI-generated violations.

Mindmap

mindmap
  root((solid-like-a-rock))
    What it does
      Check layer imports
      Enforce boundaries
      Catch violations early
    Config
      YAML rules file
      Allow lists
      Deny lists
      Baseline mode
    Installation
      Homebrew
      Swift Package
      CI integration
    Layers checked
      Domain
      Data
      Presentation
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Add solid-like-a-rock to your iOS project's CI pipeline so the build fails whenever an AI-generated file imports across forbidden layer boundaries

USE CASE 2

Run the init command on an existing project to auto-generate a YAML config that maps your folder structure to Clean Architecture layers

USE CASE 3

Use the baseline feature to adopt the linter on a legacy codebase without breaking the build on pre-existing violations

USE CASE 4

Catch a Data layer file accidentally importing UIKit before the violation spreads to other modules

Tech stack

SwiftSwiftSyntaxYAMLHomebrew

Getting it running

Difficulty · easy Time to first run · 30min

Homebrew or Swift Package Manager required, the init command generates a starter YAML config automatically from your project's import graph.

Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

SolidLikeARock is a command-line tool for Swift developers that checks whether their code respects architectural boundaries. In a pattern called Clean Architecture, a project is divided into layers, such as Domain (the core business logic), Data (talking to databases and APIs), and Presentation (the user interface). The rule is that these layers should only depend on layers closer to the center, not on outer ones. For example, a network layer should never import UI code. This tool enforces those rules automatically on every build and in continuous integration pipelines. The motivation stated in the README is that AI-generated code can introduce architectural violations faster than human reviewers can catch them. One bad import that gets past a code review can spread into dozens more. SolidLikeARock catches these violations the moment they appear, regardless of whether a human or an AI assistant wrote the offending code. The tool works by reading each Swift source file using SwiftSyntax, which is an official Apple library that produces a real parsed representation of Swift code rather than a text search. It identifies which architectural layer a file belongs to based on its folder path, then checks whether that file's imports match the rules you have defined. If a forbidden import appears, it prints an error message that includes the file, line, and the rule that was broken. Configuration lives in a YAML file at your project root where you define layers, their source paths, and either an allow list (only these imports are permitted) or a deny list (these imports are forbidden). The tool includes an init command that analyzes your project's actual import graph and generates a starter configuration automatically. There is also a baseline feature: if you adopt the tool on an existing project that already has violations, you can record those as a baseline so the linter only fails on new problems going forward. The tool installs via Homebrew and is available as a Swift package. It sits alongside SwiftLint (which checks code style) and Periphery (which finds dead code) as a complementary static analysis step focused purely on architectural rules. The project is MIT licensed.

Copy-paste prompts

Prompt 1
Help me write a solid-like-a-rock YAML config for a SwiftUI project with Domain, Data, and Presentation folders using a deny list to block UIKit imports in the Data layer
Prompt 2
How do I add solid-like-a-rock to my Xcode project's build phases so it runs on every compile and fails the build on violations?
Prompt 3
I have 50 existing violations in my project, show me how to use solid-like-a-rock's baseline feature so the linter only flags new problems going forward
Prompt 4
Walk me through what solid-like-a-rock's init command produces when I run it on an existing Swift project with mixed folder naming
Open on GitHub → Explain another repo

← nenadvulic on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.