VDK Docs
CLI

CLI Examples

Real-world examples of VDK CLI commands for common development scenarios and project types

Command Examples

This page provides real-world examples of VDK CLI commands for common development scenarios and project types.

Getting Started Examples

Initialize New Project

# Basic initialization
vdk init

# Initialize with specific IDE
vdk init --claude-code

# Initialize with custom output path
vdk init --outputPath ./ai-rules

# Initialize with deep scanning
vdk init --deep --verbose

Quick Setup Workflow

# Complete setup for Next.js project
vdk init --claude-code --deep
vdk integrations --setup cursor
vdk deploy --team frontend-team

Project Type Examples

React + TypeScript SPA

# Initial setup
cd my-react-app
vdk init --projectPath . --outputPath ./.ai/rules

# Setup IDE integrations
vdk integrations --scan
vdk integrations --setup claude-code
vdk integrations --setup cursor

# Check results
vdk status
ls -la .ai/rules/

Generated Structure:

my-react-app/
├── .ai/rules/
│   ├── react-patterns.md
│   ├── typescript-conventions.md
│   ├── component-architecture.md
│   └── testing-guidelines.md
├── CLAUDE.md
├── .cursor/rules/
└── vdk.config.json

Next.js Full-Stack Application

# Deep scan for comprehensive analysis
vdk init --deep --claude-code --watch

# Custom ignore patterns for Next.js
vdk init \
  --ignorePattern "**/.next/**" \
  --ignorePattern "**/dist/**" \
  --ignorePattern "**/node_modules/**" \
  --use-gitignore

# Deploy to hub for team collaboration
vdk deploy --project-name "ecommerce-platform" --team "fullstack-team"

Typical Output:

🔍 Scanning project at: /Users/dev/nextjs-ecommerce
📁 Detected project structure...
🔧 Technology Analysis:
   - Framework: Next.js 15 (App Router)
   - Language: TypeScript
   - Database: PostgreSQL + Prisma
   - Styling: Tailwind CSS
   - Authentication: NextAuth.js

🎯 Pattern Detection:
   - Architecture: App Router + Server Components
   - Patterns: Repository Pattern, Custom Hooks
   - API: REST + Server Actions

📝 Generated 18 AI rules in .ai/rules/
✅ VDK configuration created
🔧 Claude Code integration configured
✅ Deployed to VDK Hub: https://vdk.tools/projects/ecommerce-platform

Node.js API Server

# Focus on backend patterns
vdk init \
  --projectPath ./src \
  --ignorePattern "**/tests/**" \
  --ignorePattern "**/*.test.js"

# Setup for VS Code + GitHub Copilot
vdk integrations --setup github-copilot

# Example configuration for Express API
cat > vdk.config.json << 'EOF'
{
  "project": {
    "name": "user-api",
    "type": "api",
    "framework": "express"
  },
  "scanner": {
    "includePatterns": [
      "src/**/*.ts",
      "routes/**/*.ts",
      "middleware/**/*.ts"
    ],
    "analyzers": {
      "node": { "version": "18+" },
      "express": { "routeAnalysis": true }
    }
  }
}
EOF

vdk init --overwrite

Python Django Project

# Initialize for Python project
vdk init --projectPath . --deep

# Custom patterns for Django
vdk init \
  --ignorePattern "**/migrations/**" \
  --ignorePattern "**/__pycache__/**" \
  --ignorePattern "**/venv/**"

# Check detected patterns
vdk status --verbose

Integration Examples

Claude Code Setup

# Basic Claude Code setup
vdk integrations --setup claude-code

# Advanced Claude Code setup with custom memory
vdk claude-code --setup --update-memory

# Enable watch mode for continuous updates
vdk init --claude-code --watch

# Update memory after major changes
vdk claude-code --update-memory

# Check Claude Code status
vdk claude-code --check

Generated Files:

├── CLAUDE.md                    # Project memory
├── .claude/
│   ├── settings.json           # Claude Code settings
│   └── commands/
│       ├── vdk-analyze.md      # Custom slash command
│       ├── vdk-refresh.md      # Refresh rules command
│       └── vdk-deploy.md       # Deploy command

Multi-IDE Setup

# Setup multiple IDEs simultaneously
vdk integrations --setup claude-code
vdk integrations --setup cursor
vdk integrations --setup windsurf

# Check all integration statuses
vdk integrations --list

# Scan for newly installed IDEs
vdk integrations --scan

# Setup all detected IDEs
vdk integrations --setup-all

Cursor Advanced Setup

# Setup Cursor with custom configuration
vdk integrations --setup cursor

# Validate Cursor MDC files
vdk validate --ide cursor

# Generate Cursor-specific rules
cat > .cursor/custom-rules.mdc << 'EOF'
---
title: "Custom Project Rules"
schema: "cursor-mdc-v1"
---

# Custom Rules

<cursor:context>
This project uses a custom architecture pattern.
</cursor:context>

<cursor:rules>
- Always use our custom error handling utility
- Follow the established API response format
- Use our custom logging system
</cursor:rules>
EOF

Hub Integration Examples

Team Collaboration

# Initial team setup
vdk deploy --team "frontend-team" --project-name "design-system"

# Team member joining project
vdk update
vdk integrations --sync-all

# Check for team updates
vdk status
vdk hub status --team "frontend-team"

# Sync specific rules
vdk update --rules "react-patterns,typescript-conventions"

Rule Sharing Workflow

# Developer A: Create and share rules
vdk init --deep
vdk deploy --team "backend-team" --description "Node.js API patterns"

# Developer B: Get shared rules
vdk update --team "backend-team"
vdk integrations --setup claude-code

# Developer C: Contribute improvements
vdk init --overwrite
vdk deploy --team "backend-team" --description "Added GraphQL patterns"

Hub Management

# List available rules in hub
vdk hub list

# Search for specific patterns
vdk hub search --technology "nextjs" --pattern "app-router"

# Download specific rule
vdk hub download --rule "nextjs-app-router-patterns"

# Check hub connectivity
vdk hub ping

# View hub statistics
vdk hub analytics --project "my-project"

Development Workflow Examples

Daily Development

# Morning routine: update rules and sync
vdk update
vdk claude-code --update-memory

# After adding new dependencies
npm install @tanstack/react-query
vdk init --overwrite

# Before major refactoring
vdk init --deep --overwrite
vdk claude-code --update-memory

# End of day: share changes
git add .ai/ CLAUDE.md .cursor/
git commit -m "Update VDK rules with new patterns"

Feature Development Workflow

# 1. Start new feature branch
git checkout -b feature/user-dashboard

# 2. Update rules for new context
vdk init --overwrite

# 3. Work on feature with AI assistance
# (AI now understands the updated project state)

# 4. Before code review, update rules
vdk init --overwrite
vdk validate

# 5. Deploy updated rules for team
vdk deploy --description "Added user dashboard patterns"

Onboarding New Team Members

# New team member setup script
#!/bin/bash

echo "Setting up VDK for project..."

# Install VDK CLI
npm install -g @vibe-dev-kit/cli

# Navigate to project
cd /path/to/project

# Get latest rules from team
vdk update --team "our-team"

# Setup preferred IDE
read -p "Which IDE do you use? (claude-code/cursor/windsurf): " ide
vdk integrations --setup $ide

# Verify setup
vdk status
vdk integrations --scan

echo "VDK setup complete! Your AI assistant now understands this project."

Troubleshooting Examples

Common Issues

# Issue: Scanner timeout on large project
vdk init --timeout 300000 --batchSize 50

# Issue: Memory problems
export NODE_OPTIONS="--max-old-space-size=4096"
vdk init --stream-processing

# Issue: Permission errors
sudo chown -R $USER:$USER .ai/
chmod -R u+w .ai/

# Issue: Hub connection problems
vdk hub ping
export VDK_HUB_URL="https://backup.vdk.tools"
vdk update

Debug Mode Examples

# Enable comprehensive debugging
export VDK_DEBUG=true
vdk init --verbose

# Debug specific components
export VDK_DEBUG_SCANNER=true
export VDK_DEBUG_INTEGRATIONS=true
vdk init

# Debug integration issues
VDK_DEBUG=true vdk integrations --setup claude-code

# Save debug output
VDK_DEBUG=true vdk init 2>&1 | tee debug.log

Validation and Repair

# Validate all rules
vdk validate

# Validate specific rule file
vdk validate --file .ai/rules/react-patterns.md

# Fix common issues
vdk rules fix

# Repair corrupted configuration
vdk config validate
vdk config fix

# Reset and regenerate everything
rm -rf .ai/ CLAUDE.md .cursor/
vdk init --overwrite

Advanced Examples

Custom Templates

# Create custom template directory
mkdir -p ~/.vdk/templates/my-company

# Create custom template
cat > ~/.vdk/templates/my-company/react-component.md << 'EOF'
# React Component Guidelines

## Company Standards
- Use our custom design system
- Follow accessibility guidelines (WCAG 2.1)
- Include proper error boundaries
- Use our custom hooks for data fetching

## Example Component
```typescript
import { useCompanyHook } from '@company/hooks';
import { CompanyButton } from '@company/design-system';

interface Props {
  title: string;
}

export default function MyComponent({ title }: Props) {
  const { data, loading, error } = useCompanyHook();
  
  if (loading) return <LoadingSpinner />;
  if (error) return <ErrorBoundary error={error} />;
  
  return (
    <div className="company-component">
      <h1>{title}</h1>
      <CompanyButton>Action</CompanyButton>
    </div>
  );
}

EOF

Use custom template

vdk init --template my-company/react-component


### CI/CD Integration

```bash
# GitHub Actions workflow
cat > .github/workflows/vdk-update.yml << 'EOF'
name: Update VDK Rules
on:
  push:
    branches: [main]
    paths: ['package.json', 'src/**', 'app/**']

jobs:
  update-vdk:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
      - name: Install VDK CLI
        run: npm install -g @vibe-dev-kit/cli
      - name: Update VDK rules
        run: vdk init --overwrite
      - name: Deploy to hub
        env:
          VDK_HUB_TOKEN: ${{ secrets.VDK_HUB_TOKEN }}
        run: vdk deploy --team "our-team"
      - name: Commit changes
        run: |
          git config --local user.email "action@github.com"
          git config --local user.name "GitHub Action"
          git add .ai/ CLAUDE.md .cursor/
          git diff --staged --quiet || git commit -m "🤖 Update VDK rules"
          git push
EOF

Monorepo Setup

# Setup VDK for monorepo
cd monorepo-root

# Initialize each package
for package in packages/*; do
  echo "Setting up VDK for $package"
  cd $package
  vdk init --projectPath . --outputPath ./.ai/rules
  cd ..
done

# Create root-level rules
vdk init --projectPath . --outputPath ./.ai/shared-rules

# Deploy all packages
for package in packages/*; do
  cd $package
  vdk deploy --project-name "monorepo-$(basename $package)"
  cd ..
done

Performance Optimization

# Large codebase optimization
vdk init \
  --ignorePattern "**/node_modules/**" \
  --ignorePattern "**/dist/**" \
  --ignorePattern "**/*.test.*" \
  --ignorePattern "**/coverage/**" \
  --ignorePattern "**/.git/**" \
  --batchSize 50 \
  --timeout 300000

# Incremental scanning for active development
vdk init --incremental --watch

# Memory-optimized scanning
export NODE_OPTIONS="--max-old-space-size=8192"
vdk init --stream-processing --batchSize 25

Project-Specific Examples

E-commerce Platform

# E-commerce specific setup
vdk init --deep --claude-code

# Custom configuration for e-commerce
cat > vdk.config.json << 'EOF'
{
  "project": {
    "name": "ecommerce-platform",
    "type": "web-application",
    "domain": "e-commerce"
  },
  "scanner": {
    "includePatterns": [
      "src/components/**/*.tsx",
      "src/pages/**/*.tsx",
      "src/api/**/*.ts",
      "src/lib/**/*.ts"
    ],
    "patternDetection": {
      "business": ["shopping-cart", "payment", "inventory"]
    }
  }
}
EOF

vdk init --overwrite

Design System

# Design system setup
vdk init \
  --projectPath ./packages/design-system \
  --outputPath ./.ai/design-rules

# Focus on component patterns
vdk init \
  --includePattern "src/components/**/*.tsx" \
  --includePattern "src/tokens/**/*.ts" \
  --deep

API Gateway

# Microservices API gateway
vdk init \
  --projectPath ./services \
  --ignorePattern "**/node_modules/**" \
  --deep

# Deploy for microservices team
vdk deploy \
  --team "microservices" \
  --project-name "api-gateway" \
  --description "API gateway patterns and conventions"

Next Steps