summaryrefslogtreecommitdiff
path: root/internal/promptstore/default_prompts.go
blob: 8aefb6b602e9ff65b2bd3a00434b2ed920826503 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
// Built-in meta-prompts for prompt management.
package promptstore

import (
	"time"
)

// DefaultPrompts returns the built-in meta-prompts for prompt management.
// It assembles prompts from category-specific helpers so each remains concise.
func DefaultPrompts() []Prompt {
	now := time.Now()
	return []Prompt{
		buildSavePrompt(now),
		buildUpdatePrompt(now),
		buildDeletePrompt(now),
		buildDesignPrompt(now),
	}
}

// formattingRules is the shared instruction block for clarifying-question formatting
// used by the save and update meta-prompts.
const formattingRules = `IMPORTANT FORMATTING RULES for clarifying questions:
- Use numbered questions: 1), 2), 3)
- ANY CHOICE MUST BE NUMBERED using combined format: 1a), 1b), 1c), 2a), 2b), etc.
- NEVER use standalone letters like "a)" - always combine with question number
- NEVER use dashes (-) or bullets (•) for options
- Every option must be numbered for easy selection by the user`

// buildSavePrompt creates the "save_prompt" meta-prompt that turns a conversation
// into a reusable prompt template.
func buildSavePrompt(now time.Time) Prompt {
	return Prompt{
		Name:        "save_prompt",
		Title:       "Save Current Conversation as Prompt",
		Description: "Interactively create a new prompt template from the current conversation. Claude will analyze the conversation, ask clarifying questions about templating, show a preview, and wait for approval before saving.",
		Arguments: []PromptArgument{
			{Name: "prompt_name", Description: "Unique identifier for the new prompt (lowercase, underscores allowed)", Required: true},
			{Name: "prompt_title", Description: "Human-readable display name for the new prompt", Required: true},
		},
		Messages: []PromptMessage{{
			Role:    "user",
			Content: MessageContent{Type: "text", Text: savePromptText()},
		}},
		Tags:    []string{"meta", "prompt-management", "interactive"},
		Created: now,
		Updated: now,
	}
}

// savePromptText returns the user message body for the save_prompt meta-prompt.
func savePromptText() string {
	return `I want to create a new prompt template named '{{prompt_name}}' with title '{{prompt_title}}'.

Please help me by:
1) Analyzing our current conversation to understand what should be templated
2) Asking me clarifying questions about:
   - What parts should be template arguments vs fixed text
   - What description would best explain this prompt's purpose
   - What tags would help categorize it
   - Whether multi-turn messages are needed
3) Showing me a complete preview of the prompt structure in a code block
4) Only after I approve, use the create_prompt tool to save it

` + formattingRules + `

Examples:
  1) Question Category
  Which do you prefer?
  1a) First option
  1b) Second option
  1c) Third option

  2) Arguments
  Should this accept parameters?
  2a) No arguments - fixed behavior
  2b) Optional file_pattern argument
  2c) Multiple optional arguments

  3) Sub-items
  Consider these aspects:
  3a) First aspect to consider
  3b) Second aspect to consider
  3c) Third aspect to consider

  4) Multiple sub-questions
  4a) Sub-question one?
      Answer options here
  4b) Sub-question two?
      Answer options here

Start by examining our conversation and asking your clarifying questions using this format.`
}

// buildUpdatePrompt creates the "update_prompt" meta-prompt for modifying
// an existing prompt interactively.
func buildUpdatePrompt(now time.Time) Prompt {
	return Prompt{
		Name:        "update_prompt",
		Title:       "Update Existing Prompt",
		Description: "Interactively modify an existing prompt. Claude will fetch the current version, ask what changes you want, show a preview with changes highlighted, and wait for approval before updating.",
		Arguments: []PromptArgument{
			{Name: "prompt_name", Description: "Name of the existing prompt to update", Required: true},
		},
		Messages: []PromptMessage{{
			Role:    "user",
			Content: MessageContent{Type: "text", Text: updatePromptText()},
		}},
		Tags:    []string{"meta", "prompt-management", "interactive"},
		Created: now,
		Updated: now,
	}
}

// updatePromptText returns the user message body for the update_prompt meta-prompt.
func updatePromptText() string {
	return `I want to update the existing prompt '{{prompt_name}}'.

Please help me by:
1) Ask me what changes I want to make to the prompt '{{prompt_name}}' (title, description, arguments, messages, or tags)
2) If I reference content from our current conversation, help extract and template it
3) Show me a complete preview of the updated prompt with changes highlighted
4) Only after I approve, use the update_prompt tool to save the changes

` + formattingRules + `

Examples:
  1) Question Category
  Which do you prefer?
  1a) First option
  1b) Second option
  1c) Third option

  2) Changes to Make
  What aspects should be updated?
  2a) Description only
  2b) Arguments only
  2c) Both description and arguments
  2d) Complete rewrite

  3) Multiple aspects
  Consider:
  3a) First aspect to evaluate
  3b) Second aspect to evaluate
  3c) Third aspect to evaluate

Start by asking me what changes I want to make, using this format for any clarifying questions.`
}

// buildDeletePrompt creates the "delete_prompt" meta-prompt for safely removing
// a custom prompt with explicit confirmation.
func buildDeletePrompt(now time.Time) Prompt {
	return Prompt{
		Name:        "delete_prompt",
		Title:       "Delete Custom Prompt",
		Description: "Interactively delete an existing custom prompt with confirmation. Claude will show the current prompt, ask for confirmation, and only delete after explicit approval. Built-in prompts cannot be deleted.",
		Arguments: []PromptArgument{
			{Name: "prompt_name", Description: "Name of the existing prompt to delete", Required: true},
		},
		Messages: []PromptMessage{{
			Role: "user",
			Content: MessageContent{Type: "text", Text: `I want to delete the existing prompt '{{prompt_name}}'.

Please help me by:
1) Confirm with me that I want to delete the prompt named '{{prompt_name}}'
2) Explain that this action cannot be undone (though backups are automatically created)
3) Ask me to type 'yes' to confirm the deletion
4) Only after I explicitly confirm with 'yes', use the delete_prompt tool to delete it

IMPORTANT NOTES:
- Built-in prompts (save_prompt, update_prompt, delete_prompt) cannot be deleted
- Only custom prompts stored in user.jsonl can be deleted
- Backups are automatically created before deletion

Ask me to confirm the deletion of '{{prompt_name}}'.`},
		}},
		Tags:    []string{"meta", "prompt-management", "interactive"},
		Created: now,
		Updated: now,
	}
}

// buildDesignPrompt creates the "design_prompt" meta-prompt for building
// a brand new prompt template from scratch through guided questions.
func buildDesignPrompt(now time.Time) Prompt {
	return Prompt{
		Name:        "design_prompt",
		Title:       "Design New Prompt from Scratch",
		Description: "Interactively design a brand new prompt template through guided questions. Claude will help you define the purpose, arguments, message flow, and metadata step by step, show a preview, and wait for approval before saving.",
		Arguments:   []PromptArgument{},
		Messages: []PromptMessage{{
			Role: "user",
			Content: MessageContent{Type: "text", Text: `I want to design a brand new prompt template from scratch.

Please ask me:
1) What should this prompt do? (describe the task/purpose in 1-2 sentences)
2) What arguments does it need? (if any - use {{argument}} syntax)
3) Prompt name (lowercase, underscores only), title, and tags

Then show me a preview and save it after I approve.

Keep questions brief and focused.`},
		}},
		Tags:    []string{"meta", "prompt-management", "interactive", "creation"},
		Created: now,
		Updated: now,
	}
}