Skip to content

AytuncYildizli/reprompter

Repository files navigation

RePrompter

Your prompt sucks. Let's fix that.

Version License Tests Stars

RePrompter is a prompt engineering skill for AI coding agents. It takes rough, low-quality prompts and transforms them into structured, high-scoring prompts that produce dramatically better results. Works with Claude Code, OpenClaw, Codex, or any LLM that accepts structured prompts.


RePrompter demo — rough prompt to structured output in 15 seconds


Four Output Lanes

Lane What it does Trigger
Single Interview, structure, score one prompt reprompt this, clean up this prompt
/goal preflight Codex CLI or Claude Code CLI v2.1.139+: infer intent, build the expanded prompt, then compress it into /goal <summary of expanded prompt> before /goal, for /goal, Codex /goal, Claude Code /goal, /goal preflight
Repromptverse Plan a team of 2-5 agents, reprompt each one, execute in parallel, evaluate, retry reprompter teams, repromptverse, smart run
Reverse Show a great output, extract the prompt DNA that produced it reverse reprompt, learn from this, prompt dna

Before / After

Input:  "uhh build a crypto dashboard, maybe coingecko data, add caching, test it too"
Score:  1.6/10
Output: Structured XML prompt with role, context, task, requirements,
        constraints, output format, and success criteria
Score:  9.0/10  (+462%)
See the full generated prompt
<role>
Senior full-stack engineer specializing in real-time dashboard systems,
REST API integration, and cache-aware data pipelines.
</role>

<context>
- Frontend + backend + tests required (cross-layer scope)
- Data source: CoinGecko API (free tier, 30 calls/min rate limit)
- Existing API behavior must be preserved
</context>

<task>
Deliver a real-time crypto dashboard backed by a cache-aware CoinGecko proxy API,
with unit tests for both API and UI, without breaking existing API contracts.
</task>

<requirements>
- Build dashboard UI with loading, error, empty, and stale-data states
- Implement backend CoinGecko proxy with JSON schema validation + configurable cache TTL
- Preserve backward compatibility for all existing API consumers
- Add deterministic unit tests for frontend rendering states and backend edge cases
- Cache must serve stale data on upstream failure (stale-while-revalidate pattern)
</requirements>

<constraints>
- No direct client-side calls to CoinGecko (all traffic through proxy)
- No breaking changes to existing API response fields or status codes
- Mock all external network boundaries in tests
- Rate limit CoinGecko calls to stay within free tier (30/min)
</constraints>

<output_format>
- Backend: /api/prices endpoint returning { prices: [...], cached: bool, updatedAt: ISO }
- Frontend: React component with 5s auto-refresh interval
- Tests: Vitest suite with >=80% branch coverage
</output_format>

<success_criteria>
- Dashboard auto-updates every 5s and shows "stale" indicator when cache is old
- Proxy returns normalized data within 200ms (cache hit) / 2s (cache miss)
- Existing API integration tests still pass with zero modifications
</success_criteria>
Dimension Before After Change
Clarity 3 9 +200%
Specificity 2 9 +350%
Structure 1 10 +900%
Constraints 0 8 new
Verifiability 1 9 +800%
Decomposition 2 9 +350%
Overall 1.6 9.0 +462%

Scores are self-assessed. Treat as directional indicators, not absolutes.


Install

Claude Code

mkdir -p skills/reprompter
curl -sL https://github.com/aytuncyildizli/reprompter/archive/main.tar.gz | \
  tar xz --strip-components=1 -C skills/reprompter

For the /goal preflight lane on Claude Code, pin the CLI to v2.1.139 or later. /goal depends on the hooks layer — if disableAllHooks or allowManagedHooksOnly is set in settings.json the command is unavailable on any version (v2.1.140 only made the failure visible). Managed environments that block hooks should stick to Single mode for goal-shaped work.

claude --version
# Expect 2.1.139 or later. Upgrade if older.

OpenClaw / Codex

cp -R reprompter /path/to/workspace/skills/reprompter

For Codex, install or update the CLI and confirm the goals feature is available:

npm install -g @openai/codex@latest
codex --version
codex features list | grep '^goals'

If goals is present but disabled, set features.goals = true in ~/.codex/config.toml and start a fresh Codex session before using /goal.

Any LLM

Use SKILL.md as the behavior spec. Templates are in references/.


Quick Start

reprompt this: build a REST API with auth and rate limiting

/goal Preflight

Use RePrompter before /goal whenever the goal is bigger than a single direct instruction. The lane works on Codex CLI (any version exposing the goals feature) and Claude Code CLI v2.1.139+ (native /goal slash command shipped on 2026-05-11). Both runtimes shape the command as /goal <objective>, so RePrompter first builds the full expanded prompt, then compresses it into a dense copy-pasteable /goal <summary of expanded prompt> command. The command should read like a summary of the old long XML prompt, not a tiny rewrite of the rough input.

reprompt this for /goal: migrate our billing dashboard to the new API without breaking existing reports

Add an explicit runtime marker when you have one — "Codex /goal" or "Claude Code /goal" — otherwise RePrompter will ask. RePrompter then shows a Goal Command Card:

Field Example (Claude Code)
Goal Command /goal Migrate billing dashboard API usage to the new API by first mapping current data/report consumers, preserving schemas, filters, exports, scheduled outputs, and historical totals, implementing the smallest compatible adapter changes, adding parity fixtures, and proving compatibility with unit, integration, dashboard smoke, and report export checks.
Compressed From Expanded RePrompter prompt
Objective Migrate billing dashboard API usage without breaking reports
Runtime Claude Code CLI (≥ v2.1.139)
Mode /goal preflight
Paste Into Claude Code TUI prompt, as-is
Risk Level medium
Missing Inputs API contract diff, report smoke path
Verification npm test, dashboard smoke, report export check
Quality 3/10 → 8/10

For Codex, the Card differs only in the Runtime (Codex CLI) and Paste Into (Codex TUI prompt, as-is) rows.

Then run the generated command in your chosen runtime:

/goal Migrate billing dashboard API usage to the new API by first mapping current data/report consumers, preserving schemas, filters, exports, scheduled outputs, and historical totals, implementing the smallest compatible adapter changes, adding parity fixtures, and proving compatibility with unit, integration, dashboard smoke, and report export checks.

On Claude Code (v2.1.139+) the goal is thread-persistent — it survives /resume, terminal close, and context compaction — and a Haiku evaluator checks the completion condition against the transcript after each turn. Use /goal pause and /goal resume to handle interruptions. On Codex (alpha) the same /goal <objective> shape applies once features.goals = true in ~/.codex/config.toml and a fresh session is started.

For automation surfaces such as Whip, the same contract is available as a local runtime command:

node scripts/goal-command.js \
  --input "migrate our billing dashboard to the new API without breaking reports" \
  --target codex \
  --out-dir /tmp/reprompter-goal

It writes goal-command.json, goal-command.txt, goal-command-card.json, reprompter-expanded-prompt.md, and compressed-goal-summary.txt. The command is artifact generation only; it does not execute /goal, dispatch agents, read secrets, or touch production. The same /goal <objective> output also pastes directly into Claude Code v2.1.139+ — a --target claude-code switch is planned for a follow-up release; until then the existing --target codex artifact text is shape-compatible with Claude Code's /goal surface.

reprompter teams - audit the auth module for security and test coverage
reverse reprompt this: [paste a great output you want to reproduce]

RePrompter interviews you (2-5 questions), generates a structured XML prompt, and shows a before/after quality score.


How It Works

Single Mode

Rough prompt → Input guard → Quick mode gate → Interview (2-5 questions)
→ Template selection → XML prompt generation → Quality scoring → Delta rewrite if < 7/10

17 templates cover feature, bugfix, refactor, testing, API, UI, security, docs, content, research, and multi-agent swarm patterns.

Repromptverse Mode

Phase 1: Score prompt, interview if needed, plan team, show Plan Cards → user approves
Phase 2: Write XML prompt per agent (target 8+/10), show quality scorecard
Phase 3: Execute (tmux / TeamCreate / OpenClaw / sequential fallback)
Phase 4: Show Result Cards, evaluate, retry with delta prompts if needed (max 2)

Agents get non-overlapping scopes, explicit success criteria, and file:line reference requirements. The evaluator loop ensures quality before synthesis.

Reverse Mode

Exemplar output → EXTRACT structure → ANALYZE task type + domain + tone
→ SYNTHESIZE XML prompt → Score → Optional: INJECT into flywheel

11 task type classifiers (code review, security audit, architecture doc, API spec, test plan, bug report, PR description, documentation, content, research, ops report) with 8 domain detectors and tone analysis. Solves the flywheel cold-start problem by seeding it with known-good prompt/output pairs.


Key Features

Closed-Loop Flywheel (v12) - The loop is now end-to-end. Every prompt emits a <success_criteria> block of testable assertions. After execution, scripts/outcome-record.js writes a structured record joining prompt + criteria + output; scripts/evaluate-outcome.js scores it against the criteria (regex / predicate / llm_judge / manual). Records feed into a local flywheel via npm run flywheel:ingest. At generation time, REPROMPTER_FLYWHEEL_BIAS=1 makes the skill consult past outcomes and bias toward historically winning recipes. npm run flywheel:ab compares bias-on vs bias-off effectiveness so you can prove whether the bias is helping. All data local.

Prompt Flywheel Recipe Fingerprinting - Every prompt carries a deterministic recipe fingerprint (template + patterns + capability tier + domain + context layers + quality bucket). Strategy learner groups outcomes by fingerprint so recommendations are grounded in repeated evidence, not one-off runs.

Agent Cards - Plan Cards (before execution), Status Line (during), Result Cards (after). Full transparency into what agents will do, are doing, and found.

Dimension Interview - Low-scoring prompt dimensions trigger targeted questions. No more vague prompts spawning expensive agents.

Pattern Library - 6 pluggable prompt engineering patterns: constraint-first framing, uncertainty labeling, self-critique checkpoints, delta retry scaffolds, evidence-strength labeling, context-manifest transparency.

Capability Routing - When multiple models are available, routes each agent by capability tier (reasoning, long context, cost-optimized, latency-optimized) with provider-diverse fallback chains.


Testing

npm run check    # 205 tests + 4 benchmarks
npm test         # individual: npm run test:reverse-engineer
Suite Tests
Intent router 21
Reverse engineer 43
Outcome collector 43
Strategy learner 36
Recipe fingerprint 14
Repromptverse runtime 9
Capability policy 7
Pattern selector 7
Runtime adapter 5
Flywheel E2E 5
Others 4
Total 169

All benchmarks at 100%: routing (64/64), artifacts (84/84), flywheel (13/13), provider (9/9).


Compatibility

Capability Claude Code Codex OpenClaw Any LLM
Single mode yes yes yes yes
/goal preflight yes¹ yes - -
Reverse mode yes yes yes yes
Multi-agent parallel yes yes yes -
Multi-agent sequential yes yes yes yes

¹ Claude Code /goal requires CLI v2.1.139+ (shipped 2026-05-11) and depends on the hooks layer. Under disableAllHooks or allowManagedHooksOnly in settings.json, /goal is unavailable on any version — v2.1.140 only upgraded the failure mode from a silent hang to a clear error message. No config flag needed beyond the version pin in environments that permit hooks; managed environments that block hooks must use Single mode for goal-shaped work.

Codex parallel paths: D1 native subagents (Codex CLI 0.121.0+, multi_agent default-enabled) or D2 shell-level (codex exec --ephemeral --sandbox workspace-write + background + wait; workspace-write is required for workers to write their /tmp/rpt-*.md artifacts, and codex exec keeps approval = never automatically). See SKILL.md Option D and references/runtime/codex-runtime.md.


Configuration

// ~/.claude/settings.json
{
  "env": {
    "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1"
  },
  "preferences": {
    "model": "opus"
  }
}

Feature flags: REPROMPTER_FLYWHEEL, REPROMPTER_POLICY_ENGINE, REPROMPTER_LAYERED_CONTEXT, REPROMPTER_STRICT_EVAL, REPROMPTER_PATTERN_LIBRARY, REPROMPTER_TELEMETRY (all 0|1, enabled by default).


Architecture

SKILL.md                        # Behavior spec (the product)
references/                     # 18 templates (XML + markdown)
  feature-template.md
  bugfix-template.md
  reverse-template.md
  marketing-swarm-template.md
  ...
scripts/                        # Runtime engine
  intent-router.js              # Mode + profile routing
  reverse-engineer.js           # Exemplar analysis + prompt extraction
  capability-policy.js          # Model selection + fallback chains
  context-builder.js            # Token-budgeted context assembly
  artifact-evaluator.js         # Output quality gates
  pattern-selector.js           # Pluggable prompt patterns
  recipe-fingerprint.js         # Strategy hashing
  outcome-collector.js          # Flywheel data capture
  strategy-learner.js           # Historical recommendation engine
  repromptverse-runtime.js      # Orchestration composer

Contributing

See CONTRIBUTING.md. PRs welcome.

License

MIT

About

Your prompt sucks. Let's fix that. Interactive interview → structured prompt → quality scored → ready to execute.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors