mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-05 01:50:27 +08:00
feat: add dynamic output format for prompt-enhancer and update README
- Redesign output format to be dynamic and task-adaptive - Replace fixed template with core + optional fields structure - Add simple and complex task examples - Update workflow and enhancement guidelines - Add Agent Skills section to README.md and README_CN.md - Document Prompt Enhancer skill usage with -e/--enhance flags - Provide skill creation best practices 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -18,81 +18,107 @@ allowed-tools: (none)
|
||||
|
||||
## 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: [One-sentence technical goal with tech stack / 明确技术目标含技术栈]
|
||||
|
||||
TECH STACK: [Relevant technologies from memory / 相关技术栈]
|
||||
- [Framework/Library: Purpose]
|
||||
|
||||
CONTEXT: [Session memory findings / 会话记忆发现]
|
||||
- [Key context point 1]
|
||||
- [Key context point 2]
|
||||
- [Design patterns/constraints from session]
|
||||
INTENT: Fix authentication token validation in JWT middleware
|
||||
|
||||
ACTION:
|
||||
1. [Concrete step with technical details / 具体步骤含技术细节]
|
||||
2. [Concrete step with technical details]
|
||||
3. [Testing/validation step]
|
||||
1. Review token expiration logic in auth middleware
|
||||
2. Add proper error handling for expired tokens
|
||||
3. Test with valid/expired/malformed tokens
|
||||
```
|
||||
|
||||
ATTENTION: [Critical constraints / 关键约束]
|
||||
- [Security/compatibility/performance concerns]
|
||||
- [Design pattern requirements]
|
||||
**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 → Internal Analysis → Direct Output
|
||||
↓ ↓ ↓
|
||||
P1-4 Semantic+Memory Enhanced Prompt
|
||||
(3 dimensions) (Structured)
|
||||
Trigger (-e/--enhance) → Internal Analysis → Dynamic Output
|
||||
↓ ↓ ↓
|
||||
User Input Assess Task Type Select Fields
|
||||
Extract Memory Context Structure Prompt
|
||||
```
|
||||
|
||||
1. **Detect**: Check triggers (P1-P4)
|
||||
2. **Internal Analysis**:
|
||||
- Semantic (EN/CN) intent analysis
|
||||
- Memory extraction (tech stack, patterns, constraints)
|
||||
- Enhancement (structure + supplement + clarify)
|
||||
3. **Output**: Present enhanced structured prompt directly
|
||||
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 Checklist (Internal)
|
||||
## Enhancement Guidelines (Internal)
|
||||
|
||||
**Structure**:
|
||||
- [ ] INTENT: Clear, one-sentence technical goal
|
||||
- [ ] TECH STACK: Relevant technologies from session
|
||||
- [ ] CONTEXT: Key session findings and constraints
|
||||
- [ ] ACTION: Concrete steps with technical details
|
||||
- [ ] ATTENTION: Critical constraints and patterns
|
||||
**Always Include**:
|
||||
- Clear, actionable INTENT
|
||||
- Concrete ACTION steps with technical details
|
||||
|
||||
**Supplement**:
|
||||
- [ ] Add tech stack/frameworks mentioned in session
|
||||
- [ ] Include design patterns if relevant
|
||||
- [ ] Add testing/validation requirements
|
||||
- [ ] Specify performance metrics if applicable
|
||||
**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
|
||||
|
||||
**Clarify**:
|
||||
- [ ] Make vague intent explicit
|
||||
- [ ] Resolve ambiguous references (it/that/这个/那个)
|
||||
- [ ] Expand multi-module scope with dependencies
|
||||
- [ ] Add missing context from memory
|
||||
**Quality Checks**:
|
||||
- Make vague intent explicit
|
||||
- Resolve ambiguous references
|
||||
- Add testing/validation steps
|
||||
- Include constraints from memory
|
||||
|
||||
## Best Practices
|
||||
|
||||
- ✅ Detect `-e`/`--enhance` flags first (P1)
|
||||
- ✅ Support EN + CN semantic keywords
|
||||
- ✅ Trigger only on `-e`/`--enhance` flags
|
||||
- ✅ Use **dynamic field selection** based on task type
|
||||
- ✅ Extract **memory context ONLY** (no file reading)
|
||||
- ✅ Add tech stack, design patterns, testing requirements
|
||||
- ✅ Direct output (no intermediate steps)
|
||||
- ✅ Use INTENT/TECH STACK/CONTEXT/ACTION/ATTENTION format
|
||||
- ❌ NO tool calls (AskUserQuestion removed)
|
||||
- ❌ NO Bash, Read, Glob, Grep operations
|
||||
- ❌ NO file analysis or codebase scanning
|
||||
|
||||
## Key Changes
|
||||
|
||||
1. **Removed all tools** - Pure analysis and output
|
||||
2. **Removed user confirmation** - Direct output for speed
|
||||
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
|
||||
- ✅ 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
|
||||
|
||||
60
README.md
60
README.md
@@ -289,6 +289,66 @@ MCP (Model Context Protocol) tools provide advanced codebase analysis. **Recomme
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Agent Skills
|
||||
|
||||
**Agent Skills** extend Claude's capabilities with modular, reusable expertise packages. Skills are automatically discovered and triggered based on context.
|
||||
|
||||
### **Available Skills**
|
||||
|
||||
#### **Prompt Enhancer**
|
||||
Transform vague prompts into structured, actionable specifications.
|
||||
|
||||
**Usage**: Add `-e` or `--enhance` flag to any request
|
||||
```bash
|
||||
# Example
|
||||
fix authentication issue -e
|
||||
optimize database queries --enhance
|
||||
```
|
||||
|
||||
**What it does**:
|
||||
- Analyzes session context and tech stack
|
||||
- Structures intent into INTENT → ACTION format
|
||||
- Adds relevant context, constraints, and metrics
|
||||
- Outputs ready-to-execute specifications
|
||||
|
||||
**Output**: Dynamic structured prompt adapted to task type (simple tasks get minimal fields, complex tasks get comprehensive specifications)
|
||||
|
||||
### **Creating Custom Skills**
|
||||
|
||||
Skills are stored in `.claude/skills/` (project) or `~/.claude/skills/` (personal):
|
||||
|
||||
```bash
|
||||
# Create a new skill
|
||||
mkdir -p .claude/skills/my-skill
|
||||
```
|
||||
|
||||
**SKILL.md structure**:
|
||||
```yaml
|
||||
---
|
||||
name: My Skill Name
|
||||
description: What it does and when to use it. Use when [trigger conditions].
|
||||
allowed-tools: Read, Grep, Glob # Optional tool restrictions
|
||||
---
|
||||
|
||||
# My Skill Name
|
||||
|
||||
## Instructions
|
||||
[Step-by-step guidance for Claude]
|
||||
|
||||
## Examples
|
||||
[Concrete usage examples]
|
||||
```
|
||||
|
||||
**Best Practices**:
|
||||
- Write specific descriptions with clear trigger conditions
|
||||
- Include both what the skill does and when to use it
|
||||
- Keep skills focused on single capabilities
|
||||
- Test by asking questions that match your description
|
||||
|
||||
For complete documentation, see [skills.md](skills.md).
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Getting Started
|
||||
|
||||
### Complete Development Workflow
|
||||
|
||||
60
README_CN.md
60
README_CN.md
@@ -289,6 +289,66 @@ MCP (模型上下文协议) 工具提供高级代码库分析。**推荐安装**
|
||||
|
||||
---
|
||||
|
||||
## 🎯 智能体技能 (Agent Skills)
|
||||
|
||||
**智能体技能** 通过模块化、可复用的专业知识包扩展 Claude 的能力。技能会根据上下文自动发现和触发。
|
||||
|
||||
### **可用技能**
|
||||
|
||||
#### **提示词增强器 (Prompt Enhancer)**
|
||||
将模糊提示转换为结构化、可执行的规范。
|
||||
|
||||
**使用方式**:在任何请求中添加 `-e` 或 `--enhance` 标志
|
||||
```bash
|
||||
# 示例
|
||||
修复认证问题 -e
|
||||
优化数据库查询 --enhance
|
||||
```
|
||||
|
||||
**功能说明**:
|
||||
- 分析会话上下文和技术栈
|
||||
- 将意图结构化为 INTENT → ACTION 格式
|
||||
- 添加相关上下文、约束和指标
|
||||
- 输出可立即执行的规范
|
||||
|
||||
**输出**:根据任务类型动态调整的结构化提示(简单任务使用最少字段,复杂任务使用全面规范)
|
||||
|
||||
### **创建自定义技能**
|
||||
|
||||
技能存储在 `.claude/skills/`(项目)或 `~/.claude/skills/`(个人):
|
||||
|
||||
```bash
|
||||
# 创建新技能
|
||||
mkdir -p .claude/skills/my-skill
|
||||
```
|
||||
|
||||
**SKILL.md 结构**:
|
||||
```yaml
|
||||
---
|
||||
name: 我的技能名称
|
||||
description: 功能说明和使用时机。使用时机:[触发条件]。
|
||||
allowed-tools: Read, Grep, Glob # 可选工具限制
|
||||
---
|
||||
|
||||
# 我的技能名称
|
||||
|
||||
## 指令
|
||||
[Claude 的分步指导]
|
||||
|
||||
## 示例
|
||||
[具体使用示例]
|
||||
```
|
||||
|
||||
**最佳实践**:
|
||||
- 编写具体的描述,包含明确的触发条件
|
||||
- 同时说明功能和使用时机
|
||||
- 保持技能专注于单一能力
|
||||
- 通过匹配描述的问题进行测试
|
||||
|
||||
完整文档请参阅 [skills.md](skills.md)。
|
||||
|
||||
---
|
||||
|
||||
## 🚀 快速入门
|
||||
|
||||
### 完整开发工作流
|
||||
|
||||
Reference in New Issue
Block a user