Skip to content

Update Supabase prompt to use execute_sql tool for database operations#2829

Open
wwwillchen wants to merge 1 commit intodyad-sh:mainfrom
wwwillchen:fix-supabase-prompt-instructions
Open

Update Supabase prompt to use execute_sql tool for database operations#2829
wwwillchen wants to merge 1 commit intodyad-sh:mainfrom
wwwillchen:fix-supabase-prompt-instructions

Conversation

@wwwillchen
Copy link
Collaborator

@wwwillchen wwwillchen commented Feb 27, 2026

Summary

  • Updated Supabase prompt to emphasize using the execute_sql tool for database operations
  • Changed documentation to clarify that users should not manually create migration files
  • Added warning that migration files in supabase/migrations/ are automatically generated

Test plan

  • Review the updated prompt content in src/prompts/supabase_prompt.ts
  • Verify that the guidance is clear about using execute_sql tool
  • Ensure migration file warning is prominent

πŸ€– Generated with Claude Code


Open with Devin

- Change 'profiles table migration' to 'profiles table using the execute_sql tool'
- Replace SQL code example with emphasis on using execute_sql tool
- Add warning against manually creating/modifying migration files in supabase/migrations/
- Clarify that database schema setup should use the execute SQL tool
@wwwillchen
Copy link
Collaborator Author

@BugBot run

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refines the guidance provided within the Supabase prompt, ensuring that database interactions are performed exclusively through the execute_sql tool. The changes aim to prevent incorrect practices, such as manual creation or modification of migration files, by clearly stating that these files are automatically managed. This improves consistency and reduces potential errors in database schema management.

Highlights

  • Supabase Prompt Update: The Supabase prompt has been updated to explicitly emphasize the use of the execute_sql tool for all database operations.
  • Migration File Guidance: Documentation was changed to clarify that users should not manually create migration files within supabase/migrations/.
  • Automatic Migration Generation: A warning was added to indicate that migration files in supabase/migrations/ are automatically generated and should not be modified manually.
Changelog
  • src/prompts/supabase_prompt.ts
    • Modified the instruction for creating a profiles table to explicitly state using the execute_sql tool instead of just "create profiles table migration".
    • Replaced a generic SQL query example with a prominent warning emphasizing the use of the execute_sql tool and prohibiting manual creation or modification of migration files in supabase/migrations/.
    • Clarified that database schema setup should be done using the execute_sql tool.
Activity
  • No activity has occurred on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with πŸ‘ and πŸ‘Ž on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

βœ… Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 1 additional finding.

Open in Devin Review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

\`\`\`
You will need to setup the database schema.
You will need to setup the database schema using the execute SQL tool.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent tool name in LLM system prompt

Medium Severity

Lines 106 and 108 refer to the tool as "execute SQL tool" (informal, no backticks), while line 30 correctly uses `execute_sql`. The actual tool name registered in the system is execute_sql (with underscore). Since this is an LLM system prompt, inconsistent naming risks the model not recognizing or correctly invoking the execute_sql tool when following instructions from the Database section.

Additional Locations (1)

Fix in CursorΒ Fix in Web

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request successfully updates the Supabase prompt to emphasize the use of the execute_sql tool for all database operations. It clearly instructs users not to manually create or modify migration files within supabase/migrations/, reinforcing that these are automatically generated. These changes significantly improve the guidance for interacting with the Supabase database, promoting correct tool usage and preventing potential issues from manual migration file management.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 28, 2026

Greptile Summary

This PR updates the Supabase prompt documentation to clarify the proper workflow for database operations. The changes emphasize using the execute_sql tool for all database operations and explicitly warn against manually creating migration files in supabase/migrations/, as these are automatically generated.

  • Changed line 30 from "Create profiles table migration" to "Create profiles table using the execute_sql tool"
  • Added prominent warning in the Database section that migration files are automatically generated and must not be manually created
  • Guidance is consistent with the actual execute_sql tool implementation, which can automatically write migration files when enabled via settings

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • Documentation-only change that accurately reflects the tool implementation and improves clarity for users. No functional code changes.
  • No files require special attention

Important Files Changed

Filename Overview
src/prompts/supabase_prompt.ts Updates documentation to emphasize using execute_sql tool instead of manual migrations

Last reviewed commit: 4dc8321

@github-actions
Copy link
Contributor

πŸ” Dyadbot Code Review Summary

Verdict: β›” NO - Do NOT merge

Reviewed by 3 independent agents: Correctness Expert, Code Health Expert, UX Wizard.

Issues Summary

Severity File Issue
πŸ”΄ HIGH src/prompts/supabase_prompt.ts:106 Prompt tells model to use execute_sql tool but that tool only exists in local-agent mode β€” will break build mode
🟑 MEDIUM src/prompts/supabase_prompt.ts:106 Inaccurate claim that migration files are generated by an "external system"
🟒 Low Priority Notes (1 item)
  • Inconsistent tool name formatting β€” src/prompts/supabase_prompt.ts:106-108: Line 30 uses backtick-quoted execute_sql but lines 106/108 use prose "execute SQL tool". Should use exact tool name consistently for LLM clarity.
🚫 Dropped False Positives (1 item)
  • Warning message too long β€” Dropped: The prompt is consumed by an AI model, not displayed to end users. Formatting is functional.

Generated by Dyadbot multi-agent code review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4dc832161d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with πŸ‘.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

## Database
If the user wants to use the database, use SQL queries like this:
**IMPORTANT: Always use the execute SQL tool to run SQL queries against the Supabase database. NEVER write SQL migration files to \`supabase/migrations/\` β€” those files are automatically generated by an external system and must not be created or modified manually.**

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use canonical execute_sql tool name in prompt

The updated database guidance tells the model to use an "execute SQL" tool, but the actual local-agent tool is registered as execute_sql (src/pro/main/ipc/handlers/local_agent/tools/execute_sql.ts, name: "execute_sql"). In tool-calling flows, name matching is exact, so this wording can cause the model to emit plain SQL/manual file edits instead of calling the executable tool, which means database changes may not be applied.

Useful? React with πŸ‘Β / πŸ‘Ž.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Multi-agent review: 2 issue(s) found (1 HIGH, 1 MEDIUM)

## Database
If the user wants to use the database, use SQL queries like this:
**IMPORTANT: Always use the execute SQL tool to run SQL queries against the Supabase database. NEVER write SQL migration files to \`supabase/migrations/\` β€” those files are automatically generated by an external system and must not be created or modified manually.**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ”΄ HIGH | logic

execute_sql tool instruction applies to all chat modes but tool only exists in local-agent mode

The prompt now tells the model to "Always use the execute SQL tool" for all database operations, but execute_sql is a tool only registered in local-agent (Pro) mode. In build mode, SQL is executed via <dyad-execute-sql> XML tags parsed by response_processor.ts β€” there is no execute_sql tool in that mode.

getSupabaseAvailableSystemPrompt is used in both modes (see chat_stream_handlers.ts), so models running in build mode will be instructed to call a tool that does not exist. This will cause the model to either hallucinate a tool call or fail to execute any SQL, breaking database setup for non-Pro users.

πŸ’‘ Suggestion: Either conditionally inject different database instructions based on chat mode, or make the instruction mode-agnostic by documenting both the XML tag approach (build mode) and the execute_sql tool (local-agent mode).

## Database
If the user wants to use the database, use SQL queries like this:
**IMPORTANT: Always use the execute SQL tool to run SQL queries against the Supabase database. NEVER write SQL migration files to \`supabase/migrations/\` β€” those files are automatically generated by an external system and must not be created or modified manually.**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟑 MEDIUM | accuracy

Inaccurate claim that migration files are generated by an "external system"

The warning states migration files "are automatically generated by an external system," but they are actually written by Dyad's own execute_sql tool when enableSupabaseWriteSqlMigration is enabled (see execute_sql.ts lines 46-53). This is a first-party Dyad feature, not an external system.

This misleading framing could confuse users who see migration files appear after the model says it will never create them, or lead the model to give incorrect explanations.

πŸ’‘ Suggestion: Revise to: "Migration files in supabase/migrations/ are automatically managed by Dyad when the Write SQL Migration setting is enabled. Do not create or modify these files directly."

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

βœ… Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 issues found across 1 file

Confidence score: 3/5

  • There’s a concrete risk of incorrect tool usage: src/prompts/supabase_prompt.ts tells the model to always use the execute SQL tool even in build mode where execute_sql isn’t registered, which can lead to failed SQL execution paths.
  • The prompt also inconsistently names the tool (β€œexecute SQL tool” vs execute_sql), which could cause the model to call the wrong tool identifier.
  • Pay close attention to src/prompts/supabase_prompt.ts - prompt/tooling instructions may not match registered tools across modes.
Prompt for AI agents (unresolved issues)

Check if these issues are valid β€” if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="src/prompts/supabase_prompt.ts">

<violation number="1" location="src/prompts/supabase_prompt.ts:106">
P1: This prompt unconditionally instructs the model to "Always use the execute SQL tool", but `execute_sql` is only registered as a tool in local-agent (Pro) mode. In build mode, SQL is executed via `<dyad-execute-sql>` XML tags β€” no `execute_sql` tool exists. Since `getSupabaseAvailableSystemPrompt` is used in both modes, models in build mode will be told to call a tool that doesn't exist, causing them to either hallucinate a tool call or fail to execute SQL entirely. Consider conditionally injecting different instructions based on the chat mode, or making the guidance mode-agnostic.</violation>

<violation number="2" location="src/prompts/supabase_prompt.ts:108">
P2: The tool is referred to here as "the execute SQL tool" (informal, no backticks), but the actual registered tool name is `execute_sql` (with underscore). Line 30 of this same file correctly uses the backtick-quoted `` `execute_sql` `` form. Since this is an LLM system prompt and tool-calling flows rely on exact name matching, using the informal name risks the model not recognizing or correctly invoking the tool. Use the canonical `` `execute_sql` `` name consistently throughout the prompt.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

## Database
If the user wants to use the database, use SQL queries like this:
**IMPORTANT: Always use the execute SQL tool to run SQL queries against the Supabase database. NEVER write SQL migration files to \`supabase/migrations/\` β€” those files are automatically generated by an external system and must not be created or modified manually.**
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: This prompt unconditionally instructs the model to "Always use the execute SQL tool", but execute_sql is only registered as a tool in local-agent (Pro) mode. In build mode, SQL is executed via <dyad-execute-sql> XML tags β€” no execute_sql tool exists. Since getSupabaseAvailableSystemPrompt is used in both modes, models in build mode will be told to call a tool that doesn't exist, causing them to either hallucinate a tool call or fail to execute SQL entirely. Consider conditionally injecting different instructions based on the chat mode, or making the guidance mode-agnostic.

Prompt for AI agents
Check if this issue is valid β€” if so, understand the root cause and fix it. At src/prompts/supabase_prompt.ts, line 106:

<comment>This prompt unconditionally instructs the model to "Always use the execute SQL tool", but `execute_sql` is only registered as a tool in local-agent (Pro) mode. In build mode, SQL is executed via `<dyad-execute-sql>` XML tags β€” no `execute_sql` tool exists. Since `getSupabaseAvailableSystemPrompt` is used in both modes, models in build mode will be told to call a tool that doesn't exist, causing them to either hallucinate a tool call or fail to execute SQL entirely. Consider conditionally injecting different instructions based on the chat mode, or making the guidance mode-agnostic.</comment>

<file context>
@@ -103,13 +103,9 @@ function Login() {
 ## Database
 
-If the user wants to use the database, use SQL queries like this:
+**IMPORTANT: Always use the execute SQL tool to run SQL queries against the Supabase database. NEVER write SQL migration files to \`supabase/migrations/\` β€” those files are automatically generated by an external system and must not be created or modified manually.**
 
-\`\`\`sql
</file context>
Fix with Cubic

\`\`\`
You will need to setup the database schema.
You will need to setup the database schema using the execute SQL tool.
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The tool is referred to here as "the execute SQL tool" (informal, no backticks), but the actual registered tool name is execute_sql (with underscore). Line 30 of this same file correctly uses the backtick-quoted `execute_sql` form. Since this is an LLM system prompt and tool-calling flows rely on exact name matching, using the informal name risks the model not recognizing or correctly invoking the tool. Use the canonical `execute_sql` name consistently throughout the prompt.

Prompt for AI agents
Check if this issue is valid β€” if so, understand the root cause and fix it. At src/prompts/supabase_prompt.ts, line 108:

<comment>The tool is referred to here as "the execute SQL tool" (informal, no backticks), but the actual registered tool name is `execute_sql` (with underscore). Line 30 of this same file correctly uses the backtick-quoted `` `execute_sql` `` form. Since this is an LLM system prompt and tool-calling flows rely on exact name matching, using the informal name risks the model not recognizing or correctly invoking the tool. Use the canonical `` `execute_sql` `` name consistently throughout the prompt.</comment>

<file context>
@@ -103,13 +103,9 @@ function Login() {
-\`\`\`
-
-You will need to setup the database schema.
+You will need to setup the database schema using the execute SQL tool.
 
 ### Row Level Security (RLS)
</file context>
Suggested change
You will need to setup the database schema using the execute SQL tool.
You will need to setup the database schema using the \`execute_sql\` tool.
Fix with Cubic

@github-actions github-actions bot added the needs-human:review-issue ai agent flagged an issue that requires human review label Feb 28, 2026
@github-actions
Copy link
Contributor

🎭 Playwright Test Results

❌ Some tests failed

OS Passed Failed Flaky Skipped
🍎 macOS 235 1 6 6

Summary: 235 passed, 1 failed, 6 flaky, 6 skipped

Failed Tests

🍎 macOS

  • debugging_logs.spec.ts > network requests and responses should appear in the console
    • Error: expect(locator).toBeEnabled() failed

πŸ“‹ Re-run Failing Tests (macOS)

Copy and paste to re-run all failing spec files locally:

npm run e2e \
  e2e-tests/debugging_logs.spec.ts

⚠️ Flaky Tests

🍎 macOS

  • attach_image.spec.ts > attach image via drag - chat (passed after 1 retry)
  • local_agent_auto.spec.ts > local-agent - auto model (passed after 1 retry)
  • select_component.spec.ts > select component next.js (passed after 1 retry)
  • setup_flow.spec.ts > Setup Flow > setup banner shows correct state when node.js is installed (passed after 1 retry)
  • setup.spec.ts > setup ai provider (passed after 1 retry)
  • undo.spec.ts > undo (passed after 1 retry)

πŸ“Š View full report

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-human:review-issue ai agent flagged an issue that requires human review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant