openClaw Skill: Quality Gateways (Generic Web + API Applications)
Purpose
This skill defines and applies 6 universal quality gateways for typical application projects that include:
- Backend API services (any stack)
- Web frontends (any stack)
- CI/CD pipelines (any provider)
The gateways are written in LLM-friendly operational language: how to check, calculate, evaluate, and document results consistently.
This skill is language-agnostic and can be used on any repository. It relies on a central configuration file:
.defs/quality-gateway-definition.json (MUST be stored in the repository, not the workspace)
Non-Negotiable Storage Rules (openClaw)
- The gateway definition file MUST be placed in:
REPO_ROOT/.defs/quality-gateway-definition.json
- Temporary files MUST go to:
REPO_ROOT/.tmp/quality-gates/ (do not create or delete other workspace directories)
- Reports MUST be written to repository paths defined in the JSON config (default suggested below)
Inputs
- Repository root path (REPO_ROOT)
- Optional CI artifacts path (if provided by the runtime)
- Optional commit range (for PR-focused evaluation)
- Optional environment notes (target load, environments, risk level)
Outputs
- A human-readable report (Markdown)
- A machine-readable report (JSON) containing raw metrics + per-check scores
- Evidence references (paths, snippets, CI links if available)
Recommended default output paths (override via JSON config):
docs/quality/quality-gate-report.md
docs/quality/quality-gate-report.json
- Evidence directory:
docs/quality/evidence/
The 6 Quality Gateways
Each gateway produces:
- Score: 0–100
- Status: PASS / WARN / FAIL
- Blocking behavior: some gateways are “blocking” (FAIL blocks release)
All gateway thresholds and weights come from:
.defs/quality-gateway-definition.json
Gateway 1 — Build & Dependency Health
Goal
Ensure the system can be built and packaged reliably, and dependencies are manageable and safe to ship.
What to Check (typical checks)
- CI pipeline status (green on default branch / PR)
- Reproducible build or deterministic packaging indicators
- Dependency freshness (stale/outdated dependencies)
- License policy compliance (allowlist/denylist)
- SBOM presence (if required)
How to Measure / Calculate
- Boolean checks: PASS=100, FAIL=0
- Ratio checks (e.g., “outdated deps %”): scale 0–100 using thresholds
- Policy checks: hard FAIL if a forbidden license is detected (if enabled)
Evidence to Collect
- CI job summary (or local build logs)
- Dependency list report output (tool-specific, but keep the report file)
- SBOM artifact path (if present)
- License scan output (if used)
How to Document
In the report, include:
- Build command/pipeline name
- Artifact identifiers / versions
- Summary of dependency deltas and policy results
Gateway 2 — Automated Testing & Coverage
Goal
Prove correctness through automated tests and prevent regression.
What to Check
- Unit tests pass
- Integration/API tests pass (or contract tests)
- E2E/smoke tests pass (for web apps)
- Code coverage meets thresholds (overall + critical components)
- Flaky test rate is controlled (if CI provides retries/flakes)
How to Measure / Calculate
- Test pass: boolean
- Coverage: numeric percentage
- Score mapping example:
= target: 100
- between warn and target: linear 70–99
- below warn: linear 0–69
- Optional “critical path coverage” gets extra weight
Evidence to Collect
- Test run outputs (JUnit/TRX/etc.)
- Coverage summary files
- List of failed tests (if any) + links
How to Document
- Test suites executed
- Coverage numbers (overall + key areas)
- Notes on skipped tests (if allowed) and rationale
Gateway 3 — Security & Supply-Chain
Goal
Prevent known vulnerabilities, secrets leakage, insecure configs, and supply-chain risks.
What to Check
- Dependency vulnerabilities (Critical/High/Medium counts)
- Secret scanning results (must be zero leaked secrets)
- Basic secure configuration checks (CSP, TLS, auth boundaries) where applicable
- SAST findings severity counts (if tooling exists)
- Container image scan (if containers exist)
How to Measure / Calculate
- Vulnerability gating (typical):
- Critical = 0 required (FAIL otherwise)
- High = 0 required (or <= allowedHigh)
- Medium allowed up to a budget (WARN if above warn)
- Secrets: any secret finding => FAIL (blocking)
- Score: start at 100 and subtract penalties by severity and count (config-driven)
Evidence to Collect
- Vulnerability scan report files
- Secret scan output (including file paths and fingerprint IDs, not actual secrets)
- SAST report snippet/summary
How to Document
- Severity counts and whether exceptions exist
- Any exception MUST include: reason, owner, expiry date (if your org uses waivers)
Gateway 4 — Performance & Efficiency (API + Web)
Goal
Ensure the system meets baseline performance and user experience targets.
What to Check
API (typical):
- p95 latency under target
- Error rate under target
- Throughput meets expected load (if known)
Web (typical):
- Core Web Vitals (LCP, CLS, INP) on a reference device/profile
- Bundle size / asset weight thresholds (optional)
How to Measure / Calculate
- Latency score:
- p95 <= target: 100
- between target and warn: linear 70–99
warn: 0–69 (linear), with hard FAIL if beyond “max”
- Error rate:
- <= target: 100
- <= warn: 70–99
warn: 0–69, FAIL if beyond max
- Web vitals:
- Each metric scored independently; weighted into a single web score
Evidence to Collect
- Load test or benchmark outputs (k6/JMeter/etc.)
- APM snapshots (if available)
- Lighthouse or Web Vitals report exports
How to Document
- Test conditions: environment, dataset size, concurrency, device profile
- Key p95 / error rate / vitals values
- Notable regressions vs baseline
Gateway 5 — Maintainability & Code Health
Goal
Keep the codebase understandable, changeable, and reviewable over time.
What to Check
- Static analysis quality (lint errors, rule violations)
- Complexity thresholds (cyclomatic complexity, large functions/classes)
- Duplication rate
- “Change risk” signals (hotspots: frequent churn + complexity)
- Documentation coverage for public APIs (e.g., endpoint docs, component docs)
How to Measure / Calculate
- Issue density: findings per KLOC (or per file for smaller repos)
- Complexity score: percentage of units exceeding complexity threshold
- Duplication: % duplicated lines
- Score: weighted average of normalized sub-scores (config-driven)
Evidence to Collect
- Static analysis summaries
- Complexity and duplication reports (any tool is fine; store outputs)
- List of top hotspots and why (files + metrics)
How to Document
- Top 10 problems by impact
- Concrete refactoring suggestions only if asked; otherwise just findings
Gateway 6 — Release Readiness & Operability (Observability + Runbooks)
Goal
Make sure the system can be operated safely in production.
What to Check
- Health endpoints exist and are meaningful
- Logging is structured and includes correlation IDs
- Metrics and dashboards exist for key signals (latency, error rate, saturation)
- Alerts configured for SLO breaches / error budget burn (if applicable)
- Runbooks for major failure modes exist (deploy rollback, incident triage)
- Versioning and changelog/release notes exist
How to Measure / Calculate
Mostly “presence + completeness” scoring:
- Each required artifact is a boolean check
- Optional maturity rubric: 0 (missing), 50 (partial), 100 (complete)
- Blocking if “minimum operability” is not met (config-driven)
Evidence to Collect
- Paths to runbooks, dashboards-as-code, alert configs
- Sample log/metric/tracing docs
- On-call/ops notes (if present)
How to Document
- List missing operational artifacts
- Minimum go-live checklist status
Standard Evaluation Algorithm (LLM-Executable)
Step 1: Load configuration
- Read
REPO_ROOT/.defs/quality-gateway-definition.json
- Validate it against the schema description (see below)
- If fields are missing, use documented defaults from the JSON
Step 2: Collect metrics per check
For each gate:
- For each check:
- Identify data source:
- Prefer CI artifacts if provided
- Otherwise use repository files and local commands (if allowed by runtime)
- Produce a metric value (number/boolean/string) and evidence references
Step 3: Score each check (0–100)
Use the scoring method defined per check:
boolean: pass => 100, fail => 0
threshold_range: linear scoring between warn and target
penalty_by_count: start at 100 and subtract per issue
rubric: map {missing/partial/complete} to {0/50/100}
Step 4: Score each gateway
- Compute weighted average of its checks
- Determine gateway status using configured thresholds:
- Score >= passScore => PASS
- Score >= warnScore => WARN
- else => FAIL
- If gateway is marked
blockingOnFail=true, any FAIL blocks release
Step 5: Produce reports
Write:
- Markdown report (human)
- JSON report (machine)
Include:
- per-gateway score/status
- per-check metrics + evidence paths
- overall score and overall status
- explicit “BLOCKERS” list if any
Report Template (Markdown)
Use this outline in docs/quality/quality-gate-report.md unless JSON overrides paths:
Summary
- Overall Score:
- Overall Status:
- Blocking Failures:
- Date/Commit:
Gateway Results
| Gateway |
Score |
Status |
Key Metrics |
Evidence |
Details (per Gateway)
- Score/Status
- Checks:
- : metric=..., score=..., evidence=...
- Notes / Exceptions
quality-gateway-definition.json — JSON Schema Description
The configuration file is a normal JSON document with:
Root
schemaVersion (string) — version of this config layout
projectProfile (object) — context used for defaults
scoring (object) — global pass/warn thresholds and aggregation rules
reporting (object) — output paths and evidence folder
gates (array) — list of gateway definitions (exactly 6 for this skill)
projectProfile (object)
applicationType (string) — e.g. "web_api_and_web"
riskLevel (string) — "low"|"medium"|"high"
releaseCadence (string) — e.g. "daily"|"weekly"|"monthly"
expectedLoad (object, optional)
apiRps (number)
concurrency (number)
scoring (object)
passScore (number 0–100)
warnScore (number 0–100)
overallAggregation (string) — "weighted_average"
blockIfAnyBlockingGateFails (boolean)
reporting (object)
markdownReportPath (string, repo-relative)
jsonReportPath (string, repo-relative)
evidenceDir (string, repo-relative)
tempDir (string, repo-relative; MUST be inside .tmp/quality-gates/)
gates (array of objects)
Each gate:
id (string) — stable identifier
name (string)
description (string)
weight (number) — relative importance in overall score
blockingOnFail (boolean)
checks (array)
checks (array of objects)
Each check:
id (string)
name (string)
description (string)
weight (number)
metricType (string) — "boolean"|"percentage"|"count"|"duration_ms"|"rubric"
scoringMethod (string) — "boolean"|"threshold_range"|"penalty_by_count"|"rubric"
thresholds (object) — depends on scoringMethod:
- for
threshold_range:
target (number)
warn (number)
max (number, optional hard-fail)
direction (string) — "higher_is_better"|"lower_is_better"
- for
penalty_by_count:
allowed (number)
warnAbove (number)
failAbove (number)
penaltyPerUnit (number)
evidenceHints (array of strings) — where to find evidence in a generic repo/CI
notes (string, optional)
Operational Notes
- If a metric cannot be measured, do NOT invent numbers.
- Mark the check as
"unknown" in the JSON report and score it using the config’s fallback rule (recommended: treat unknown as WARN with score 70 unless the check is security/secrets, where unknown should be FAIL).
- Always include evidence references (paths or CI artifact names).
- Keep all temp work inside
.tmp/quality-gates/.
JSON references
templ/quality-gateway-definition-template.json (template settings file. Can be copied to REPO_ROOT/.defs/quality-gateway-definition.json if missing)
1---2name: tcc-quality-gates3description: openClaw Skill: Quality Gateways (Generic Web + API Applications)4---5# openClaw Skill: Quality Gateways (Generic Web + API Applications)67## Purpose8This skill defines and applies **6 universal quality gateways** for typical application projects that include:9- Backend API services (any stack)10- Web frontends (any stack)11- CI/CD pipelines (any provider)1213The gateways are written in **LLM-friendly operational language**: how to **check**, **calculate**, **evaluate**, and **document** results consistently.1415This skill is **language-agnostic** and can be used on any repository. It relies on a central configuration file:16- `.defs/quality-gateway-definition.json` (MUST be stored in the repository, not the workspace)1718## Non-Negotiable Storage Rules (openClaw)19- The gateway definition file MUST be placed in: `REPO_ROOT/.defs/quality-gateway-definition.json`20- Temporary files MUST go to: `REPO_ROOT/.tmp/quality-gates/` (do not create or delete other workspace directories)21- Reports MUST be written to repository paths defined in the JSON config (default suggested below)2223## Inputs24- Repository root path (REPO_ROOT)25- Optional CI artifacts path (if provided by the runtime)26- Optional commit range (for PR-focused evaluation)27- Optional environment notes (target load, environments, risk level)2829## Outputs301. A human-readable report (Markdown)312. A machine-readable report (JSON) containing raw metrics + per-check scores323. Evidence references (paths, snippets, CI links if available)3334Recommended default output paths (override via JSON config):35- `docs/quality/quality-gate-report.md`36- `docs/quality/quality-gate-report.json`37- Evidence directory: `docs/quality/evidence/`3839---4041# The 6 Quality Gateways4243Each gateway produces:44- **Score**: 0–10045- **Status**: PASS / WARN / FAIL46- **Blocking behavior**: some gateways are “blocking” (FAIL blocks release)4748All gateway thresholds and weights come from:49- `.defs/quality-gateway-definition.json`5051---5253## Gateway 1 — Build & Dependency Health54### Goal55Ensure the system can be built and packaged reliably, and dependencies are manageable and safe to ship.5657### What to Check (typical checks)58- CI pipeline status (green on default branch / PR)59- Reproducible build or deterministic packaging indicators60- Dependency freshness (stale/outdated dependencies)61- License policy compliance (allowlist/denylist)62- SBOM presence (if required)6364### How to Measure / Calculate65- Boolean checks: PASS=100, FAIL=066- Ratio checks (e.g., “outdated deps %”): scale 0–100 using thresholds67- Policy checks: hard FAIL if a forbidden license is detected (if enabled)6869### Evidence to Collect70- CI job summary (or local build logs)71- Dependency list report output (tool-specific, but keep the report file)72- SBOM artifact path (if present)73- License scan output (if used)7475### How to Document76In the report, include:77- Build command/pipeline name78- Artifact identifiers / versions79- Summary of dependency deltas and policy results8081---8283## Gateway 2 — Automated Testing & Coverage84### Goal85Prove correctness through automated tests and prevent regression.8687### What to Check88- Unit tests pass89- Integration/API tests pass (or contract tests)90- E2E/smoke tests pass (for web apps)91- Code coverage meets thresholds (overall + critical components)92- Flaky test rate is controlled (if CI provides retries/flakes)9394### How to Measure / Calculate95- Test pass: boolean96- Coverage: numeric percentage97 - Score mapping example:98 - >= target: 10099 - between warn and target: linear 70–99100 - below warn: linear 0–69101- Optional “critical path coverage” gets extra weight102103### Evidence to Collect104- Test run outputs (JUnit/TRX/etc.)105- Coverage summary files106- List of failed tests (if any) + links107108### How to Document109- Test suites executed110- Coverage numbers (overall + key areas)111- Notes on skipped tests (if allowed) and rationale112113---114115## Gateway 3 — Security & Supply-Chain116### Goal117Prevent known vulnerabilities, secrets leakage, insecure configs, and supply-chain risks.118119### What to Check120- Dependency vulnerabilities (Critical/High/Medium counts)121- Secret scanning results (must be zero leaked secrets)122- Basic secure configuration checks (CSP, TLS, auth boundaries) where applicable123- SAST findings severity counts (if tooling exists)124- Container image scan (if containers exist)125126### How to Measure / Calculate127- Vulnerability gating (typical):128 - Critical = 0 required (FAIL otherwise)129 - High = 0 required (or <= allowedHigh)130 - Medium allowed up to a budget (WARN if above warn)131- Secrets: any secret finding => FAIL (blocking)132- Score: start at 100 and subtract penalties by severity and count (config-driven)133134### Evidence to Collect135- Vulnerability scan report files136- Secret scan output (including file paths and fingerprint IDs, not actual secrets)137- SAST report snippet/summary138139### How to Document140- Severity counts and whether exceptions exist141- Any exception MUST include: reason, owner, expiry date (if your org uses waivers)142143---144145## Gateway 4 — Performance & Efficiency (API + Web)146### Goal147Ensure the system meets baseline performance and user experience targets.148149### What to Check150API (typical):151- p95 latency under target152- Error rate under target153- Throughput meets expected load (if known)154155Web (typical):156- Core Web Vitals (LCP, CLS, INP) on a reference device/profile157- Bundle size / asset weight thresholds (optional)158159### How to Measure / Calculate160- Latency score:161 - p95 <= target: 100162 - between target and warn: linear 70–99163 - > warn: 0–69 (linear), with hard FAIL if beyond “max”164- Error rate:165 - <= target: 100166 - <= warn: 70–99167 - > warn: 0–69, FAIL if beyond max168- Web vitals:169 - Each metric scored independently; weighted into a single web score170171### Evidence to Collect172- Load test or benchmark outputs (k6/JMeter/etc.)173- APM snapshots (if available)174- Lighthouse or Web Vitals report exports175176### How to Document177- Test conditions: environment, dataset size, concurrency, device profile178- Key p95 / error rate / vitals values179- Notable regressions vs baseline180181---182183## Gateway 5 — Maintainability & Code Health184### Goal185Keep the codebase understandable, changeable, and reviewable over time.186187### What to Check188- Static analysis quality (lint errors, rule violations)189- Complexity thresholds (cyclomatic complexity, large functions/classes)190- Duplication rate191- “Change risk” signals (hotspots: frequent churn + complexity)192- Documentation coverage for public APIs (e.g., endpoint docs, component docs)193194### How to Measure / Calculate195- Issue density: findings per KLOC (or per file for smaller repos)196- Complexity score: percentage of units exceeding complexity threshold197- Duplication: % duplicated lines198- Score: weighted average of normalized sub-scores (config-driven)199200### Evidence to Collect201- Static analysis summaries202- Complexity and duplication reports (any tool is fine; store outputs)203- List of top hotspots and why (files + metrics)204205### How to Document206- Top 10 problems by impact207- Concrete refactoring suggestions only if asked; otherwise just findings208209---210211## Gateway 6 — Release Readiness & Operability (Observability + Runbooks)212### Goal213Make sure the system can be operated safely in production.214215### What to Check216- Health endpoints exist and are meaningful217- Logging is structured and includes correlation IDs218- Metrics and dashboards exist for key signals (latency, error rate, saturation)219- Alerts configured for SLO breaches / error budget burn (if applicable)220- Runbooks for major failure modes exist (deploy rollback, incident triage)221- Versioning and changelog/release notes exist222223### How to Measure / Calculate224Mostly “presence + completeness” scoring:225- Each required artifact is a boolean check226- Optional maturity rubric: 0 (missing), 50 (partial), 100 (complete)227- Blocking if “minimum operability” is not met (config-driven)228229### Evidence to Collect230- Paths to runbooks, dashboards-as-code, alert configs231- Sample log/metric/tracing docs232- On-call/ops notes (if present)233234### How to Document235- List missing operational artifacts236- Minimum go-live checklist status237238---239240# Standard Evaluation Algorithm (LLM-Executable)241242## Step 1: Load configuration243- Read `REPO_ROOT/.defs/quality-gateway-definition.json`244- Validate it against the schema description (see below)245- If fields are missing, use documented defaults from the JSON246247## Step 2: Collect metrics per check248For each gate:249- For each check:250 - Identify data source:251 - Prefer CI artifacts if provided252 - Otherwise use repository files and local commands (if allowed by runtime)253 - Produce a metric value (number/boolean/string) and evidence references254255## Step 3: Score each check (0–100)256Use the scoring method defined per check:257- `boolean`: pass => 100, fail => 0258- `threshold_range`: linear scoring between warn and target259- `penalty_by_count`: start at 100 and subtract per issue260- `rubric`: map {missing/partial/complete} to {0/50/100}261262## Step 4: Score each gateway263- Compute weighted average of its checks264- Determine gateway status using configured thresholds:265 - Score >= passScore => PASS266 - Score >= warnScore => WARN267 - else => FAIL268- If gateway is marked `blockingOnFail=true`, any FAIL blocks release269270## Step 5: Produce reports271Write:2721) Markdown report (human)2732) JSON report (machine)274Include:275- per-gateway score/status276- per-check metrics + evidence paths277- overall score and overall status278- explicit “BLOCKERS” list if any279280---281282# Report Template (Markdown)283Use this outline in `docs/quality/quality-gate-report.md` unless JSON overrides paths:284285## Summary286- Overall Score:287- Overall Status:288- Blocking Failures:289- Date/Commit:290291## Gateway Results292| Gateway | Score | Status | Key Metrics | Evidence |293|---|---:|---|---|---|294295## Details (per Gateway)296### <Gateway Name>297- Score/Status298- Checks:299 - <Check>: metric=..., score=..., evidence=...300- Notes / Exceptions301302---303304# quality-gateway-definition.json — JSON Schema Description305306The configuration file is a normal JSON document with:307308## Root309- `schemaVersion` (string) — version of this config layout310- `projectProfile` (object) — context used for defaults311- `scoring` (object) — global pass/warn thresholds and aggregation rules312- `reporting` (object) — output paths and evidence folder313- `gates` (array) — list of gateway definitions (exactly 6 for this skill)314315## projectProfile (object)316- `applicationType` (string) — e.g. `"web_api_and_web"`317- `riskLevel` (string) — `"low"|"medium"|"high"`318- `releaseCadence` (string) — e.g. `"daily"|"weekly"|"monthly"`319- `expectedLoad` (object, optional)320 - `apiRps` (number)321 - `concurrency` (number)322323## scoring (object)324- `passScore` (number 0–100)325- `warnScore` (number 0–100)326- `overallAggregation` (string) — `"weighted_average"`327- `blockIfAnyBlockingGateFails` (boolean)328329## reporting (object)330- `markdownReportPath` (string, repo-relative)331- `jsonReportPath` (string, repo-relative)332- `evidenceDir` (string, repo-relative)333- `tempDir` (string, repo-relative; MUST be inside `.tmp/quality-gates/`)334335## gates (array of objects)336Each gate:337- `id` (string) — stable identifier338- `name` (string)339- `description` (string)340- `weight` (number) — relative importance in overall score341- `blockingOnFail` (boolean)342- `checks` (array)343344## checks (array of objects)345Each check:346- `id` (string)347- `name` (string)348- `description` (string)349- `weight` (number)350- `metricType` (string) — `"boolean"|"percentage"|"count"|"duration_ms"|"rubric"`351- `scoringMethod` (string) — `"boolean"|"threshold_range"|"penalty_by_count"|"rubric"`352- `thresholds` (object) — depends on scoringMethod:353 - for `threshold_range`:354 - `target` (number)355 - `warn` (number)356 - `max` (number, optional hard-fail)357 - `direction` (string) — `"higher_is_better"|"lower_is_better"`358 - for `penalty_by_count`:359 - `allowed` (number)360 - `warnAbove` (number)361 - `failAbove` (number)362 - `penaltyPerUnit` (number)363- `evidenceHints` (array of strings) — where to find evidence in a generic repo/CI364- `notes` (string, optional)365366---367368# Operational Notes369- If a metric cannot be measured, do NOT invent numbers.370 - Mark the check as `"unknown"` in the JSON report and score it using the config’s fallback rule (recommended: treat unknown as WARN with score 70 unless the check is security/secrets, where unknown should be FAIL).371- Always include evidence references (paths or CI artifact names).372- Keep all temp work inside `.tmp/quality-gates/`.373374# JSON references375- `templ/quality-gateway-definition-template.json` (template settings file. Can be copied to `REPO_ROOT/.defs/quality-gateway-definition.json` if missing)