# AI Expert CLI

A command-line tool to manage and query specialized Claude assistants. Create domain-specific AI experts with custom knowledge bases.

## Prerequisites

- Node.js 14.0 or higher
- [Claude CLI](https://claude.ai/code) installed and configured

## Installation

```bash
npm install -g ai-expert-cli
# or
pnpm add -g ai-expert-cli
```

## Quick Start

```bash
# Create a new expert
ai create "React Expert" "React.js development with hooks and performance optimization"

# Quick query (returns answer and exits)
ai react-expert "how to optimize re-renders?"

# Interactive mode (continuous conversation)
ai react-expert

# Interactive with initial question
ai react-expert -i "how to optimize re-renders?"

# List all experts
ai list
```

## Usage

### Creating Experts

```bash
ai create <name> <specialty>
```

Creates a new AI expert with specified knowledge domain. Experts are stored in `~/.ai-experts/`.

### Querying Experts

```bash
# Quick answer mode
ai <expert-name> "your question"

# Interactive conversation mode
ai <expert-name>
ai <expert-name> -i
ai <expert-name> --interactive "initial question"
```

Get instant answers or start an interactive conversation with your specialized assistants.

### Managing Experts

```bash
# List all available experts
ai list

# Edit an expert's configuration
ai edit <expert-name>
```

## Expert Configuration

Each expert is a JSON file in `~/.ai-experts/` with the following structure:

```json
{
  "name": "Expert Name",
  "slug": "expert-name",
  "specialty": "Domain expertise description",
  "systemPrompt": "Custom instructions for the AI",
  "context": {
    "concepts": ["key concept 1", "key concept 2"],
    "patterns": ["best practice 1", "best practice 2"],
    "examples": [
      {
        "name": "Example name",
        "code": "example code"
      }
    ],
    "customVariables": {}
  }
}
```

## Examples

### Create a Tailwind CSS Expert

```bash
ai create "Tailwind Master" "Tailwind CSS with custom design systems"
```

### Create a Database Expert

```bash
ai create "DB Architect" "PostgreSQL optimization and schema design"
```

### Query for Specific Solutions

```bash
ai tailwind-master "create a gradient button with hover effect"
ai db-architect "optimize query with multiple joins"

# Interactive mode
ai tailwind-master
ai db-architect -i "explain indexing strategies"
```

## Features

- 🚀 **Fast**: Direct integration with Claude CLI for instant responses
- 🎯 **Specialized**: Create experts for any domain or technology
- 📚 **Knowledge Base**: Store patterns, examples, and best practices
- 🔧 **Customizable**: Edit expert configurations anytime
- 💡 **Smart**: Leverages Claude's capabilities with focused expertise
- 💬 **Interactive**: Start conversations with experts using `-i` flag
- ⚡ **Dual Commands**: Use both `ai` and `ai-expert` commands

## How It Works

1. **Expert Creation**: Define a specialist with domain knowledge
2. **Context Building**: Add concepts, patterns, and examples
3. **Query Processing**: Combines system prompt with your question
4. **Claude Integration**: Uses local Claude CLI for processing
5. **Instant Response**: Get expert-level answers immediately

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

## Author

[Anderson Denis da Rosa](https://github.com/andersondrosa)

## License

MIT


---

**Note**: This tool requires [Claude CLI](https://claude.ai/code) to be installed and accessible in your PATH.