Files
Claude-Code-Workflow/.claude/commands/enhance-prompt.md
catlog22 7775cb3b0a Refactor planning workflow documentation and enhance UI designer role template
- Updated the `/workflow:plan` command description to clarify its orchestration of a 4-phase planning workflow.
- Revised the execution flow and core planning principles for improved clarity and structure.
- Removed the `ANALYSIS_RESULTS.md` file as it is no longer needed in the workflow.
- Enhanced the `concept-enhanced` tool documentation to specify mandatory first steps and output requirements.
- Expanded the `ui-designer` role template to include detailed design workflows, output requirements, and collaboration strategies.
- Introduced new design phases with clear outputs and user approval checkpoints in the UI designer template.
2025-09-30 13:37:37 +08:00

3.5 KiB

name, description, usage, argument-hint, examples
name description usage argument-hint examples
enhance-prompt Context-aware prompt enhancement using session memory and codebase analysis /enhance-prompt <user_input> user input to enhance
/enhance-prompt "add user profile editing"
/enhance-prompt "fix login button"
/enhance-prompt "clean up the payment code"

Overview

Systematically enhances user prompts by combining session memory context with codebase patterns, translating ambiguous requests into actionable specifications.

Core Protocol

Enhancement Pipeline: Intent TranslationContext IntegrationGemini Analysis (if needed)Structured Output

Context Sources:

  • Session memory (conversation history, previous analysis)
  • Codebase patterns (via Gemini when triggered)
  • Implicit technical requirements

Gemini Trigger Logic

FUNCTION should_use_gemini(user_prompt):
  critical_keywords = ["refactor", "migrate", "redesign", "auth", "payment", "security"]

  RETURN (
    prompt_affects_multiple_modules(user_prompt, threshold=3) OR
    any_keyword_in_prompt(critical_keywords, user_prompt)
  )
END

Gemini Integration: @~/.claude/workflows/intelligent-tools-strategy.md

Enhancement Rules

Intent Translation

User Says Translate To Focus
"fix" Debug and resolve Root cause → preserve behavior
"improve" Enhance/optimize Performance/readability
"add" Implement feature Integration + edge cases
"refactor" Restructure quality Maintain behavior
"update" Modernize Version compatibility

Context Integration Strategy

Session Memory First:

  • Reference recent conversation context
  • Reuse previously identified patterns
  • Build on established understanding

Codebase Analysis (via Gemini):

  • Only when complexity requires it
  • Focus on integration points
  • Identify existing patterns

Example:

# User: "add login"
# Session Memory: Previous auth discussion, JWT mentioned
# Inferred: JWT-based auth, integrate with existing session management
# Gemini (if multi-module): Analyze AuthService patterns, middleware structure

Output Structure

INTENT: [Clear technical goal]
CONTEXT: [Session memory + codebase patterns]
ACTION: [Specific implementation steps]
ATTENTION: [Critical constraints]

Output Examples

Simple (no Gemini):

# Input: "fix login button"
INTENT: Debug non-functional login button
CONTEXT: From session - OAuth flow discussed, known state issue
ACTION: Check event binding → verify state updates → test auth flow
ATTENTION: Preserve existing OAuth integration

Complex (with Gemini):

# Input: "refactor payment code"
INTENT: Restructure payment module for maintainability
CONTEXT: Session memory - PCI compliance requirements
         Gemini - PaymentService → StripeAdapter pattern identified
ACTION: Extract reusable validators → isolate payment gateway logic
ATTENTION: Zero behavior change, maintain PCI compliance, full test coverage

Automatic Triggers

  • Ambiguous language: "fix", "improve", "clean up"
  • Multi-module impact (>3 modules)
  • Architecture changes
  • Critical systems: auth, payment, security
  • Complex refactoring

Key Principles

  1. Memory First: Leverage session context before analysis
  2. Minimal Gemini: Only when complexity demands it
  3. Context Reuse: Build on previous understanding
  4. Clear Output: Structured, actionable specifications
  5. Avoid Duplication: Reference existing context, don't repeat