service-invariant-guard

Scan code to classify direct mutations of service-managed fields and generate a guard report.

1|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/Benmore-Studio/Benmore-Meridian --skill service-invariant-guard
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: service-invariant-guard
Source: https://github.com/Benmore-Studio/Benmore-Meridian/tree/main/skills/service-invariant-guard
Command: npx skills add https://github.com/Benmore-Studio/Benmore-Meridian --skill service-invariant-guard

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Detects direct mutations to fields that should only be modified through a designated domain service, preventing invariant drift in aggregates, balances, or state machines.

Core Features & Use Cases

  • Identifies direct writes, updates, or bulk mutations to guarded fields across the codebase.
  • Classifies findings as AUTHORIZED (within the owning service), LEGACY (pre-existing direct mutations), VIOLATION (unauthorized edits), or COMPUTED WRITE (writes to read-only properties).
  • Generates a comprehensive GUARD REPORT with actionable fixes and migration guidance.

Quick Start

Run the skill against your codebase to detect and start remediating direct mutations that bypass service guards.

Frequently Asked Questions about service-invariant-guard

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I detect direct field mutations that bypass domain service invariants?

To enforce domain invariants, scan the codebase to identify direct mutations of service-managed fields and classify them as AUTHORIZED, LEGACY, VIOLATION, or COMPUTED WRITE. This produces a guard report with recommended fixes and migration steps.

What is the best way to refactor legacy code that directly modifies aggregate state?

Refactoring legacy direct mutations involves scanning for LEGACY writes and following generated migration steps to route changes through the owning domain service. This remediates invariant drift and enforces centralized state guards.

Can I use this to find unauthorized balance updates in my codebase?

Yes, it applies to code where invariants govern aggregates, balances, or state transitions. It scans for direct writes to these guarded fields and flags non-service edits as VIOLATIONs.

How does the code review process classify direct writes to read-only properties?

The code review process classifies direct writes to read-only properties as COMPUTED WRITE. It scans for these mutations alongside unauthorized edits to generate a comprehensive guard report with actionable fixes.

When do I need a guard report for service-managed fields?

You need a guard report when invariant drift occurs in aggregates, balances, or state machines. It identifies direct mutations bypassing designated domain services and provides migration guidance.