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: openclaw-skill-quality-gateways-generic-web-api-applications
3description: "This skill defines and applies 6 universal quality gateways for
4 typical application projects that include:"
5metadata:
6 source: https://skillmd.com/skills/modbender/openclaw-skill-quality-gateways-generic-web-api-applications
7---
8
9# openClaw Skill: Quality Gateways (Generic Web + API Applications)
10
11## Purpose
12This skill defines and applies **6 universal quality gateways** for typical application projects that include:
13- Backend API services (any stack)
14- Web frontends (any stack)
15- CI/CD pipelines (any provider)
16
17The gateways are written in **LLM-friendly operational language**: how to **check**, **calculate**, **evaluate**, and **document** results consistently.
18
19This skill is **language-agnostic** and can be used on any repository. It relies on a central configuration file:
20- `.defs/quality-gateway-definition.json` (MUST be stored in the repository, not the workspace)
21
22## Non-Negotiable Storage Rules (openClaw)
23- The gateway definition file MUST be placed in: `REPO_ROOT/.defs/quality-gateway-definition.json`
24- Temporary files MUST go to: `REPO_ROOT/.tmp/quality-gates/` (do not create or delete other workspace directories)
25- Reports MUST be written to repository paths defined in the JSON config (default suggested below)
26
27## Inputs
28- Repository root path (REPO_ROOT)
29- Optional CI artifacts path (if provided by the runtime)
30- Optional commit range (for PR-focused evaluation)
31- Optional environment notes (target load, environments, risk level)
32
33## Outputs
341. A human-readable report (Markdown)
352. A machine-readable report (JSON) containing raw metrics + per-check scores
363. Evidence references (paths, snippets, CI links if available)
37
38Recommended default output paths (override via JSON config):
39- `docs/quality/quality-gate-report.md`
40- `docs/quality/quality-gate-report.json`
41- Evidence directory: `docs/quality/evidence/`
42
43---
44
45# The 6 Quality Gateways
46
47Each gateway produces:
48- **Score**: 0–100
49- **Status**: PASS / WARN / FAIL
50- **Blocking behavior**: some gateways are “blocking” (FAIL blocks release)
51
52All gateway thresholds and weights come from:
53- `.defs/quality-gateway-definition.json`
54
55---
56
57## Gateway 1 — Build & Dependency Health
58### Goal
59Ensure the system can be built and packaged reliably, and dependencies are manageable and safe to ship.
60
61### What to Check (typical checks)
62- CI pipeline status (green on default branch / PR)
63- Reproducible build or deterministic packaging indicators
64- Dependency freshness (stale/outdated dependencies)
65- License policy compliance (allowlist/denylist)
66- SBOM presence (if required)
67
68### How to Measure / Calculate
69- Boolean checks: PASS=100, FAIL=0
70- Ratio checks (e.g., “outdated deps %”): scale 0–100 using thresholds
71- Policy checks: hard FAIL if a forbidden license is detected (if enabled)
72
73### Evidence to Collect
74- CI job summary (or local build logs)
75- Dependency list report output (tool-specific, but keep the report file)
76- SBOM artifact path (if present)
77- License scan output (if used)
78
79### How to Document
80In the report, include:
81- Build command/pipeline name
82- Artifact identifiers / versions
83- Summary of dependency deltas and policy results
84
85---
86
87## Gateway 2 — Automated Testing & Coverage
88### Goal
89Prove correctness through automated tests and prevent regression.
90
91### What to Check
92- Unit tests pass
93- Integration/API tests pass (or contract tests)
94- E2E/smoke tests pass (for web apps)
95- Code coverage meets thresholds (overall + critical components)
96- Flaky test rate is controlled (if CI provides retries/flakes)
97
98### How to Measure / Calculate
99- Test pass: boolean
100- Coverage: numeric percentage
101 - Score mapping example:
102 - >= target: 100
103 - between warn and target: linear 70–99
104 - below warn: linear 0–69
105- Optional “critical path coverage” gets extra weight
106
107### Evidence to Collect
108- Test run outputs (JUnit/TRX/etc.)
109- Coverage summary files
110- List of failed tests (if any) + links
111
112### How to Document
113- Test suites executed
114- Coverage numbers (overall + key areas)
115- Notes on skipped tests (if allowed) and rationale
116
117---
118
119## Gateway 3 — Security & Supply-Chain
120### Goal
121Prevent known vulnerabilities, secrets leakage, insecure configs, and supply-chain risks.
122
123### What to Check
124- Dependency vulnerabilities (Critical/High/Medium counts)
125- Secret scanning results (must be zero leaked secrets)
126- Basic secure configuration checks (CSP, TLS, auth boundaries) where applicable
127- SAST findings severity counts (if tooling exists)
128- Container image scan (if containers exist)
129
130### How to Measure / Calculate
131- Vulnerability gating (typical):
132 - Critical = 0 required (FAIL otherwise)
133 - High = 0 required (or <= allowedHigh)
134 - Medium allowed up to a budget (WARN if above warn)
135- Secrets: any secret finding => FAIL (blocking)
136- Score: start at 100 and subtract penalties by severity and count (config-driven)
137
138### Evidence to Collect
139- Vulnerability scan report files
140- Secret scan output (including file paths and fingerprint IDs, not actual secrets)
141- SAST report snippet/summary
142
143### How to Document
144- Severity counts and whether exceptions exist
145- Any exception MUST include: reason, owner, expiry date (if your org uses waivers)
146
147---
148
149## Gateway 4 — Performance & Efficiency (API + Web)
150### Goal
151Ensure the system meets baseline performance and user experience targets.
152
153### What to Check
154API (typical):
155- p95 latency under target
156- Error rate under target
157- Throughput meets expected load (if known)
158
159Web (typical):
160- Core Web Vitals (LCP, CLS, INP) on a reference device/profile
161- Bundle size / asset weight thresholds (optional)
162
163### How to Measure / Calculate
164- Latency score:
165 - p95 <= target: 100
166 - between target and warn: linear 70–99
167 - > warn: 0–69 (linear), with hard FAIL if beyond “max”
168- Error rate:
169 - <= target: 100
170 - <= warn: 70–99
171 - > warn: 0–69, FAIL if beyond max
172- Web vitals:
173 - Each metric scored independently; weighted into a single web score
174
175### Evidence to Collect
176- Load test or benchmark outputs (k6/JMeter/etc.)
177- APM snapshots (if available)
178- Lighthouse or Web Vitals report exports
179
180### How to Document
181- Test conditions: environment, dataset size, concurrency, device profile
182- Key p95 / error rate / vitals values
183- Notable regressions vs baseline
184
185---
186
187## Gateway 5 — Maintainability & Code Health
188### Goal
189Keep the codebase understandable, changeable, and reviewable over time.
190
191### What to Check
192- Static analysis quality (lint errors, rule violations)
193- Complexity thresholds (cyclomatic complexity, large functions/classes)
194- Duplication rate
195- “Change risk” signals (hotspots: frequent churn + complexity)
196- Documentation coverage for public APIs (e.g., endpoint docs, component docs)
197
198### How to Measure / Calculate
199- Issue density: findings per KLOC (or per file for smaller repos)
200- Complexity score: percentage of units exceeding complexity threshold
201- Duplication: % duplicated lines
202- Score: weighted average of normalized sub-scores (config-driven)
203
204### Evidence to Collect
205- Static analysis summaries
206- Complexity and duplication reports (any tool is fine; store outputs)
207- List of top hotspots and why (files + metrics)
208
209### How to Document
210- Top 10 problems by impact
211- Concrete refactoring suggestions only if asked; otherwise just findings
212
213---
214
215## Gateway 6 — Release Readiness & Operability (Observability + Runbooks)
216### Goal
217Make sure the system can be operated safely in production.
218
219### What to Check
220- Health endpoints exist and are meaningful
221- Logging is structured and includes correlation IDs
222- Metrics and dashboards exist for key signals (latency, error rate, saturation)
223- Alerts configured for SLO breaches / error budget burn (if applicable)
224- Runbooks for major failure modes exist (deploy rollback, incident triage)
225- Versioning and changelog/release notes exist
226
227### How to Measure / Calculate
228Mostly “presence + completeness” scoring:
229- Each required artifact is a boolean check
230- Optional maturity rubric: 0 (missing), 50 (partial), 100 (complete)
231- Blocking if “minimum operability” is not met (config-driven)
232
233### Evidence to Collect
234- Paths to runbooks, dashboards-as-code, alert configs
235- Sample log/metric/tracing docs
236- On-call/ops notes (if present)
237
238### How to Document
239- List missing operational artifacts
240- Minimum go-live checklist status
241
242---
243
244# Standard Evaluation Algorithm (LLM-Executable)
245
246## Step 1: Load configuration
247- Read `REPO_ROOT/.defs/quality-gateway-definition.json`
248- Validate it against the schema description (see below)
249- If fields are missing, use documented defaults from the JSON
250
251## Step 2: Collect metrics per check
252For each gate:
253- For each check:
254 - Identify data source:
255 - Prefer CI artifacts if provided
256 - Otherwise use repository files and local commands (if allowed by runtime)
257 - Produce a metric value (number/boolean/string) and evidence references
258
259## Step 3: Score each check (0–100)
260Use the scoring method defined per check:
261- `boolean`: pass => 100, fail => 0
262- `threshold_range`: linear scoring between warn and target
263- `penalty_by_count`: start at 100 and subtract per issue
264- `rubric`: map {missing/partial/complete} to {0/50/100}
265
266## Step 4: Score each gateway
267- Compute weighted average of its checks
268- Determine gateway status using configured thresholds:
269 - Score >= passScore => PASS
270 - Score >= warnScore => WARN
271 - else => FAIL
272- If gateway is marked `blockingOnFail=true`, any FAIL blocks release
273
274## Step 5: Produce reports
275Write:
2761) Markdown report (human)
2772) JSON report (machine)
278Include:
279- per-gateway score/status
280- per-check metrics + evidence paths
281- overall score and overall status
282- explicit “BLOCKERS” list if any
283
284---
285
286# Report Template (Markdown)
287Use this outline in `docs/quality/quality-gate-report.md` unless JSON overrides paths:
288
289## Summary
290- Overall Score:
291- Overall Status:
292- Blocking Failures:
293- Date/Commit:
294
295## Gateway Results
296| Gateway | Score | Status | Key Metrics | Evidence |
297|---|---:|---|---|---|
298
299## Details (per Gateway)
300### <Gateway Name>
301- Score/Status
302- Checks:
303 - <Check>: metric=..., score=..., evidence=...
304- Notes / Exceptions
305
306---
307
308# quality-gateway-definition.json — JSON Schema Description
309
310The configuration file is a normal JSON document with:
311
312## Root
313- `schemaVersion` (string) — version of this config layout
314- `projectProfile` (object) — context used for defaults
315- `scoring` (object) — global pass/warn thresholds and aggregation rules
316- `reporting` (object) — output paths and evidence folder
317- `gates` (array) — list of gateway definitions (exactly 6 for this skill)
318
319## projectProfile (object)
320- `applicationType` (string) — e.g. `"web_api_and_web"`
321- `riskLevel` (string) — `"low"|"medium"|"high"`
322- `releaseCadence` (string) — e.g. `"daily"|"weekly"|"monthly"`
323- `expectedLoad` (object, optional)
324 - `apiRps` (number)
325 - `concurrency` (number)
326
327## scoring (object)
328- `passScore` (number 0–100)
329- `warnScore` (number 0–100)
330- `overallAggregation` (string) — `"weighted_average"`
331- `blockIfAnyBlockingGateFails` (boolean)
332
333## reporting (object)
334- `markdownReportPath` (string, repo-relative)
335- `jsonReportPath` (string, repo-relative)
336- `evidenceDir` (string, repo-relative)
337- `tempDir` (string, repo-relative; MUST be inside `.tmp/quality-gates/`)
338
339## gates (array of objects)
340Each gate:
341- `id` (string) — stable identifier
342- `name` (string)
343- `description` (string)
344- `weight` (number) — relative importance in overall score
345- `blockingOnFail` (boolean)
346- `checks` (array)
347
348## checks (array of objects)
349Each check:
350- `id` (string)
351- `name` (string)
352- `description` (string)
353- `weight` (number)
354- `metricType` (string) — `"boolean"|"percentage"|"count"|"duration_ms"|"rubric"`
355- `scoringMethod` (string) — `"boolean"|"threshold_range"|"penalty_by_count"|"rubric"`
356- `thresholds` (object) — depends on scoringMethod:
357 - for `threshold_range`:
358 - `target` (number)
359 - `warn` (number)
360 - `max` (number, optional hard-fail)
361 - `direction` (string) — `"higher_is_better"|"lower_is_better"`
362 - for `penalty_by_count`:
363 - `allowed` (number)
364 - `warnAbove` (number)
365 - `failAbove` (number)
366 - `penaltyPerUnit` (number)
367- `evidenceHints` (array of strings) — where to find evidence in a generic repo/CI
368- `notes` (string, optional)
369
370---
371
372# Operational Notes
373- If a metric cannot be measured, do NOT invent numbers.
374 - 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).
375- Always include evidence references (paths or CI artifact names).
376- Keep all temp work inside `.tmp/quality-gates/`.
377
378# JSON references
379- `templ/quality-gateway-definition-template.json` (template settings file. Can be copied to `REPO_ROOT/.defs/quality-gateway-definition.json` if missing)