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

# Skills

> Give your AI models highly specific, modular knowledge. Install Skill folders containing SKILL.md files to inject targeted instructions and documentation into your prompts.

***

As your AI application scales, you need to teach the model highly specific workflows — such as “How to write a database migration for our stack” or “How to draft a compliant legal contract in our jurisdiction.”

Dumping all these instructions into a single system prompt quickly blows up your context window, increases costs, and hurts performance.

**LLM Router Skills** solves this problem elegantly.

A **Skill** is a lightweight, modular folder that contains a `SKILL.md` file with precise instructions, business rules, and references. LLM Router intelligently injects only the relevant skills into the prompt when they are needed.

## What is a Skill?

A Skill is simply a directory that contains at minimum a `SKILL.md` file (and optionally other reference files).

* The `SKILL.md` file includes step-by-step instructions the AI must follow.
* It can reference additional files inside the same folder (API docs, code examples, templates, etc.).
* Instead of building complex RAG pipelines, you just install Skills — and let the router handle context injection.

## How to Install Skills

You have two easy ways to add Skills:

1. **Browse the Skills Catalog**\
   Visit [skills.sh](https://skills.sh) or [skillsmp.com](https://skillsmp.com) to explore and install community or official skills with one click/command.

2. **Add a Custom Skill**\
   Provide the GitHub repository URL of your own skill folder. LLM Router will pull it directly.

Once installed, each skill gets a unique **Skill ID** (e.g. `stripe_api`, `react_guidelines`).

## Smart Skill Injection

When you send a request, you can pass a list of Skill IDs. LLM Router offers two modes:

### 1. Automatic Relevance (Recommended)

Set `enableAutoSearch: true`.

The router analyzes the user’s prompt, reads the `SKILL.md` files (and any referenced files inside the skill), and **only injects the skills that are actually relevant**.

This keeps your context window lean and dramatically reduces cost and latency.

### 2. Force All Skills

Set `enableAutoSearch: false` (default).

All listed `SKILL.md` files are injected regardless of the prompt. Use this when you need guaranteed access to certain instructions.

## Using Skills via API

```typescript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.llmrouter.app/v1",
  apiKey: process.env.LLM_ROUTER_API_KEY,
});

async function main() {
  const response = await client.chat.completions.create({
    model: "anthropic/claude-opus-4.6",
    messages: [
      { role: "user", content: "Write a new billing webhook handler." },
    ],
    gateway: {
      skills: {
        skillIds: ["stripe_api", "node_best_practices", "marketing_copy"],
        enableAutoSearch: true, // Smart injection
      },
    },
  });

  console.log(response.choices[0].message.content);
}

main();
```

In the example above, only the Stripe and Node.js skills would be injected — the marketing copy skill would be ignored.

***

## Smart Skill Injection (`enableAutoSearch`)

If you pass 10 different `skillIds` in your request, injecting all 10 `SKILL.md` files into the prompt every time will waste thousands of input tokens.

You can optimize this using the `enableAutoSearch` flag:

* **`enableAutoSearch: true` (Recommended):**
  LLM Router acts as an intelligent librarian. It reads the user's prompt, searches through the `SKILL.md` files (and their referenced pages) defined in your `skillIds` array, and **only injects the skills that are highly relevant** to the current question.
  *(In the example above, the user asked for a billing webhook. The router would dynamically inject the `stripe_api` and `node_best_practices` markdown instructions, but completely ignore `marketing_copy`).*

* **`enableAutoSearch: false` (Default):**
  LLM Router forcefully injects the content of **all** the `SKILL.md` files listed in `skillIds` into the request, regardless of the user's prompt. Use this if you want absolute certainty that the model has access to those specific instructions at all times.

***

## Configuration Properties

### The `skills` Object

| Property | Type | Default | Description |
| :- | :- | :- | :- |
| `skillIds` | `string[]` | *Required* | An array of Skill IDs you have installed via the LLM Router dashboard. |
| `enableAutoSearch` | `boolean` | `false` | If `true`, the Gateway will intelligently analyze the prompt and only inject the specific `SKILL.md` instructions from your list that are highly relevant to the user's query. |

> [!NOTE]
>
> **Context Optimization Synergy:** Using `enableAutoSearch: true` alongside our
> Chat Optimization features ensures your prompts remain incredibly lean,
> keeping latency low and drastically reducing your upstream API costs.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.