Skip to content

Using the Prompt Library ​

The prompt library holds reusable prompts, both the ones CodeCompanion ships with and any you write yourself. Run them from the Action Palette, a keymap, the command line or the chat buffer.

Keymaps ​

To map a prompt to a key, pass its alias to prompt():

lua
vim.keymap.set("n", "<LocalLeader>d", function()
  require("codecompanion").prompt("docs")
end, { noremap = true, silent = true })

Command Line ​

Any prompt with an alias can be run from the command line:

:CodeCompanion /docs

Slash Commands ​

In the chat buffer, type / followed by the alias. Only chat prompts with is_slash_cmd = true in their opts appear here.

Any tools and skills the prompt declares are added to the chat buffer before its content is inserted.

Released under the Apache-2.0 License.