> ## Documentation Index
> Fetch the complete documentation index at: https://nikcli.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Advanced Automation

> Master complex automation scenarios with NikCLI's AI-powered development capabilities

# Advanced Automation

Explore sophisticated automation workflows that leverage NikCLI's AI-powered development capabilities.

## 🧠 AI-Powered Development Examples

### Example 1: Code Migration

Migrate a legacy codebase to modern architecture with AI assistance.

<Steps>
  <Step title="Analyze Legacy Code">
    ```bash theme={null}
    /agent universal-agent "Analyze this legacy JavaScript codebase and create a comprehensive migration plan to modern TypeScript with React and Node.js"
    ```
  </Step>

  <Step title="AI Analysis">
    ```bash theme={null}
    # NikCLI performs AI analysis:
    # - Identifies architectural patterns
    # - Detects dependencies and relationships
    # - Assesses complexity and risk
    # - Creates migration strategy
    ```
  </Step>

  <Step title="Sequential Migration">
    ```bash theme={null}
    /agent universal-agent "Convert JavaScript to TypeScript"
    /agent universal-agent "Refactor to React components"
    /agent universal-agent "Modernize backend to Node.js"
    /agent universal-agent "Update build tools and configuration"
    /agent universal-agent "Add comprehensive testing"
    ```
  </Step>

  <Step title="Validation and Testing">
    ```bash theme={null}
    /agent universal-agent "Validate the migrated codebase, run comprehensive tests, and ensure all functionality is preserved"
    ```
  </Step>
</Steps>

**AI Features Demonstrated:**

* **Natural Language Understanding**: Understands migration requirements
* **Code Analysis**: Identifies components, functions, and dependencies
* **Context Awareness**: Evaluates project structure and patterns
* **Intelligent Generation**: Creates appropriate modern code
* **Adaptive Responses**: Adjusts approach based on results

### Example 2: Multi-Phase Project Automation

Automate a complex multi-phase project with intelligent coordination.

<Steps>
  <Step title="Strategic Planning">
    ```bash theme={null}
    /plan "Build a complete SaaS platform with microservices architecture, real-time features, and AI integration"
    ```
  </Step>

  <Step title="Phase 1: Foundation">
    ```bash theme={null}
    /parallel --strategy sequential \
      "universal-agent:Set up microservices infrastructure" \
      "universal-agent:Configure API gateway and service discovery" \
      "universal-agent:Set up monitoring and logging" \
      "universal-agent:Create CI/CD pipeline"
    ```
  </Step>

  <Step title="Phase 2: Core Services">
    ```bash theme={null}
    /parallel --strategy hybrid \
      "universal-agent:Build user management service" \
      "universal-agent:Create data processing service" \
      "universal-agent:Implement AI integration service" \
      "universal-agent:Set up real-time communication service"
    ```
  </Step>

  <Step title="Phase 3: Frontend and Integration">
    ```bash theme={null}
    /parallel --strategy parallel \
      "universal-agent:Build React dashboard" \
      "universal-agent:Create mobile app" \
      "universal-agent:Integrate all services" \
      "universal-agent:Add comprehensive testing"
    ```
  </Step>
</Steps>

## ⚡ Efficient Development Workflows

### Example 3: Multi-Phase Project Development

Develop a complex project with structured phases and AI assistance.

<Steps>
  <Step title="Project Planning">
    ```bash theme={null}
    /plan "Build complete e-commerce platform with React frontend, Node.js backend, and PostgreSQL database"
    ```
  </Step>

  <Step title="Phase 1: Backend Development">
    ```bash theme={null}
    /agent universal-agent "Build user authentication API"
    /agent universal-agent "Create product management service"
    /agent universal-agent "Implement order processing system"
    /agent universal-agent "Add payment integration"
    /agent universal-agent "Build admin API endpoints"
    ```
  </Step>

  <Step title="Phase 2: Frontend Development">
    ```bash theme={null}
    /agent universal-agent "Create user authentication components"
    /agent universal-agent "Build product catalog interface"
    /agent universal-agent "Implement shopping cart functionality"
    /agent universal-agent "Add payment processing UI"
    /agent universal-agent "Create admin dashboard"
    ```
  </Step>

  <Step title="Phase 3: Testing and Integration">
    ```bash theme={null}
    /agent universal-agent "Write unit tests for all components"
    /agent universal-agent "Create integration tests"
    /agent universal-agent "Add end-to-end tests"
    /agent universal-agent "Generate test coverage reports"
    ```
  </Step>
</Steps>

### Example 4: Structured Development Workflow

Handle complex development tasks with structured planning.

<Steps>
  <Step title="Create Development Plan">
    ```bash theme={null}
    /plan "Build complete authentication system with database, API, and frontend"
    ```
  </Step>

  <Step title="Execute Sequential Tasks">
    ```bash theme={null}
    /agent universal-agent "Set up PostgreSQL database"
    /agent universal-agent "Create user tables and indexes"
    /agent universal-agent "Build authentication service"
    /agent universal-agent "Create login and registration UI"
    /agent universal-agent "Create product tables"
    /agent universal-agent "Build product management API"
    /agent universal-agent "Create product catalog UI"
    /agent universal-agent "Run full system tests"
    ```
  </Step>

  <Step title="Track Progress">
    ```bash theme={null}
    /todo
    # View current progress and completed tasks
    ```
  </Step>
</Steps>

## 🤖 Streamlined Development

### Example 5: Efficient Project Creation

Create a complete project with AI assistance and minimal manual intervention.

<Steps>
  <Step title="Enable Auto Mode">
    ```bash theme={null}
    /auto
    ```
  </Step>

  <Step title="Execute Development Tasks">
    ```bash theme={null}
    /auto "Create a complete e-commerce platform with React frontend, Node.js backend, PostgreSQL database, and Docker deployment"
    ```
  </Step>

  <Step title="Monitor Progress">
    ```bash theme={null}
    # NikCLI will:
    # - Analyze requirements
    # - Create project structure
    # - Implement components
    # - Set up infrastructure
    # - Configure deployment
    # - Generate documentation
    # - Ask for input when needed
    ```
  </Step>
</Steps>

### Example 6: Intelligent Code Refactoring

Automatically refactor code with intelligent analysis and transformation.

<Steps>
  <Step title="Analyze Codebase">
    ```bash theme={null}
    /agent universal-agent "Analyze this codebase for refactoring opportunities: identify code smells, performance issues, and architectural improvements"
    ```
  </Step>

  <Step title="Create Refactoring Plan">
    ```bash theme={null}
    /plan "Refactor codebase to improve maintainability, performance, and scalability"
    ```
  </Step>

  <Step title="Execute Intelligent Refactoring">
    ```bash theme={null}
    /parallel --strategy adaptive \
      "universal-agent:Extract common patterns into reusable utilities" \
      "universal-agent:Optimize database queries and add proper indexing" \
      "universal-agent:Refactor components for better reusability" \
      "universal-agent:Implement proper error handling and logging" \
      "universal-agent:Add comprehensive type definitions" \
      "universal-agent:Optimize bundle size and performance"
    ```
  </Step>
</Steps>

## 🔧 Advanced Configuration

### Example 7: Custom Agent Orchestration

Create custom agent workflows for specific domains.

<Steps>
  <Step title="Create Specialized Agents">
    ```bash theme={null}
    /create-agent "Frontend Expert" --specialization "react,typescript,ui-ux" --capabilities "component-design,responsive-layout,accessibility"
    /create-agent "Backend Expert" --specialization "nodejs,api,databases" --capabilities "rest-api,graphql,microservices"
    /create-agent "DevOps Expert" --specialization "docker,kubernetes,ci-cd" --capabilities "containerization,deployment,monitoring"
    ```
  </Step>

  <Step title="Configure Agent Coordination">
    ```bash theme={null}
    /agent-config "Frontend Expert" --coordination-mode "collaborative"
    /agent-config "Backend Expert" --coordination-mode "sequential"
    /agent-config "DevOps Expert" --coordination-mode "parallel"
    ```
  </Step>

  <Step title="Execute Coordinated Development">
    ```bash theme={null}
    /parallel --agent-coordination \
      "Frontend Expert:Design and implement user interface" \
      "Backend Expert:Build API and database layer" \
      "DevOps Expert:Set up infrastructure and deployment"
    ```
  </Step>
</Steps>

### Example 8: Performance Optimization Automation

Automatically optimize application performance across all layers.

<Steps>
  <Step title="Performance Analysis">
    ```bash theme={null}
    /agent universal-agent "Perform comprehensive performance analysis: frontend bundle size, API response times, database query performance, and resource utilization"
    ```
  </Step>

  <Step title="Parallel Optimization">
    ```bash theme={null}
    /parallel --strategy hybrid \
      "universal-agent:Optimize frontend bundle with code splitting and lazy loading" \
      "universal-agent:Implement API caching and response optimization" \
      "universal-agent:Optimize database queries and add proper indexing" \
      "universal-agent:Configure CDN and static asset optimization" \
      "universal-agent:Implement monitoring and performance tracking"
    ```
  </Step>

  <Step title="Validation and Monitoring">
    ```bash theme={null}
    /agent universal-agent "Validate performance improvements and set up continuous monitoring with alerts and dashboards"
    ```
  </Step>
</Steps>

## 🎯 Real-World Scenarios

### Scenario 1: Enterprise Application Migration

Migrate a monolithic enterprise application to microservices.

```bash theme={null}
# Phase 1: Analysis and Planning
/plan "Migrate monolithic enterprise application to microservices architecture with zero downtime"

# Phase 2: Parallel Service Extraction
/parallel --strategy hybrid \
  "universal-agent:Extract user management service" \
  "universal-agent:Extract product catalog service" \
  "universal-agent:Extract order processing service" \
  "universal-agent:Extract payment service" \
  "universal-agent:Create API gateway" \
  "universal-agent:Set up service discovery"

# Phase 3: Data Migration
/parallel --strategy sequential \
  "universal-agent:Design microservices database schema" \
  "universal-agent:Create data migration scripts" \
  "universal-agent:Implement data synchronization" \
  "universal-agent:Validate data integrity"

# Phase 4: Testing and Deployment
/parallel --strategy parallel \
  "universal-agent:Create comprehensive test suite" \
  "universal-agent:Set up staging environment" \
  "universal-agent:Configure monitoring and logging" \
  "universal-agent:Plan zero-downtime deployment"
```

### Scenario 2: AI-Powered Application Development

Build an AI-powered application with machine learning integration.

```bash theme={null}
# Phase 1: AI Integration Planning
/plan "Create AI-powered recommendation engine with React frontend, Python ML backend, and real-time data processing"

# Phase 2: Backend AI Services
/parallel --strategy hybrid \
  "universal-agent:Build Python ML service with TensorFlow" \
  "universal-agent:Create data preprocessing pipeline" \
  "universal-agent:Implement recommendation algorithms" \
  "universal-agent:Set up model training and deployment" \
  "universal-agent:Create API for ML predictions"

# Phase 3: Frontend Integration
/parallel --strategy parallel \
  "universal-agent:Build React dashboard for ML insights" \
  "universal-agent:Create real-time data visualization" \
  "universal-agent:Implement user interaction tracking" \
  "universal-agent:Add A/B testing framework"

# Phase 4: Production Deployment
/parallel --strategy sequential \
  "universal-agent:Set up ML model serving infrastructure" \
  "universal-agent:Configure data pipeline monitoring" \
  "universal-agent:Implement model versioning and rollback" \
  "universal-agent:Create production monitoring dashboard"
```

## 🚀 Best Practices for Advanced Automation

### 1. Use Cognitive Orchestration for Complex Tasks

```bash theme={null}
# Let NikCLI analyze and plan complex tasks
/agent universal-agent "Analyze and optimize this complex system architecture"
```

### 2. Leverage Parallel Execution Strategically

```bash theme={null}
# Use parallel execution for independent tasks
/parallel --strategy adaptive "task1" "task2" "task3"

# Use sequential for dependent tasks
/parallel --strategy sequential "setup" "configure" "deploy"
```

### 3. Monitor and Optimize Continuously

```bash theme={null}
# Monitor performance and resource usage
/parallel-monitor --real-time
/stats --detailed
/memory --optimize
```

### 4. Use Planning Mode for Large Projects

```bash theme={null}
# Always plan large, complex projects
/plan "Your complex project description"
# Creates detailed execution plan
# Manages dependencies and resources
# Provides progress tracking
```

## 🎯 Next Steps

<CardGroup cols={2}>
  <Card title="Agent System" icon="robot" href="/agent-system/architecture">
    Deep dive into cognitive orchestration
  </Card>

  <Card title="Parallel Execution" icon="zap" href="/cli-reference/parallel-execution">
    Master parallel execution
  </Card>

  <Card title="Command Reference" icon="terminal" href="/cli-reference/commands-overview">
    Complete command reference
  </Card>

  <Card title="Troubleshooting" icon="wrench" href="/troubleshooting/common-issues">
    Solve advanced problems
  </Card>
</CardGroup>

<Tip>
  **Pro Tip:** Use `/auto --full-autonomy` for projects where you trust NikCLI's decision-making. This enables the most advanced automation features and can dramatically accelerate development.
</Tip>
