LLM-Oriented Context Structuring
What it does
A method for creating machine-readable documentation for LLMs in the form of a structured file with XML markup, containing usage rules, code examples, and library function descriptions. Submitted to the prompt as context, increasing code generation accuracy from 20-30% to 100% through few-shot learning and explicit instructions.
When it helps
Use ReadMeLLM when working with lesser-known libraries, internal tools, or custom APIs that LLMs lack sufficient knowledge about. Especially effective for code generation when standard documentation doesn't yield needed results. Apply to create structured context with rules, examples, and function descriptions. Ideal for integration into RAG systems, CI/CD pipelines, and IDE plugins where high-accuracy code generation without hallucinations is required.
A prompt you can paste
Generic by design: it applies the technique without knowing your task. Adapt the marked parts.
# LLM-Oriented Context Structuring (ReadMeLLM) Prompt # CONTEXT AND RULES FOR LIBRARY UNDERSTANDING ## Library Name: [Placeholder: Name of the library] ## Version: [Placeholder: Version of the library] ## 1. Core Purpose: Describe the main goal and functionality of the library in 1-2 sentences. - [Placeholder: Core purpose description] ## 2. Key Components/Modules: List the main modules or classes and their primary function. - [Placeholder: Module 1 Name]: [Brief description] - [Placeholder: Module 2 Name]: [Brief description] - ... ## 3. Rules for Usage: Specify constraints and best practices for using the library. - Always use functions/methods from the provided context. - If a function is not described, do not invent its behavior. - Prioritize [Placeholder: Specific function/method] for [Specific task]. - Avoid [Placeholder: Specific anti-pattern or deprecated usage]. - [Add any other crucial rules] ## 4. Core Function Examples: Provide 1-3 clear, concise examples demonstrating common use cases. Each example should include: - A brief description of the task. - The code snippet. - The expected output or outcome. ### Example 1: [Task Description]
If this one does not fit, the two closest alternatives in the corpus are Debugging Prompts Framework and Context Injection, which target the same failure from a different angle.
Worked example
The same technique applied to a concrete job: review a 2,000-line pull request and report only real defects. Use it as the pattern for your own case rather than as a finished artefact.
# LLM-Oriented Context Structuring for Code Review
## 🎯 Goal
To ensure the LLM identifies only genuine defects in a 2,000-line pull request by providing it with a structured, machine-readable context.
## 📖 Context and Rules
1. **Role:** You are an expert code reviewer with a keen eye for detail and a deep understanding of common programming pitfalls.
2. **Task:** Review the provided pull request code and identify **only real defects**. Do not suggest improvements, style changes, or minor optimizations unless they are critical for functionality or security.
3. **Input:** The code for a 2,000-line pull request.
4. **Output Format:** A structured report detailing each defect found.
* Each defect should be listed with a unique ID (e.g., DEFECT-001).
* For each defect, provide:
* **File and Line Number:** Specify the exact location.
* **Description:** Clearly explain the defect and its potential impact.
* **Type:** Categorize the defect (e.g., Bug, Security Vulnerability, Logic Error, Performance Issue, Resource Leak).
* **Severity:** Assign a severity level (e.g., Critical, High, Medium, Low).
5. **Constraints:**
* **Strict Defect Identification:** Focus solely on identifying actual bugs, security vulnerabilities, or critical logic flaws.
* **No General Suggestions:** Do not offer general advice on code style, readability, or minor refactoring unless it directly causes a defect.
* **Adhere to Format:** Strictly follow the specified output format. If no defects are found, state "No real defects identified."
* **Contextual Understanding:** Base your review on the provided code context. Do not assume external knowledge.
## 📝 Examples of Defects (Illustrative)
**Example 1:**
* **DEFECT-001**
* **File and Line Number:** `src/utils.js:45`
* **Description:** The function `calculateTotal` does not handle cases where the `items` array is empty, leading to a division by zero error.
* **Type:** Bug
* **Severity:** High
**Example 2:**
* **DEFECT-002**
* **File and Line Number:** `api/auth.py:112`
* **Description:** User passwords are being stored in plain text, posing a significant security risk.
* **Type:** Security Vulnerability
* **Severity:** Critical
## 💻 Pull Request Code
Get this written for your actual task
Paste what you are trying to do and the corpus will be matched against it directly. Free, no account, about ten seconds.
single retrieval pass
That number is low on purpose, and it is real. It is the raw similarity of one retrieval pass: no specialist read the paper, no judge compared anything, the first plausible match won.
one of which is this page
Picking the right one for a specific task is the work, and it is the work GetDecision does.
| This page | one technique, generic prompt |
| What you just ran | one technique matched to your wording, nothing verified |
| Full run | ten specialists read the papers in full, a judge ranks the top three for your task and shows its reasoning, generation on the model you pick, saved to your history |
See the top three for your taskTen specialists, a judge, and the reasoning shown. Free account, first run included.
Run the full analysis