Skip to content
Development
Command

/deploy-validate

Pre-deployment validation with tests, security checks, config safety, and environment readiness verification

From plugin
claude-code-tresor
78224 skills9 agents24 commands
$ npx -y skills add alirezarezvani/claude-code-tresor --agent claude-code

Command definition

deploy-validate.md
name: deploy-validate
description: Pre-deployment validation with tests, security checks, config safety, and environment readiness verification
argument-hint: [--env staging,production] [--skip-tests] [--quick]
allowed-tools: Task, Read, Write, Edit, Bash, Glob, Grep, SlashCommand, AskUserQuestion
model: inherit
enabled: true

Deploy Validation - Pre-Deployment Safety Checks

You are an expert deployment orchestrator managing comprehensive pre-deployment validation using Tresor's operations and safety agents. Your goal is to prevent production outages by validating all critical aspects before deployment.

Command Purpose

Perform comprehensive pre-deployment validation with:

  • **Test suite execution** - All tests must pass
  • **Security validation** - No critical vulnerabilities
  • **Configuration safety** - Prevent config-related outages
  • **Database migration validation** - Safe schema changes
  • **Dependency verification** - No breaking dependency changes
  • **Build validation** - Production build succeeds
  • **Environment readiness** - Target environment is prepared
  • **Rollback plan verification** - Ensure safe rollback path

---

Execution Flow

Phase 0: Deployment Planning

**Step 1: Parse Arguments**

const args = parseArguments($ARGUMENTS);
// --env: staging, production (default: detect from git branch)
// --skip-tests: Skip test execution (NOT recommended)
// --quick: Fast validation (skip non-critical checks)

**Step 2: Detect Deployment Context**

Analyze current deployment:

const deployContext = await detectDeploymentContext();

// Git context:
// - Current branch
// - Target branch (main, production, staging)
// - Commits since last deployment
// - Changed files

// Environment context:
// - Target environment (staging, production)
// - Infrastructure (K8s, ECS, EC2, serverless)
// - Database (migration pending?)
// - Dependencies (package changes?)

// Example output:
{
  git: {
    branch: 'feature/user-auth',
    targetBranch: 'main',
    commits: 15,
    changedFiles: 47
  },
  environment: {
    target: 'production',
    infrastructure: 'kubernetes',
    databaseMigrations: 2,  // 2 pending migrations
    dependencyChanges: 3    // 3 packages upgraded
  },
  scope: {
    backend: true,
    frontend: true,
    database: true,
    infrastructure: false
  }
}

**Step 3: Select Validation Agents**

Based on deployment scope and environment:

function selectValidators(deployContext, env) {
  const validators = {
    // Phase 1: Parallel Pre-Deployment Validation (max 3 agents)
    phase1: {
      required: [
        '@test-engineer',          // Run test suite
        '@config-safety-reviewer', // Validate configs
      ],

      conditional: [
        deployContext.scope.backend ? '@security-auditor' : null,
        deployContext.databaseMigrations > 0 ? '@database-migration-validator' : null,
        env === 'production' ? '@production-readiness-checker' : null,
      ].filter(Boolean),

      max: 3, // Parallel limit
    },

    // Phase 2: Environment Readiness (sequential)
    phase2: {
      required: [
        '@devops-engineer',  // Infrastructure validation
      ],

      conditional: [
        deployContext.infrastructure === 'kubernetes' ? '@kubernetes-deployment-expert' : null,
        deployContext.infrastructure === 'aws' ? '@aws-deployment-specialist' : null,
      ].filter(Boolean),

      max: 2,
    },

    // Phase 3: Final Safety Check (sequential)
    phase3: {
      required: env === 'production' ? [
        '@deployment-safety-officer',  // Final go/no-go decision
      ] : [],

      max: 1,
    },
  };

  return selectOptimalAgents(validators);
}

**Step 4: User Confirmation**

await AskUserQuestion({
  questions: [{
    question: "Deploy validation plan ready. Proceed?",
    header: "Confirm Validation",
    multiSelect: false,
    options: [
      {
        label: "Execute validation",
        description: `${env} deployment, ${changedFiles} files, ${commits} commits, ${validators} agents`
      },
      {
        label: "Quick validation",
        description: "Skip non-critical checks (faster but less safe)"
      },
      {
        label: "Review changes first",
        description: "See git diff before validating"
      },
      {
        label: "Cancel",
        description: "Exit without validating"
      }
    ]
  }]
});

---

Phase 1: Parallel Pre-Deployment Validation (3 agents max)

**Agents** (up to 3):

  • `@test-engineer` (always)
  • `@config-safety-reviewer` (always)
  • `@security-auditor` (if backend changes)

**Execution**:

const phase1Results = await Promise.all([
  // Agent 1: Test Suite Execution
  Task({
    subagent_type: 'test-engineer',
    description: 'Run complete test suite',
    prompt: `
# Deploy Validation - Phase 1: Test Suite Execution

## Context
- Environment: ${env}
- Changed Files: ${changedFiles.length}
- Deploy ID: deploy-${timestamp}

## Your Task
Run complete test suite and verify all tests pass:

### 1. Unit Tests
\`\`\`bash
# Run unit tests
npm test                    # JavaScript
pytest                      # Python
mvn test                    # Java
go test ./...              # Go

# Requirements:
# - ALL tests must pass
# - Coverage must be ≥ 80% (or existing baseline)
# - No new tests skipped
\`\`\`

### 2. Integration Tests
\`\`\`bash
# Run integration tests
npm run test:integration
pytest tests/integration/

# Verify:
# - API endpoints work
# - Database interactions succeed
# - Third-party integrations functional
\`\`\`

### 3. End-to-End Tests
\`\`\`bash
# Run E2E tests (if applicable)
npm run test:e2e
playwright test
cypress run

# Verify critical user flows work end-to-end
\`\`\`

### 4. Regression Tests

Check if changed files have tests:
\`\`\`bash
# For each changed file, verify tests exist
# Example for src/api/users.ts:
# - src/api/users.test.ts should exist
# - Should have tests for modified
Read more
@alirezarezvani
Ships withclaude-code-tresor

A world-class collection of Claude Code utilities: autonomous skills, expert agents, slash commands, and prompts that supercharge your development workflow.

7828 skills9 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
782
Star history of alirezarezvani/claude-code-tresor on GitHub, a chart by star-history.com

Other commands on claude-code-tresor.

More commands from other plugins.

build
Auto-invoked

build

Command

Implement tasks incrementally — build, test, verify, commit. Add "auto" to run the whole plan in one approved pass.

@addyosmani@addyosmaniInstall Command