quality-guardian
v1.3.92
Published
AI Quality Management System for Claude Code projects
Maintainers
Readme
Quality Guardian 🛡️
AI Quality Management System - Integrated quality management tool for Claude Code projects
Overview
Quality Guardian is a system that verifies AI code changes from multiple angles, detects "AI shortcuts", and prevents quality degradation.
Main Features
- 🔍 Before/After Baseline Comparison
- 🧠 Context-Aware PR Analysis
- 🔐 Invariant Checks (Detection of migration deletion, etc.)
- 🔬 Deep Quality Analysis (Mutation testing, etc.)
- 🤖 Auto-Fix Functionality
- 🎯 PM Orchestrator System - Automatic quality management via AI Control System
PM Orchestrator Architecture
Quality Guardian v1.3.63+ adopts the Hub-and-Spoke Architecture AI Control System. This evolution moves from "I'll be careful" to "system enforcement".
Architecture Diagram
┌─────────────────────────────────────────────────────────────┐
│ UserPromptSubmit Hook │
│ (Pattern Detection & Automatic PM Launch) │
└──────────────────────┬──────────────────────────────────────┘
│
▼
┌────────────────┐
│ │
│ PM Orchestr │ ◄──── Hub (Central)
│ ator │
│ │
└────────┬───────┘
│
┌──────────────┼──────────────┐
│ │ │
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│ Rule │ │ Design │ │ QA │
│ Checker │ │ er │ │ │
└─────────┘ └─────────┘ └─────────┘
│ │ │
└──────────────┼──────────────┘
▼
┌────────────────┐
│ │
│ Implementer │ ◄──── Implementation
│ │
└────────┬───────┘
│
▼
┌────────────────┐
│ │
│ Reporter │ ◄──── Result Reporting
│ │
└────────────────┘6 Specialized Sub-agents
PM Orchestrator (250 lines)
- Task analysis (type, complexity, impact scope)
- Selection of appropriate sub-agents and determination of launch order
- Checkpoint management (does not proceed until all checks pass)
- Error handling (auto-fix, retry, rollback)
- Final report coordination
Rule Checker (200 lines)
- Validation of MUST Rules (Rules 1, 4, 7, 14, 16, 17)
- Branch confirmation before git operations
- Complete verification of "same" instructions
- Complete verification of PR review comments
- Detection of Claude Code traces
Designer (200 lines)
- Task type analysis (new feature, bug fix, refactoring)
- Complexity evaluation (simple, medium, complex)
- Implementation plan creation (files to create, files to change, steps)
- Risk analysis (compatibility, security, performance)
Implementer (400 lines)
- Strict implementation following PM instructions
- Auto-fix functionality (lint errors, formatting, unused variables)
- Retry functionality (network errors, file locks)
- Rollback functionality (automatic recovery on implementation failure)
- Supports 4 implementation patterns
QA (250 lines)
- File existence verification
- Test execution and result verification
- Code quality checks (lint, typecheck, build)
- Functional verification via Playwright
- Quality score calculation
Reporter (150 lines)
- Integration of sub-agent results
- User-friendly report creation
- Problem prioritization
- Next action suggestions
Execution Flow
Pattern 1: CodeRabbit Resolve (PR Review Response)
User Input: "Please resolve CodeRabbit comments"
│
▼
PM Orchestrator: Task analysis
│
├─► Rule Checker: Verify MUST Rule 14 (complete response to PR comments)
│ └─► Retrieve all comments, create TodoWrite
│
├─► Implementer: Fix each comment in order
│ ├─► Auto-fix: Lint errors → Auto-fix
│ ├─► Retry: Network errors → Retry
│ └─► Rollback: Test failure → Report to user
│
├─► QA: Verify fix results
│ ├─► Execute lint, test, typecheck, build
│ └─► Verify all pass
│
└─► Reporter: Report results
└─► Fix content, test results, resolve execution resultsPattern 2: List Modification (Version Update, etc.)
User Input: "Update version from 1.3.63 to 1.3.64"
│
▼
PM Orchestrator: Task analysis
│
├─► Rule Checker: Execute MUST Rule 7 (complete verification)
│ ├─► Search all locations with grep -r "1.3.63"
│ └─► Detect 5 locations (VERSION, install.sh×2, js, json)
│
├─► Designer: Create change plan
│ └─► 5 file changes, risk assessment (low)
│
├─► Implementer: Update 5 locations in order
│ ├─► Change each file
│ ├─► Verify no old version remains with grep
│ └─► Add change history to README.md
│
├─► QA: Verify change results
│ └─► Verify all 5 locations updated
│
└─► Reporter: Report results
└─► Changed file list, verification resultsPattern 3: Complex Task (New Feature Addition, etc.)
User Input: "Add user authentication feature"
│
▼
PM Orchestrator: Task analysis (complex task)
│
├─► Designer: Detailed design
│ ├─► Required files: auth.ts, login.tsx, AuthContext.tsx
│ ├─► Tests: auth.test.ts, login.test.tsx
│ └─► Risks: Security (high), Compatibility (medium)
│
├─► Rule Checker: Verify related rules
│ └─► Verify MUST Rule 2 (Test First)
│
├─► Implementer: Implement with Test First
│ ├─► Step 1: Create tests (verify failure)
│ ├─► Step 2: Implementation
│ ├─► Step 3: Verify test pass
│ └─► On error: Auto-fix → Retry → Rollback
│
├─► QA: Comprehensive verification
│ ├─► Unit tests: Pass
│ ├─► Playwright: Verify login operation
│ ├─► Security: Verify password hashing
│ └─► Quality score: 85/100
│
└─► Reporter: Detailed report
├─► Implementation file list
├─► Test results
├─► Security check results
└─► Next action suggestionsError Handling (Phase 3)
PM Orchestrator responds in the following 3 stages when errors occur:
Auto-fix (Automatic Correction)
- Lint errors →
npm run lint -- --fix - Format errors → Prettier auto-fix
- Unused variables → Automatic deletion
- Import order → Auto-sort
- Lint errors →
Retry (Retry with Exponential Backoff)
- Network errors → Retry with backoff (max 3 times)
- File lock → Wait and retry
- Temporary failures → Automatic retry
Rollback (Automatic Recovery)
- If retry fails 3 times → Rollback
- Report error details to user
- Suggest recovery method
Installation
npm install -g quality-guardianOr execute without installation:
npx quality-guardian installUsage
1. Run Quality Check
quality-guardian check2. Run Specific Check
# Baseline comparison
quality-guardian baseline
# PR Analysis
quality-guardian pr-check
# Invariant verification
quality-guardian invariants
# Deep analysis
quality-guardian deep-analysis3. Enable Auto-Fix
quality-guardian check --auto-fixConfiguration
Create .quality-guardian.json in project root:
{
"baseline": {
"enabled": true,
"path": ".quality-baseline"
},
"prAnalysis": {
"enabled": true,
"contextDepth": 3
},
"invariants": {
"enabled": true,
"rules": [
"no-migration-deletion",
"no-test-skip",
"no-security-bypass"
]
},
"deepAnalysis": {
"enabled": true,
"mutationTest": true,
"complexityCheck": true
}
}Key Features in Detail
1. Before/After Baseline Comparison
Records code quality metrics before implementation and detects degradation after implementation.
Metrics:
- Test coverage
- Code complexity
- Number of lint warnings
- Build time
- Bundle size
Detection Example:
⚠️ Quality Degradation Detected:
- Test coverage: 85% → 78% (-7%)
- Code complexity: 12 → 18 (+50%)
- Lint warnings: 3 → 7 (+4)2. Context-Aware PR Analysis
Analyzes PR changes understanding context rather than per-line differences.
Analysis Items:
- Consistency of change intent
- Impact scope
- Missing tests
- Documentation updates
- Breaking changes
Analysis Example:
📊 PR Analysis Results:
✅ Change intent: Consistent
⚠️ Impact scope: Moderate (5 files affected)
❌ Missing tests: UserService.ts tests not added
⚠️ Documentation: Update needed in README.md
✅ Breaking changes: None3. Invariant Checks
Detects code changes that violate project invariants.
Check Items:
- Migration file deletion
- Test skip addition
- Security check bypass
- Critical dependency deletion
- Environment variable deletion
Detection Example:
🚨 Invariant Violation Detected:
❌ Migration deletion: 20231201_add_user_table.sql deleted
❌ Test skip: UserService.test.ts includes .skip()
⚠️ Security bypass: Authentication check commented out4. Deep Quality Analysis
Performs advanced code quality analysis.
Analysis Items:
- Mutation testing
- Complexity analysis
- Dead code detection
- Dependency analysis
- Performance regression
Analysis Example:
🔬 Deep Analysis Results:
Mutation test score: 85%
Code complexity: 12 (OK)
Dead code: 3 functions detected
Dependency: 2 unused packages
Performance: No regressionAuto-Fix
Automatically fixes detectable issues.
Fixable Items:
- Lint errors
- Format errors
- Unused imports
- Missing documentation
- Simple complexity issues
Execution Example:
$ quality-guardian check --auto-fix
🤖 Auto-Fix Results:
✅ Fixed 12 lint errors
✅ Formatted 8 files
✅ Removed 5 unused imports
✅ Added 3 missing documentation comments
⚠️ Manual fix required for 2 complexity issuesCI/CD Integration
GitHub Actions
name: Quality Guardian
on: [pull_request]
jobs:
quality-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run Quality Guardian
run: |
npx quality-guardian check
npx quality-guardian pr-checkGitLab CI
quality-check:
script:
- npx quality-guardian check
- npx quality-guardian pr-check
only:
- merge_requestsLicense
MIT
Contributors
Quality Guardian Team
Version History
- 1.3.91: Current version - Latest PM Orchestrator integration
- 1.3.63: PM Orchestrator Architecture adoption
- 1.0.0: Initial release
