refactor: simplify prompt-enhancer skill description and internal analysis

- Update description: focus on intelligent analysis and session memory
- Simplify trigger mechanism to only -e/--enhance flags
- Condense internal analysis section to single concise statement
- Remove verbose semantic analysis details for cleaner documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
catlog22
2025-10-18 22:41:25 +08:00
parent b8935777e7
commit 99cb29ed23

View File

@@ -1,6 +1,6 @@
---
name: Prompt Enhancer
description: Transform vague prompts into actionable specs using session memory ONLY (no file analysis). AUTO-TRIGGER on (1) -e/--enhance flags, (2) vague keywords (fix/improve/refactor/修复/优化/重构), (3) unclear refs (it/that/这个/那个), (4) multi-module scope. Supports English + Chinese semantic recognition.
description: Transform vague prompts into actionable specs using intelligent analysis and session memory. Trigger with -e/--enhance flags.
allowed-tools: (none)
---
@@ -10,35 +10,9 @@ allowed-tools: (none)
**Languages**: English + Chinese (中英文语义识别)
## Triggers
| Priority | Condition | Examples | Action |
|----------|-----------|----------|--------|
| **P1** | `-e` / `--enhance` flag | "fix auth -e", "优化性能 --enhance" | Immediate enhancement |
| **P2** | Vague keywords | EN: fix/improve/refactor<br>CN: 修复/优化/重构/更新/改进 | Semantic analysis |
| **P3** | Unclear references | EN: it/that/the code<br>CN: 这个/那个/它/代码 | Context extraction |
| **P4** | Multi-module scope | >3 modules or critical systems | Dependency analysis |
## Process (Internal → Direct Output)
**Internal Analysis (Silent)**:
1. **Semantic Analysis**
- Intent keywords (EN/CN): fix/修复, improve/优化, add/添加, refactor/重构
- Scope identification: file → module → system
- Domain mapping: auth/API/DB/UI/Performance
2. **Memory Extraction** (NO File Reading)
- Recent user requests and context
- Tech stack mentioned in session (frameworks, libraries, patterns)
- Design patterns discussed or implied
- User preferences and constraints
- Known dependencies from conversation
3. **Enhancement Dimensions**
- **Structure**: Convert to INTENT/CONTEXT/ACTION/ATTENTION format
- **Supplement**: Add tech stack, design patterns, testing requirements
- **Clarify**: Make intent explicit, resolve ambiguous references
**Internal Analysis**: Intelligently extract session context, identify tech stack, and structure into actionable format.
**Output**: Direct structured prompt (no intermediate steps shown)
@@ -66,18 +40,6 @@ ATTENTION: [Critical constraints / 关键约束]
- [Security/compatibility/performance concerns]
- [Design pattern requirements]
```
## Semantic Patterns (EN + CN)
| Intent (EN/CN) | Semantic Meaning | Enhancement Focus |
|----------------|------------------|-------------------|
| fix/修复 + vague target | Debug & resolve | Root cause + tech stack + testing |
| improve/优化 + no metrics | Enhance/optimize | Performance metrics + patterns + benchmarks |
| add/添加 + feature | Implement feature | Integration points + edge cases + tests |
| refactor/重构 + module | Restructure | Design patterns + backward compatibility |
| update/更新 + version | Modernize | Migration path + breaking changes |
| clean up/清理 + area | Simplify/organize | Code quality patterns + tech debt |
## Workflow
```
@@ -134,87 +96,3 @@ Trigger → Internal Analysis → Direct Output
3. **Added tech stack section** - Supplement with technologies
4. **Enhanced internal analysis** - 3 dimensions (structure + supplement + clarify)
5. **Focus on memory** - Session context only, no file reading
## Examples
### Example 1: Vague Fix Request
**Input**: "fix auth -e" / "修复认证 --enhance"
**Internal Analysis**:
- Semantic: "fix/修复" → debug intent
- Memory: Recent mention of JWT, token expiration issues
- Tech stack: JWT, Express.js middleware (from session)
- Enhancement: Add testing, security patterns
**Output**:
```
📋 ENHANCED PROMPT
INTENT: Fix authentication token expiration handling in JWT-based auth system
TECH STACK:
- JWT: Token generation and validation
- Express.js: Middleware implementation
- Jest: Unit testing framework
CONTEXT:
- User reported token expiration issues in previous conversation
- Session indicates JWT-based authentication system
- Preference for backward compatibility with existing tokens
ACTION:
1. Analyze JWT token lifecycle and expiration validation logic
2. Implement proper token refresh mechanism with sliding expiration
3. Add middleware for token validation with detailed error handling
4. Write unit tests for token expiration and refresh scenarios
5. Update API documentation for token refresh endpoints
ATTENTION:
- Must maintain backward compatibility with existing valid tokens
- Security: Follow JWT best practices (HS256/RS256, secure secret storage)
- Testing: Cover edge cases (expired, malformed, missing tokens)
- Performance: Consider token validation caching for high-traffic endpoints
```
### Example 2: Vague Optimization Request
**Input**: "optimize performance --enhance" / "优化性能 -e"
**Internal Analysis**:
- Semantic: "optimize/优化" → performance intent
- Memory: Previous discussion about API response times, React rendering
- Tech stack: React, Node.js, PostgreSQL (from session)
- Enhancement: Add metrics, profiling, specific optimizations
**Output**:
```
📋 ENHANCED PROMPT
INTENT: Optimize API response times and React component rendering performance
TECH STACK:
- React: Component optimization (memo, useMemo, useCallback)
- Node.js: API endpoint optimization
- PostgreSQL: Query optimization and indexing
CONTEXT:
- User mentioned slow API responses (>2s) in previous conversation
- React app shows rendering performance issues on large lists
- PostgreSQL database queries identified as bottleneck
ACTION:
1. Profile API endpoints using Node.js profiler to identify slow queries
2. Optimize PostgreSQL queries with proper indexing and query analysis (EXPLAIN)
3. Implement React.memo for expensive list components
4. Add useMemo/useCallback for derived data and event handlers
5. Implement pagination/virtualization for large data lists
6. Add performance monitoring with metrics (response time, render time)
7. Write performance benchmarks and regression tests
ATTENTION:
- Metrics: Target <500ms API response, <100ms render time
- Patterns: Use React.memo judiciously (avoid over-optimization)
- Testing: Add performance regression tests with benchmarks
- Compatibility: Ensure optimizations don't break existing functionality
```