| 1 | --- |
| 2 | title: "How to Create and Manage Prompts in Continue" |
| 3 | description: "Prompts are used to kick off tasks for Agent, Plan, and Chat requests" |
| 4 | keywords: [prompts, context, slash command] |
| 5 | sidebarTitle: "Prompts" |
| 6 | --- |
| 7 | |
| 8 | Prompts are included as user messages and are especially useful as instructions for repetitive and/or complex tasks. |
| 9 | |
| 10 | ## Slash commands |
| 11 | |
| 12 | By setting `invokable` to `true`, you make the markdown file a prompt, which will be available when you type <kbd>/</kbd> in Chat, Plan, and Agent mode. |
| 13 | |
| 14 | ```md title="explain-invokable.md" |
| 15 | --- |
| 16 | name: Explain invokable |
| 17 | description: Explains what happens when you set invokable to true |
| 18 | invokable: true |
| 19 | --- |
| 20 | |
| 21 | Explain that when `invokable` is set to `true`, a slash command becomes available in the IDE extensions and CLI |
| 22 | ``` |
| 23 | |
| 24 | These slash commands can be combined with other instructions, including highlighted code, to provide additional context. |
| 25 | |
| 26 | ## Example: `Create Supabase functions` prompt |
| 27 | |
| 28 | Here is a prompt that generates high-quality PostgreSQL functions that adhere to best practices: |
| 29 | |
| 30 | ```md title="supabase-create-functions.md" |
| 31 | --- |
| 32 | name: Create Supabase functions |
| 33 | description: Guidelines for writing Supabase database functions |
| 34 | invokable: true |
| 35 | --- |
| 36 | |
| 37 | # Database: Create functions |
| 38 | |
| 39 | You're a Supabase Postgres expert in writing database functions. Generate **high-quality PostgreSQL functions** that adhere to the following best practices: |
| 40 | |
| 41 | ## General Guidelines |
| 42 | |
| 43 | 1. **Default to `SECURITY INVOKER`:** |
| 44 | |
| 45 | - Functions should run with the permissions of the user invoking the function, ensuring safer access control. |
| 46 | - Use `SECURITY DEFINER` only when explicitly required and explain the rationale. |
| 47 | |
| 48 | 2. **Set the `search_path` Configuration Parameter:** |
| 49 | |
| 50 | - Always set `search_path` to an empty string (`set search_path = '';`). |
| 51 | - This avoids unexpected behavior and security risks caused by resolving object references in untrusted or unintended schemas. |
| 52 | - Use fully qualified names (e.g., `schema_name.table_name`) for all database objects referenced within the function. |
| 53 | |
| 54 | 3. **Adhere to SQL Standards and Validation:** |
| 55 | - Ensure all queries within the function are valid PostgreSQL SQL queries and compatible with the specified context (ie. Supabase). |
| 56 | |
| 57 | ... |
| 58 | ``` |
| 59 | |
| 60 | <Info>You can read the rest of the `Create Supabase functions` prompt [here](http://hub.continue.dev/supabase/create-functions)</Info> |
| 61 | |
| 62 | If you are using a local `config.yaml`, you can add it to your agent like this: |
| 63 | |
| 64 | ```md title="config.yaml" |
| 65 | ... |
| 66 | |
| 67 | prompts: |
| 68 | - uses: supabase/create-functions |
| 69 | |
| 70 | ... |
| 71 | ``` |
| 72 | |
| 73 | 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) |
| 74 | |
| 75 | To use this prompt, you can open Chat / Agent / Edit, type <kbd>/</kbd>, select the prompt, and type out any additional instructions you'd like to add. |
| 76 | |
| 77 | ## Using a prompt with `cn (TUI mode)` |
| 78 | |
| 79 | You can run this command to start [cn](../../guides/cli) with the [Create Supabase functions](http://hub.continue.dev/supabase/create-functions) prompt. |
| 80 | |
| 81 | ``` |
| 82 | cn --prompt supabase/create-functions "I need a function that checks for the health status" |
| 83 | ``` |
| 84 | Alternatively, you can start [cn](../../guides/cli) and then type <kbd>/</kbd> to manually invoke the prompt yourself. |
| 85 | |
| 86 | ## Using a prompt to kick off a Continuous AI workflow with `cn (Headless mode) |
| 87 | |
| 88 | You can kick off Continuous AI workflows using a prompt with [cn](../../guides/cli) by adding the `-p` flag. |
| 89 | |
| 90 | 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. |
| 91 | |
| 92 | 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. |
| 93 | |
| 94 | 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. |
| 95 | |
| 96 | Here is a command that you could run whenever you have a new feature: |
| 97 | |
| 98 | ``` |
| 99 | cn -p --prompt supabase/create-functions "I need a function for the new feature on my current branch similar to my existing database functions" |
| 100 | ``` |
| 101 | |
| 102 | <Info>You can see the entire `Create Supabase functions` prompt [here](http://hub.continue.dev/supabase/create-functions)</Info> |
| 103 | |
| 104 | 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. |
| 105 | |
| 106 | You will then be able to review the implementation and improve it before you merge the new feature. |