summaryrefslogtreecommitdiff
path: root/gemfeed/2026-02-14-meta-slash-commands-for-prompts-and-context.html
blob: b9aa949de773f280abd410af747dbcf9c2cd20cf (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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Meta slash-commands to manage prompts and context for coding agents</title>
<link rel="shortcut icon" type="image/gif" href="/favicon.ico" />
<link rel="stylesheet" href="../style.css" />
<link rel="stylesheet" href="style-override.css" />
</head>
<body>
<p class="header">
<a href="https://foo.zone">Home</a> | <a href="https://codeberg.org/snonux/foo.zone/src/branch/content-md/gemfeed/2026-02-14-meta-slash-commands-for-prompts-and-context.md">Markdown</a> | <a href="gemini://foo.zone/gemfeed/2026-02-14-meta-slash-commands-for-prompts-and-context.gmi">Gemini</a>
</p>
<h1 style='display: inline' id='meta-slash-commands-to-manage-prompts-and-context-for-coding-agents'>Meta slash-commands to manage prompts and context for coding agents</h1><br />
<br />
<span class='quote'>Published at 2026-02-14T13:44:45+02:00</span><br />
<br />
<span>I work on many small, repeatable tasks. Instead of retyping the same instructions every time, I want to turn successful prompts into reusable slash-commands and keep background knowledge in loadable context files. This post describes a set of *meta* slash-commands: commands that create, update, and delete other commands and context files. They live as markdown in a dotfiles repo and work with any coding agent that supports slash-commands—Claude Code CLI, Cursor Agent, OpenCode, Ampcode, and others.</span><br />
<br />
<pre>
    ┌─────────────────────────────────────────────────────────────┐
    │  Cursor Agent                                    [~][□][X]  │
    ├─────────────────────────────────────────────────────────────┤
    │                                                             │
    │   → /load-context api-guidelines                            │
    │                                                             │
    │   Context loaded: api-guidelines.md                         │
    │   Ready. Ask me to implement something.                     │
    │                                                             │
    │   → /create-command review-pr                               │
    │                                                             │
    │   Analyzing "review-pr"...                                  │
    │   Generated: description + prompt. Save to commands/ ? [Y]  │
    │                                                             │
    │   ✓ Saved. Use /review-pr anytime.                          │
    │                                                             │
    └─────────────────────────────────────────────────────────────┘
                          │
                          │  slash-commands
                          ▼
    ┌──────────┐  ┌──────────┐  ┌──────────┐  ┌──────────┐
    │ /load-   │  │ /create- │  │ /update- │  │ /review-  │
    │ context  │  │ command  │  │ command  │  │ pr        │
    └──────────┘  └──────────┘  └──────────┘  └──────────┘
         │              │              │              │
         └──────────────┴──────────────┴──────────────┘
                              │
                    coding agent executes
                    your prompt library	
</pre>
<br />
<h2 style='display: inline' id='table-of-contents'>Table of Contents</h2><br />
<br />
<ul>
<li><a href='#meta-slash-commands-to-manage-prompts-and-context-for-coding-agents'>Meta slash-commands to manage prompts and context for coding agents</a></li>
<li>⇢ <a href='#motivation-collecting-prompts-for-later-re-use'>Motivation: collecting prompts for later re-use</a></li>
<li>⇢ <a href='#loading-whole-context-before-asking-the-agent-to-do-something'>Loading whole context before asking the agent to do something</a></li>
<li>⇢ <a href='#works-with-any-coding-agent-that-supports-slash-commands'>Works with any coding agent that supports slash-commands</a></li>
<li>⇢ <a href='#commands-that-manage-slash-commands'>Commands that manage slash-commands</a></li>
<li>⇢ ⇢ <a href='#create-command'><span class='inlinecode'>/create-command</span></a></li>
<li>⇢ ⇢ <a href='#update-command'><span class='inlinecode'>/update-command</span></a></li>
<li>⇢ ⇢ <a href='#delete-command'><span class='inlinecode'>/delete-command</span></a></li>
<li>⇢ <a href='#commands-that-manage-context-files'>Commands that manage context files</a></li>
<li>⇢ ⇢ <a href='#create-context'><span class='inlinecode'>/create-context</span></a></li>
<li>⇢ ⇢ <a href='#update-context'><span class='inlinecode'>/update-context</span></a></li>
<li>⇢ ⇢ <a href='#delete-context'><span class='inlinecode'>/delete-context</span></a></li>
<li>⇢ ⇢ <a href='#load-context'><span class='inlinecode'>/load-context</span></a></li>
<li>⇢ <a href='#summary'>Summary</a></li>
</ul><br />
<h2 style='display: inline' id='motivation-collecting-prompts-for-later-re-use'>Motivation: collecting prompts for later re-use</h2><br />
<br />
<span>When I use a coding agent, I often find myself repeating the same kind of request: "review this function," "explain this error," "add tests for this module," "format this as a blog post" and may other cases. Typing long prompts from scratch is tedious, and ad-hoc prompts are easy to forget. I&#39;d rather capture what works and reuse it.</span><br />
<br />
<span>The solution is to treat prompts as first-class artefacts: store them as markdown files (one file per slash-command or per context), and use a small set of *meta* commands to manage them. The agent then creates, updates, or deletes these files through conversation—no hand-editing of markdowns. I can say <span class='inlinecode'>/create-command review-code we just did a code review</span> and the agent generates the command file based on the current agent&#39;s context, shows a preview, and saves it. Later I run <span class='inlinecode'>/review-code</span> and get a consistent workflow every time.</span><br />
<br />
<span>Because everything is just markdown in a directory (e.g. <span class='inlinecode'>~/Notes/Prompts/commands/</span> for commands and <span class='inlinecode'>~/Notes/Prompts/context/</span> for context), I can version it in git, sync it across machines, and gradually build a library of prompts. If the number of commands grows too large, I might later split them into skills or expose them via a searchable MCP server—but for now, a flat directory of <span class='inlinecode'>.md</span> files is enough.</span><br />
<br />
<h2 style='display: inline' id='loading-whole-context-before-asking-the-agent-to-do-something'>Loading whole context before asking the agent to do something</h2><br />
<br />
<span>A separate but related need is *context*: background information the agent should have before I ask it to do anything. For example, I might have a document describing our Kubernetes setup, API conventions, or the architecture of a specific service. If I ask "add a new endpoint for X" without that context, the agent guesses and without having a reference to an existing project with an <span class='inlinecode'>AGENTS.md</span>. If I first load the relevant context file, the agent knows the naming conventions, the existing patterns, and the infrastructure—and its edits are more accurate.</span><br />
<br />
<span>So I keep two kinds of artefacts:</span><br />
<br />
<ul>
<li>Commands — Reusable workflows (e.g. "review code", "explain error"). They live as <span class='inlinecode'>.md</span> files in a <span class='inlinecode'>commands/</span> directory. Meta-commands create, update, and delete them.</li>
<li>Context — Reusable background (project rules, API notes, infrastructure docs, personas). They live as <span class='inlinecode'>.md</span> files in a <span class='inlinecode'>context/</span> directory. I can create, update, delete, and—importantly—*load* them. Loading a context file injects that content into the conversation so the agent has it in mind for subsequent requests.</li>
</ul><br />
<span>The use case is: start a session, run <span class='inlinecode'>/load-context api-guidelines</span> (or whatever context name), then ask the agent to implement a feature or fix a bug. The agent already knows the guidelines. No need to paste a wall of text every time; the context is on demand (not implicit like with skills).</span><br />
<br />
<h2 style='display: inline' id='works-with-any-coding-agent-that-supports-slash-commands'>Works with any coding agent that supports slash-commands</h2><br />
<br />
<span>I use different agents depending on the task: Claude Code CLI, Cursor Agent (CLI), OpenCode, Ampcode and others. What they have in common is support for custom slash-commands (or the ability to read prompt files). My meta-commands and context files are just markdown; there is no lock-in. Point your agent at the same directories and you get the same prompts and context. I don&#39;t need an MCP server returning prompts right now—the files on disk are enough. If slash-commands ever become too many to manage in a flat list, I may later introduce an MCP server to expose them as skills or searchable prompts.</span><br />
<br />
<h2 style='display: inline' id='commands-that-manage-slash-commands'>Commands that manage slash-commands</h2><br />
<br />
<span>These meta-commands create, update, and delete other slash-commands. The target files live in <span class='inlinecode'>~/Notes/Prompts/commands/</span> (or your chosen path). Each command is one <span class='inlinecode'>.md</span> file. You can see the commands (and the context files) here:</span><br />
<br />
<a class='textlink' href='https://codeberg.org/snonux/dotfiles/src/branch/master/prompts/commands'>https://codeberg.org/snonux/dotfiles/src/branch/master/prompts/commands</a><br />
<a class='textlink' href='https://codeberg.org/snonux/dotfiles/src/branch/master/prompts/context'>https://codeberg.org/snonux/dotfiles/src/branch/master/prompts/context</a><br />
<br />
<h3 style='display: inline' id='create-command'><span class='inlinecode'>/create-command</span></h3><br />
<br />
<span>Creates a new slash-command by inferring its purpose from the name you give.</span><br />
<br />
<ul>
<li>Parameter: <span class='inlinecode'>command_name</span> (e.g. <span class='inlinecode'>review-code</span>, <span class='inlinecode'>explain-error</span>, <span class='inlinecode'>optimize-function</span>)</li>
<li>What it does: The agent analyses the name, infers intent and parameters, writes a description and prompt, shows a preview, and saves <span class='inlinecode'>{{command_name}}.md</span> to the commands directory.</li>
<li>Good for: Turning the current task or a recurring need into a reusable command without editing files by hand.</li>
</ul><br />
<span>Example usage:</span><br />
<br />
<pre>
/create-command review-code
/create-command explain-error
</pre>
<br />
<h3 style='display: inline' id='update-command'><span class='inlinecode'>/update-command</span></h3><br />
<br />
<span>Updates an existing slash-command step by step.</span><br />
<br />
<ul>
<li>Parameter: <span class='inlinecode'>command_name</span> (e.g. <span class='inlinecode'>create-command</span>, <span class='inlinecode'>review-code</span>)</li>
<li>What it does: Reads the existing <span class='inlinecode'>.md</span> file, shows the current content, asks what to change (description, parameters, prompt text), applies edits, shows a preview, and saves.</li>
<li>Good for: Refining a command after you&#39;ve used it a few times or when requirements change.</li>
</ul><br />
<span>Example usage:</span><br />
<br />
<pre>
/update-command create-command
/update-command review-code
</pre>
<br />
<h3 style='display: inline' id='delete-command'><span class='inlinecode'>/delete-command</span></h3><br />
<br />
<span>Removes a slash-command by deleting its definition file.</span><br />
<br />
<ul>
<li>Parameter: <span class='inlinecode'>command_name</span> (e.g. <span class='inlinecode'>testing</span>, <span class='inlinecode'>review-code</span>)</li>
<li>What it does: Verifies the file exists, shows what will be deleted, asks for confirmation, then deletes the file.</li>
<li>Good for: Cleaning up experiments or commands you no longer use.</li>
</ul><br />
<span>Example usage:</span><br />
<br />
<pre>
/delete-command testing
/delete-command review-code
</pre>
<br />
<h2 style='display: inline' id='commands-that-manage-context-files'>Commands that manage context files</h2><br />
<br />
<span>These meta-commands create, update, delete, and *load* context files. Context files live in <span class='inlinecode'>~/Notes/Prompts/context/</span>. Loading a context injects its content into the conversation so the agent can use it for subsequent requests.</span><br />
<br />
<h3 style='display: inline' id='create-context'><span class='inlinecode'>/create-context</span></h3><br />
<br />
<span>Creates a new context file.</span><br />
<br />
<ul>
<li>Parameter: <span class='inlinecode'>context_name</span> (without <span class='inlinecode'>.md</span>), e.g. <span class='inlinecode'>epimetheus</span>, <span class='inlinecode'>api-guidelines</span></li>
<li>What it does: Checks if the context already exists, asks what the context should contain (background, structure, sections), then writes <span class='inlinecode'>{{context_name}}.md</span> to the context directory.</li>
<li>Good for: Capturing project rules, API conventions, or infrastructure notes once and reusing them via <span class='inlinecode'>/load-context</span>.</li>
</ul><br />
<span>Example usage:</span><br />
<br />
<pre>
/create-context epimetheus
/create-context api-guidelines
</pre>
<br />
<h3 style='display: inline' id='update-context'><span class='inlinecode'>/update-context</span></h3><br />
<br />
<span>Updates an existing context file by adding, modifying, or removing content.</span><br />
<br />
<ul>
<li>Parameter: <span class='inlinecode'>context_name</span> (e.g. <span class='inlinecode'>epimetheus</span>, <span class='inlinecode'>api-guidelines</span>). If omitted, lists available context files.</li>
<li>What it does: Reads the existing file, asks what to change (add section, modify section, remove section, rewrite, or full overhaul), applies changes, and saves.</li>
<li>Good for: Keeping context up to date as the project or infrastructure evolves.</li>
</ul><br />
<span>Example usage:</span><br />
<br />
<pre>
/update-context epimetheus
/update-context api-guidelines
/update-context
</pre>
<br />
<h3 style='display: inline' id='delete-context'><span class='inlinecode'>/delete-context</span></h3><br />
<br />
<span>Deletes a context file after confirmation.</span><br />
<br />
<ul>
<li>Parameter: <span class='inlinecode'>context_name</span> (e.g. <span class='inlinecode'>epimetheus</span>, <span class='inlinecode'>old-api-guidelines</span>). If omitted, lists available context files.</li>
<li>What it does: Verifies the file exists, shows a preview or summary, asks for confirmation, then deletes the file.</li>
<li>Good for: Removing outdated or unused context.</li>
</ul><br />
<span>Example usage:</span><br />
<br />
<pre>
/delete-context epimetheus
/delete-context old-api-guidelines
/delete-context
</pre>
<br />
<h3 style='display: inline' id='load-context'><span class='inlinecode'>/load-context</span></h3><br />
<br />
<span>Loads a context file into the conversation so the agent has that background for subsequent requests.</span><br />
<br />
<ul>
<li>Parameter: <span class='inlinecode'>context_name</span> (e.g. <span class='inlinecode'>epimetheus</span>, <span class='inlinecode'>api-guidelines</span>). If omitted, lists available context files.</li>
<li>What it does: Reads the context file, displays its content, and confirms it is loaded. From then on, the agent can use that information when you ask it to implement features, fix bugs, or answer questions.</li>
<li>Good for: Starting a session with "load our API guidelines" or "load our Kubernetes runbook" so the agent knows the infrastructure and conventions before you ask it to do something.</li>
</ul><br />
<span>Example usage:</span><br />
<br />
<pre>
/load-context epimetheus
/load-context api-guidelines
/load-context
</pre>
<br />
<h2 style='display: inline' id='summary'>Summary</h2><br />
<br />
<pre>
| Meta-command       | Purpose                                      | Good for                                          |
|--------------------|----------------------------------------------|---------------------------------------------------|
| /create-command    | Create new slash-command from name           | Turning current or recurring tasks into commands  |
| /update-command    | Edit existing slash-command                  | Refining commands over time                       |
| /delete-command    | Remove slash-command file                    | Cleaning up unused commands                       |
| /create-context    | Create new context file                      | Capturing project/infra knowledge once            |
| /update-context    | Edit existing context file                   | Keeping context up to date                        |
| /delete-context    | Remove context file                          | Removing outdated context                         |
| /load-context      | Load context into conversation               | Giving the agent background before tasks          |
</pre>
<br />
<span>Context is what the agent *knows*; commands are what the agent *does*. Both are markdown files you can create, update, and delete on the fly through the same coding agent—Claude Code CLI, Cursor Agent, OpenCode, Ampcode, or any other that supports slash-commands or prompt files. That&#39;s why these meta-commands are useful for ad-hoc creation, updating, and deleting of prompts and context without leaving the conversation.</span><br />
<br />
<span>Other related posts:</span><br />
<br />
<a class='textlink' href='./2026-02-14-meta-slash-commands-for-prompts-and-context.html'>2026-02-14 Meta slash-commands to manage prompts and context for coding agents (You are currently reading this)</a><br />
<a class='textlink' href='./2026-02-02-tmux-popup-editor-for-cursor-agent-prompts.html'>2026-02-02 A tmux popup editor for Cursor Agent CLI prompts</a><br />
<br />
<span>E-Mail your comments to <span class='inlinecode'>paul@nospam.buetow.org</span> :-)</span><br />
<br />
<a class='textlink' href='../'>Back to the main site</a><br />
<p class="footer">
	Generated with <a href="https://codeberg.org/snonux/gemtexter">Gemtexter 3.0.1-develop</a> |
	served by <a href="https://www.OpenBSD.org">OpenBSD</a>/<a href="https://man.openbsd.org/relayd.8">relayd(8)</a>+<a href="https://man.openbsd.org/httpd.8">httpd(8)</a> |
	<a href="https://foo.zone/site-mirrors.html">Site Mirrors</a>
	<br />
	Webring: <a href="https://shring.sh/foo.zone/previous">previous</a> | <a href="https://shring.sh">shring</a> | <a href="https://shring.sh/foo.zone/next">next</a>
</p>
</body>
</html>