Guarding Architecture Skill
- Installs
- 30.9k
- Repo stars
- 8
- Security scans passed
- 3/3
- Repo updated
- Dec 1, 2026
TL;DR
guarding-architecture is a skill that records architecture invariants as named contracts with a rationale and a build-enforced guard, and sends violations to redesign or a written amendment.
Install if
Teams whose module boundaries erode through small convenient imports and who want invariants enforced by architecture tests.
Skip if
Projects with no module boundaries to protect, or anyone who wants style preferences such as small modules written down as rules.
npx skills add https://github.com/riekelt/principal-engineer --skill guarding-architectureTry it first through the Skillselion MCP - nothing to install, nothing on disk.
1. Add the remote connector:
claude mcp add --transport http skillselion https://mcp.skillselion.com/mcp2. Ask your agent:
Use Skillselion load_skill to load skill:riekelt/principal-engineer#guarding-architecture (Guarding Architecture) and follow it.Try it first through the Skillselion MCP - nothing to install, nothing on disk.
1. Add this URL as a custom connector (Claude.ai, ChatGPT or Cursor):
https://mcp.skillselion.com/mcp2. Ask your agent:
Use Skillselion load_skill to load skill:riekelt/principal-engineer#guarding-architecture (Guarding Architecture) and follow it.On this page
What guarding-architecture covers
- Names each invariant with a statement, a rationale and implications
- Adds architecture tests that fail the build on forbidden imports and layering breaks
- Requires specs to show how a design upholds each invariant it touches
- Handles genuine exceptions as amendments or dated waivers with an expiry
guarding-architecture by the numbers
| All-time installs | 30,938 (30.9k) | skills.sh registry |
|---|---|---|
| Repo stars | ★ 8 | GitHub |
| Security audit | 3 / 3 scanners passed | skills.sh audit |
| Repo last updated | December 1, 2026 | GitHub |
| Repository | riekelt/principal-engineer ↗ | |
Data as of Dec 4, 2026 (Skillselion catalog sync)
What can the guarding-architecture skill do in Claude Code?
- Capabilities
- invariant naming · architecture tests · exception amendments
- Use cases
- code review · refactoring · documentation
What guarding-architecture says it does
Every enforceable invariant gets an architecture test that fails the build: dependency directions, package boundaries, layering rules, forbidden imports.
A design that violates a named invariant is wrong by construction: redesign it, do not argue the exception into the spec.
A contract can fail a build; taste can only fail a mood.
What does the Guarding Architecture skill produce?
Each important invariant has a name, a written rationale and a guard that fails the build when it is violated.
- Named invariants with statement, rationale and guard
- Architecture tests that fail the build
What files ship with guarding-architecture?
Guarding architecture
REQUIRED BACKGROUND: the principal-engineering skill.
Overview
Structural invariants are load-bearing contracts: violating one surfaces as a class of bugs, not a single defect. An invariant that matters gets a name, a written rationale, and a mechanical guard; an invariant without a guard is a wish.
The pattern
- Name the invariants. Numbered and citable ("Law 3"), each with a Statement (technology-neutral, meant to outlast any framework), a Rationale, and Implications. The Rationale is a concrete failure narrative: the class of bugs that appears when the invariant is violated, told from an incident, not an abstraction.
- Split the stable from the volatile. The principles document changes rarely and names no classes; its current realization (the canonical owners, the guards, the reference designs) lives in a companion that changes with the code. When the two disagree, the invariant governs and the realization document gets corrected.
- Enforce mechanically. Every enforceable invariant gets an architecture test that fails the build: dependency directions, package boundaries, layering rules, forbidden imports. What cannot be build-enforced becomes a named review check with the invariant cited.
- Violations mean redesign, never justification. A design that violates a named invariant is wrong by construction: redesign it, do not argue the exception into the spec. Watering the contract down to match nonconforming code is the banned move; the violation gets recorded and the code gets fixed (the same rule the technical-writer plugin applies to normative documents).
- Specs show conformance. A design that touches guarded ground names the invariants it touches and shows, per invariant, how it upholds each; the reviewer checks claims against named invariants instead of debating taste.
- Exceptions are amendments. A genuine exception proposes an amendment, naming the invariant it bends and the boundary of the bend; silent exceptions are how an invariant becomes a suggestion. This is the only legal form of exception, and point 4 bans every other; an unreachable owner does not create one, so the change waits or lands conforming. A genuinely temporary exception is a dated waiver with an expiry condition and the owner's sign-off, recorded in the volatile realization document, not by amending the stable invariant for a passing condition.
- An unexplained guard exclusion is a violation hidden from the build. Whoever finds one surfaces it to the invariant's owner. An exclusion is never precedent for the next one; extending an exclusion list "like the others did" ratifies erosion instead of following a pattern.
Common invariant classes
Worth guarding in most systems, as examples rather than mandates:
- One canonical owner per concern (see
keeping-one-source-of-truth). - Dependency direction: the domain never imports the delivery mechanism.
- Critical-path isolation: no I/O and no slow or optional dependency on the hot path.
- Fail-closed boundaries: a gate that cannot evaluate must deny (see
handling-failures). - Migration immutability (see the hard rules in
principal-engineering).
Common mistakes
- A principles document full of class names: the realization document wearing the wrong title; split them.
- Adding the import "for now". Boundaries die by single convenient imports; the guard exists because each violation is locally reasonable.
- An invariant asserted in review but absent from the build: enforced exactly as often as the right reviewer is present.
- Justifying a violation by the cost of conforming. The cost argument may be right, but its correct form is an amendment to the invariant, decided by the owner, recorded (via
recording-decisionswhere installed), never a quiet exception in one spec. - Principles written as taste ("prefer small modules") instead of contracts ("module X never imports module Y"). A contract can fail a build; taste can only fail a mood.
Which skills are related to guarding-architecture?
How does guarding-architecture compare?
Compared with an architecture decision log alone, it adds build-enforced guards and a rule that violations get redesigned.
Guarding Architecture skill FAQ
Who is the Guarding Architecture skill for?
Teams whose module boundaries erode through small convenient imports and who want invariants enforced by architecture tests. Skip if: Projects with no module boundaries to protect, or anyone who wants style preferences such as small modules written down as rules.
When should I use guarding-architecture?
A change crosses module boundaries, adds a dependency direction, touches a critical path or conflicts with a stated principle, or when architecture principles are written or updated.
What does guarding-architecture enforce?
Structural invariants such as dependency direction, canonical owners and fail-closed boundaries. Each gets a name, a rationale and a guard, usually an architecture test that fails the build.
How are exceptions handled?
A genuine exception proposes an amendment naming the invariant and the boundary of the bend. A temporary one is a dated waiver with an expiry condition and the owner's sign-off.
Does it need another skill?
The doc names the principal-engineering skill as required background, and it refers to keeping-one-source-of-truth and handling-failures for related invariants.
Is Guarding Architecture safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
Add a guarding-architecture badge
Show developers this skill is listed on Skillselion. Paste this into your README.