validate

A command that validates the entire `ai-dev-standards` codebase through code-quality checks, tests, and end-to-end testing.

In plain words
What is it for?
Use it before delivery or after changes to run the project’s full validation process.
Why use it?
It checks both the implementation and the user-facing result, while reporting failures and timing information.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/daffy0208/ai-dev-standards/validate
Clone the repo
git clone --depth 1 https://github.com/daffy0208/ai-dev-standards

Made for: Claude Code.

Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 24,307 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.24307
Opus 5 $0.00000 $0.12153
Sonnet 5 $0.00000 $0.04861
Haiku 4.5 $0.00000 $0.02431

Measured 3d ago against content hash 423befa59446, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

validate scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

rm -rf dist/ build/ .cache/ node_modules/.cache/
.claude/commands/validate.md · 3,020 lines

How it starts

The opening of the file, as written. The whole thing — 3,020 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Ultimate Validation Command

Run comprehensive validation of the entire ai-dev-standards codebase. This command validates code quality, runs all tests, and performs end-to-end testing that ensures the application works exactly as a user would experience it.

Initialization

# Start timing for comprehensive validation report
VALIDATION_START_TIME=$(date +%s)
echo ""
echo "🚀 Starting Comprehensive Validation Process..."
echo "⏱️  Start Time: $(date '+%Y-%m-%d %H:%M:%S')"
echo ""

# Check for continue-on-failure mode (for testing Wave 2 features)
if [ "$VALIDATION_CONTINUE_ON_FAILURE" = "true" ]; then
  echo "⚠️  VALIDATION_CONTINUE_ON_FAILURE=true detected"
  echo "   Running in TEST MODE - will continue past failures"
  echo "   This mode is for verifying Wave 2 features only"
  echo "   Production validation requires all phases to pass"
  echo ""
fi

Helper Functions - Self-Correction Mechanisms

These helper functions provide automatic retry logic, error categorization, and auto-healing capabilities to make validation robust against transient failures.

###############################################################################
# retry_with_backoff: Retry a command with exponential backoff
# Usage: retry_with_backoff <max_attempts> <command>
# Example: retry_with_backoff 3 "npm install"
###############################################################################
retry_with_backoff() {
  local max_attempts=$1
  shift
  local command="$@"
  local attempt=1
  local timeout=2
  local exit_code=0

  while [ $attempt -le $max_attempts ]; do
    echo "  Attempt $attempt/$max_attempts: Running command..."

    # Execute command and capture exit code
    eval "$command"
    exit_code=$?

    # Success - return immediately
    if [ $exit_code -eq 0 ]; then
      if [ $attempt -gt 1 ]; then
        echo "  ✅ Command succeeded on attempt $attempt"
      fi
      return 0
    fi

    # Failed - check if we should retry
    if [ $attempt -lt $max_attempts ]; then
      echo "  ⚠️  Attempt $attempt failed (exit code: $exit_code), retrying in ${timeout}s..."
      sleep $timeout
      timeout=$((timeout * 2))  # Exponential backoff: 2s, 4s, 8s
    fi

    attempt=$((attempt + 1))
  done

  # All attempts failed
  echo "  ❌ Command failed after $max_attempts attempts (exit code: $exit_code)"
  return $exit_code
}

###############################################################################
# categorize_error: Determine if an error is fatal or recoverable
# Usage: categorize_error <exit_code> <error_output>
# Returns: "FATAL" or "RECOVERABLE"
###############################################################################
categorize_error() {
  local exit_code=$1
  local error_output="$2"

  # Fatal error patterns
  if echo "$error_output" | grep -qi "ENOSPC\|disk.*full\|no space"; then
    echo "FATAL: Disk space exhausted"
    return 1
  fi

  if echo "$error_output" | grep -qi "EACCES\|permission denied"; then
    echo "FATAL: Permission denied"
    return 1
  fi

  if echo "$error_output" | grep -qi "MODULE_NOT_FOUND\|Cannot find module"; then
    echo "RECOVERABLE: Missing dependencies (run npm install)"
    return 0
  fi

  if echo "$error_output" | grep -qi "ECONNREFUSED\|ETIMEDOUT\|network"; then
    echo "RECOVERABLE: Network connectivity issue"
    return 0
  fi

  if echo "$error_output" | grep -qi "rate limit\|429"; then
    echo "RECOVERABLE: API rate limit (retry with backoff)"
    return 0
  fi

  # Default categorization based on exit code
  if [ $exit_code -eq 1 ]; then
    echo "RECOVERABLE: Generic failure (exit code 1)"
    return 0
  elif [ $exit_code -ge 128 ]; then
    echo "FATAL: Signal termination (exit code $exit_code)"
    return 1
  else
    echo "RECOVERABLE: Unknown error (exit code $exit_code)"
    return 0
  fi
}

###############################################################################
# auto_heal: Attempt automatic fixes for common failures
# Usage: auto_heal <error_type> <context>
# Returns: 0 if healing attempted, 1 if no healing available
###############################################################################
auto_heal() {
  local error_type="$1"
  local context="$2"

  case "$error_type" in
    "missing_dependencies")
      echo "  🔧 Auto-healing: Installing dependencies..."
      npm install > /dev/null 2>&1
      if [ $? -eq 0 ]; then
        echo "  ✅ Dependencies installed successfully"
        return 0
      else
        echo "  ❌ Failed to install dependencies"
        return 1
      fi
      ;;

    "stale_build")
      echo "  🔧 Auto-healing: Cleaning and rebuilding..."
      rm -rf dist/ build/ .cache/ node_modules/.cache/
      npm run build > /dev/null 2>&1
      if [ $? -eq 0 ]; then
        echo "  ✅ Clean rebuild successful"
        return 0
      else
        echo "  ❌ Rebuild failed"
        return 1
      fi
      ;;

    "docker_network")
      echo "  🔧 Auto-healing: Recreating Docker network..."
      docker network prune -f > /dev/null 2>&1
      sleep 2
      echo "  ✅ Docker network cleaned"
      return 0
      ;;

    "github_api_rate_limit")
      echo "  🔧 Auto-healing: Waiting for GitHub API rate limit reset..."
      RESET_TIME=$(gh api rate_limit --jq '.rate.reset' 2>/dev/null)
      if [ ! -z "$RESET_TIME" ]; then
        CURRENT_TIME=$(date +%s)
        WAIT_TIME=$((RESET_TIME - CURRENT_TIME + 10))
        if [ $WAIT_TIME -gt 0 ] && [ $WAIT_TIME -lt 300 ]; then
          echo "  ⏳ Waiting ${WAIT_TIME}s for rate limit reset..."
          sleep $WAIT_TIME
          echo "  ✅ Rate limit should be reset now"
          return 0
        fi
      fi
      echo "  ⚠️  Unable to determine rate limit reset time"
      return 1
      ;;

    "port_conflict")
      echo "  🔧 Auto-healing: Killing processes on conflicting ports..."
      # Common test ports: 3000, 5173, 8080
      lsof -ti:3000,5173,8080 | xargs kill -9 2>/dev/null
      sleep 1
      echo "  ✅ Port conflicts cleared"
      return 0
      ;;

    *)
      echo "  ℹ️  No auto-healing available for: $error_type"
      return 1
      ;;
  esac
}

###############################################################################
# validate_prerequisites: Check and auto-heal missing prerequisites
###############################################################################
validate_prerequisites() {
  echo "🔍 Validating prerequisites..."
  local missing_prereqs=0

  # Check Node.js
  if ! command -v node &> /dev/null; then
    echo "  ❌ Node.js not installed"
    missing_prereqs=$((missing_prereqs + 1))
  else
    echo "  ✅ Node.js installed: $(node --version)"
  fi

  # Check npm
  if ! command -v npm &> /dev/null; then
    echo "  ❌ npm not installed"
    missing_prereqs=$((missing_prereqs + 1))
  else
    echo "  ✅ npm installed: $(npm --version)"
  fi

  # Check dependencies
  if [ ! -d "node_modules" ]; then
    echo "  ⚠️  node_modules missing - attempting auto-heal..."
    auto_heal "missing_dependencies" ""
    if [ $? -ne 0 ]; then
      missing_prereqs=$((missing_prereqs + 1))
    fi
  else
    echo "  ✅ Dependencies installed"
  fi

  # Check jq (required for JSON operations)
  if ! command -v jq &> /dev/null; then
    echo "  ⚠️  jq not installed (required for validation)"
    echo "     Install with: brew install jq (Mac) or apt install jq (Linux)"
    missing_prereqs=$((missing_prereqs + 1))
  else
    echo "  ✅ jq installed"
  fi

  echo ""

  if [ $missing_prereqs -gt 0 ]; then
    echo "❌ $missing_prereqs prerequisite(s) missing or failed to auto-heal"
    echo "   Please install missing prerequisites and try again"
    return 1
  fi

  echo "✅ All prerequisites validated"
  echo ""
  return 0
}

# Run prerequisite validation before starting phases
validate_prerequisites
if [ $? -ne 0 ]; then
  exit 1
fi

Read the full file on GitHub · 3,020 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 3,020 lines · 0 tokens per session scan C 423befa59446

Subscribe to this mod's changes

validate is a command published in the GitHub repository daffy0208/ai-dev-standards (36 stars, last pushed 8mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 24,307 tokens. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.