> ## Documentation Index
> Fetch the complete documentation index at: https://codinitdev-mintlify-update-changelog-codinit-dev-90028.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Chat & Commands

> Master CodinIT AI chat interface and commands to accelerate development with natural language prompts and powerful shortcuts.

### Opening the Chat Interface

<Tabs>
  <Tab title="macOS" icon="https://mintcdn.com/codinitdev-mintlify-update-changelog-codinit-dev-90028/MdhL3v8munj9L5IE/assets/frameworks/icons/apple.svg?fit=max&auto=format&n=MdhL3v8munj9L5IE&q=85&s=8d5e92b4086c38167a00bb3b4e03f016" width="16" height="16" data-path="assets/frameworks/icons/apple.svg">
    Press `Cmd + K` to open the AI chat interface
  </Tab>

  <Tab title="Windows" icon="https://mintcdn.com/codinitdev-mintlify-update-changelog-codinit-dev-90028/MdhL3v8munj9L5IE/assets/frameworks/icons/windows.svg?fit=max&auto=format&n=MdhL3v8munj9L5IE&q=85&s=317cc0232287f8bad6ed3241c5978792" width="16" height="16" data-path="assets/frameworks/icons/windows.svg">
    Press `Ctrl + K` to open the AI chat interface
  </Tab>

  <Tab title="Linux" icon="https://mintcdn.com/codinitdev-mintlify-update-changelog-codinit-dev-90028/MdhL3v8munj9L5IE/assets/frameworks/icons/linux.svg?fit=max&auto=format&n=MdhL3v8munj9L5IE&q=85&s=0c269318c9c0f6cebb88db997c36c921" width="16" height="16" data-path="assets/frameworks/icons/linux.svg">
    Press `Ctrl + K` to open the AI chat interface
  </Tab>
</Tabs>

***

### Your First AI Request

Simply type what you want in natural language:

```
Create a React component for a user profile card with avatar, name, and bio
```

The AI will generate the complete component with proper structure, types, and styling.

## AI Commands

Quick Commands

Use `/` prefix to access quick commands in the chat:

| Command     | Description                      | Example                         |
| ----------- | -------------------------------- | ------------------------------- |
| `/explain`  | Explain selected code            | `/explain this function`        |
| `/refactor` | Refactor code for better quality | `/refactor to use async/await`  |
| `/fix`      | Fix bugs or errors               | `/fix this TypeScript error`    |
| `/test`     | Generate unit tests              | `/test this component`          |
| `/docs`     | Generate documentation           | `/docs for this API`            |
| `/optimize` | Optimize performance             | `/optimize this database query` |

<Tip>
  You don't need to use commands - natural language works great too! Commands are just shortcuts for common tasks.
</Tip>

### Code Generation Commands

<AccordionGroup>
  <Accordion title="/component - Generate UI Components">
    Create React, Vue, Angular, or framework-specific components

    ```
    /component button with loading state and variants
    ```
  </Accordion>

  <Accordion title="/api - Create API Endpoints">
    Generate REST or GraphQL API endpoints with validation

    ```
    /api endpoint for user registration with email validation
    ```
  </Accordion>

  <Accordion title="/db - Database Operations">
    Create schemas, migrations, and queries

    ```
    /db schema for e-commerce products with categories
    ```
  </Accordion>

  <Accordion title="/hook - Custom React Hooks">
    Generate custom React hooks with TypeScript

    ```
    /hook for fetching and caching API data
    ```
  </Accordion>
</AccordionGroup>

## Effective Prompting

Writing Great Prompts

<Steps>
  <Step title="Be Specific">
    Instead of: "Make a form"

    Try: "Create a React form with email, password fields, validation using Zod, and submit handler"
  </Step>

  <Step title="Include Context">
    Mention your tech stack, frameworks, and preferences

    ```
    Create a Next.js 14 server action for creating a blog post
    using Prisma and TypeScript
    ```
  </Step>

  <Step title="Specify Requirements">
    List all requirements upfront

    ```
    Build an image upload component that:
    - Accepts PNG/JPG only
    - Max size 5MB
    - Shows preview
    - Displays upload progress
    - Has error handling
    ```
  </Step>

  <Step title="Reference Existing Code">
    Select code in your editor and ask AI to work with it

    ```
    Refactor this component to use React Server Components
    ```
  </Step>
</Steps>

### Examples of Good Prompts

<CodeGroup>
  ```plaintext Component Creation theme={null}
  Create a dark mode toggle component for Next.js using:
  - React Server Components
  - Tailwind CSS
  - localStorage for persistence
  - Smooth animation transitions
  - TypeScript with strict types
  ```

  ```plaintext API Development theme={null}
  Generate a RESTful API endpoint for user authentication:
  - POST /api/auth/login
  - Accepts email and password
  - Validates with Zod
  - Returns JWT token
  - Handles errors properly
  - Uses bcrypt for password comparison
  ```

  ```plaintext Database Schema theme={null}
  Create a Prisma schema for a blog platform with:
  - Users (id, email, name, avatar)
  - Posts (id, title, content, published, authorId)
  - Comments (id, content, authorId, postId)
  - Tags (id, name) with many-to-many to Posts
  - Include all relations and indexes
  ```

  ```plaintext Testing theme={null}
  Write comprehensive tests for the UserService class:
  - Unit tests for all methods
  - Mock database calls
  - Test error scenarios
  - Use Jest and TypeScript
  - Include setup and teardown
  ```
</CodeGroup>

## Context-Aware AI

How CodinIT Understands Your Project

CodinIT's AI automatically analyzes:

* **Current file** you're editing
* **Selected code** in your editor
* **Project structure** and file organization
* **Dependencies** in package.json
* **TypeScript types** and interfaces
* **Git history** for recent changes

<Info>
  You don't need to re-explain your project setup. The AI already knows your tech stack!
</Info>

### Working with Selected Code

1. **Select code** in your editor
2. **Open AI chat** (`Cmd/Ctrl + K`)
3. **Ask about the selection**:
   * "Explain this code"
   * "Add error handling"
   * "Convert to TypeScript"
   * "Optimize for performance"

## Multi-File Operations

Creating Multiple Files

Ask AI to generate entire features:

```
Create a complete authentication system:
- Login/signup pages (React components)
- Auth API routes (Next.js)
- Protected route middleware
- Auth context provider
- Types and validation schemas
```

The AI will create all necessary files in the correct directories.

### Refactoring Across Files

```
Refactor the user management feature to use a repository pattern:
- Move database calls to UserRepository
- Update UserService to use the repository
- Modify API routes accordingly
- Update tests
```

## AI Provider Selection

Choosing the Right Model

Different models excel at different tasks:

<Tabs>
  <Tab title="Claude" icon="https://mintcdn.com/codinitdev-mintlify-update-changelog-codinit-dev-90028/MdhL3v8munj9L5IE/assets/ai-icons/anthropic.svg?fit=max&auto=format&n=MdhL3v8munj9L5IE&q=85&s=6fd79242049a0f4b0fcaef90913d8397" width="24" height="24" data-path="assets/ai-icons/anthropic.svg">
    **Best for:**

    * Complex code generation
    * Detailed explanations
    * Refactoring large codebases
    * Architectural decisions

    **Recommended model:** Claude 4.5 Sonnet
  </Tab>

  <Tab title="GPT-5" icon="https://mintcdn.com/codinitdev-mintlify-update-changelog-codinit-dev-90028/MdhL3v8munj9L5IE/assets/ai-icons/openai.svg?fit=max&auto=format&n=MdhL3v8munj9L5IE&q=85&s=d92ad39c49a1db2b754fcab6f3a97700" width="24" height="24" data-path="assets/ai-icons/openai.svg">
    **Best for:**

    * General-purpose coding
    * Quick iterations
    * Documentation generation
    * Code completion

    **Recommended model:** GPT-5
  </Tab>

  <Tab title="DeepSeek" icon="https://mintcdn.com/codinitdev-mintlify-update-changelog-codinit-dev-90028/MdhL3v8munj9L5IE/assets/ai-icons/deepseek.svg?fit=max&auto=format&n=MdhL3v8munj9L5IE&q=85&s=62dfc35a5c6e479af08590597b8f5882" width="16" height="16" data-path="assets/ai-icons/deepseek.svg">
    **Best for:**

    * Cost-effective development
    * Code understanding
    * Bug fixes
    * Testing generation

    **Recommended model:** DeepSeek Coder
  </Tab>

  <Tab title="Local Models" icon="https://mintcdn.com/codinitdev-mintlify-update-changelog-codinit-dev-90028/MdhL3v8munj9L5IE/assets/ai-icons/ollama.svg?fit=max&auto=format&n=MdhL3v8munj9L5IE&q=85&s=d19c25adecd75d7c5f366d729cb97e68" width="24" height="24" data-path="assets/ai-icons/ollama.svg">
    **Best for:**

    * Privacy-sensitive projects
    * Offline development
    * Learning and experimentation

    **Recommended model:** Codestral or Llama 3.1
  </Tab>
</Tabs>

### Switching Models

Change the AI provider on-the-fly:

1. Click the **model selector** in chat interface
2. Choose from your configured providers
3. Continue the conversation with new model

<Tip>
  Try different models for the same task to compare results! Each has unique strengths.
</Tip>

## Advanced Features

Inline AI Editing

<Steps>
  <Step title="Select Code">
    Highlight the code you want to modify
  </Step>

  <Step title="Press Cmd/Ctrl + I">
    Opens inline AI editor
  </Step>

  <Step title="Describe Changes">
    Type what you want to change

    ```
    Add TypeScript types and JSDoc comments
    ```
  </Step>

  <Step title="Review & Accept">
    AI shows diff, you can accept, reject, or iterate
  </Step>
</Steps>

### Conversation History

Access previous AI conversations:

* **Recent chats** in sidebar
* **Search history** by keywords
* **Pin important conversations**
* **Export conversations** for documentation

### Custom Instructions

Set global AI instructions for your project:

```json theme={null}
{
  "ai": {
    "customInstructions": [
      "Always use TypeScript strict mode",
      "Follow our company's naming conventions",
      "Include comprehensive error handling",
      "Write tests alongside implementation"
    ]
  }
}
```

## Tips & Best Practices

<CardGroup cols={2}>
  <Card title="Iterate Gradually" icon="iteration-ccw">
    Build features incrementally. Start simple, then ask AI to enhance.
  </Card>

  <Card title="Review AI Code" icon="search-check">
    Always review generated code. AI is powerful but not perfect.
  </Card>

  <Card title="Provide Feedback" icon="message-circle-plus">
    Tell AI when output isn't quite right. "Make it more concise" or "Add error handling"
  </Card>

  <Card title="Save Good Prompts" icon="bookmark-check">
    Keep a collection of prompts that work well for your use cases.
  </Card>
</CardGroup>

## Common Use Cases

Debugging

```
I'm getting this error: [paste error]

In this code: [select code]

How do I fix it?
```

### Code Review

```
Review this pull request for:
- Security issues
- Performance problems
- Best practice violations
- Missing edge cases
```

### Learning

```
Explain how this authentication flow works step by step,
including what happens on the client and server
```

### Documentation

```
Generate API documentation for these endpoints in OpenAPI 3.0 format
```

## Keyboard Shortcuts

<Tabs>
  <Tab title="macOS" icon="https://mintcdn.com/codinitdev-mintlify-update-changelog-codinit-dev-90028/MdhL3v8munj9L5IE/assets/frameworks/icons/apple.svg?fit=max&auto=format&n=MdhL3v8munj9L5IE&q=85&s=8d5e92b4086c38167a00bb3b4e03f016" width="16" height="16" data-path="assets/frameworks/icons/apple.svg">
    | Action              | Shortcut  |
    | ------------------- | --------- |
    | Open AI Chat        | `Cmd + K` |
    | Inline Edit         | `Cmd + I` |
    | Accept Suggestion   | `Tab`     |
    | Reject Suggestion   | `Esc`     |
    | Next Suggestion     | `Alt + ]` |
    | Previous Suggestion | `Alt + [` |
  </Tab>

  <Tab title="Windows/Linux" icon="https://mintcdn.com/codinitdev-mintlify-update-changelog-codinit-dev-90028/MdhL3v8munj9L5IE/assets/frameworks/icons/windows.svg?fit=max&auto=format&n=MdhL3v8munj9L5IE&q=85&s=317cc0232287f8bad6ed3241c5978792" width="16" height="16" data-path="assets/frameworks/icons/windows.svg">
    | Action              | Shortcut   |
    | ------------------- | ---------- |
    | Open AI Chat        | `Ctrl + K` |
    | Inline Edit         | `Ctrl + I` |
    | Accept Suggestion   | `Tab`      |
    | Reject Suggestion   | `Esc`      |
    | Next Suggestion     | `Alt + ]`  |
    | Previous Suggestion | `Alt + [`  |
  </Tab>
</Tabs>

## Next Steps

<CardGroup cols={2}>
  <Card title="Prompt Engineering Guide" icon="book" href="/prompting/prompt-engineering-guide">
    Learn advanced prompting techniques
  </Card>

  <Card title="Select Your Model" icon="brain" href="/getting-started/select-your-model">
    Compare and choose AI providers
  </Card>

  <Card title="Project Templates" icon="folder-open-dot" href="/essentials/project-templates">
    Start projects with AI-generated templates
  </Card>

  <Card title="Model Configuration" icon="puzzle" href="/model-config/context-windows">
    Understand context windows and limits
  </Card>
</CardGroup>
