Changesets · Branches · Tags · Compare
| Changeset | 607dd12e068ce631d41cd790bb3e7f8b7f6e594eae6c13dc694493d6b674d4b8 |
|---|---|
| Author | Nate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-06-25 12:42 -07:00 |
| Committer | GitHub <noreply@github.com> · 2025-06-25 12:42 -07:00 |
| Parents | 2ad2cb09cca6, 5c65352c196a |
2 files changed
modified docs/docs/customize/deep-dives/prompts.md +33 −72
| @@ -5,93 +5,54 @@ | ||
| 5 | 5 | Prompts are reusable instructions that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks. |
| 6 | 6 | |
| 7 | 7 | :::info |
| 8 | -Visit the Hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=prompts) | |
| 8 | +Prompts were previously defined in a `.prompt` file format, but for consistency we now recommend using the same Markdown format as [rules](./rules.mdx) and adding `alwaysApply: false` to the frontmatter so that they are manually triggered. | |
| 9 | 9 | ::: |
| 10 | 10 | |
| 11 | -## Examples | |
| 12 | - | |
| 13 | -Below are some examples to get you started. | |
| 14 | - | |
| 15 | -### Security review | |
| 16 | - | |
| 17 | -```text title="Security best practices review" | |
| 18 | -@open - Review these files for the following security best practices: | |
| 19 | -- Does the architecture follow security-by-design principles? | |
| 20 | -- Are there potential security vulnerabilities in the system design? | |
| 21 | -- Is sensitive data handled appropriately throughout the lifecycle? | |
| 22 | -``` | |
| 23 | - | |
| 24 | -### Reference best practice guides | |
| 25 | - | |
| 26 | -```text title="Redux best practices review" | |
| 27 | -@https://redux.js.org/style-guide/ | |
| 28 | -@currentFile | |
| 11 | +### Quick Start | |
| 29 | 12 | |
| 30 | -Review this code for adherence to Redux best practices. | |
| 31 | -``` | |
| 13 | +Below is a quick example of setting up a prompt file: | |
| 32 | 14 | |
| 33 | -### Pull in commonly used files for tasks | |
| 15 | +1. Create a folder called `.continue/rules` at the top level of your workspace | |
| 16 | +2. Add a file called `review-prompt.md` to this folder. | |
| 17 | +3. Write the following contents to `review-prompt.md` and save. | |
| 34 | 18 | |
| 35 | -```text title="Generate a new TypeORM entity" | |
| 36 | -@src/db/dataSource.ts @src/db/entity/SampleEntity.ts | |
| 19 | +```md title="review-prompt.md" | |
| 20 | +--- | |
| 21 | +name: Redux best practices review | |
| 22 | +alwaysApply: false | |
| 23 | +--- | |
| 37 | 24 | |
| 38 | -Use these files to generate a new TypeORM entity based on the following requirements: | |
| 25 | +Review the currently open file for adherence to Redux best practices, as explained in their style guide at https://redux.js.org/style-guide/. | |
| 39 | 26 | ``` |
| 40 | 27 | |
| 41 | -## Including Context Providers in your prompts | |
| 42 | - | |
| 43 | -Many [context providers](../context-providers.mdx) can be referenced by typing "@" followed by the name of the context provider. The currently supported list is: | |
| 44 | - | |
| 45 | -- `@terminal` - The contents of the terminal | |
| 46 | -- `@currentFile` - The currently active file | |
| 47 | -- `@open` - All open files | |
| 48 | -- `@os` - Information about the operating system | |
| 49 | -- `@problems` - Problems reported by the language server in the active file | |
| 50 | -- `@repo-map` - A map of files in the repository | |
| 51 | -- `@tree` - A tree view of the repository structure | |
| 52 | - | |
| 53 | -Or you can directly type URLs and file paths: | |
| 54 | - | |
| 55 | -- `@https://github.com/continuedev/continue` - The contents of a URL | |
| 56 | -- `@src/index.ts` - The contents of a file (VS Code only) | |
| 28 | +Now to use this prompt, you can open Chat, type <kbd>/</kbd>, select the prompt, and type out any additional instructions you'd like to add. | |
| 57 | 29 | |
| 58 | -All references will be attached as context items, rather than injected directly inline. | |
| 30 | +## Further Examples | |
| 59 | 31 | |
| 60 | -## Local `.prompt` files | |
| 32 | +Below are more examples to get you started. You can also visit the Hub to [explore prompts](https://hub.continue.dev/explore/prompts) or [create your own](https://hub.continue.dev/new?type=block&blockType=prompts). | |
| 61 | 33 | |
| 62 | -In addition to Prompt blocks on the Hub, you can also define prompts in local `.prompt` files, located in the `.continue/prompts` folder at the top level of your workspace. This is useful for quick iteration on prompts to test them out before pushing up to the Hub. | |
| 63 | - | |
| 64 | -### Quick Start | |
| 65 | - | |
| 66 | -Below is a quick example of setting up a prompt file: | |
| 67 | - | |
| 68 | -1. Create a folder called `.continue/prompts` at the top level of your workspace | |
| 69 | -2. Add a file called `test.prompt` to this folder. | |
| 70 | -3. Write the following contents to `test.prompt` and save. | |
| 34 | +### Security review | |
| 71 | 35 | |
| 72 | -```.prompt | |
| 73 | -name: Current file prompt | |
| 74 | -description: A test prompt using the current file context provider | |
| 36 | +```md title="security-review.md" | |
| 37 | +--- | |
| 38 | +name: Security best practices review | |
| 39 | +alwaysApply: false | |
| 75 | 40 | --- |
| 76 | -@currentFile | |
| 77 | -``` | |
| 78 | - | |
| 79 | -Now to use this prompt, you can open Chat, type <kbd>/</kbd>, select the prompt, and add type out some additional text such as "Review the code for any issues". | |
| 80 | - | |
| 81 | -### Format | |
| 82 | - | |
| 83 | -The format is inspired by [HumanLoops's .prompt file](https://docs.humanloop.com/docs/prompt-file-format), with additional templating to reference files, URLs, and context providers. | |
| 84 | 41 | |
| 85 | -:::info | |
| 86 | -The current state of this format is experimental and subject to change | |
| 87 | -::: | |
| 42 | +Review the changes in the current git diff for these security best practices: | |
| 88 | 43 | |
| 89 | -### Preamble | |
| 44 | +- Does the architecture follow security-by-design principles? | |
| 45 | +- Are there potential security vulnerabilities in the system design? | |
| 46 | +- Is sensitive data handled appropriately throughout the lifecycle? | |
| 47 | +``` | |
| 90 | 48 | |
| 91 | -The "preamble" is everything above the `---` separator, and lets you specify model parameters. It uses YAML syntax and currently supports the following parameters: | |
| 49 | +### Pull in commonly used files for tasks | |
| 92 | 50 | |
| 93 | -- `name` - The display title | |
| 94 | -- `description` - The description you will see in the dropdown | |
| 95 | -- `version` - Can be either "1" (for legacy prompt files) or "2" (this is the default and does not need to be set) | |
| 51 | +```md title="typeorm-entity-generator.md" | |
| 52 | +--- | |
| 53 | +name: Generate a new TypeORM entity | |
| 54 | +alwaysApply: false | |
| 55 | +--- | |
| 96 | 56 | |
| 97 | -If you don't need any of these parameters, you can leave out the preamble and do not need to include the `---` separator. | |
| 57 | +Referencing `src/db/dataSource.ts` and `src/db/entity/SampleEntity.ts`, generate a new TypeORM entity based on the following requirements: | |
| 58 | +``` |
modified docs/docs/customize/deep-dives/rules.mdx +18 −8
| @@ -55,19 +55,26 @@ | ||
| 55 | 55 | |
| 56 | 56 | Rules can also be added to an Assistant on the Continue Hub. |
| 57 | 57 | |
| 58 | -Explore available rules [here](https://hub.continue.dev/explore/rules), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub. These blocks are defined using the [`config.yaml` syntax](../../reference.md#rules) and can also be created locally. | |
| 58 | +Explore available rules [here](https://hub.continue.dev), or [create your own](https://hub.continue.dev/new?type=block&blockType=rules) in the Hub. | |
| 59 | 59 | |
| 60 | 60 | ### Syntax |
| 61 | 61 | |
| 62 | +:::info | |
| 63 | + | |
| 64 | +Rules were originally defined in YAML format (demonstrated below), but we introduced Markdown for easier editing. While both are still supported, we recommend Markdown. | |
| 65 | + | |
| 66 | +::: | |
| 67 | + | |
| 62 | 68 | Rules blocks can be simple text, written in YAML configuration files, or as Markdown (`.md`) files. They can have the following properties: |
| 63 | 69 | |
| 64 | 70 | - `name` (**required** for YAML): A display name/title for the rule |
| 65 | 71 | - `globs` (optional): When files are provided as context that match this glob pattern, the rule will be included. This can be either a single pattern (e.g., `"**/*.{ts,tsx}"`) or an array of patterns (e.g., `["src/**/*.ts", "tests/**/*.ts"]`). |
| 66 | 72 | - `regex` (optional): When files are provided as context and their content matches this regex pattern, the rule will be included. This can be either a single pattern (e.g., `"^import .* from '.*';$"`) or an array of patterns (e.g., `["^import .* from '.*';$", "^export .* from '.*';$"]`). |
| 67 | 73 | - `description` (optional): A description for the rule. Agents may read this description when `alwaysApply` is false to determine whether the rule should be pulled into context. |
| 68 | -- `alwaysApply`: true - Always include the rule, regardless of file context | |
| 69 | -- `alwaysApply`: false - Included if globs exist AND match file context, or the agent decides to pull the rule into context based on it's description | |
| 70 | -- `alwaysApply`: undefined - Default behavior: include if no globs exist OR globs exist and match | |
| 74 | +- `alwaysApply`: Determines whether the rule is always included. Behavior is described below: | |
| 75 | + - `true`: Always included, regardless of file context | |
| 76 | + - `false`: Included if globs exist AND match file context, or the agent decides to pull the rule into context based on it's description | |
| 77 | + - `undefined` (default behavior): Included if no globs exist OR globs exist and match | |
| 71 | 78 | |
| 72 | 79 | <Tabs groupId="rules-example"> |
| 73 | 80 | <TabItem value="md" label="Markdown"> |
| @@ -97,10 +104,13 @@ | ||
| 97 | 104 | |
| 98 | 105 | ```yaml title="doc-standards.yaml" |
| 99 | 106 | name: Documentation Standards |
| 100 | - globs: docs/**/*.{md,mdx} | |
| 101 | - alwaysApply: false | |
| 107 | + version: 1.0.0 | |
| 108 | + schema: v1 | |
| 109 | + | |
| 102 | 110 | rules: |
| 103 | 111 | - name: Documentation Standards |
| 112 | + globs: docs/**/*.{md,mdx} | |
| 113 | + alwaysApply: false | |
| 104 | 114 | rule: > |
| 105 | 115 | - Follow Docusaurus documentation standards |
| 106 | 116 | - Include YAML frontmatter with title, description, and keywords |
| @@ -164,7 +174,7 @@ | ||
| 164 | 174 | |
| 165 | 175 | Continue includes a simple default system message for [Chat](../../chat/how-to-use-it.md) and [Agent](../../agent/how-to-use-it.md) requests, to help the model provide reliable codeblock formats in its output. |
| 166 | 176 | |
| 167 | -This can be viewed in the rules section of the toolbar (see above), or visit the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4) | |
| 177 | +This can be viewed in the rules section of the toolbar (see above), or in the source code [here](https://github.com/continuedev/continue/blob/main/core/llm/constructMessages.ts#L4). | |
| 168 | 178 | |
| 169 | 179 | Advanced users can override this system message for a specific model if needed by using `chatOptions.baseSystemMessage`. See the [`config.yaml` reference](../../reference.md#models). |
| 170 | 180 | |
| @@ -172,7 +182,7 @@ | ||
| 172 | 182 | |
| 173 | 183 | :::warning |
| 174 | 184 | |
| 175 | -`.contninuerules` will be deprecated in a future release. Please use the `.continue/rules` folder instead. | |
| 185 | +`.continuerules` will be deprecated in a future release. Please use the `.continue/rules` folder instead. | |
| 176 | 186 | |
| 177 | 187 | ::: |
| 178 | 188 |