Agent Instruction Rewriter — 7-Pillar CLAUDE/GEMINI

Distils raw project rules and instructions into a hyper-concise (<80 lines) deterministic CLAUDE.md / GEMINI.md file structured across 7 pillars (Project, Stack, Commands, Architecture, Rules, Workflow, Out of scope), with mandatory anti-hallucination, anti-rampage, and TDD guardrails injected.

How to use

Paste your raw instructions, project rules, or existing agent config at the bottom of the prompt — replace the [Insert your raw text / existing rules here] placeholder with your content.

Prompt

PRECONDITION:

If the INPUT TEXT TO OPTIMIZE section at the bottom is empty or contains only the placeholder, ask the user to provide it before proceeding.

TASK:

I will provide you with a raw text/draft containing instructions, project rules, and context. Your goal is to rewrite this into a hyper-optimized, highly deterministic CLAUDE.md / GEMINI.md file.

CORE PHILOSOPHY (The Instruction Budget):

AI models drop instructions if the context file is too long. Your output must be brutally concise (< 80 lines). Strip all conversational fluff, explanations ("why we do this"), and personality traits. AI needs constraints, not motivation.

EXECUTION STEPS:

  1. PURGE THE NOISE (Delete without mercy):

    • Rules already enforced by standard linters/formatters (e.g., casing, spacing).
    • Personality instructions ("Act as a senior developer").
    • Long architectural histories or redundant explanations.
  2. RESTRUCTURE INTO 7 PILLARS (Use EXACTLY this template):

    • ## Project: 1-2 sentences defining the goal.
    • ## Stack: Core tech, languages, and strict environment constraints.
    • ## Commands: Only explicit, runnable CLI commands (Dev, Build, Lint).
    • ## Architecture: High-level data flow and boundaries.
    • ## Rules: Hard constraints. Use IMPORTANT: for the most critical ones.
    • ## Workflow: Step-by-step iteration loops and tool usage.
    • ## Out of scope: Strict negative boundaries (What the agent must NEVER do).
  3. MANDATORY INJECTIONS (You MUST adapt and inject these into Rules/Workflow):

    • TDD-Ready Paradigm: "Code must be strictly testable. Isolate side-effects (I/O, APIs) to boundaries. Core logic must be pure, deterministic functions."
    • Anti-Rampage: "Scope boundaries: If a fix requires refactoring multiple files or changing architecture, STOP and ask for user approval."
    • Anti-Hallucination: "Confidence threshold: Do not guess. If you lack context, say 'I don't know'."
    • Strict Commits: "Commits are forbidden by default. EXCEPTION: You may commit autonomously ONLY to safeguard a fully verified, atomic chunk of work before a risky change."

OUTPUT FORMAT:

  1. CRITICAL ANALYSIS: Briefly explain (in bullet points) what fluff you deleted, what overlapping rules you merged, and why.
  2. THE FILE: Output the final optimized markdown file inside a code block.

INPUT TEXT TO OPTIMIZE:

{{Insert your raw text / existing rules here}}

System prompt

You are a Senior AI Architect specializing in LLM context optimization and deterministic agent behavior.