Source profileQuality 85/100Review permissions

tody-agent/codymaster/.amp/skills/cm-safe-deploy/SKILL.md

cm-safe-deploy

Use when setting up deployment infrastructure for any project - establishes multi-gate deploy pipeline with test gates, build verification, frontend safety checks, and rollback strategy before code reaches production

Source repository stars
48
Declared platforms
0
Static risk flags
4
Last source update
2026-08-04
Source checked
2026-08-04

Decision brief

What it does—and where it fits

Use when setting up deployment infrastructure for any project - establishes multi-gate deploy pipeline with test gates, build verification, frontend safety checks, and rollback strategy before code reaches production

Best for

  • Setting up a new project's deployment infrastructure
  • A project has no test gate before deploy
  • Project deploys directly from git push

Not for

  • Tasks that require unconfirmed production actions or broad system permissions.
  • Environments where the pinned source and install steps cannot be inspected.

Compatibility matrix

Platform support, with evidence labels

PlatformStatusEvidenceWhat to check
CodexNot declaredNo explicit evidencePortability before use
Claude CodeNot declaredNo explicit evidencePortability before use
CursorNot declaredNo explicit evidencePortability before use
Gemini CLINot declaredNo explicit evidencePortability before use
Open the compatibility checker

Installation

Inspect first. Install second.

The source command is displayed only when detected. A safe inspection prompt is always available so your agent can explain every action before execution.

Source-detected install commandSource
npx skills add https://github.com/tody-agent/codymaster --skill ".amp/skills/cm-safe-deploy"
Safe inspection promptEditorial

Inspect the Agent Skill "cm-safe-deploy" from https://github.com/tody-agent/codymaster/blob/14cd03c9b12b3087494371e5ccef81005182dcaa/.amp/skills/cm-safe-deploy/SKILL.md at commit 14cd03c9b12b3087494371e5ccef81005182dcaa. List every install step, command, network request, credential, file read/write, external action, and rollback step. Explain whether it fits my task. Do not install or execute anything until I approve.

Workflow

What the source asks the agent to do

  1. 01

    Gate 4: Build Verification

    Production build must succeed without errors.

    Import resolution failuresTree-shaking errorsMissing environment variables
  2. 02

    Gate 5: Dist Asset Verification (NEW)

    [!IMPORTANT] The build can "succeed" but produce an incomplete dist/ directory. This gate catches missing critical assets.

    [!IMPORTANT] The build can "succeed" but produce an incomplete dist/ directory. This gate catches missing critical assets.
  3. 03

    Step 1: Create test infrastructure

    Review the “Step 1: Create test infrastructure” section in the pinned source before continuing.

    Review and apply the “Step 1: Create test infrastructure” source section.
  4. 04

    Step 2: Create package.json scripts

    Review the “Step 2: Create package.json scripts” section in the pinned source before continuing.

    Review and apply the “Step 2: Create package.json scripts” source section.
  5. 05

    Step 3: Add frontend safety tests

    REQUIRED SUB-SKILL: Follow cm-quality-gate to create test file with all layers.

    REQUIRED SUB-SKILL: Follow cm-quality-gate to create test file with all layers.

Permission review

Static risk signals and limitations

Runs scripts

medium · line 91

The documentation asks the agent to run terminal commands or scripts.

node -e "

Reads files

low · line 102

The documentation asks the agent to read local files, directories, or repositories.

const src = fs.readFileSync(wf, 'utf-8');

Reads files

low · line 116

The documentation asks the agent to read local files, directories, or repositories.

const gi = fs.readFileSync('.gitignore', 'utf-8');

Network access

medium · line 151

The documentation includes network, browsing, or remote request actions.

SUPABASE_URL=https://YOUR_PROJECT.supabase.co

Runs scripts

medium · line 159

The documentation asks the agent to run terminal commands or scripts.

git add .dev.vars.example

Network access

medium · line 404

The documentation includes network, browsing, or remote request actions.

STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://your-app.pages.dev)

Writes files

medium · line 472

The documentation asks the agent to create, modify, or delete local files.

*REQUIRED SUB-SKILL:** Follow `cm-quality-gate` to create test file with all layers.

Evidence record

Why each signal appears

EvidenceSourceComputedTestedEditorial
SignalValueEvidence typeMeaning
Quality score85/100ComputedDocumentation, specificity, maintenance, and trust rules
Repository stars48SourceRepository attention, not individual Skill quality
Compatibility0 platformsSourceDeclared in the catalog source record
Usage guideautomated source guideEditorialGenerated or reviewed according to the visible evidence level

Pinned source

Provenance and original SKILL.md

Repository
tody-agent/codymaster
Skill path
.amp/skills/cm-safe-deploy/SKILL.md
Commit
14cd03c9b12b3087494371e5ccef81005182dcaa
License
Not declared
Collected
2026-08-04
Default branch
main
View the original SKILL.md

Safe Deploy Pipeline v2

TL;DR

  • Use before/during deploying to staging or production
  • Multi-gate: secrets, build, stage, smoke, prod, rollback plan
  • Identity: verifies correct GitHub/Cloudflare/Supabase account
  • Next: cm-quality-gate (post-deploy)

Overview

A deploy without gates is a deploy with hope. Hope is not a strategy.

Core principle: Every project needs a multi-gate deploy pipeline. Code passes through syntax → tests → i18n → build → verify → deploy, with hard stops at each gate. No gate skipping. No "it'll be fine."

[!CAUTION] March 2026 Incident: 572 backend tests passed green while app.js had catastrophic syntax errors → white screen in production. This pipeline exists because test:gate alone was NOT enough.

The Iron Law

NO DEPLOY WITHOUT PASSING ALL GATES.
GATES ARE SEQUENTIAL. EACH MUST PASS BEFORE THE NEXT RUNS.
SYNTAX CHECK IS GATE 1. IF IT FAILS, NOTHING ELSE RUNS.

When to Use

ALWAYS when:

  • Setting up a new project's deployment infrastructure
  • A project has no test gate before deploy
  • Project deploys directly from git push
  • After a production incident caused by untested code
  • Adding CI/CD to an existing project

The 8-Gate Pipeline

digraph pipeline {
    rankdir=LR;
    gate0 [label="Gate 0\nSecret\nHygiene", shape=box, style=filled, fillcolor="#ffc0cb"];
    gate05 [label="Gate 0.5\nSecurity\nScan", shape=box, style=filled, fillcolor="#f0b3ff"];
    gate1 [label="Gate 1\nSyntax", shape=box, style=filled, fillcolor="#ffcccc"];
    gate2 [label="Gate 2\nTest\nSuite", shape=box, style=filled, fillcolor="#ffe0cc"];
    gate3 [label="Gate 3\ni18n\nParity", shape=box, style=filled, fillcolor="#e0ccff"];
    gate4 [label="Gate 4\nBuild", shape=box, style=filled, fillcolor="#ffffcc"];
    gate5 [label="Gate 5\nDist\nVerify", shape=box, style=filled, fillcolor="#ccffcc"];
    gate6 [label="Gate 6\nDeploy +\nSmoke", shape=box, style=filled, fillcolor="#cce5ff"];
    fail [label="STOP\nFix first", shape=box, style=filled, fillcolor="#ff9999"];

    gate0 -> gate05 [label="pass"];
    gate0 -> fail [label="fail"];
    gate05 -> gate1 [label="pass"];
    gate05 -> fail [label="fail"];
    gate1 -> gate2 [label="pass"];
    gate1 -> fail [label="fail"];
    gate2 -> gate3 [label="pass"];
    gate2 -> fail [label="fail"];
    gate3 -> gate4 [label="pass"];
    gate3 -> fail [label="fail"];
    gate4 -> gate5 [label="pass"];
    gate4 -> fail [label="fail"];
    gate5 -> gate6 [label="pass"];
    gate5 -> fail [label="fail"];
}

Gate 0: Secret Hygiene (FASTEST FAIL — < 0.5 seconds)

[!CAUTION] March 2026 Security Incident: SUPABASE_SERVICE_KEY was accidentally committed to wrangler.jsonc. This exposed a service-role key that bypasses Row Level Security in git history. Gate 0 prevents this from ever reaching the remote.

The Rule: Where Each Variable Lives

Variable TypeCorrect LocationWRONG Location
Supabase URL (public)wrangler.jsonc vars section❌ Hardcoded in code
SUPABASE_SERVICE_KEYCloudflare Secret (wrangler secret put)wrangler.jsonc
SUPABASE_ANON_KEYCloudflare Secretwrangler.jsonc
DB connection stringsCloudflare Secret❌ Anywhere in repo
Local dev secrets.dev.vars (gitignored)wrangler.jsonc
Build config (non-secret)wrangler.jsonc

Secret Hygiene Check (Enhanced — Repo-Wide):

Calls cm-secret-shield Layer 4 for deep scanning. Below is the essential check:

node -e "
const fs = require('fs');
const { execSync } = require('child_process');

// 1. Check wrangler config for secrets
const wranglerFiles = ['wrangler.jsonc', 'wrangler.toml', 'wrangler.json'];
const dangerous = ['SERVICE_KEY', 'ANON_KEY', 'DB_PASSWORD', 'SECRET_KEY', 'PRIVATE_KEY', 'API_SECRET'];
let failed = false;

for (const wf of wranglerFiles) {
  if (!fs.existsSync(wf)) continue;
  const src = fs.readFileSync(wf, 'utf-8');
  for (const key of dangerous) {
    // Check for actual values, not just variable names
    const valuePattern = new RegExp(key + '\\\\s*[=:]\\\\s*[\"\'][a-zA-Z0-9/+=]{20,}', 'g');
    if (valuePattern.test(src)) {
      console.error('❌ DANGEROUS: ' + wf + ' contains a ' + key + ' VALUE');
      console.error('  Fix: wrangler secret put ' + key + ' (then remove from ' + wf + ')');
      failed = true;
    }
  }
}

// 2. Check .gitignore has required patterns
if (fs.existsSync('.gitignore')) {
  const gi = fs.readFileSync('.gitignore', 'utf-8');
  const required = ['.env', '.dev.vars'];
  const missing = required.filter(r => !gi.includes(r));
  if (missing.length > 0) {
    console.error('❌ .gitignore missing: ' + missing.join(', '));
    failed = true;
  }
} else {
  console.error('❌ No .gitignore found!');
  failed = true;
}

// 3. Check .env files aren't tracked by git
try {
  const tracked = execSync('git ls-files', { encoding: 'utf-8' });
  const badFiles = ['.env', '.dev.vars', '.env.local', '.env.production'];
  const trackedBad = badFiles.filter(f => tracked.split('\\n').includes(f));
  if (trackedBad.length > 0) {
    console.error('❌ CRITICAL: Secret files tracked by git: ' + trackedBad.join(', '));
    console.error('   Fix: git rm --cached ' + trackedBad.join(' '));
    failed = true;
  }
} catch (e) { /* not a git repo */ }

if (failed) {
  console.error('\\n🛡️ Gate 0 FAILED. Fix issues above before deploying.');
  process.exit(1);
}
console.log('✅ Gate 0 passed: repo-wide secret hygiene verified');
"

Setup .dev.vars for local development:

# .dev.vars — local only, NEVER committed
SUPABASE_URL=https://YOUR_PROJECT.supabase.co
SUPABASE_SERVICE_KEY=YOUR_SERVICE_KEY

# Add to .gitignore:
echo ".dev.vars" >> .gitignore

# Commit the template:
cp .dev.vars .dev.vars.example  # Remove values first
git add .dev.vars.example

If secrets were already committed:

# Remove from git history (URGENT — do before pushing)
git filter-repo --path wrangler.jsonc --invert-paths  # Nuclear option
# OR just remove the value from wrangler.jsonc and add as secret:
wrangler secret put SUPABASE_SERVICE_KEY
# Then rotate the key immediately in Supabase dashboard

Gate 0.5: Security Scan (Snyk + Aikido — Parallel)

[!IMPORTANT] CodyMaster internal: This gate is MANDATORY. Both Snyk and Aikido must pass. User projects: This gate is SUGGESTED by default. Becomes MANDATORY if CVEs or risk flags were detected during development.

Run both scanners in parallel:

# Snyk — dependency vulnerabilities
snyk test

# Aikido — SAST + dependencies + secrets + IaC
aikido-api-client scan-release <repo> $(git rev-parse HEAD) \
  --minimum-severity-level="HIGH"

For CodyMaster (maximum strictness):

aikido-api-client scan-release <repo> $(git rev-parse HEAD) \
  --minimum-severity-level="HIGH" \
  --fail-on-sast-scan \
  --fail-on-secrets-scan

Gate decision:

  • Both pass → proceed to Gate 1
  • Either fails → STOP. Fix before continuing. Invoke cm-security-gate for remediation.

See cm-security-gate for full setup, flag reference, and remediation workflow.


Gate 1: Syntax Validation (FAST FAIL)

[!IMPORTANT] This gate runs in < 1 second and catches the EXACT class of errors that caused the March 2026 incident. Run it BEFORE the test suite (which takes 10-30s).

StackCommandWhat it checks
Vanilla JSnode -c path/to/app.jsJavaScript parse errors
TypeScriptnpx tsc --noEmitType errors + syntax
Pythonpython -m py_compile app.pyPython syntax
Gogo vet ./...Go static analysis

For frontend monoliths without TypeScript:

# Ultra-fast syntax check — fails in < 1s if broken
node -c public/static/app.js

Why separate from Gate 2?

  • node -c takes < 1 second. Test suite takes 10-30 seconds.
  • If syntax is broken, 100% of tests will fail anyway — but with confusing error messages.
  • A fast syntax check gives you the EXACT line number of the error instantly.

REQUIRED SUB-SKILL: Use cm-quality-gate for parser-based validation inside the test suite (Layer 1).


Gate 2: Test Suite

The test suite MUST include:

Test CategoryWhat it validatesPriority
Frontend safetyJS syntax, function integrity, corruption patternsCRITICAL
Backend APIRoutes return correct dataRequired
Business logicCalculations, rules, validationRequired
i18n syncTranslation key parity, orphaned keysRequired for multi-lang
IntegrationEnd-to-end workflowsRecommended

Setup the test:gate script:

{
  "scripts": {
    "test:gate": "vitest run --reporter=verbose"
  }
}

Gate decision:

IF 0 failures → proceed to Gate 3
IF any failures → STOP. Fix before continuing.

REQUIRED SUB-SKILL: Use cm-quality-gate for enforcement discipline.


Gate 3: i18n Parity Check (for multi-language projects)

[!NOTE] Skip this gate if the project does not have i18n. For projects with i18n, this gate catches what test suites can miss: key drift between languages that causes blank strings in production.

# All language files must have identical key counts
node -e "
const fs = require('fs');
const path = require('path');
const I18N_DIR = 'public/static/i18n';
const langs = ['vi','en','th','ph'];
const results = {};
let allMatch = true;

for (const lang of langs) {
  const filePath = path.join(I18N_DIR, lang + '.json');
  const data = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
  const flatKeys = JSON.stringify(data).split('\":').length - 1;
  results[lang] = flatKeys;
  console.log(lang + ': ' + flatKeys + ' keys');
}

const counts = Object.values(results);
if (new Set(counts).size !== 1) {
  console.error('❌ KEY PARITY FAILURE! Counts differ across languages.');
  console.error(JSON.stringify(results));
  process.exit(1);
} else {
  console.log('✅ Key parity: all languages have ' + counts[0] + ' keys');
}

// Check for null/empty values
let nullCount = 0;
for (const lang of langs) {
  const data = JSON.parse(fs.readFileSync(path.join(I18N_DIR, lang + '.json'), 'utf-8'));
  const check = (obj, prefix) => {
    for (const [k, v] of Object.entries(obj)) {
      if (k === '_meta') continue;
      if (typeof v === 'object' && v !== null) { check(v, prefix + '.' + k); continue; }
      if (v === null || v === undefined || v === '') {
        console.error('  ⚠ ' + lang + '.' + prefix + '.' + k + ' is null/empty');
        nullCount++;
      }
    }
  };
  check(data, lang);
}
if (nullCount > 0) {
  console.error('❌ Found ' + nullCount + ' null/empty translation values!');
  process.exit(1);
}
console.log('✅ No null/empty values');
"

What this catches:

  • Keys added to vi.json but forgotten in en.json → blank strings for English users
  • Null values from bad translation scripts → t() returns key name instead of translation
  • Key count drift between languages → inconsistent UX

Gate 4: Build Verification

Production build must succeed without errors.

npm run build

What this catches that tests don't:

  • Import resolution failures
  • Tree-shaking errors
  • Missing environment variables
  • Asset compilation failures
  • Bundle size explosions

Optional: Bundle size guard:

{
  "scripts": {
    "build:verify": "npm run build && node -e \"const s=require('fs').statSync('dist/_worker.js').size; if(s>2e6) {console.error('Bundle too large: '+s); process.exit(1)}\""
  }
}

Gate 5: Dist Asset Verification (NEW)

[!IMPORTANT] The build can "succeed" but produce an incomplete dist/ directory. This gate catches missing critical assets.

# Verify critical files exist in dist/
node -e "
const fs = require('fs');
const required = [
  'dist/_worker.js',
  'dist/static/app.js',
  'dist/static/style.css',
  'dist/static/i18n/vi.json',
  'dist/static/i18n/en.json',
  'dist/static/i18n/th.json',
  'dist/static/i18n/ph.json',
];
const missing = required.filter(f => !fs.existsSync(f));
if (missing.length > 0) {
  console.error('❌ Missing files in dist/:');
  missing.forEach(f => console.error('  ' + f));
  process.exit(1);
}
console.log('✅ All ' + required.length + ' critical files present in dist/');
"

Adapt required array to your project. At minimum, verify:

  • Worker/server entry point exists
  • Frontend JS/CSS files exist
  • Translation files are copied
  • Critical images/assets are present

Gate 6: Deploy + Post-Deploy Smoke Test

Only after Gates 1-5 pass.

Deploy command varies by platform:

PlatformCommand
Cloudflare Pagesnpx wrangler pages deploy dist/
Vercelnpx vercel --prod
Netlifynpx netlify deploy --prod

Post-deploy verification:

# Smoke test the deployed URL — must return 200
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://your-app.pages.dev)
if [ "$STATUS" != "200" ]; then
  echo "❌ POST-DEPLOY SMOKE TEST FAILED! Status: $STATUS"
  echo "⚠ Consider immediate rollback."
  exit 1
fi
echo "✅ Smoke test passed (HTTP $STATUS)"

Composing the Deploy Script

package.json (Recommended)

{
  "scripts": {
    "predeploy:syntax": "node -c public/static/app.js",
    "predeploy:i18n": "node scripts/check-i18n-parity.js",
    "predeploy:dist": "node scripts/verify-dist.js",
    "deploy": "npm run predeploy:syntax && npm run test:gate && npm run predeploy:i18n && npm run build && npm run predeploy:dist && YOUR_DEPLOY_COMMAND"
  }
}

Key insight: Chain gates with &&. If any gate fails, the chain stops immediately.


Rollback Protocol

When a deployment causes issues:

SeverityActionCommand
White screen (syntax)Revert last commit, redeploygit revert HEAD && npm run deploy
Broken translationsRevert JSON files, redeploygit checkout HEAD~1 -- public/static/i18n/*.json && npm run deploy
API errorRevert server code, redeploygit revert HEAD && npm run deploy
Partial breakageCherry-pick fix, deployFix → test → deploy

Cloudflare Pages specific:

# Rollback to previous deployment
wrangler pages deployments list --project-name prms
wrangler pages deployment rollback <deployment-id> --project-name prms

Setting Up for a New Project

Step 1: Create test infrastructure

npm install -D vitest acorn

Step 2: Create package.json scripts

{
  "scripts": {
    "test:gate": "vitest run --reporter=verbose",
    "build": "YOUR_BUILD_COMMAND",
    "deploy": "node -c public/static/app.js && npm run test:gate && npm run build && YOUR_DEPLOY_COMMAND"
  }
}

Step 3: Add frontend safety tests

REQUIRED SUB-SKILL: Follow cm-quality-gate to create test file with all layers.

Step 4: Create deploy workflow

Create .agents/workflows/deploy.md.


Red Flags — STOP

  • ❌ Deploying without running test:gate
  • ❌ Skipping syntax check ("tests will catch it")
  • ❌ Skipping build step ("tests passed so it'll build")
  • ❌ Running tests and deploy in parallel
  • ❌ "Tests passed last time" (run them NOW)
  • ❌ "Only changed one file" (test everything)
  • ❌ No frontend safety tests for JS projects
  • ❌ No dist/ verification after build
  • ❌ No post-deploy smoke test
  • ❌ No i18n parity check for multi-language apps

Rationalization Table

ExcuseReality
"Tests passed earlier"Code changed since then. Run fresh.
"Build always works"Until it doesn't. 30 seconds to verify.
"It's a one-line change"One line broke 600 lines of app.js. Test it.
"CI will catch it"CI runs AFTER push. Catch BEFORE push.
"Just a hotfix"Hotfixes need MORE testing, not less.
"Syntax check is redundant"node -c takes 0.5s and prevented the March 2026 disaster.
"i18n parity is overkill"Missing keys → blank strings in production.
"dist/ is always complete"Build tools can silently skip assets. Check.

Integration with Other Skills

SkillWhen
cm-quality-gateSetting up Gate 2 frontend tests and Test Gate
cm-secret-shieldGate 0 calls Secret Shield Layer 4 for deep scanning
cm-safe-i18nAdding i18n-specific gates
cm-terminalMonitoring gate commands
cm-identity-guardGate 0 verifies deploy identity

The Bottom Line

6 gates. Sequential. Each must pass. No exceptions.

Syntax → Tests → i18n → Build → Dist Verify → Deploy + Smoke.

This is non-negotiable.

Alternatives

Compare before choosing

Computed 9532,606

K-Dense-AI/scientific-agent-skills

simpy

Build, inspect, test, and analyze bounded process-based discrete-event simulations with SimPy, including events, resources, interrupts, monitoring, replications, warm-up, and reproducible output analysis.

Computed 9410,895

huggingface/skills

hf-cloud-sagemaker-production-defaults

Create a SageMaker endpoint (real-time, real-time scale-to-zero, or async) with autoscaling, CloudWatch alarms, and tagging enabled by default. Use this skill whenever about to create a SageMaker endpoint, write deployment code that calls `create_endpoint`, or finalize a deployment after the image URI and IAM role are known. Provides deploy.py for real-time endpoints, deploy_ic.py for real-time endpoints that scale to zero instances via inference components, and deploy_async.py for async endpoin

Computed 9482

aAAaqwq/AGI-Super-Team

trade-prediction-markets

Build and test Polymarket prediction market trading strategies for YES/NO token trading. Provides 6 tools: get_all_prediction_events (browse markets, $0.001), get_prediction_market_data (analyze price history, $0.001), create_prediction_market_strategy (generate code, $1-$4.50), run_prediction_market_backtest (test performance, $0.001). Trade on real-world events (politics, economics, sports, crypto). Currently simulation only (live deployment coming soon).

Computed 9337,425

github/awesome-copilot

flowstudio-power-automate-build

Build, scaffold, and deploy Power Automate cloud flows using the FlowStudio MCP server. Your agent constructs flow definitions, wires connections, deploys, and tests — all via MCP without opening the portal. Load this skill when asked to: create a flow, build a new flow, deploy a flow definition, scaffold a Power Automate workflow, construct a flow JSON, update an existing flow's actions, patch a flow definition, add actions to a flow, wire up connections, or generate a workflow definition from