claude-code-prompt-improver  by severity1

Intelligent prompt enhancer for Claude Code

Created 1 month ago
946 stars

Top 38.7% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides an intelligent prompt improvement hook for Claude Code, designed to enrich vague user prompts before execution. It targets Claude Code users seeking to enhance output precision and reduce iterative clarification, ultimately improving first-try results.

How It Works

The core mechanism involves a UserPromptSubmit hook that intercepts user prompts. It wraps these prompts with evaluation instructions, prompting Claude to assess clarity against conversation history. For ambiguous inputs, Claude initiates a dynamic research plan, gathering context from the codebase, web, or documentation. Subsequently, it formulates 1-6 targeted, grounded questions using the AskUserQuestion tool for the user. Upon receiving answers, Claude proceeds with the original request, now armed with enhanced context. Clear prompts bypass this clarification process entirely. This approach leverages conversation history and dynamic planning for efficient, context-aware prompt refinement.

Quick Start & Requirements

  • Installation: Manual installation is required. Copy scripts/improve-prompt.py to ~/.claude/hooks/ and ensure it's executable. Update ~/.claude/settings.json to include the hook under UserPromptSubmit.
  • Prerequisites: Claude Code 2.0.22+ (specifically requiring the AskUserQuestion tool).
  • Links: No external quick-start or demo links are provided; refer to the repository's README.
  • Note: Plugin installation is currently non-functional due to issue #10225.

Highlighted Details

  • Intercepts prompts, wrapping them with evaluation instructions (~300 tokens overhead per prompt).
  • Employs a dynamic research plan for context gathering when prompts are unclear.
  • Utilizes the AskUserQuestion tool to ask a maximum of 1-6 clarifying questions.
  • Offers bypass prefixes (*, /, #) for direct prompt execution without evaluation.
  • Aims for improved first-attempt outcomes by proactively addressing prompt ambiguity.

Maintenance & Community

No specific details regarding maintainers, community channels (e.g., Discord, Slack), or roadmap are present in the provided README.

Licensing & Compatibility

  • License: MIT.
  • Compatibility: The MIT license generally permits broad use. However, a known bug prevents UserPromptSubmit hooks from plugins from executing, mandating manual installation.

Limitations & Caveats

Manual installation is the sole method due to a bug affecting plugin hooks. Users must remember to use bypass prefixes (*, /, #) if they wish to skip the prompt improvement process. The functionality is dependent on Claude Code version 2.0.22+ and its AskUserQuestion tool.

Health Check
Last Commit

2 weeks ago

Responsiveness

Inactive

Pull Requests (30d)
2
Issues (30d)
0
Star History
502 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.