Install
openclaw skills install aegis-quality-guardianAI Development Quality Guardian — contract-driven, design-first quality guardrails for AI-assisted full-stack development. Five-layer defense: Design → Contract → Implementation → Verification → PM. Prevents project chaos at scale. Activate when: starting a feature, setting up a project, dispatching coding tasks, reviewing PRs, or managing multi-agent workflows. Also triggers on projects with a contracts/ directory (implementation guardrails auto-activate).
openclaw skills install aegis-quality-guardianFive-layer defense for AI-assisted software development.
Before starting the Aegis workflow, detect the project architecture to choose the right contract strategy.
Scan the workspace for indicators:
frontend//client//web/ AND backend//server//api/ directories → Monorepopackage.json with workspaces containing both frontend and backend → MonorepoDetected: This workspace contains only {frontend|backend} code.
Where does the other side live?
(a) Another repo managed by the same agent (I can access it)
(b) Another repo managed by a different agent/workspace (I cannot access it)
(c) This is actually a monorepo (I missed something)
| Mode | Contract Location | Sync Method |
|---|---|---|
| Monorepo | contracts/ in project root | Direct (same repo) |
| Multi-Repo, Single Agent | Lead workspace's contracts/, copied to each repo | Copy before dispatch |
| Cross-Agent, Cross-Workspace | Dedicated contract repository | Git submodule / package / lead copy-sync |
Cross-Workspace: Contract lives in an independent Git repo. Each agent's workspace integrates it as read-only. Contract Change Requests go through the Lead who has merge rights. See references/multi-agent-protocol.md for the full protocol.
Before any non-trivial feature, create a Design Brief:
templates/design-brief.md for the templateLite Mode stops here — proceed to Phase 3 after Design Brief approval.
Define the API contract before writing implementation code:
contracts/api-spec.yaml (OpenAPI 3.1) — use templates/api-spec-starter.yaml as basecontracts/shared-types.ts — use templates/shared-types-starter.ts as basecontracts/errors.yaml — use templates/errors-starter.yaml as basebash scripts/validate-contract.sh <project-path> to check consistencyReference: references/contract-first-guide.md for the full contract-first methodology.
contracts/ exists in the project rootcontracts/api-spec.yaml, contracts/errors.yaml, contracts/shared-types.tsCLAUDE.md for project-specific constraintsdocs/designs/ relevant fileR1: Contract is the truth
contracts/api-spec.yamlR2: Shared types — import, never redefine
import { User, ApiResponse } from '../contracts/shared-types'R3: Error codes from registry only
contracts/errors.yamlR4: Contract tests mandatory
R5: Never modify contracts directly If the contract needs changes:
docs/contract-changes/CHANGE-{date}-{description}.mdR6: CLAUDE.md constraints
R7: Pre-commit checks are mandatory
--no-verify| Situation | Action |
|---|---|
| Need a new endpoint | Check api-spec.yaml first |
| Need a new type | Check shared-types.ts → if missing, Change Request |
| Need a new error code | Check errors.yaml → if missing, Change Request |
| API response doesn't match spec | Fix code, not spec |
| Spec seems wrong | Change Request, implement per current spec |
| No contracts/ directory | Hard rules don't apply — standard development |
After implementation, validate quality:
bash scripts/validate-contract.sh <project-path>pnpm test (if frontend exists)bash scripts/gap-report.sh <project-path>E2E Test ← Playwright (real browser + real backend)
Integration Test ← Real HTTP server + real DB (no mocks)
Contract Test ← Validate against api-spec.yaml (NO mocking the contract)
Frontend Test ← Vitest + React Testing Library + MSW (contract-typed mocks)
Unit Test ← Mock external deps, test pure logic
contracts/shared-types.tspnpm test must pass — same blocking power as backend testslint → type-check → unit → frontend-test → contract → integration → route-coverage → build → E2EIntegration tests must cover what the frontend calls, not just what the backend implements.
verify-route-coverage.sh cross-references frontend API calls with backend routes. Every consumer route needs a backend handler + integration test.consumer-routes.yaml to the contract repo. Backend CI validates coverage against it.contracts/route-manifest.yaml — declares every API route the frontend consumes. Auto-generated or manual.Run after integration tests in CI:
bash scripts/verify-route-coverage.sh <project-path>
Full-stack features require a complete testing strategy in the Design Brief before coding begins.
Reference: references/testing-strategy.md for the full testing pyramid and standards.
Track progress and enforce quality gates:
docs/designs/<feature>/implementation-summary.md — use templates/implementation-summary.mdInitialize Aegis in any project:
bash scripts/init-project.sh /path/to/project
This creates:
contracts/ — API spec, shared types, error codes (stack-aware)docs/designs/ — for Design Briefs.aegis/ — portable validation scriptsCLAUDE.md — from Aegis template (if not existing)docker-compose.integration.yml — auto-detects your databaseSet up guardrails (pre-commit hooks + CI):
bash scripts/setup-guardrails.sh /path/to/project --ci github # or --ci gitlab
When multiple agents work on the same project:
Cross-Workspace: When agents operate in separate workspaces, contract lives in a dedicated repository. Each agent integrates via submodule/package/copy-sync and treats contracts/ as read-only. Integration testing is orchestrated externally.
Reference: references/multi-agent-protocol.md
~/.claude/skills/aegis/ # ← You are here (CC skill)
├── SKILL.md # This file
├── templates/ # Project templates
│ ├── design-brief.md
│ ├── claude-md.md
│ ├── api-spec-starter.yaml
│ ├── shared-types-starter.ts
│ ├── errors-starter.yaml
│ ├── contract-test-example.ts
│ ├── docker-compose.integration.yml
│ ├── implementation-summary.md
│ └── route-manifest-starter.yaml # Consumer route manifest template
├── scripts/ # Automation
│ ├── init-project.sh # Initialize Aegis in a project
│ ├── setup-guardrails.sh # Pre-commit + CI setup
│ ├── detect-stack.sh # Auto-detect language/framework
│ ├── validate-contract.sh # Validate contract consistency
│ ├── gap-report.sh # Design Brief vs implementation gaps
│ ├── generate-types.sh # Generate types from OpenAPI spec
│ └── verify-route-coverage.sh # Consumer-driven route coverage check
└── references/ # Deep-dive guides
├── contract-first-guide.md
├── testing-strategy.md
└── multi-agent-protocol.md