diff --git a/docs/customization/prompts.mdx b/docs/customization/prompts.mdx index cf229284da..8b41a2e56e 100644 --- a/docs/customization/prompts.mdx +++ b/docs/customization/prompts.mdx @@ -13,4 +13,6 @@ description: "These are the specialized instructions that shape how models respo ## Learn More -Prompts have the same syntax as [prompt files](/customization/prompts). The `config.yaml` spec for `prompts` can be found [here](/reference#prompts). +- [Explore prompts](https://hub.continue.dev/?type=prompts) on the Hub +- Learn more in the [prompts deep dive](/customize/deep-dives/prompts) +- View [`prompts`](/reference#prompts) in the YAML Reference for more details diff --git a/docs/customize/deep-dives/prompts.mdx b/docs/customize/deep-dives/prompts.mdx index d80466da78..81533547e3 100644 --- a/docs/customize/deep-dives/prompts.mdx +++ b/docs/customize/deep-dives/prompts.mdx @@ -1,62 +1,106 @@ --- -title: "Creating Custom Prompts in Continue" -description: "Learn how to create reusable prompt files in Continue to streamline repetitive tasks, including examples for code reviews, security checks, and entity generation" +title: "How to Create and Manage Prompts in Continue" +description: "Prompts are used to kick off tasks for Agent, Plan, and Chat requests" +keywords: [prompts, context, slash command] +sidebarTitle: "Prompts" --- -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. +Prompts are included as user messages and especially useful as instructions for repetitive and/or complex tasks. - - Prompts were previously defined in a `.prompt` file format, but for - consistency we now recommend using the same Markdown format as - [rules](./rules) and adding `alwaysApply: false` to the frontmatter so - that they are manually triggered. - +## Slash commands -## Quick Start: How to Create Your First Prompt File +By setting `invokable` to `true`, you make the markdown file a prompt, which will be available when you type / in Chat, Plan, and Agent mode. -Below is a quick example of setting up a prompt file: +```md title="explain-invokable.md" +--- +name: Explain invokable +description: Explains what happens when you set invokable to true +invokable: true +--- + +Explain that when `invokable` is set to `true`, a slash command becomes available in the IDE extensions and CLI +``` -1. Create a folder called `.continue/rules` at the top level of your workspace -2. Add a file called `review-prompt.md` to this folder. -3. Write the following contents to `review-prompt.md` and save. +These slash commands can be combined with additional instructions, including highlighted code, to provide additional context. -```md title="review-prompt.md" +## Example: `Create Supabase functions` prompt + +Here is a prompt that generates high-quality PostgreSQL functions that adhere to best practices: + +```md title="supabase-create-functions.md" --- -name: Redux best practices review -alwaysApply: false +name: Create Supabase functions +description: Guidelines for writing Supabase database functions +invokable: true --- -Review the currently open file for adherence to Redux best practices, as explained in their style guide at https://redux.js.org/style-guide/. +# Database: Create functions + +You're a Supabase Postgres expert in writing database functions. Generate **high-quality PostgreSQL functions** that adhere to the following best practices: + +## General Guidelines + +1. **Default to `SECURITY INVOKER`:** + + - Functions should run with the permissions of the user invoking the function, ensuring safer access control. + - Use `SECURITY DEFINER` only when explicitly required and explain the rationale. + +2. **Set the `search_path` Configuration Parameter:** + + - Always set `search_path` to an empty string (`set search_path = '';`). + - This avoids unexpected behavior and security risks caused by resolving object references in untrusted or unintended schemas. + - Use fully qualified names (e.g., `schema_name.table_name`) for all database objects referenced within the function. + +3. **Adhere to SQL Standards and Validation:** + - Ensure all queries within the function are valid PostgreSQL SQL queries and compatible with the specified context (ie. Supabase). + +... ``` -Now to use this prompt, you can open Chat, type /, select the prompt, and type out any additional instructions you'd like to add. +You can read the rest of the `Create Supabase functions` prompt [here](http://hub.continue.dev/supabase/create-functions) -## Example Prompt Templates for Common Use Cases +If you are using a local `config.yaml`, you can add it to your agent like this: -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). +```md title="config.yaml" +... -### How to Create a Security Review Prompt +prompts: + - uses: supabase/create-functions -```md title="security-review.md" ---- -name: Security best practices review -alwaysApply: false ---- +... +``` + +If you are using Continue Hub, you can add it to your agent by selecting "Use Rule" [here](https://hub.continue.dev/supabase/create-functions) + +To use this prompt, you can open Chat / Agent / Edit, type /, select the prompt, and type out any additional instructions you'd like to add. + +## Using a prompt with `cn` -Review the changes in the current git diff for these security best practices: +You can run this command to start [cn](../../guides/cli) with the [Create Supabase functions](http://hub.continue.dev/supabase/create-functions) prompt. -- Does the architecture follow security-by-design principles? -- Are there potential security vulnerabilities in the system design? -- Is sensitive data handled appropriately throughout the lifecycle? ``` +cn --prompt supabase/create-functions "I need a function that checks for the health status" +``` +Alternatively, you can start [cn](../../guides/cli) and then type / to manually invoke the prompt yourself. -### How to Create a Prompt That References Existing Files +## Using a prompt to kick off a Continuous AI workflow -```md title="typeorm-entity-generator.md" ---- -name: Generate a new TypeORM entity -alwaysApply: false ---- +You can kick off Continuous AI workflows using a prompt with [cn](../../guides/cli). + +For example, say you are building a SaaS application and must repeatedly create custom Supabase validation functions for each new feature that accepts user input. -Referencing `src/db/dataSource.ts` and `src/db/entity/SampleEntity.ts`, generate a new TypeORM entity based on the following requirements: +These functions require you to interpret business requirements, implement complex cross-table logic (like checking user permissions, tier limits, and time-based restrictions), and make judgment calls about edge cases. + +Each function is unique enough that it can't be templated or scripted. This is where kicking off a Continuous AI workflow to get you started can be quite helpful. + +Here is a command that you could run whenever you have a new feature: + +``` + cn -p --prompt supabase/create-functions "I need a function for the new feature on my current branch similar to my existing database functions" ``` + +You can see the entire `Create Supabase functions` prompt [here](http://hub.continue.dev/supabase/create-functions) + +When you run this workflow, [cn](../../guides/cli) will checkout your current branch, explore the new and existing code, and then draft a function for you. + +You will then be able to review the implementation and improve it before you merge the new feature. \ No newline at end of file diff --git a/docs/customize/deep-dives/rules.mdx b/docs/customize/deep-dives/rules.mdx index f2dd041666..93631f3abb 100644 --- a/docs/customize/deep-dives/rules.mdx +++ b/docs/customize/deep-dives/rules.mdx @@ -1,7 +1,7 @@ --- title: "How to Create and Manage Rules in Continue" -description: "Rules are used to provide instructions to the model for Agent, Chat, and Edit requests." -keywords: [rules, .continuerules, system, prompt, message] +description: "Rules are used to provide system message instructions to the model for Agent, Chat, and Edit requests" +keywords: [rules, system, prompt, message] sidebarTitle: "Rules" --- @@ -156,13 +156,4 @@ Continue includes a simple default system message for [Agent](../../features/age 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). -Advanced users can override this system message for a specific model if needed by using `chatOptions.baseSystemMessage`. See the [`config.yaml` reference](/reference#models). - -### Legacy: .continuerules File (Deprecated) - - - `.continuerules` will be deprecated in a future release. Please use the - `.continue/rules` folder instead. - - -You can create project-specific rules by adding a `.continuerules` file to the root of your project. This file is raw text and its full contents will be used as rules. +Advanced users can override this system message for a specific model if needed by using `chatOptions.baseSystemMessage`. See the [`config.yaml` reference](/reference#models). \ No newline at end of file diff --git a/docs/customize/deep-dives/slash-commands.mdx b/docs/customize/deep-dives/slash-commands.mdx deleted file mode 100644 index ef11b0f8de..0000000000 --- a/docs/customize/deep-dives/slash-commands.mdx +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: "Using Slash Commands in Continue" -description: "Learn how to use and create Slash Commands in Continue to run custom prompts, access context providers, and speed up coding tasks." -keywords: [slash command, custom commands, step] -sidebarTitle: "Slash Commands" ---- - -![actions](/images/actions.gif) - -Slash commands are shortcuts that can be activated by typing '/' in a chat session (press cmd/ctrl + L (VS Code) or cmd/ctrl + J (JetBrains)), and selecting from the dropdown. -![slash-commands](/images/slash-commands.png) - -Slash commands can be combined with additional instructions, including highlighted code. - - - **Recommended approach**: Use prompt files to create slash commands instead of - the deprecated `config.json` approach. The methods described below provide - better flexibility and are the actively maintained ways to add custom - commands. - - -## Ways to Create Slash Commands in Continue - -### Agent Prompt Blocks - -The easiest way to add a slash command is by adding [`prompt` blocks](../../hub/blocks/block-types#prompts) to your agent, which show up as slash commands in [Chat](../../features/chat/how-it-works). - -### Prompt Files - -It is also possible to write your own slash command by defining a “.prompt file.” Prompt files can be as simple as a text file, but also include templating so that you can refer to files, URLs, highlighted code, and more. - -Learn more about prompt files [here](./prompts). - -### MCP Server Prompts - -Any prompts provided by [Model Context Protocol](https://modelcontextprotocol.io/introduction) servers are also accessible in chat as Slash Commands. See the [MCP Server Deep Dive](./mcp) for more details. diff --git a/docs/customize/model-roles/edit.mdx b/docs/customize/model-roles/edit.mdx index e60d47017d..b559eaba39 100644 --- a/docs/customize/model-roles/edit.mdx +++ b/docs/customize/model-roles/edit.mdx @@ -6,7 +6,7 @@ sidebar_position: 3 --- import { ModelRecommendations } from '/snippets/ModelRecommendations.jsx' -It's often useful to select a different model to respond to Edit prompts than for chat prompts, as Edits are often more code-specific and may require less conversational readability. +It's often useful to select a different model to respond to Edit instructions than for Chat instructions, as Edits are often more code-specific and may require less conversational readability. In Continue, you can add `edit` to a model's roles to specify that it can be used for Edit requests. If no edit models are specified, the selected `chat` model is used. diff --git a/docs/customize/model-roles/intro.mdx b/docs/customize/model-roles/intro.mdx index ccdd3a3b09..9fa344afeb 100644 --- a/docs/customize/model-roles/intro.mdx +++ b/docs/customize/model-roles/intro.mdx @@ -7,7 +7,7 @@ icon: "book-open" - [`chat`](/customize/model-roles/chat): Used for chat conversations in the extension sidebar - [`autocomplete`](/customize/model-roles/autocomplete): Used for autocomplete code suggestions in the editor -- [`edit`](/customize/model-roles/edit): Used to generate code based on edit prompts +- [`edit`](/customize/model-roles/edit): Used to generate code based on edit instructions - [`apply`](/customize/model-roles/apply): Used to decide how to apply edits to a file - [`embed`](/customize/model-roles/embeddings): Used to generate embeddings used for vector search (@Codebase and @Docs context providers) - [`rerank`](/customize/model-roles/reranking): Used to rerank results from vector search diff --git a/docs/hub/blocks/block-types.mdx b/docs/hub/blocks/block-types.mdx index 461072d468..9e31200e15 100644 --- a/docs/hub/blocks/block-types.mdx +++ b/docs/hub/blocks/block-types.mdx @@ -1,34 +1,31 @@ --- -title: "Blocks: Models, Rules, Prompts, and MCP servers" +title: "Models, Rules, Prompts, and MCP servers" sideBarTitle: "Block Types" description: "Explore the different types of reusable blocks in Continue Hub including models, MCP servers, rules, and prompts" --- ## Models -Models are blocks that let you specify Large Language Models (LLMs) and other deep learning models to be used for various roles in the open-source IDE extension like Chat, Autocomplete, Edit, Embed, Rerank, etc. You can explore available models on [the hub](https://hub.continue.dev/explore/models). - -Continue supports [many model providers](/customize/model-providers), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have one or more of the following roles depending on its capabilities, including `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. Read more about roles [here](/customize/model-roles). View [`models`](/reference#models) in the YAML Reference for more details. +Models are blocks that let you specify Large Language Models (LLMs) and other deep learning models to be used for various roles in the open-source IDE extension like Chat, Autocomplete, Edit, Embed, Rerank, etc. You can explore available models on [the hub](https://hub.continue.dev/?type=models). +Continue supports [many model providers](/customize/model-providers), including Anthropic, OpenAI, Gemini, Ollama, Amazon Bedrock, Azure, xAI, DeepSeek, and more. Models can have one or more of the following roles depending on its capabilities, including `chat`, `edit`, `apply`, `autocomplete`, `embed`, and `rerank`. +Read more about roles [here](/customize/model-roles) and view [`models`](/reference#models) in the YAML Reference for more details. ## MCP Servers -Model Context Protocol (MCP) is a standard way of building and sharing tools for language models. MCP Servers can be defined in `mcpServers` blocks. [Explore MCP Servers](https://hub.continue.dev/explore/mcp) on the hub. +Model Context Protocol (MCP) is a standard way of building and sharing tools for language models. MCP Servers can be defined in `mcpServers` blocks. -Learn more in the [MCP deep dive](/customize/deep-dives/mcp), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. +[Explore MCP Servers](https://hub.continue.dev/?type=mcpServers) on the Hub, learn more in the [MCP deep dive](/customize/deep-dives/mcp), and view [`mcpServers`](/reference#mcpservers) in the YAML Reference for more details. ## Rules -Rules blocks are instructions that your custom AI code agent will always keep in mind - the contents of rules are inserted into the system message for all Chat requests. [Explore rules](https://hub.continue.dev/explore/rules) on the hub. +Rules blocks are instructions that your custom AI code agent will always keep in mind - the contents of rules are inserted into the system message for all Chat, Plan, and Agent requests. -Learn more in the [rules deep dive](/customize/deep-dives/rules), and view [`rules`](/reference#rules) in the YAML Reference for more details. +[Explore rules](https://hub.continue.dev/?type=rules) on the Hub, learn more in the [rules deep dive](/customize/deep-dives/rules), and view [`rules`](/reference#rules) in the YAML Reference for more details. ## Prompts -Prompts blocks are pre-written, reusable prompts that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks. [Explore prompts](https://hub.continue.dev/explore/prompts) on the hub. - -Prompt blocks are pre-written, reusable prompts that can be referenced at any time during chat. They are especially useful as context for repetitive and/or complex tasks. [Explore prompts](https://hub.continue.dev/explore/prompts) on the hub. -Prompt blocks have the same syntax as [prompt files](/customize/deep-dives/prompts). The `config.yaml` spec for `prompts` can be found [here](/reference#prompts). - +Prompts blocks are pre-written, reusable instructions that are used to kick off a task. They are especially useful as context for repetitive and/or complex tasks. +[Explore prompts](https://hub.continue.dev/?type=prompts) on the Hub, learn more in the [prompts deep dive](/customize/deep-dives/prompts), and view [`prompts`](/reference#prompts) in the YAML Reference for more details. \ No newline at end of file diff --git a/docs/hub/introduction.mdx b/docs/hub/introduction.mdx index 29061ec2aa..449a59e8fe 100644 --- a/docs/hub/introduction.mdx +++ b/docs/hub/introduction.mdx @@ -10,6 +10,6 @@ Continue Hub provides a centralized platform for managing the essential building - **[Models](/hub/blocks/block-types#models)**: Discover and configure models from various providers - **[MCP Tools](/hub/blocks/block-types#mcp-servers)**: Access and integrate Model Context Protocol tools to retrieve real-time data and take action - **[Rules](/hub/blocks/block-types#rules)**: Define custom guidelines for your custom AI coding agent to follow -- **[Prompts](/hub/blocks/block-types#prompts)**: Create and share reusable prompts that kickoff your custom AI coding agent +- **[Prompts](/hub/blocks/block-types#prompts)**: Create and share reusable instructions that kickoff your agent Continue Hub also makes it easy for engineering leaders to centrally [configure](/hub/secrets/secret-types) and [govern](/hub/governance/org-permissions) these resources for their organization. \ No newline at end of file diff --git a/docs/reference.mdx b/docs/reference.mdx index 0024f5bff1..d2eefb1127 100644 --- a/docs/reference.mdx +++ b/docs/reference.mdx @@ -325,47 +325,55 @@ context: ### `rules` -List of rules that the LLM should follow. These are concatenated into the system message for all [Agent](/features/agent/quick-start), [Chat](/features/chat/quick-start), and [Edit](/features/edit/quick-start) requests. See the [rules deep dive](/customize/deep-dives/rules) for details. +Rules are concatenated into the system message for all [Agent](/features/agent/quick-start), [Chat](/features/chat/quick-start), and [Edit](/features/edit/quick-start) requests. -Explicit rules can either be simple text or an object with the following properties: +Confiugration example: -- `name` (**required**): A display name/title for the rule -- `rule` (**required**): The text content of the rule -- `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"]`). - -```yaml title="config.yaml"l +```yaml title="config.yaml" rules: - - Always annotate Python functions with their parameter and return types - - name: TypeScript best practices - rule: Always use TypeScript interfaces to define shape of objects. Use type aliases sparingly. - globs: "**/*.{ts,tsx}" - - name: TypeScript test patterns - rule: In TypeScript tests, use Jest's describe/it pattern and follow best practices for mocking. - globs: - - "src/**/*.test.ts" - - "tests/**/*.ts" - - uses: myprofile/my-mood-setter - with: - TONE: concise + - uses: sanity/sanity-opinionated # rules file stored on Continue Hub + - uses: file://user/Desktop/rules.md # rules file stored on local computer +``` + +Rules file example: + +```md title="rules.md" +--- +name: Pirate rule +--- + +Talk like a pirate ``` +See the [rules deep dive](/customize/deep-dives/rules) for more details. + --- ### `prompts` -A list of custom prompts that can be invoked from the chat window. Each prompt has a name, description, and the actual prompt text. +Prompts can be invoked with a / command. + +Configuration example: ```yaml title="config.yaml" prompts: - - name: check - description: Check for mistakes in my code - prompt: | - Please read the highlighted code and check for any mistakes. You should look for the following, and be extremely vigilant: - - Syntax errors - - Logic errors - - Security vulnerabilities + - uses: supabase/create-functions # prompts file stored on Continue Hub + - uses: file://user/Desktop/prompts.md # prompts file stored on local computer ``` +Prompts file example: + +```md title="prompts.md" +--- +name: Make pirate comments +invokable: true +--- + +Rewrite all comments in the active file to talk like a pirate +``` + +See the [prompts deep dive](/customize/deep-dives/prompts) for more details. + --- ### `docs`