1# Assistant Commands
2
3## Overview
4
5Slash commands enhance the assistant's capabilities. Begin by typing a `/` at the beginning of the line to see a list of available commands:
6
7- `/default`: Inserts the default prompt into the context
8- `/diagnostics`: Injects errors reported by the project's language server into the context
9- `/fetch`: Inserts the content of a webpage and inserts it into the context
10- `/file`: Inserts a single file or a directory of files into the context
11- `/now`: Inserts the current date and time into the context
12- `/prompt`: Adds a custom-configured prompt to the context (see Prompt Library)
13- `/symbols`: Inserts the current tab's active symbols into the context
14- `/tab`: Inserts the content of the active tab or all open tabs into the context
15- `/terminal`: Inserts a select number of lines of output from the terminal
16
17### Other Commands:
18
19- `/search`: Performs semantic search for content in your project based on natural language
20 - Not generally available yet, but some users may have access to it.
21- `/workflow`: Opts into the edit workflow for a specific context
22 - Not generally available yet.
23
24> **Note:** Remember, commands are only evaluated when the context is created or when the command is inserted, so a command like `/now` won't continuously update, or `/file` commands won't keep their contents up to date.
25
26## `/default`
27
28Read more about `/default` in the [Prompting: Editing the Default Prompt](/assistant/prompting.md#default-prompt) section.
29
30Usage: `/default`
31
32## `/diagnostics`
33
34The `/diagnostics` command injects errors reported by the project's language server into the context. This is useful for getting an overview of current issues in your project.
35
36Usage: `/diagnostics [--include-warnings] [path]`
37
38- `--include-warnings`: Optional flag to include warnings in addition to errors.
39- `path`: Optional path to limit diagnostics to a specific file or directory.
40
41## `/file`
42
43The `/file` command inserts the content of a single file or a directory of files into the context. This allows you to reference specific parts of your project in your conversation with the assistant.
44
45Usage: `/file <path>`
46
47You can use glob patterns to match multiple files or directories.
48
49Examples:
50
51- `/file src/index.js` - Inserts the content of `src/index.js` into the context.
52- `/file src/*.js` - Inserts the content of all `.js` files in the `src` directory.
53- `/file src` - Inserts the content of all files in the `src` directory.
54
55## `/now`
56
57The `/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).
58
59Usage: `/now`
60
61## `/prompt`
62
63The `/prompt` command inserts a prompt from the prompt library into the context. It can also be used to nest prompts within prompts.
64
65Usage: `/prompt <prompt_name>`
66
67Related: `/default`
68
69## `/search` (Not generally available)
70
71The `/search` command performs a semantic search for content in your project based on natural language queries. This allows you to find relevant code or documentation within your project.
72
73Usage: `/search <query> [--n <limit>]`
74
75- `query`: The natural language query to search for.
76- `--n <limit>`: Optional flag to limit the number of results returned.
77
78## `/symbols`
79
80The `/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.
81
82Usage: `/symbols`
83
84## `/tab`
85
86The `/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.
87
88Usage: `/tab [tab_name|all]`
89
90- `tab_name`: Optional name of a specific tab to insert.
91- `all`: Insert content from all open tabs.
92
93Examples:
94
95- `/tab` - Inserts the content of the active tab.
96- `/tab "index.js"` - Inserts the content of the tab named "index.js".
97- `/tab all` - Inserts the content of all open tabs.
98
99## `/terminal`
100
101The `/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.
102
103Usage: `/terminal [--line-count <number>]`
104
105- `--line-count <number>`: Optional flag to specify the number of lines to insert (default is a predefined number).
106
107## `/workflow` (Not generally available)
108
109The `/workflow` command inserts a prompt that opts into the edit workflow. This sets up the context for the assistant to suggest edits to your code.
110
111Usage: `/workflow`
112
113## Extensibility
114
115The Zed team plans for assistant commands to be extensible, but this isn't quite ready yet. Stay tuned!
116
117Zed is open source, and all the slash commands are defined in the [assistant crate](https://github.com/zed-industries/zed/tree/main/crates/assistant/src/slash_command). If you are interested in creating your own slash commands a good place to start is by learning from the existing commands.