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

# Extension Types

> Understanding the different types of capabilities you can add through Qwen Code extensions

# Extension Types

Qwen Code extensions support five main types of capabilities. Each type serves a different purpose and can be combined within a single extension.

## MCP Servers

**Model Context Protocol (MCP) servers** add new tools that the AI can use to interact with external services, APIs, or perform specialized operations.

### What are MCP Servers?

* Standalone processes that communicate via stdio
* Provide tools (functions) the AI can call
* Can expose prompts and resources
* Run continuously during your session

### Use Cases

* Fetch data from external APIs
* Interact with databases
* Control external services (deployment, monitoring)
* Process files in specialized formats
* Integrate with third-party tools

### Example

```json theme={null}
{
  "name": "github-tools",
  "version": "1.0.0",
  "mcpServers": {
    "github": {
      "command": "node",
      "args": ["${extensionPath}${/}dist${/}server.js"],
      "cwd": "${extensionPath}",
      "env": {
        "GITHUB_TOKEN": "${GITHUB_TOKEN}"
      }
    }
  }
}
```

**Learn more:** [Creating MCP Server Extensions](/extensions/mcp-servers)

## Custom Commands

**Custom commands** are shortcuts for complex prompts that can be invoked with slash syntax.

### What are Custom Commands?

* Markdown files with optional YAML frontmatter
* Can include template variables with `{{args}}`
* Can execute shell commands with `!{command}`
* Support nested directory structure for organization

### Use Cases

* Create project-specific workflows
* Package common development patterns
* Automate repetitive tasks
* Build domain-specific helpers

### Example

```markdown theme={null}
---
description: Search for a pattern in code and summarize findings
---

Please summarize the findings for the pattern `{{args}}`.

Search Results:
!{grep -r {{args}} .}
```

Invoked as: `/fs:grep-code "TODO"`

**Learn more:** [Creating Command Extensions](/extensions/commands)

## Skills

**Skills** are specialized capabilities that the AI can automatically invoke when relevant to the user's request.

### What are Skills?

* Model-invoked capabilities (not user-invoked)
* Defined in `SKILL.md` files with YAML frontmatter
* Discovered automatically when extension is loaded
* Available via `/skills` command to view/manage

### Use Cases

* Add domain-specific expertise
* Provide specialized analysis capabilities
* Enable automatic workflow handling
* Extend AI reasoning for specific tasks

### Example

```markdown theme={null}
---
name: code-analyzer
description: Analyzes code structure and provides insights about complexity and dependencies
---

# Code Analyzer

When analyzing code, focus on:
- Code complexity and maintainability
- Dependencies and coupling
- Potential performance issues
```

**Learn more:** [Creating Skill Extensions](/extensions/skills)

## Subagents (Agents)

**Subagents** are specialized AI assistants configured for specific tasks with their own system prompts and tool access.

### What are Subagents?

* Markdown or YAML files defining agent behavior
* YAML frontmatter specifies name, tools, model config
* Content contains system prompt instructions
* Appear in agent manager dialog

### Use Cases

* Create task-specific AI experts
* Define consistent behavior patterns
* Package reusable AI workflows
* Share specialized assistants

### Example

```markdown theme={null}
---
name: refactoring-expert
description: Specialized in code refactoring and improving code quality
color: blue
tools:
  - Read
  - Write
  - Grep
modelConfig:
  model: qwen3-coder-plus
---

You are a refactoring specialist focused on improving code quality.

Your expertise includes:
- Identifying code smells
- Applying SOLID principles
- Improving readability
```

**Learn more:** [Creating Agent Extensions](/extensions/agents)

## Context Providers

**Context providers** supply persistent context to the model through a `QWEN.md` file that's loaded in every session.

### What are Context Providers?

* Markdown file loaded into system context
* Always available to the AI
* Useful for instructions and documentation
* Can describe extension capabilities

### Use Cases

* Provide usage instructions for extension tools
* Define behavioral guidelines
* Document project conventions
* Add domain knowledge

### Example

```markdown theme={null}
# Database Query Assistant

You have access to database query tools. When the user asks about data:

1. Use the `query_database` tool to fetch information
2. Format results in clear tables
3. Explain any complex queries

Always verify table names before querying.
```

**Learn more:** [Creating Context Provider Extensions](/extensions/context-providers)

## Settings

**Extension settings** allow you to configure API keys, credentials, and other values securely.

### What are Settings?

* Defined in `qwen-extension.json`
* Prompted during installation
* Stored securely (sensitive values in keychain)
* Passed as environment variables to MCP servers

### Use Cases

* Store API keys and tokens
* Configure service endpoints
* Set user preferences
* Provide credentials

### Example

```json theme={null}
{
  "name": "api-extension",
  "version": "1.0.0",
  "settings": [
    {
      "name": "API Key",
      "description": "Your API key for the service",
      "envVar": "MY_API_KEY",
      "sensitive": true
    },
    {
      "name": "API Endpoint",
      "description": "Base URL for the API",
      "envVar": "API_ENDPOINT",
      "sensitive": false
    }
  ]
}
```

Manage with:

```bash theme={null}
qwen extensions settings set my-extension "API Key"
qwen extensions settings list my-extension
```

## Combining Extension Types

You can combine multiple types in a single extension:

```
my-complete-extension/
├── qwen-extension.json       # Defines MCP servers and settings
├── QWEN.md                   # Provides context
├── commands/
│   ├── deploy.md            # Custom command
│   └── test.md              # Custom command
├── skills/
│   └── analyzer/
│       └── SKILL.md         # Skill
└── agents/
    └── expert.md            # Subagent
```

```json theme={null}
{
  "name": "my-complete-extension",
  "version": "1.0.0",
  "mcpServers": {
    "tools": {
      "command": "node",
      "args": ["${extensionPath}${/}dist${/}server.js"]
    }
  },
  "contextFileName": "QWEN.md",
  "commands": "commands",
  "skills": "skills",
  "agents": "agents",
  "settings": [
    {
      "name": "Service Token",
      "description": "Authentication token",
      "envVar": "SERVICE_TOKEN",
      "sensitive": true
    }
  ]
}
```

This creates a comprehensive extension with tools, commands, AI capabilities, and secure configuration.

## Next Steps

* [Creating Your First Extension](/extensions/creating-extensions)
* [MCP Server Extensions](/extensions/mcp-servers)
* [Command Extensions](/extensions/commands)
* [Skill Extensions](/extensions/skills)
* [Agent Extensions](/extensions/agents)
* [Context Providers](/extensions/context-providers)
