/cm:cm-quality-gatefrom cm
Enforces test gates, evidence-based verification, and frontend safety checks before deployment. Blocks deploys on test failures and requires fresh verification evidence.
Ships in cm. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Three checkpoints, one skill: Pre-deploy testing, evidence verification, frontend safety.
test:gate.Goal: Identify the framework and install the correct testing dependencies.
package.json for framework (React, Vue, Astro, etc.) and wrangler.json(c).npm install -D vitest jsdom acornvitest.config.ts or vite.config.ts with environment: 'jsdom'.{
"scripts": {
"test:gate": "vitest run --reporter=verbose"
}
}
Do not combine these files. They form the "Quality Gate."
test/frontend-safety.test.ts)Prevents white screens, template corruption, and syntax errors.
test('app.js does not contain catastrophic corruption', () => {
const code = fs.readFileSync('public/static/app.js', 'utf-8');
expect(code).not.toMatch(/=\s*'[^']*\$\{t\(/); // Bug #1
expect(code).not.toMatch(/<\s+[a-zA-Z]/); // Bug #2
});
test/api-routes.test.ts)Ensures backend endpoints respond correctly.
test/business-logic.test.ts)Tests pure functions, validations, and transformations.
test/i18n-sync.test.ts)Guarantees all language files have identical key counts.
ALWAYS run npm run test:gate before deploying. 0 failures required.
Check for skip override (explicit user words only):
Run test gate:
npm run test:gate
Parse results: total files, total tests, failures, duration
Gate decision:
| DON'T | DO |
|---|---|
| Deploy then test | Test then deploy |
| "Tests passed earlier" | Run fresh test:gate NOW |
| Skip for "small changes" | Every change gets tested |
| Run test + deploy parallel | Sequential: test → gate → deploy |
ALWAYS run the proving command before saying "fixed" or "done."
1. IDENTIFY → What command proves this claim?
2. RUN → Execute the FULL command (fresh)
3. READ → Full output, check exit code
4. VERIFY → Does output confirm the claim?
5. ONLY THEN → Make the claim
| Claim | Requires | Not Sufficient |
|---|---|---|
| Tests pass | Test output: 0 failures | "Should pass", previous run |
| Build succeeds | Build: exit 0 | Linter passing |
| Bug fixed | Test symptom: passes | Code changed, assumed fixed |
| Requirements met | Line-by-line checklist | Tests passing |
Automated via Layer 1 above.
Setting up or enhancing test suites for projects with frontend JavaScript/TypeScript.
| Layer | What it checks | Priority |
|---|---|---|
| 1. Syntax Validation | JS parses without errors (via acorn) | CRITICAL |
| 2. Function Integrity | Named functions exist and are callable | Required |
| 3. Template Safety | HTML templates have matching tags | Required |
| 4. Asset References | Referenced files actually exist | Required |
| 5. Corruption Patterns | Known bad patterns (empty functions, truncation) | Required |
| 6. Import/Export | Module references resolve | Recommended |
| 7. CSS Validation | CSS files parse correctly | Recommended |
npm install -D vitest acorn
import { parse } from 'acorn';
import { readFileSync } from 'fs';
test('app.js has valid syntax', () => {
const code = readFileSync('public/static/app.js', 'utf-8');
expect(() => parse(code, { ecmaVersion: 2022, sourceType: 'script' })).not.toThrow();
});
This single test would have prevented the March 2026 white-screen incident.
After ALL gates pass, update .cm/CONTINUITY.md:
verified or ready-to-deploy✅ Quality gate passed: [test count] tests, 0 failuresAfter ANY gate fails, FIRST run Memory Integrity Check:
.cm/meta-learnings.json if memory was the causeThen update .cm/CONTINUITY.md:
module:{failing-module} or global if systemicToken savings: Next session instantly knows if last run passed or failed without re-running the test suite just to check status.
| Skill | Relationship |
|---|---|
cm-safe-deploy | Quality gate is the primary blocker for the deploy pipeline |
cm-identity-guard | Verify identity before using quality gate to ship |
cm-tdd | TDD creates the logic for Layer 3 |
cm-safe-i18n | Leverages Layer 4 for parity checks |
cm-safe-deploy | PRE-REQUISITE for production: Security scan (Snyk + Aikido) PASS must be in deployment evidence. No production deploy without security clearance. |
| Evidence | Command | Required |
|---|---|---|
| Test suite passes | npm run test:gate | ✅ Always |
| Build succeeds | npm run build | ✅ Always |
| Security scan passes | snyk test && aikido-api-client scan-release ... | ✅ For production / public releases |
| i18n parity | Included in test:gate | ✅ If multilingual |
After all gates pass, compute a 0–100 score for the change:
cm quality score --mode WARNING
Components (each weighted): intent 30%, ownership 25%, context 20%, tests 15%, review 10%.
Inputs are derived automatically from .cm/handoff/{plan,exec,review,quality}.json when present, or can be overridden with --intent <0..1>, --ownership <0..1>, etc.
Modes:
OFF — silent (LITE projects)WARNING — print + advise (default; STANDARD projects)SOFT — warn loudly under 60 (PROFESSIONAL projects)FULL — exit 1 under 70 (ENTERPRISE projects, blocks deploy)The default mode follows the project tier from cm tier classify.
The gate is where "goal-driven execution" actually closes the loop:
Gate principle: weak criteria fail here, not in production. Reject "make it work" handoffs back to planning.
Test before deploy. Scan before release. Evidence before claims. Safety before shipping. Non-negotiable.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
44 skills in this plugin
/cm-ads-trackerEnd-to-end ad conversion tracking: Meta Pixel+CAPI, TikTok Events API, Google Ads Enhanced Conversions, GTM, attribution. Auto-detects industry, maps standard events, outputs a developer-ready implementation doc. Use for pixels, GTM, CAPI, ROAS, or 'set up tracking' requests./cm-autopilotEasy-to-use conversational CLI (Claude Code style) for non-technical users to spawn parallel AI tasks supervised by a visual web dashboard./cm-auto-publisherComprehensive publishing automation skill bridging AI agents (OpenClaw, Manus, Claude) to the Content Factory Router. Uses the Router API to publish markdown articles with rich media to any connected Astro site natively.npx claudepluginhub tody-agent/codymaster --plugin cmOther plugins' skills for the same job