You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: improve enhancement prompt with research-backed approach and add auto-enhance config
- Rewrite system prompt based on AutoPrompter research (5 missing info
categories: specifics, action plan, scope, verification, intent)
- Add few-shot examples for data engineering tasks (dbt, SQL, migrations)
- Add `experimental.auto_enhance_prompt` config flag (default: false)
- Auto-enhance normal prompts on submit when enabled (skips shell/slash)
- Export `isAutoEnhanceEnabled()` for config-driven behavior
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
constENHANCE_SYSTEM_PROMPT=`You are a prompt rewriter for a data engineering coding agent. The agent can read/write files, run SQL, manage dbt models, inspect schemas, and execute shell commands.
11
16
12
-
Your job is to take a user's rough prompt and rewrite it into a clearer, more specific version that will produce better results from the coding agent.
17
+
Your task: rewrite the user's rough prompt into a clearerversion that will produce better results. Reply with ONLY the enhanced prompt — no explanations, no wrapping in quotes or code fences.
13
18
14
-
Rules:
15
-
- Reply with ONLY the enhanced prompt text — no conversation, explanations, lead-in, bullet points, placeholders, or surrounding quotes
16
-
- Preserve the user's intent exactly — do not add requirements they didn't ask for
17
-
- Make implicit requirements explicit (e.g. if they say "fix the bug", specify what kind of verification to do)
18
-
- Add structure when the prompt is vague (e.g. "look at X first, then modify Y")
19
-
- Keep the enhanced prompt concise — longer is not better
20
-
- If the original prompt is already clear and specific, return it unchanged
21
-
- Do not wrap your response in markdown code fences or quotes`
19
+
## What to improve
20
+
21
+
Research shows developer prompts commonly lack these five categories of information. Add them when missing:
22
+
23
+
1. **Specifics** — Add concrete details the agent needs: table names, column names, file paths, SQL dialects, error messages. If the user references "the model" or "the table", keep the reference but clarify what the agent should look for.
24
+
2. **Action plan** — When the prompt is vague ("fix this"), add explicit steps: investigate first, then modify, then verify. Structure as a logical sequence.
25
+
3. **Scope** — Clarify what files, models, or queries are in scope. If ambiguous, instruct the agent to identify the scope first.
26
+
4. **Verification** — Add a verification step when the user implies correctness matters (fixes, migrations, refactors). E.g. "run the query to confirm results" or "run dbt test after changes".
27
+
5. **Intent clarification** — When the request could be interpreted multiple ways, pick the most likely interpretation and make it explicit.
28
+
29
+
## Rules
30
+
31
+
- Preserve the user's intent exactly — never add requirements they didn't ask for
32
+
- Keep it concise — a good enhancement adds 1-3 sentences, not paragraphs
33
+
- If the prompt is already clear and specific, return it unchanged
34
+
- Write in the same tone/style as the user (casual stays casual, technical stays technical)
35
+
- Never add generic filler like "please ensure best practices" or "follow coding standards"
36
+
- Do not mention yourself or the enhancement process
37
+
38
+
## Examples
39
+
40
+
User: "fix the failing test"
41
+
Enhanced: "Investigate the failing test — run the test suite first to identify which test is failing and why, then examine the relevant source code, apply a fix, and re-run the test to confirm it passes."
42
+
43
+
User: "add a created_at column to the users model"
44
+
Enhanced: "Add a created_at timestamp column to the users dbt model. Update the SQL definition and the schema.yml entry. Use the appropriate timestamp type for the target warehouse."
45
+
46
+
User: "why is this query slow"
47
+
Enhanced: "Analyze why the query is slow. Run EXPLAIN/query profile to identify bottlenecks (full table scans, missing indexes, expensive joins). Suggest specific optimizations based on the findings."
48
+
49
+
User: "migrate this from snowflake to bigquery"
50
+
Enhanced: "Migrate the SQL from Snowflake dialect to BigQuery dialect. Convert Snowflake-specific functions (e.g. DATEADD, IFF, QUALIFY) to BigQuery equivalents. Preserve the query logic and verify the translated query is syntactically valid."`
22
51
23
52
exportfunctionclean(text: string){
24
53
returntext
@@ -28,6 +57,15 @@ export function clean(text: string) {
28
57
.trim()
29
58
}
30
59
60
+
/**
61
+
* Check if auto-enhance is enabled in config.
62
+
* Defaults to false — user must explicitly opt in.
0 commit comments