From 2072ddfa6ea19cab32831159d0a05b8a193862af Mon Sep 17 00:00:00 2001 From: catlog22 Date: Tue, 21 Oct 2025 15:33:27 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=E5=A2=9E=E5=BC=BA=E5=99=A8=E6=96=87=E6=A1=A3=EF=BC=8C=E6=8F=90?= =?UTF-8?q?=E4=BE=9B=E6=A8=A1=E7=B3=8A=E6=8F=90=E7=A4=BA=E8=BD=AC=E5=8C=96?= =?UTF-8?q?=E4=B8=BA=E5=8F=AF=E6=93=8D=E4=BD=9C=E8=A7=84=E8=8C=83=E7=9A=84?= =?UTF-8?q?=E8=AF=A6=E7=BB=86=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/skills/prompt-enhancer/SKILL.md | 124 ++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 .claude/skills/prompt-enhancer/SKILL.md diff --git a/.claude/skills/prompt-enhancer/SKILL.md b/.claude/skills/prompt-enhancer/SKILL.md new file mode 100644 index 00000000..348515ce --- /dev/null +++ b/.claude/skills/prompt-enhancer/SKILL.md @@ -0,0 +1,124 @@ +--- +name: Prompt Enhancer +description: Transform vague prompts into actionable specs using intelligent analysis and session memory. Use when user input contains -e or --enhance flag. +allowed-tools: (none) +--- + +# Prompt Enhancer + +**Transform**: Vague intent → Structured specification (Memory-based, Direct Output) + +**Languages**: English + Chinese (中英文语义识别) + +## Process (Internal → Direct Output) + +**Internal Analysis**: Intelligently extract session context, identify tech stack, and structure into actionable format. + +**Output**: Direct structured prompt (no intermediate steps shown) + +## Output Format + +**Dynamic Structure**: Adapt fields based on task type and context needs. Not all fields are required. + +**Core Fields** (always present): +- **INTENT**: One-sentence technical goal +- **ACTION**: Concrete steps with technical details + +**Optional Fields** (include when relevant): +- **TECH STACK**: Relevant technologies (when tech-specific) +- **CONTEXT**: Session memory findings (when context matters) +- **ATTENTION**: Critical constraints (when risks/requirements exist) +- **SCOPE**: Affected modules/files (for multi-module tasks) +- **METRICS**: Success criteria (for optimization/performance tasks) +- **DEPENDENCIES**: Related components (for integration tasks) + +**Example (Simple Task)**: +``` +📋 ENHANCED PROMPT + +INTENT: Fix authentication token validation in JWT middleware + +ACTION: +1. Review token expiration logic in auth middleware +2. Add proper error handling for expired tokens +3. Test with valid/expired/malformed tokens +``` + +**Example (Complex Task)**: +``` +📋 ENHANCED PROMPT + +INTENT: Optimize API performance with caching and database indexing + +TECH STACK: +- Redis: Response caching +- PostgreSQL: Query optimization + +CONTEXT: +- API response times >2s mentioned in previous conversation +- PostgreSQL slow query logs show N+1 problems + +ACTION: +1. Profile endpoints to identify slow queries +2. Add PostgreSQL indexes on frequently queried columns +3. Implement Redis caching for read-heavy endpoints +4. Add cache invalidation on data updates + +METRICS: +- Target: <500ms API response time +- Cache hit ratio: >80% + +ATTENTION: +- Maintain backward compatibility with existing API contracts +- Handle cache invalidation correctly to avoid stale data +``` +## Workflow + +``` +Trigger (-e/--enhance) → Internal Analysis → Dynamic Output + ↓ ↓ ↓ + User Input Assess Task Type Select Fields + Extract Memory Context Structure Prompt +``` + +1. **Detect**: User input contains `-e` or `--enhance` +2. **Analyze**: + - Determine task type (fix/optimize/implement/refactor) + - Extract relevant session context + - Identify tech stack and constraints +3. **Structure**: + - Always include: INTENT + ACTION + - Conditionally add: TECH STACK, CONTEXT, ATTENTION, METRICS, etc. +4. **Output**: Present dynamically structured prompt + +## Enhancement Guidelines (Internal) + +**Always Include**: +- Clear, actionable INTENT +- Concrete ACTION steps with technical details + +**Add When Relevant**: +- TECH STACK: Task involves specific technologies +- CONTEXT: Session memory provides useful background +- ATTENTION: Security/compatibility/performance concerns exist +- SCOPE: Multi-module or cross-component changes +- METRICS: Performance/optimization goals need measurement +- DEPENDENCIES: Integration points matter + +**Quality Checks**: +- Make vague intent explicit +- Resolve ambiguous references +- Add testing/validation steps +- Include constraints from memory + +## Best Practices + +- ✅ Trigger only on `-e`/`--enhance` flags +- ✅ Use **dynamic field selection** based on task type +- ✅ Extract **memory context ONLY** (no file reading) +- ✅ Always include INTENT + ACTION as core fields +- ✅ Add optional fields only when relevant to task +- ✅ Direct output (no intermediate steps shown) +- ❌ NO tool calls +- ❌ NO file operations (Bash, Read, Glob, Grep) +- ❌ NO fixed template - adapt to task needs