Overview
/quality-gates is a production command in the Quality category of the Prismatic Platform. It enforces a comprehensive set of quality gate checkpoints that every code change must pass before being accepted into the codebase. The gates cover compilation warnings, Credo static analysis, Dialyzer type checking, test execution, typespec coverage, memory safety patterns, and 13 total quality domains. The command operates at BLOCKING authority level, meaning it can halt commits, merge requests, and deployments when quality standards are not met.
This command is executed by the quality-gate-enforcer agent and represents the primary enforcement mechanism of the platform's quality infrastructure. It is part of the platform's 216-command slash command registry, built on the AIAD (Autonomous Intelligence Agent Design) standard. The BLOCKING authority level is the highest enforcement authority in the quality system, giving this command absolute veto power over any code change that fails to meet standards.
The quality gate system evolved from early compilation checks into a comprehensive 13-domain quality enforcement framework. Each domain has specific metrics, thresholds, and detection rules. The platform currently maintains a 100/100 quality score with zero violations across all domains, a state achieved through systematic application of quality gates over hundreds of evolution cycles.
Architecture
The quality gate system operates as a multi-stage checkpoint pipeline where each stage must pass before the next begins.
Gate Pipeline Architecture
/quality-gates
|
Gate Configuration
|
+-------+-------+-------+-------+
| | | | |
Stage 1 Stage 2 Stage 3 Stage 4
Compile Static Dynamic Meta
| | | |
Warnings Credo Tests Quality
Dialyzer Pattern Cover Score
Types Safety Perf DNA
| | | |
+-------+-------+-------+
|
Gate Verdict
(PASS/FAIL)
|
+----+----+----+
| | |
Allow Block ReportQuality Domains (13 Total)
| Domain | Gate Stage | Check Type | Current Status |
|---|---|---|---|
| Compilation | Stage 1 | Zero warnings (--warnings-as-errors) | 0 violations |
| Dialyzer | Stage 1 | Type consistency analysis | 0 violations |
| Credo | Stage 2 | Static code analysis (--strict) | 0 violations |
| Guard Functions | Stage 2 | Guard clause presence on public functions | 0 violations |
| Memory Safety | Stage 2 | Unsafe map access, nil handling | 0 violations |
| Typespec Coverage | Stage 2 | @spec annotation completeness | 0 violations |
@impl Coverage | Stage 2 | Callback implementation annotations | 0 violations (709 total) |
| DateTime Precision | Stage 2 | Microsecond precision enforcement | 0 violations |
| Timing Patterns | Stage 2 | Process.sleep and timer anti-patterns | 0 violations |
| TODO Management | Stage 2 | TODO/FIXME tracking and lifecycle | 0 violations |
| Performance | Stage 3 | Page load (<250ms), render (<100ms) | 0 violations |
| Regression Prevention | Stage 3 | 25 custom Credo checks | 0 violations |
| Quality Score | Stage 4 | Composite 100-point score | 100/100 |
Usage
# Run all quality gates (standard mode)
/quality-gates
# Run quick gates only (compilation + critical checks)
/quality-gates --quick
# Run full gates including performance benchmarks
/quality-gates --full
# Run gates for specific application
/quality-gates --app prismatic_web
# Run specific gate stage only
/quality-gates --stage 2
# Run gates with detailed output
/quality-gates --verbose
# Run gates in CI mode (optimized for pipelines)
/quality-gates --ci
# Pre-commit gate check (fastest)
/quality-gates --pre-commit
# Show gate configuration without running
/quality-gates --show-config
# Run gates and export report
/quality-gates --report ./gate-report.jsonPractical Examples
# Pre-commit quick validation
/quality-gates --pre-commit --app prismatic_perimeter
# Full validation before merge request
/quality-gates --full --verbose --report ./mr-quality.json
# CI/CD pipeline gate (exits non-zero on failure)
/quality-gates --ci --exit-code
# Check specific quality domain
/quality-gates --domain dialyzer --verbose
# Validate after refactoring
/quality-gates --full --app prismatic_api --verboseOptions
| Option | Type | Default | Description |
|---|---|---|---|
--quick | flag | false | Run only Stage 1 gates (fastest) |
--full | flag | false | Run all stages including performance |
--pre-commit | flag | false | Optimized for pre-commit hook usage |
--ci | flag | false | CI/CD pipeline optimized mode |
--app | string | all | Specific application to gate |
--stage | integer | all | Run specific gate stage (1-4) |
--domain | string | all | Check specific quality domain |
--verbose | flag | false | Detailed output per check |
--exit-code | flag | true | Return non-zero on failure |
--report | path | none | Export gate report to file |
--show-config | flag | false | Display gate configuration |
--fix | flag | false | Auto-fix violations where possible |
--parallel | flag | true | Run independent checks in parallel |
--timeout | duration | 300s | Maximum total execution time |
Execution Flow
Stage 1: Compilation Gates
The first stage verifies that the codebase compiles cleanly:
- Zero-Warning Compilation --
mix compile --warnings-as-errors --forcemust produce zero warnings - Dialyzer Analysis -- Type specifications are verified against actual function implementations
- Dependency Check -- All dependencies are present and compatible
Stage 1 failures block all subsequent stages. Compilation must be clean before any further analysis.
Stage 2: Static Analysis Gates
The second stage performs comprehensive static analysis:
- Credo Strict --
mix credo --strictchecks code style, readability, and complexity - Pattern Verification -- 25 custom Credo checks prevent regression of 700+ previously eliminated violations
- Memory Safety -- Detects unsafe map access (
map.keywithout guard), nil propagation risks - Typespec Coverage -- Ensures public functions have
@specannotations - Guard Functions -- Verifies guard clauses on public function heads
@implAnnotations -- Confirms callback implementations are annotated- DateTime Precision -- Enforces microsecond precision in all timestamp operations
- Timing Patterns -- Detects
Process.sleepusage and timer anti-patterns - TODO Management -- Tracks and enforces TODO lifecycle rules
Stage 3: Dynamic Analysis Gates
The third stage runs tests and performance benchmarks:
- Test Suite --
mix testwith full coverage reporting - Performance Checks -- Page load times, render times, health check response times
- Regression Tests -- Dedicated regression test suite for previously fixed bugs
Stage 4: Meta-Quality Gates
The fourth stage evaluates overall quality health:
- Quality Score -- Composite score across all 13 domains must be >= 100
- Quality DNA -- Cross-session quality continuity verification
- Quality Floor -- Guardian checks that quality has not regressed below floor
Integration Points
| Component | Integration Type | Description |
|---|---|---|
| /quality-unified | Peer | Unified quality interface delegates to gates |
| /quality-evolve | Consumer | Evolution validated through gates |
| /quality-hbfs | Peer | HBFS prioritization informs gate focus |
| /quality-enforce | Peer | Enforcement policies drive gate thresholds |
| /regression-check | Component | Regression checks are a gate stage 2 component |
| Pre-commit Hook | Caller | Git pre-commit invokes --pre-commit mode |
| CI/CD Pipeline | Caller | GitLab CI invokes --ci mode |
| Telemetry | Monitoring | Gate execution metrics and trends |
Best Practices
Gate Mode Selection
Choose the appropriate gate mode for your context:
| Context | Recommended Mode | Typical Duration |
|---|---|---|
| Every file save | --pre-commit --quick | 10-30s |
| Before commit | --pre-commit | 30-60s |
| Before merge request | --full | 2-5 min |
| CI/CD pipeline | --ci --full | 3-8 min |
| After major refactor | --full --verbose | 5-10 min |
Handling Gate Failures
When gates fail, the output identifies the specific domain, violation location, and suggested fix. Address violations in priority order:
- Stage 1 failures (compilation) -- Must fix first; blocks everything
- Stage 2 critical (memory safety, regression) -- High risk if ignored
- Stage 2 standard (Credo, typespecs) -- Code quality
- Stage 3 (tests, performance) -- Runtime behavior
- Stage 4 (meta-quality) -- Systemic health
Continuous Gate Compliance
Maintain continuous gate compliance rather than batch-fixing before merges. Running --pre-commit --quick after every significant change catches violations early when they are cheapest to fix.
Error Handling
| Error Code | Description | Resolution |
|---|---|---|
GATE_BLOCKED | One or more gates failed, code change blocked | Fix violations shown in output |
COMPILATION_WARNING | Zero-warning policy violated | Fix or suppress the specific warning |
DIALYZER_MISMATCH | Type specification inconsistency | Correct @spec to match implementation |
CREDO_VIOLATION | Static analysis rule violated | Follow Credo suggestion in output |
TEST_FAILURE | One or more tests failed | Fix failing tests before proceeding |
PERFORMANCE_VIOLATION | Page load or render time exceeded limit | Optimize slow paths; see profiling data |
QUALITY_REGRESSION | Quality score decreased from baseline | Investigate which domain regressed |
TIMEOUT | Gate execution exceeded time limit | Increase --timeout or narrow scope with --app |
Advanced Usage
Custom Gate Profiles
Create named gate profiles for different scenarios:
# Use a custom profile for experimental branches
/quality-gates --profile experimental # Relaxed thresholds
/quality-gates --profile production # Strictest thresholdsSelective Domain Override
Temporarily exempt specific domains (with documented justification):
# Skip Dialyzer for rapid prototyping (requires L3+ authority)
/quality-gates --skip-domain dialyzer --reason "prototyping phase, will add types before merge"Gate Trend Analysis
Analyze quality gate results over time:
/quality-gates --history 30d --format json --report ./gate-trends.jsonDoctrine Compliance
All commands operate under the NO MERCY, NO DOUBTS doctrine:
- NO MERCY: Zero tolerance for incomplete execution or quality violations. Gate failures are absolute: no code passes through a failed gate.
- NO DOUBTS: Full investigation before action, evidence-based results. Every gate verdict includes specific evidence for the pass/fail decision.
Related Commands
- /quality-unified - Unified quality command with quick, full, pre-commit and CI modes
- /quality-evolve - Quality-focused evolution targeting specific quality domains
- /quality-hbfs - Hottest-bug-first search for quality assessment prioritization
- /quality-enforce - Mandatory progressive quality debt elimination with AIAD enforcement
- /regression-check - Execute 25 custom Credo regression checks preventing 700+ violations
- /verify-patterns - Pattern matching audit for file, module or entire codebase
- /code - Core coding implementation and feature development
- /fix - Bug fix implementation with mandatory regression tests
Connect & Contribute
Created by Tomáš Korcak (korczis) | Open Source under GHL