architecture-guard

v1.11.0

Framework-agnostic architecture review extension for validating implementation against governance and architecture constitutions, detecting architectural drift, and generating non-blocking refactor tasks.

Community extension — Independently maintained. Use at your own discretion. Learn more

Architecture Overview

This document explains what Architecture Guard is and why it exists.

What Is This?

Architecture Guard is a modular architecture governance orchestration layer for Spec Kit. It helps AI follow the architectural rules you define and keeps those rules visible while the team works.

It reviews specifications, plans, task lists, and implementations against your project's architecture standards and turns the results into:

  • architecture drift detection
  • structured refactor tasks
  • consistency reviews
  • architecture evolution proposals
  • incremental migration guidance

The goal is to make architecture part of the workflow instead of something you only check at review time.

See the Quick Start in the README for the brownfield and greenfield entrypoints. If you are specifically cleaning up duplicated logic, follow the DRY Cleanup Guide after the brownfield mapping pass.

Why It’s Useful

Architecture Guard is helpful because it gives AI a smaller, better set of rules to follow:

  • small models stay on rails because they read the right context first
  • architecture decisions stop living only in people’s heads
  • drift becomes visible as refactor work instead of hidden technical debt
  • security and architecture checks happen in the workflow, not after the damage is done
  • the system stays framework-agnostic, so the same ideas work across Laravel, NestJS, Next.js, Django, and more

Best Features

Architecture Guard stands out because it combines a few practical capabilities in one workflow:

  • Ponytail Pragmatism: Enforces the "lazy senior developer" mindset (YAGNI, minimal dependencies, one-liners) natively during implementation. (Inspired by the Ponytail Pragmatism Skill)
  • DRY Cleanup Guidance: Helps brownfield projects find duplicated business logic, validation, DTO mapping, and orchestration, then turn them into small refactor tasks instead of copy-paste drift.
  • Brownfield Discovery + Verification: Maps the current codebase, surfaces architectural drift early, and confirms approved refactors actually made it into the final work.
  • Repository Hygiene Guard: Automatically detects stray *-copy.ts drafts, orphaned code, and debug artifacts before they hit your main branch. Learn more →

The Problem It Solves

AI-generated code usually optimizes for:

  • speed
  • local correctness
  • immediate implementation success

It does not naturally preserve architectural consistency or remember your standards from one feature to the next.

Over time this creates drift:

  • business logic leaks into controllers or route handlers
  • direct database access bypasses established boundaries
  • inconsistent response contracts appear across modules
  • modules reach into each other's internals
  • new features introduce slightly different patterns

Each issue looks small in isolation. After enough features, boundaries weaken and technical debt spreads silently.

Architecture Guard detects these drifts early and converts them into structured, visible, non-blocking architecture work.

What It Actually Does

Think of it as a governance layer that sits between Spec Kit and implementation.

PhaseWhat HappensOutput
SpecificationReviews ownership, boundaries, contractsMissing boundaries or unclear ownership
PlanningDetects coupling and architecture driftWarnings before implementation hardens
Task GenerationConverts violations into structured refactor workPrioritized refactor tasks
ImplementationRe-checks implementation against architecture rulesDrift detection and consistency review
Architecture EvolutionDetects repeated patterns and proposes architecture updatesConstitution update proposals
Approved ChangesApplies accepted updates into planning artifactsUpdated tasks and plans via architecture-apply
VerificationPost-implementation task and requirement auditTask gap analysis and outcome report

Key Philosophy

Architecture Guard is intentionally non-blocking by default.

Violations become:

  • refactor tasks
  • migration tasks
  • architecture proposals

They are not hard errors unless a rule is explicitly marked as blocking in the architecture constitution.

Example:

[Refactor Task]
Title: Move pricing rule out of checkout handler
Reason: The handler currently owns business decisions that belong in the application layer.
Scope: Checkout handler and checkout application service.
Priority: P1
Suggested Fix: Extract pricing logic into the checkout service and keep the handler responsible for validation and delegation only.

Benefits

Architecture Guard can make Spec Kit feel safer, clearer, and easier to scale without adding heavy process.

Spec Kit OnlySpec Kit + Architecture Guard
AI starts each feature independentlyAI checks work against architecture standards first
Drift accumulates silentlyDrift becomes visible and actionable
Architecture inconsistencies appear during code reviewInconsistencies are detected earlier
Constitution exists passivelyConstitution becomes actively enforced
No structured architecture debt trackingViolations become prioritized refactor tasks
Architecture evolution is manual and inconsistentArchitecture evolution becomes structured and reviewable

The practical payoff:

  • less time re-explaining the same rules
  • clearer boundaries for both AI and humans
  • earlier feedback before drift hardens
  • more visible architecture debt
  • more consistent behavior from smaller or mixed-capability models

Compared to Static Analyzers

Static analyzers are great at rules. Architecture Guard is better at helping AI keep the right shape in mind while it works.

Static AnalyzersArchitecture Guard
Language-specific toolingFramework-agnostic architecture review
Syntax and code-pattern focusArchitecture and boundary focus
Build-time blockingNon-blocking by default
Generic rulesProject-specific architecture rules
Runtime/tooling dependenciesPrompt-based with no runtime dependency

Architecture Guard is a prompt governance layer, not a static analysis engine. Its commands are structured Markdown files that instruct the AI agent on what to check and how to report findings. It does not perform AST inspection, syntax analysis, or runtime checks. For complementary static guarantees, pair it with SonarLint, ESLint, or a framework-native linter.

When To Use It

Use Architecture Guard when you want AI-assisted development to stay disciplined over time:

  • your project has meaningful boundaries
  • AI-generated code tends to drift from your standards
  • multiple developers need the same rules enforced consistently
  • architecture decisions should be visible instead of tribal knowledge
  • you want refactor work to surface before debt becomes expensive
  • you want architecture evolution to be intentional instead of accidental

Best Fit

  • modular monoliths
  • microservices
  • large full-stack applications
  • shared API/UI contract systems
  • long-lived codebases
  • systems where consistency matters more than framework purity
  • teams using smaller models that benefit from compact, explicit guidance

When NOT To Use It

Do not use Architecture Guard when the overhead would outweigh the value:

  • tiny projects with no meaningful architecture
  • throwaway prototypes
  • one-off scripts
  • projects with no agreed architectural direction
  • teams unwilling to maintain architecture standards
  • replacing benchmarking or profiling workflows

If you can fully manage architecture mentally and the project is truly small, this extension may be unnecessary overhead.

Stats

19 stars

Version

1.11.0release
Updated 27 days ago

Install

Using the Specify CLI

specify extension add architecture-guard --from https://github.com/DyanGalih/spec-kit-architecture-guard/archive/refs/tags/v1.8.17.zip

Owners

License

MIT