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
76324 skills9 agents24 commands
Install
$ npx -y skills add alirezarezvani/claude-code-tresor --agent claude-code

How it fires

How this command gets triggered: by you, by Claude, or both.

  • Fires itselfClaude auto-loads it when your prompt matches the work.
  • You can call itInvoke it directly when you want it.
  • Slash command/deploy-validate

Context preview

What this command does when you run it.

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

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
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.

Get the whole plugin