ai-dev-standards: Command for Claude Code

.claude/commands/validate.md

validate is a command for Claude Code from daffy0208/ai-dev-standards. It costs 0 tokens per session (24,307 once invoked), scanned C, original, MIT.

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

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths; positional $N argument.

This is daffy0208/ai-dev-standards's own configuration. It tells Claude Code how to work on ai-dev-standards itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ai-dev-standards configures →

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is cd ../...

Reuse

Borrowing it

Nothing to install: this file belongs to daffy0208/ai-dev-standards. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/daffy0208/ai-dev-standards/main/.claude/commands/validate.md
Clone the repo
git clone --depth 1 https://github.com/daffy0208/ai-dev-standards

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for validate

README.md
[![agentmods](https://agentmods.dev/badge/commands/daffy0208/ai-dev-standards/validate/github.svg)](https://agentmods.dev/commands/daffy0208/ai-dev-standards/validate)
Your own site
<a href="https://agentmods.dev/commands/daffy0208/ai-dev-standards/validate"><img src="https://agentmods.dev/badge/commands/daffy0208/ai-dev-standards/validate/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for validate

Your own site · 80×15
<a href="https://agentmods.dev/commands/daffy0208/ai-dev-standards/validate"><img src="https://agentmods.dev/badge/commands/daffy0208/ai-dev-standards/validate.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.24307
Opus 5.5 $0.00000 $0.09723
Sonnet 5.5 $0.00000 $0.04861
Haiku 4.5 $0.00000 $0.02431

Measured 1mo ago against content hash 423befa59446, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, 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 1mo 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. 1mo 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 (38 stars, last pushed 10mo 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.