/factory-kit:factory-promptingfrom factory-kit
Structures prompts using a small vocabulary of XML tags (instructions, context, input, output_format, examples, constraints, role, thinking) to reduce ambiguity. Useful when authoring prompts by hand, designing production templates, or rewriting unreliable asks.
Ships in factory-kit. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Each section leads with Principle (one sentence, model-agnostic), then Why (the constraint and the tradeoff), then Recipe (the canonical shape), and Failure mode when there's one to name. This skill governs how to author prompts; it doesn't tell you what to ask for.
Principle. XML tags are unambiguous delimiters. They tell the model what role each chunk plays without relying on prose cues.
Why. A bare prompt mixes roles: "Summarize these meeting notes (the meeting was with our vendor about Q3) — bullet points, max 150 words. Notes: …" The model has to infer which sentence is the ask, which is background, which is the material to operate on, and which is the output shape. It usually guesses right; under load, with long inputs, or with conflicting cues, it sometimes guesses wrong. Tags collapse the guess. <instructions> is the ask. <input> is the material. <output_format> is the shape. Each chunk has a labelled role, parseable independently.
The deeper reason: tags are positional-independent. You can reorder context and input without rewriting transition prose. Templates compose. Variable substitution stays clean.
Tradeoff. Tags add visual noise on short prompts. A one-line ask wrapped in five tags is worse, not better — that's decoration, not structure (see failure modes). Reach for tags when ambiguity is real, not as ritual.
Principle. A canonical set of ~8 tag names, each mapping to a role that genuinely differs in kind. Reuse the vocabulary across prompts; don't invent new tags per task.
Why. The same discipline that keeps a design token system legible (see factory-design.md) keeps a prompt template system legible. Ten roles you know cold beats fifty roles you have to read each time. Every prompt in the system should feel like the same product.
The set.
| Tag | Role | Use when |
|---|---|---|
<instructions> | The literal ask — what the model should do | Always, unless the ask is the only thing in the prompt |
<context> | Background that informs the task but isn't the material to operate on | The model needs to know why or for whom |
<input> | The literal material to operate on (notes, email, transcript, code, query) | There's a thing to read/transform/answer |
<output_format> | Shape and constraints of the response | The output needs structure (length, schema, tone, format) |
<examples> (nests <example>) | Few-shot demonstrations of input → output | The task is fuzzy and one good example beats a paragraph of description |
<constraints> | Hard rules (length caps, exclusions, must-include, forbidden phrasings) | A rule is binary, not advisory |
<role> | Persona / domain stance | The voice or expertise frame genuinely changes the answer |
<thinking> | Steer explicit reasoning before the answer | You want the model to lay out steps before committing to output |
Anything that doesn't map to one of these probably isn't a new tag — it's a child of <input> or a sentence in <instructions>.
Nesting. Multiple inputs get child tags inside <input>, named for what they are:
<input>
<transcript>...</transcript>
<crm_notes>...</crm_notes>
</input>
Same for examples:
<examples>
<example>
<input>...</input>
<output>...</output>
</example>
<example>
<input>...</input>
<output>...</output>
</example>
</examples>
Child names are descriptive of the artifact; parent names stay in the canonical set.
Principle. Only tag chunks whose role would otherwise be ambiguous. If a prompt has nothing to disambiguate, don't tag it.
Why. Tags exist to remove ambiguity. A one-line ask ("Translate this to French: Bonjour le monde") has no ambiguity — the input is obvious, the instruction is obvious, there's no context or constraints. Wrapping it in <instructions> and <input> adds noise without adding clarity. Tags are a tool for the cases where prose breaks down — long inputs, multiple inputs, structured outputs, conflicting cues — not a uniform shell to apply to every ask.
The watch-line: if you find yourself filling <context></context> with one short sentence, ask whether that sentence belongs in <instructions> instead. Empty or near-empty tags are a sign the template is heavier than the task.
Recipe. Reach for tags when at least one of these is true:
Otherwise: write the prose ask. It's fine.
Failure mode. Wrapping every prompt in five tags because "structured prompts are best practice." The tags carry no information; they just add tokens. Decoration, not structure. Delete them.
Principle. Canonical order: <role> → <instructions> → <context> → <input> → <examples> → <output_format> → <constraints> → <thinking>. Deviate only with reason.
Why. The order isn't arbitrary. The model reads top-to-bottom; what comes early frames what comes later. Role and instructions first set the lens. Context and input give the material. Examples calibrate. Output format and constraints close with the shape of the answer. <thinking> (when present) trails as a behavioural cue for how to respond.
There's a known long-context wrinkle: for very long inputs (tens of thousands of tokens), repeating the instructions after the input — or placing them last — often improves adherence, because the instruction is closer to the generation step. Anthropic's prompt-engineering guidance calls this out. For normal-length prompts, the canonical order is fine; for long-context tasks, consider putting <instructions> last or echoing them.
Failure mode. Putting <output_format> before <instructions> and <input>. The model commits to a shape before it knows what the task or material is, and the output skews toward filling the shape rather than answering the ask.
Principle. When a prompt is a template, mark variable slots with a syntax distinct from the tag delimiters. {{variable}} is the common choice.
Why. Templates get string-substituted before the model sees them. The substitution syntax has to be unambiguous to the templating layer (Python f-string, Jinja, Mustache, a hand-rolled .replace()) and visible to the human author. {{variable}} works across most renderers and doesn't collide with XML tags. Single braces ({variable}) work too but collide with JSON in <output_format> or <examples>.
Recipe.
<instructions>
Summarize the meeting notes below. Focus on actionable items.
</instructions>
<context>
{{meeting_context}}
</context>
<input>
<notes>
{{meeting_notes}}
</notes>
</input>
<output_format>
- Bullet points
- Max {{max_words}} words
- Bold any deadlines
</output_format>
Keep variable names snake_case and descriptive. {{notes}} is fine in a one-template world; {{meeting_notes}} is better in a template library where collisions matter.
Failure mode. Mixing brace styles ({x} in one slot, {{y}} in another) inside the same template. The renderer silently misses one and the model gets a literal {x} in the prompt.
<examples> vs prose descriptionPrinciple. Use examples when the task shape is hard to describe in prose; use prose when one rule covers the cases.
Why. Examples are expensive — they take tokens, take authoring time, and they pin the model toward the demonstrated pattern (which can over-narrow on edge cases the examples don't cover). Use them when the task is irregular: "extract sentiment but only when the speaker is the customer, not the agent," "format these dates the way our finance team writes them, which isn't ISO and isn't US-standard." Prose for the universal rule, examples for the texture.
Recipe. Two or three diverse examples beat one or ten. Diversity > volume — show the edges, not the easy middle. Each example should add a distinguishing case the others don't cover.
<examples>
<example>
<input>Customer paid the invoice on March 5.</input>
<output>{"event": "payment", "date": "2026-03-05"}</output>
</example>
<example>
<input>Follow up next Tuesday about the renewal.</input>
<output>{"event": "follow_up", "date": null, "relative": "next Tuesday"}</output>
</example>
</examples>
The second example teaches "relative dates go to relative, not date" — a rule that's faster to demonstrate than to write out.
Failure mode. Ten examples that all look the same. The model overfits to a shape it would have inferred from one. Diversity carries the signal.
<thinking> — when explicit reasoning belongs in the promptPrinciple. Use <thinking> to ask the model to lay out reasoning before answering, when the task benefits from intermediate steps the user doesn't want in the final output.
Why. Some tasks improve sharply with chain-of-thought (multi-step math, multi-constraint planning, classification with hidden criteria). The prompt can carve out a <thinking> section the model fills before the <answer> it returns. Distinct from Claude's extended thinking feature, which is a model-level capability — <thinking> in the prompt is a structural cue, useful even when extended thinking isn't on.
Recipe.
<instructions>
Decide which support tier this ticket needs.
First, in <thinking>, list the criteria you're weighing.
Then, in <answer>, output just the tier name.
</instructions>
<input>{{ticket}}</input>
The caller can strip <thinking> from the response and keep <answer>. The reasoning becomes auditable without polluting the output.
Failure mode. Asking for <thinking> on tasks that don't need it. Adds latency and tokens for no quality gain. Reach for it when the task has hidden criteria or multi-step structure, not as default.
The same disease that hits design tokens hits prompt vocabularies. <background> next to <context>. <task> next to <instructions>. <rules> next to <constraints>. <format> next to <output_format>. Each addition feels precise in the moment; in aggregate they collapse the vocabulary back into noise, and the team (or you-on-a-different-day) can't remember which to reach for.
The discipline: before inventing a new tag, write the rule in English — what role does this play that the existing set doesn't already name? If the answer is "it's basically context but a different kind of context," reject and use <context>. If the answer names a genuinely new role, add it to this file so the next prompt uses the same name.
A short, unambiguous ask wrapped in tags it doesn't need:
<instructions>What's 2 + 2?</instructions>
That's not structure; that's ceremony. The prose version is shorter and reads the same to the model. Tags carry weight when they remove real ambiguity (long input, multiple inputs, constrained output). Otherwise: prose.
/prompt slash command, which rewrites a rough ask into this shapefactory-llm-workflows.md — LangGraph nodes that use structured prompts; tag vocabulary here is what those prompts use/prompt — slash command that converts a rough ask into the structured form, using this vocabularyfactory-llm-workflows.md — where production prompts live in the stackfactory-voice.md — the voice you'd use inside <instructions> when authoring for ClaudeWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub nonlinear-xyz/factory-kit --plugin factory-kit47 skills in this plugin
/factory-animationMotion discipline distilled across builds. Attention as a fixed per-viewport budget, figure/ground separation (calm the ground, load motion into the figure), one focal point of motion per screen, diegetic-over-decorative test, trigger-on-intent-then-settle over perpetual loops, and the prefers-reduced-motion fallback. Recipe pairs Astro with a Remotion video kit (rendered assets in public/). Read whenever you add motion to a marketing surface or any page where movement competes with reading. Paired with factory-design, which owns the static visual vocabulary motion sits on top of./factory-apiAPI conventions for both server actions and tRPC builds. Covers the decision between them, per-mutation Zod input schemas, central router composition, pagination shape, multi-field search via Drizzle `ilike` + `or()`, mutation lifecycle hooks, conditional query enabling, stale-time defaults, error response shape and custom error class taxonomy, mutation-boundary audit logging, fetch adapter for tRPC routes. Read when designing or implementing any data-mutation endpoint./factory-api-route-engineerUse when designing or implementing API endpoints — server actions, tRPC procedures, REST routes for external consumers. Carries the factory's API conventions — the server actions vs tRPC decision, procedure tier stacking, per-mutation Zod schemas, central router composition with manual registration, pagination (limit/offset/orderBy default; cursor only when needed), multi-field search via `ilike` + `or()`, aggregated stats in list queries, mutation lifecycle hooks, stale-time defaults, custom error class taxonomy, fetch adapter for tRPC in App Router. Outputs endpoints that fit the house style — not bespoke per-route handlers./factory-authAuth and authorization conventions distilled across builds with three different auth stacks (Better Auth + orgs, Supabase Auth + RLS, Clerk). Covers the provider decision matrix, the unified wrapper interface (`requireAuth` / `requireRole` / `withOrgContext`), procedure tier stacking, session handling, OAuth callback safety, plugin composition with Better Auth, and the anti-patterns (hardcoded allowlists, admin client at module scope, triple-fallback auth surfaces)./factory-auth-wiring-specialistUse when wiring auth into a new project, switching auth providers, or adding role/org features. Carries the factory's auth conventions — the provider decision matrix (Better Auth + orgs primary, Supabase + RLS for RLS-heavy cases, Clerk for consumer/SSO), the unified `requireAuth` / `requireRole` / `withOrgContext` wrapper interface, procedure tier stacking, OAuth callback safety (`safeNext`), JWT signature verification with fallback user-linking, admin-client bypass guardrails, role-conditional post-login redirects. Produces auth code that fits the house seam — provider is a swap point, not a leak./factory-autopilotThe contract for an unattended build run started by `factory-kit autopilot run`. The agent edits and verifies in its assigned worktree; the runner owns the gate, commits, push, draft PR and Linear handoff. Read when a prompt says you are running under autopilot.Other plugins' skills for the same job