跳到主要内容
提示作为用户消息包含在内,尤其适用于重复和/或复杂任务的指令。

斜杠命令

通过将 invokable 设置为 true,您可以将 Markdown 文件设置为提示,当您在聊天、计划和代理模式下输入 / 时,该提示将可用。
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
这些斜杠命令可以与其他指令(包括突出显示的代码)结合使用,以提供额外的上下文。

示例:创建 Supabase 函数 提示

这是一个生成遵循最佳实践的高质量 PostgreSQL 函数的提示
supabase-create-functions.md
---
name: Create Supabase functions
description: Guidelines for writing Supabase database functions
invokable: true
---

# 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).

...
您可以在此处阅读创建 Supabase 函数提示的其余部分
如果您正在使用本地 config.yaml,您可以像这样将其添加到您的配置中
config.yaml
...

prompts:
  - uses: supabase/create-functions

...
如果您正在使用 Continue Mission Control,您可以通过在此处选择“使用规则”将其添加到您的配置中。 要使用此提示,您可以打开聊天/代理/编辑,输入 /,选择提示,然后输入您想添加的任何额外指令。

使用 cn (TUI 模式) 的提示

您可以运行此命令以使用创建 Supabase 函数提示来启动cn
cn --prompt supabase/create-functions "I need a function that checks for the health status"
或者,您可以启动cn,然后输入/以手动调用提示。

使用提示通过 `cn(无头模式)` 启动连续 AI 工作流

您可以通过添加 -p 标志,使用cn和提示来启动连续 AI 工作流。 例如,假设您正在构建一个 SaaS 应用程序,并且必须为每个接受用户输入的新功能重复创建自定义 Supabase 验证函数。 这些函数要求您解释业务需求,实现复杂的跨表逻辑(例如检查用户权限、层级限制和基于时间的限制),并对边缘情况做出判断。 每个函数都足够独特,无法模板化或脚本化。在这种情况下,启动一个连续 AI 工作流来帮助您入门会非常有帮助。 以下是您每当有新功能时可以运行的命令:
 cn -p --prompt supabase/create-functions "I need a function for the new feature on my current branch similar to my existing database functions"
您可以在此处查看完整的创建 Supabase 函数提示
当您运行此工作流时,cn 将检出您当前的分支,探索新旧代码,然后为您起草一个函数。 然后,您将能够审查实现并改进它,然后再合并新功能。