- `/file src/*.js` - Inserts the content of all `.js` files in the `src` directory.
- `/file src` - Inserts the content of all files in the `src` directory.
### `/now`
The `/now` command inserts the current date and time into the context. This can be useful letting the language model know the current time (and by extension, how old their current knowledge base is).
Usage: `/now`
### `/prompt`
The `/prompt` command inserts a prompt from the prompt library into the context. It can also be used to nest prompts within prompts.
Usage: `/prompt <prompt_name>`
Related: `/default`
### `/symbols`
The `/symbols` command inserts the active symbols (functions, classes, etc.) from the current tab into the context. This is useful for getting an overview of the structure of the current file.
Usage: `/symbols`
### `/tab`
The `/tab` command inserts the content of the active tab or all open tabs into the context. This allows you to reference the content you're currently working on.
Usage: `/tab [tab_name|all]`
- `tab_name`: Optional name of a specific tab to insert.
- `all`: Insert content from all open tabs.
Examples:
- `/tab` - Inserts the content of the active tab.
- `/tab "index.js"` - Inserts the content of the tab named "index.js".
- `/tab all` - Inserts the content of all open tabs.
### `/terminal`
The `/terminal` command inserts a select number of lines of output from the terminal into the context. This is useful for referencing recent command outputs or logs.
Usage: `/terminal [<number>]`
- `<number>`: Optional parameter to specify the number of lines to insert (default is a 50).
### `/selection`
The `/selection` command inserts the selected text in the editor into the context. This is useful for referencing specific parts of your code.
This is equivalent to the `assistant: quote selection` command ({#kb assistant::QuoteSelection}).
Usage: `/selection`
## Commands in the Rules Library {#slash-commands-in-rules}
[Commands](#commands) can be used in rules, in the Rules Library (previously known as Prompt Library), to insert dynamic content or perform actions.
For example, if you want to create a rule where it is important for the model to know the date, you can use the `/now` command to insert the current date.
> **Warn:** Slash commands in rules **only** work when they are used in text threads. Using them in non-text threads is not supported.
> **Note:** Slash commands in rules **must** be on their own line.
See the [list of commands](#commands) above for more information on commands, and what slash commands are available.
### Example
```plaintext
You are an expert Rust engineer. The user has asked you to review their project and answer some questions.
Here is some information about their project:
/file Cargo.toml
```
In the above example, the `@file` command is used to insert the contents of the `Cargo.toml` file (or all `Cargo.toml` files present in the project) into the rule.
## Nesting Rules
Similar to adding rules to the default rules, you can nest rules within other rules with the `/prompt` command (only supported in Text Threads currently).
You might want to nest rules to:
- Create templates on the fly
- Break collections like docs or references into smaller, mix-and-matchable parts
- Create variants of a similar rule (e.g., `Async Rust - Tokio` vs. `Async Rust - Async-std`)
### Example:
```plaintext
Title: Zed-Flavored Rust
## About Zed
/prompt Zed: Zed (a rule about what Zed is)
## Rust - Zed Style
/prompt Rust: Async - Async-std (zed doesn't use tokio)
/prompt Rust: Zed-style Crates (we have some unique conventions)
/prompt Rust - Workspace deps (bias towards reusing deps from the workspace)
```
_The text in parentheses above are comments and are not part of the rule._
> **Note:** While you technically _can_ nest a rule within itself, we wouldn't recommend it (in the strongest of terms.) Use at your own risk!
By using nested rules, you can create modular and reusable rule components that can be combined in various ways to suit different scenarios.