Skip to content
cosmodev ~/tools/system-prompt-builder

System Prompt Builder

AI & Agents

Assemble a system prompt from ordered blocks — role, context, constraints, output format — with a live token count, soft-limit warnings, and a shareable URL. 100% client-side.

Templates are starting points — edit every block to your case.

What it does

The System Prompt Builder turns prompt-writing into block-stacking. Instead of staring at one giant textarea, you compose your system prompt from ordered blocks — Role, Context, Constraints, Output format, Examples, Tone, Refusal policy, Safety — each edited on its own and toggled in or out. The assembled prompt and its live token count update as you type, with a warning when the prompt grows past the point where it starts crowding the context window. Everything runs 100% client-side; your prompt never leaves the browser.

How to use it

  1. Pick a template from Add a block (or start blank) — a fresh visit seeds Role, Constraints, and Output format for you.
  2. Edit each block’s title and content; use the switch to include or exclude it from the assembly without deleting it.
  3. Reorder with the ↑ / ↓ buttons — order is meaning: role first, output format last is the common skeleton.
  4. Watch the token counter (top right of the output panel); past ~2,000 tokens the builder warns that the prompt is crowding the context on most models.
  5. Copy the assembled prompt, or Share to get a URL that carries your whole builder state (the URL works for prompts up to roughly a few thousand characters).

Examples

Blocks (Role enabled, Tone disabled):

Role        You are a senior TypeScript reviewer.
Constraints - Flag only real bugs, not style.
Tone        (disabled)

Assembled output:

## Role
You are a senior TypeScript reviewer.

## Constraints
- Flag only real bugs, not style.

A five-word-role block alone lands around 30–50 tokens — the counter reflects the assembled text, not the editor, so disabled blocks cost nothing.

Good to know

  • Disabled blocks are kept, not deleted — A/B a block by toggling it and watching the token delta.
  • The “no Role block” lint is a heuristic: prompts that state who the model is tend to anchor the rest of the instructions.
  • Share URLs carry state in the query string; very large prompts exceed a comfortable URL and the Share button disables itself — use Copy instead.
  • Token counts are estimates (prose heuristic), accurate to ~15% — plenty for budgeting, not for billing.
  • Runs 100% client-side. Nothing you type is sent anywhere.
  • Related: Token Estimator, Context Window Planner, Model Picker.
Source code14 languages

100% client-side · your data never leaves your browser. Found this useful? Share it with a teammate.