Adaptive prompt intelligence: 25-step selection, rule adherence, tool orchestration, parallel execution & memory
View on NPM |
Installation |
Documentation
enhance4.mp4
Dynamically enhances prompts using intelligent risk-based selection from 25 specialized steps. Features CLAUDE.md rule adherence, MCP tool recommendations, parallel execution optimization (🔄), memory search integration, agent detection, and contrarian analysis - ensuring Claude Code maintains context and delivers results 3-4x faster.
Claude Code struggles to maintain project context throughout conversations. You have a detailed CLAUDE.md with project rules, but Claude often:
- Forgets project guidelines mid-conversation
- Ignores file organization rules when creating new files
- Loses track of coding standards over time
- Requires constant reminders about project conventions
Solution: The /enhance
command transforms vague requests into comprehensive, context-aware prompts with contrarian analysis to challenge assumptions early.
- Automatically detects available Claude Code agents (user and project level)
- Recommends existing agents that match your task type
- Proposes new agent creation when no suitable agent exists
- Smart complexity detection - only suggests agents for complex multi-step tasks
- Marks parallelizable tasks with
indicator
- Guides parallel Task execution for improved performance
- Clear instructions for running multiple Task invocations simultaneously
- Dramatic speed improvements for multi-step operations
📚 Additional Information (click to expand)
Before (what you type):
implement user authentication with OAuth
After /enhance
(what Claude receives):
Enhanced Prompt: Implement OAuth Authentication System
DETECTED TASK TYPE:
Primary intent: Implementation
Risk level: High (authentication/security)
Complexity: Multi-component system
INTELLIGENT STEP SELECTION:
Applied 15 of 25 steps based on security requirements
[Steps: 1,2,3,5,6,7,8,9,10,11,12,13,16,18,23]
MEMORY & PAST SOLUTIONS:
- Search claude-self-reflect for "OAuth implementation" 🔄
- Check git history for auth patterns 🔄
- Review similar implementations in codebase 🔄
EXTERNAL TOOLS & RESOURCES:
- mcp_zen for security review
- context7 for OAuth2 documentation
- grep MCP for GitHub OAuth examples
- claude-self-reflect for past auth discussions
PROJECT RULES (from CLAUDE.md):
- NEVER store secrets in code
- ALWAYS use environment variables for keys
- Document security decisions
AGENT RECOMMENDATIONS:
- Use 'security-reviewer' agent for audit
- Consider 'api-designer' for contract validation
REQUIREMENTS (Parallel Operations):
- Set up OAuth provider configuration 🔄
- Implement token management 🔄
- Create user session handling 🔄
- Add security middleware 🔄
- Write integration tests 🔄
- Document authentication flow
CONTRARIAN ANALYSIS:
- Is OAuth overkill for this use case?
- Could simpler JWT suffice?
- What's the recovery plan for provider outages?
EDGE CASES & SECURITY:
- Token refresh failures
- Provider API changes
- Rate limiting scenarios
- CSRF protection
- Session hijacking prevention
SUCCESS CRITERIA:
- [ ] Secure token storage implemented
- [ ] All auth flows tested (login/logout/refresh)
- [ ] Security audit passed (mcp_zen review)
- [ ] Performance < 200ms auth checks
- [ ] Zero security warnings in scan
- [ ] Documentation complete with diagrams
Two-pass enhancement - First expands using Claude's best practices, then adds CLAUDE.md rules
Contrarian analysis - Questions assumptions early to prevent wasted effort
Context engineering - Selects only relevant project rules
CLAUDE.md integration - Automatically includes applicable guidelines
Smart detection - Understands task type from your request
MCP tool recommendations - Suggests appropriate tools based on context
Works in plan mode - Compatible with Claude's planning features (Shift+P)
npm install -g cc-enhance
The /enhance
command will be automatically installed to ~/.claude/commands/
and ready to use in Claude Code.
In Claude Code:
/enhance create a deployment guide
# → Comprehensive prompt with relevant CLAUDE.md rules included
/enhance fix the login bug
# → Debugging-focused prompt with contrarian analysis
/enhance implement user authentication
# → Implementation prompt with edge cases and robustness checks
Pro Tip: Use Shift+P (plan mode) with
/enhance
to review the enhanced prompt before execution.
- Reads CLAUDE.md - Automatically finds and incorporates your project rules
- Detects Task Type - Analyzes keywords to understand what you're trying to do
- Intelligent Step Selection - Dynamically selects from 25 specialized enhancement steps based on task complexity
- Adds Contrarian Analysis - Questions assumptions early to prevent wasted effort
- Agent Detection - Scans for available agents and recommends or proposes new ones
- Parallel Execution - Marks tasks with
for simultaneous execution
- Maps to MCP Tools - Recommends appropriate tools like mcpzen for analysis
- Generates Structured Prompt - Creates comprehensive requirements with success criteria
- Presents for Review - Shows the enhanced prompt in plan mode for your approval
The /enhance
command uses a sophisticated selection system that adapts to your request's complexity:
- Low Risk (typos, docs): 4-5 essential steps only
- Medium Risk (features): 8-10 steps including validation
- High Risk (auth, payments): 12-15 steps with security checks
- Critical (production): 15+ steps with comprehensive coverage
The system selects from specialized enhancement steps including:
- Foundation Steps: Clarity, context, examples, parallel operations
- Core Steps: Requirements parsing, contrarian analysis, solution design
- Validation Steps: Testing strategy, code review, rollback planning
- Domain Steps: Security audits, migrations, performance, compliance
"fix typo in README"
→ Selects only 4 steps (basic clarity and context)"add login feature"
→ Selects 12 steps (includes security, validation, edge cases)"database migration"
→ Selects 10 steps (includes rollback, data validation, testing)"production deployment"
→ Selects 18+ steps (comprehensive validation and monitoring)
Tasks marked with can run in parallel for dramatic speed improvements.
Build your ultimate Claude Code toolbelt with these complementary tools:
- claude-self-reflect - 100+ ⭐ - Claude forgets everything. This fixes that.
- Search past conversations with semantic understanding
- 100% local by default - your data stays private
- Project-scoped search with time-based memory decay
- Perfect complement to cc-enhance for maintaining long-term context
- claude-organizer - Automatic file organization for Claude Code
- CC-Enhance handles prompt enhancement
- Claude-Organizer handles file organization
- Use together for the complete Claude Code experience!
- context7 - Real-time documentation search
- Get up-to-date library documentation
- Code examples from actual usage
- Integrates with cc-enhance recommendations
- grep (MCP) - GitHub code search
- Find real-world code examples
- Search across millions of repositories
- Pattern-based code discovery
This project was originally part of claude-organizer but has been separated to:
- Allow independent development and versioning
- Keep each tool focused on its core functionality
- Enable users to choose which features they need
- Follow the Single Responsibility Principle
🤔 Isn't CLAUDE.md enough? Why do I need this tool?
You're absolutely right to be skeptical! CLAUDE.md is indeed powerful and often sufficient. Let's be contrarian about our own tool:
When cc-enhance actually adds value:
- Complex multi-step tasks - When you need 10+ coordinated actions with validation
- Contrarian thinking - Challenges assumptions BEFORE you waste 2 hours coding the wrong solution
- Parallel execution optimization - Identifies tasks that can run simultaneously (marked with 🔄)
- Risk-appropriate validation - Automatically adds security checks for auth, skips them for typos
- Consistency across sessions - Same request always generates similarly thorough prompts
When you DON'T need cc-enhance:
- Simple one-line fixes or typo corrections
- When your CLAUDE.md is comprehensive and Claude already follows it well
- Quick questions or explanations
- When you prefer manual control over every instruction
- If you enjoy the back-and-forth clarification dance with Claude
The tool exists because even with great CLAUDE.md files, Claude can still lose context mid-conversation. This tool front-loads that context into every request.
📊 How does intelligent selection actually work?
The tool analyzes your request through multiple lenses:
- Risk Assessment - Detects keywords like "production", "payment", "auth", "database"
- Complexity Detection - Estimates scope from verbs like "implement", "refactor", "migrate"
- Context Mapping - Matches request to relevant CLAUDE.md sections
- Step Selection - Picks from 25 specialized steps based on the above
Example Decision Tree:
Request: "fix the login bug"
├─ Contains "fix" + "bug" → Debugging context
├─ Contains "login" → Security context
├─ Risk: Medium-High (auth involved)
└─ Selected steps: [1,2,7,8,9,11,12,16] (8 steps)
Including: security audit, test strategy, contrarian analysis
🚀 What makes this different from just being verbose?
Verbose approach: Add everything possible to every prompt (exhausting and inefficient)
Intelligent approach: Select only relevant enhancements based on context
Example:
"Update README"
→ 4 steps (just clarity and context)"Implement OAuth"
→ 15 steps (security, testing, edge cases, rollback plans)
The tool knows when to be brief and when to be thorough.
⚡ How do parallel operations work?
When the tool marks steps with 🔄, it means they can run simultaneously:
REQUIREMENTS:
- Run test suite 🔄
- Check lint errors 🔄
- Validate types 🔄
- Review security scan results 🔄
Instead of running these sequentially (taking 4x longer), Claude can invoke multiple Task agents simultaneously, dramatically reducing execution time.
🎯 When should I use --debug mode?
Use /enhance --debug <request>
when you want to:
- See exactly which steps were selected and why
- Understand the risk assessment for your request
- Learn how the tool interprets different requests
- Troubleshoot why certain enhancements were included/excluded
Debug mode shows the complete decision process, making the "intelligent" part transparent.
🔧 Can I customize the enhancement steps?
Currently, the 25-step dictionary is built-in, but you can:
- Use
--debug
to see all steps and understand selection - Modify your CLAUDE.md to influence which project rules are included
- Contribute new steps via GitHub pull requests
Future versions may support custom step dictionaries per project.
We welcome contributions! Please see our Contributing Guide for details.
Distributed under the MIT License. See LICENSE for more information.
