If you use AI models in your daily development work, you have probably noticed how much of your typing is the same. "Keep it short." "Show only the diff." "Cite your sources or say you're not sure." "Review this for security problems, most serious first." Every one of those phrases gets retyped, slightly differently each time, and the slight differences produce slightly different answers.
A small library of reusable snippets fixes both problems. You type less, and you get more consistent behavior because the instruction is the same every time. In this post I'll show how to structure such a library, a 20-line expander that turns /brief into the full instruction, and how this idea shows up in chat products such as Shortcut Chat.
Why snippets beat copy-pasting from a notes file
Most people already have a notes file with good prompts. It works until it doesn't: you forget which version was the good one, you paste the wrong paragraph, or you edit the text in the chat window and the improvement never makes it back. A snippet is a named, small, single-purpose instruction that you can combine with others. Three properties make that useful:
- Small. A snippet should do one thing, like constrain length or require citations. Big all-in-one prompts are hard to combine and hard to debug.
- Named. A short name you can remember and type, like
/briefor/review. - Stackable.
/review /diffonlymeans "review it, and show only changes". Two snippets, one request.
The same idea in a product
This pattern isn't new, but it is nice to see in a chat interface. Shortcut Chat's homepage describes "shortcuts": reusable snippets that you save once and add with a click or by typing / in the message box, which can be long or short, customized, and stacked together. Its examples include "keep it brief" and "cite sources", and it notes that shortcuts are only included when you explicitly add them. If you prefer a graphical tool to a repository file, that is the same idea packaged in an app. I haven't used it, so I can't say how well it works in practice.
For developers there is a good reason to also keep snippets as plain text in Git: you can review changes, share them with the team and reuse them in scripts and CI, not only in a chat window.
A starter library
Here is the file I would begin with, and the function that expands it. The snippets are deliberately boring and specific.
snippets.js
// Expand /slash tokens in a prompt using small reusable snippets kept in a plain object (or a JSON file in git).
export const snippets = {
brief: "Answer in under 120 words. No preamble.",
cite: "Cite a source for every factual claim. If you are not sure, say so instead of guessing.",
diffonly: "Show only the changed lines as a unified diff. Do not rewrite the whole file.",
review: "Review this code for bugs, security problems and unclear naming. List findings by severity, most serious first.",
tests: "Suggest edge-case tests I may have missed: empty input, very large input, wrong types, concurrency.",
};
export function expand(prompt, library = snippets) {
const used = [];
const text = prompt.replace(/(^|\s)\/([a-z][a-z0-9-]*)\b/g, (match, lead, name) => {
if (!Object.hasOwn(library, name)) throw new Error(`unknown snippet /${name}`);
used.push(name);
return `${lead}${library[name]}`;
});
return { text, used };
}
A few notes on the design:
- The regex only matches a token that starts the text or follows whitespace. That keeps
src/utils/brief.jsand URLs likehttps://example.com/citefrom being mangled, which a naive search-and-replace would do. - Unknown snippets throw. If you type
/brieffby mistake, you want an error, not the literal text "/brieff" sent to a model and silently ignored. - It reports which snippets it used. Log that next to the model name, as you would a prompt version, so you can tell later which instructions produced a good answer.
- It uses
Object.hasOwnrather than plain property access, so a token like/constructorcan't reach inherited properties.
The tests
snippets.test.js
import test from "node:test";
import assert from "node:assert/strict";
import { expand, snippets } from "./snippets.js";
test("expands a trailing token and reports what was used", () => {
const r = expand("Explain this stack trace. /brief");
assert.equal(r.text, `Explain this stack trace. ${snippets.brief}`);
assert.deepEqual(r.used, ["brief"]);
});
test("stacks several snippets in order", () => {
const r = expand("/review /diffonly Here is the function: ...");
assert.ok(r.text.startsWith(snippets.review));
assert.ok(r.text.includes(snippets.diffonly));
assert.deepEqual(r.used, ["review", "diffonly"]);
});
test("does not touch slashes inside paths or URLs", () => {
const r = expand("Open src/utils/brief.js and https://example.com/cite please");
assert.equal(r.text, "Open src/utils/brief.js and https://example.com/cite please");
assert.deepEqual(r.used, []);
});
test("an unknown snippet is an error instead of being sent to the model as text", () => {
assert.throws(() => expand("Help me /typo"), /unknown snippet \/typo/);
});
All four tests pass. The path and URL test is the one I'd keep even if you rewrite the rest: it documents the exact kind of bug that makes small text-expansion tools annoying.
What makes a good snippet
- Constrain output, don't describe a persona. "Answer in under 120 words, no preamble" is testable. "You are a world-class engineer" is a hope.
- Say what to do when unsure. "If you are not sure, say so instead of guessing" costs a sentence and prevents a lot of confident nonsense.
- Specify the format of code changes. "Show only the diff" saves you from scrolling through a rewritten 300-line file to find three changed lines.
- Ask for the thing you'll check. For reviews, ask for findings by severity. For tests, name the edge cases you care about: empty input, huge input, wrong types.
- Write the date and reason. A comment like "added after the model rewrote whole files" tells you later whether the snippet still earns its place.
Snippets for developer workflows
- Code review.
/reviewplus the diff. Ask for severity ordering so that a typo doesn't outrank a missing authorization check. Then check the findings yourself. A model's review is a prompt for your attention, not a verdict. - Debugging. A snippet that asks for the three most likely causes, ranked, and one cheap experiment for each. It stops the model jumping to a rewrite.
- Documentation. A snippet that asks for a one-line summary, one runnable example and the edge cases, in that order. Pair it with the structure from writing documentation developers read.
- Tests.
/testsasks for edge cases you missed. You decide which are worth writing.
Cautions
- Never put secrets in snippets. A snippet may be shared, logged or synced. Keep API keys, customer details and private health or financial information out of reusable text. Shortcut Chat's own FAQ gives a long personal health profile as an example of a snippet; whatever tool you use, think about where that text is stored and who can see it.
- Don't stack too many. Five contradictory snippets produce muddled answers. If two conflict (
/briefand a snippet asking for thorough detail), the result is unpredictable. - Snippets don't replace testing. If a snippet is part of a production feature, version it like any other prompt and check it against an evaluation set.
- Different models respond differently. A snippet that works for one may be ignored by another. Comparing them blind, as in this post on comparing models, is the way to find out.
Where to keep the library
For a personal library, one JSON file in a private repository is plenty. For a team, put it in the project repository, review changes by pull request and add the expander to your internal scripts. If a graphical tool suits you better, try one, as long as you can export your snippets so you aren't locked in. Whatever you choose, treat the names as an interface: renaming /review will break muscle memory and any scripts that use it.
On pricing: I have not verified Shortcut Chat's current plans beyond what its homepage and FAQ say (a monthly usage allowance, cancel anytime), and a separate pricing page was not available when I checked, so look at the site before deciding. The programme also lists a promo code, FRIEND5; I haven't confirmed what it applies to.
A short checklist
- Small, named, single-purpose snippets.
- Plain text in Git, or an app you can export from.
- Strict expansion: unknown names are errors, and paths aren't touched.
- No secrets in reusable text.
- Log which snippets were used, and test the ones that matter.
Want to try side-by-side answers yourself?
Shortcut Chat lets you send one prompt to up to three models at once and compare the answers. Check what the current plans include before you subscribe, and treat it as a way to explore, not as a replacement for testing through the API you will actually ship with.
Look at Shortcut ChatWhat I ran this against
- The snippet expander was run with
node --teston Node.js 24.22.1 on 17 November 2026. Four tests pass: trailing and stacked tokens, paths and URLs left alone, and unknown snippets rejected. No model was called. - The snippet wording is my own drafting. I haven't measured whether any of these instructions improves any model's answers, so treat them as starting points and test them with your own cases.
- I have not used Shortcut Chat for this post. What I say about the product comes only from its public homepage and FAQ, listed under Sources, read on 17 November 2026. I haven't tested its answers, speed, accuracy or limits, and its model list changes, so check the site for what is available today. This post contains an affiliate link.
Sources checked
- Shortcut Chat homepage and FAQ (side-by-side answers from up to three models at once, reusable shortcuts inserted by click or by typing
/, web search, image generation, a monthly usage allowance shown as a percentage, cancel anytime): shortcutchat.com, read 17 November 2026. I could not open a separate pricing page (it returned 404), so this post quotes no prices; check the current plans on the site.