SourceCraft Code Assistant prompt library

Warning

This feature is only available in Visual Studio Code.

Code Assistant now features a prompt library for chats, which contains templates for frequently used requests.

You can use a preset prompt, edit one, or add your own custom prompt.

Note

The interface language of the Visual Studio Code plugin depends on the selected IDE language.

Using prompts

  1. Click SourceCraft Code Assistant in the editor’s left panel.

    If you have many plugins, the chat button may be hidden in the menu.

    Alternatively, use Ctrl + L in Windows/Linux or Command + L in macOS.

  2. In the message input window, click .
  3. View the prompt description:
    • Hover over the prompt to view its brief description.
    • To view the full text of the prompt, click next to it.
  4. Select the prompt.
  5. If appropriate, edit the text, e.g., fill in the placeholders, such as #{function name}, add context and rules.
  6. Click or press Enter.

Editing a preset prompt

  1. In the message input window, click .
  2. Next to the prompt you want to edit, click .
  3. Edit the prompt text and save the changes.

Adding your custom prompt

  1. In the message input window, click .

  2. Click Add prompt.

  3. In the file that opens, fill in the prompt parameters in the section separated by ---.

    • name: Prompt name by which you can find the prompt in the menu.
    • description: Brief description of the prompt to display when you hover over it.

    If you do not specify the name and description parameters, they will be generated from the file name and the first lines of the prompt.

  4. Add prompt text and save the file.

The prompt file will be saved at <project_directory>/.codeassistant/prompts/<filename>.mdc.

You can also manually add prompt files with the .md and .mdc extensions to the specified directory and its subdirectories.

In .mdc files, there is a section for the prompt name and description:

---
name: Enter your rule name
description: Enter your rule description
---

See also