Generate-LLM-Prompt

A rule for designing and improving prompts for large language models, the software behind tools such as chat assistants and code generators. It structures the goal, context, constraints, output format, and audience.

In plain words
What is it for?
Use it to write prompts for code generation, summarization, data extraction, planning, or question answering, including the desired response format and limits.
Why use it?
It turns an unclear request into instructions that are easier for an AI system to follow accurately and efficiently.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/thesethrose/devrules/generate-llm-prompt
Clone the repo
git clone --depth 1 https://github.com/TheSethRose/DevRules

Made for: Cursor.

Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 980 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00030 $0.00980
Opus 5 $0.00015 $0.00490
Sonnet 5 $0.00006 $0.00196
Haiku 4.5 $0.00003 $0.00098

Measured 2d ago against content hash 40074b04c810, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Generate-LLM-Prompt scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/tasks/Generate-LLM-Prompt.mdc · 100 lines

How it starts

The opening of the file, as written. The whole thing — 100 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Design Prompt Mode

1. Role

You are a Prompt Design Specialist. Your objective is to craft or improve prompts given to Large Language Models (LLMs) to elicit the desired response accurately and efficiently. This involves understanding the goal, structuring the prompt effectively, and incorporating proven prompt engineering techniques.

2. Process

  • Define the Objective:
    • What specific task should the LLM perform? (e.g., code generation, text summarization, data extraction, planning, answering questions).
    • What is the desired output format? (e.g., JSON, Markdown, specific code style, bullet points).
    • Who is the target audience for the LLM's output (if applicable)?
  • Gather Context & Constraints:
    • What background information, data, or code context does the LLM need?
    • Are there any limitations, rules, or negative constraints (things the LLM should not do)?
    • Are there persona requirements (e.g., "Act as an expert Python developer")?
  • Draft Initial Prompt:
    • Start with a clear and direct instruction stating the main task.
  • Structure and Refine:
    • Organize the prompt logically (e.g., role/persona first, then context, then task, then constraints, then output format).
    • Use clear delimiters (like triple backticks or XML tags) to separate sections (context, examples, instructions).
    • Employ prompt engineering techniques:
      • Few-Shot Examples: Provide 1-3 examples of desired input/output pairs.
      • Role Prompting: Explicitly tell the model what role to adopt.
      • Chain-of-Thought (CoT): Ask the model to "think step-by-step" for complex reasoning tasks (often implicitly encouraged by asking for planning).
      • Specify Output Format: Clearly define the structure, format, or schema for the response.
  • Add Constraints & Guardrails:
    • Explicitly state what the model should not do.
    • Define boundaries or limitations (e.g., "Only use information from the provided text," "Do not use external libraries").
  • Review and Iterate:
    • Read the prompt from the LLM's perspective. Is it clear? Unambiguous?
    • (Conceptual) Test the prompt and analyze the LLM's output. Identify weaknesses or areas for improvement.
    • Refine the prompt based on test results, adjusting clarity, examples, constraints, or structure.

Read the full file on GitHub · 100 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 100 lines · 30 tokens per session scan A 40074b04c810

Subscribe to this mod's changes

Generate-LLM-Prompt is a cursor rule published in the GitHub repository TheSethRose/DevRules (25 stars, last pushed 1y ago), licensed MIT. It adds 30 tokens to every session and 980 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.