AIPM
Theme

AIPM package

Guarding Architecture

@riekelt/guarding-architecture@1.0.0

Adds a dependency direction between modules, touches a critical path, or conflicts with a stated principle - and when writing or updating architecture princi…

Scanned · no issues · Nov 28, 2026

GitHub stars: ★ 6

LinkedInPost

Install Skill

Pins this version in aipm.package.json and aipm-lock.json.

aipm add @riekelt/guarding-architecture@1.0.0

Without project tracking

Writes the skill files only. Add --no-init to skip aipm.package.json and the lockfile.

aipm add @riekelt/guarding-architecture@1.0.0 --no-init

How to use

Install the skill above, then run this in your AI tool:

/guarding-architecture <your description>

About

**REQUIRED BACKGROUND:** the `principal-engineering` skill.

Source

What gets added to your project

Preview every file this package writes on install before you run the command above.

Summary

Use when a change crosses module boundaries, adds a dependency direction between modules, touches a critical path, or conflicts with a stated principle - and when writing or updating architecture principles themselves. Encodes structural...

Skill instructions

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

  1. 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.
  2. 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.
  3. 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.
  4. 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).
  5. 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.
  6. 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.
  7. 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-decisions where 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.

Loading package files…

Share this package

Add an Install with AIPM badge

Add this badge to a GitHub README so readers can open the package page and install the same version.

Install with AIPM
[![Install with AIPM](https://www.aipm-registry.com/install-with-aipm.svg)](https://www.aipm-registry.com/skills/riekelt/guarding-architecture/1.0.0?utm_source=github&utm_medium=readme&utm_campaign=package_badge)

Publisher

riekelt

This imported publisher has not claimed its AIPM account. A connected account confirms account control, but it does not guarantee that a package is safe.

AI assistant context

What this skill is for

@riekelt/guarding-architecture@1.0.0 is an AIPM skill package for All tools. Use it when a project needs the reusable AI behavior described as: Use when a change crosses module boundaries, adds a dependency direction between modules, touches a critical path, or conflicts with a stated principle - and when writing or updating architecture principles themselves. Encodes structural...

Install
aipm add @riekelt/guarding-architecture@1.0.0
Use after install
/guarding-architecture <your description>

Tool targets

Install command by target

Add --no-init to any of these when you want the skill files without aipm.package.json or aipm-lock.json.

cursor

Run this variant when you want to install the package into cursor.

aipm add @riekelt/guarding-architecture@1.0.0 --target cursor --ci

claude

Run this variant when you want to install the package into claude.

aipm add @riekelt/guarding-architecture@1.0.0 --target claude --ci

Discussion

Comments (0)

Loading comments…

Keep exploring

riekelt/handling-failures

Use when writing or touching any error path, catch block, fallback, default value, retry, or degraded mode - in any language, any repo. Encodes the no-silent-swallows contract and the fail-loud discipline. Use whenever an exception is ab...

Published by @riekelt

skillScanned · no issues★ 6Imported · UnverifiedAll toolsNov 28, 2026, 1:03 AM2.19 KBApache-2.0

riekelt/keeping-one-source-of-truth

Use when adding data, config, state, constants, an enum-like string, a cache, or anything that could exist in two places - or when two sources already disagree. Encodes the one-fact-one-source doctrine for code and data: derive rather th...

Published by @riekelt

skillScanned · no issues★ 6Imported · UnverifiedAll toolsNov 28, 2026, 1:03 AM1.92 KBApache-2.0

riekelt/grounding-before-coding

Use when starting any non-trivial change, investigating a bug, or working in unfamiliar code - before the first line is written. Also use for pure investigation with no change planned yet - \"dig into this\", \"figure out why\", \"someti...

Published by @riekelt

skillScanned · no issues★ 6Imported · UnverifiedAll toolsNov 28, 2026, 1:03 AM2.07 KBApache-2.0

Package FAQ

Install and compatibility

How to install
Run aipm add @riekelt/guarding-architecture@1.0.0 in a project that has AIPM initialized.
Supported tools
@riekelt/guarding-architecture@1.0.0 supports All tools.

Before installing

AIPM skills can add files to your project. Review the package name, target, description, license, and publisher before installing. Use a clean branch when trying a new skill.