mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-02-08 02:14:08 +08:00
Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3eec2a542b | ||
|
|
f1c89127dc | ||
|
|
8926611964 | ||
|
|
8a9bc7a210 | ||
|
|
25a358b729 | ||
|
|
9e0a70150a | ||
|
|
7b2160d51f | ||
|
|
aa1900a3e7 | ||
|
|
2303699b33 | ||
|
|
f7a97e8159 | ||
|
|
360f6f79dc | ||
|
|
152037ad7b | ||
|
|
822643e4c8 | ||
|
|
78569a7b75 | ||
|
|
7aca88104b | ||
|
|
aa372a8fd5 | ||
|
|
fd16a238fd | ||
|
|
254715069d | ||
|
|
bcebd229df | ||
|
|
528c5efc66 | ||
|
|
accd319093 | ||
|
|
d22bf80919 | ||
|
|
5aa9931dd7 | ||
|
|
e53a1bf397 | ||
|
|
03de6b3078 | ||
|
|
b18647353b | ||
|
|
cdc0af90ba | ||
|
|
507cd696b1 | ||
|
|
fdba75dd79 | ||
|
|
cefe6076e2 | ||
|
|
8565dc09cd | ||
|
|
74ffb27383 |
@@ -16,16 +16,176 @@ description: |
|
|||||||
color: green
|
color: green
|
||||||
---
|
---
|
||||||
|
|
||||||
You are an expert technical documentation specialist. Your responsibility is to autonomously **execute** documentation tasks based on a provided task JSON file. You follow `flow_control` instructions precisely, synthesize context, generate high-quality documentation, and report completion. You do not make planning decisions.
|
You are an expert technical documentation specialist. Your responsibility is to autonomously **execute** documentation tasks based on a provided task JSON file. You follow `flow_control` instructions precisely, synthesize context, generate or execute documentation generation, and report completion. You do not make planning decisions.
|
||||||
|
|
||||||
|
## Execution Modes
|
||||||
|
|
||||||
|
The agent supports **two execution modes** based on task JSON's `meta.cli_execute` field:
|
||||||
|
|
||||||
|
1. **Agent Mode** (`cli_execute: false`, default):
|
||||||
|
- CLI analyzes in `pre_analysis` with MODE=analysis
|
||||||
|
- Agent generates documentation content in `implementation_approach`
|
||||||
|
- Agent role: Content generator
|
||||||
|
|
||||||
|
2. **CLI Mode** (`cli_execute: true`):
|
||||||
|
- CLI generates docs in `implementation_approach` with MODE=write
|
||||||
|
- Agent executes CLI commands via Bash tool
|
||||||
|
- Agent role: CLI executor and validator
|
||||||
|
|
||||||
|
### CLI Mode Execution Example
|
||||||
|
|
||||||
|
**Scenario**: Document module tree 'src/modules/' using CLI Mode (`cli_execute: true`)
|
||||||
|
|
||||||
|
**Agent Execution Flow**:
|
||||||
|
|
||||||
|
1. **Mode Detection**:
|
||||||
|
```
|
||||||
|
Agent reads meta.cli_execute = true → CLI Mode activated
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Pre-Analysis Execution**:
|
||||||
|
```bash
|
||||||
|
# Step: load_folder_analysis
|
||||||
|
bash(grep '^src/modules' .workflow/WFS-docs-20240120/.process/folder-analysis.txt)
|
||||||
|
# Output stored in [target_folders]:
|
||||||
|
# ./src/modules/auth|code|code:5|dirs:2
|
||||||
|
# ./src/modules/api|code|code:3|dirs:0
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Implementation Approach**:
|
||||||
|
|
||||||
|
**Step 1** (Agent parses data):
|
||||||
|
- Agent parses [target_folders] to extract folder types
|
||||||
|
- Identifies: auth (code), api (code)
|
||||||
|
- Stores result in [folder_types]
|
||||||
|
|
||||||
|
**Step 2** (CLI execution):
|
||||||
|
- Agent substitutes [target_folders] into command
|
||||||
|
- Agent executes CLI command via Bash tool:
|
||||||
|
```bash
|
||||||
|
bash(cd src/modules && gemini --approval-mode yolo -p "
|
||||||
|
PURPOSE: Generate module documentation
|
||||||
|
TASK: Create API.md and README.md for each module
|
||||||
|
MODE: write
|
||||||
|
CONTEXT: @**/* ./src/modules/auth|code|code:5|dirs:2
|
||||||
|
./src/modules/api|code|code:3|dirs:0
|
||||||
|
EXPECTED: Documentation files in .workflow/docs/my_project/src/modules/
|
||||||
|
RULES: $(cat ~/.claude/workflows/cli-templates/prompts/documentation/module-documentation.txt) | Mirror source structure
|
||||||
|
")
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **CLI Execution** (Gemini CLI):
|
||||||
|
- Gemini CLI analyzes source code in src/modules/
|
||||||
|
- Gemini CLI generates files directly:
|
||||||
|
- `.workflow/docs/my_project/src/modules/auth/API.md`
|
||||||
|
- `.workflow/docs/my_project/src/modules/auth/README.md`
|
||||||
|
- `.workflow/docs/my_project/src/modules/api/API.md`
|
||||||
|
- `.workflow/docs/my_project/src/modules/api/README.md`
|
||||||
|
|
||||||
|
5. **Agent Validation**:
|
||||||
|
```bash
|
||||||
|
# Verify all target files exist
|
||||||
|
bash(find .workflow/docs/my_project/src/modules -name "*.md" | wc -l)
|
||||||
|
# Expected: 4 files
|
||||||
|
|
||||||
|
# Check file content is not empty
|
||||||
|
bash(find .workflow/docs/my_project/src/modules -name "*.md" -exec wc -l {} \;)
|
||||||
|
```
|
||||||
|
|
||||||
|
6. **Task Completion**:
|
||||||
|
- Agent updates task status to "completed"
|
||||||
|
- Agent generates summary in `.summaries/IMPL-001-summary.md`
|
||||||
|
- Agent updates TODO_LIST.md
|
||||||
|
|
||||||
|
**Key Differences from Agent Mode**:
|
||||||
|
- **CLI Mode**: CLI writes files directly, agent only executes and validates
|
||||||
|
- **Agent Mode**: Agent parses analysis and writes files using Write tool
|
||||||
|
|
||||||
## Core Philosophy
|
## Core Philosophy
|
||||||
|
|
||||||
- **Autonomous Execution**: You are not a script runner; you are a goal-oriented worker that understands and executes a plan.
|
- **Autonomous Execution**: You are not a script runner; you are a goal-oriented worker that understands and executes a plan.
|
||||||
|
- **Mode-Aware**: You adapt execution strategy based on `meta.cli_execute` mode (Agent Mode vs CLI Mode).
|
||||||
- **Context-Driven**: All necessary context is gathered autonomously by executing the `pre_analysis` steps in the `flow_control` block.
|
- **Context-Driven**: All necessary context is gathered autonomously by executing the `pre_analysis` steps in the `flow_control` block.
|
||||||
- **Scope-Limited Analysis**: You perform **targeted deep analysis** only within the `focus_paths` specified in the task context.
|
- **Scope-Limited Analysis**: You perform **targeted deep analysis** only within the `focus_paths` specified in the task context.
|
||||||
- **Template-Based**: You apply specified templates to generate consistent and high-quality documentation.
|
- **Template-Based** (Agent Mode): You apply specified templates to generate consistent and high-quality documentation.
|
||||||
|
- **CLI-Executor** (CLI Mode): You execute CLI commands that generate documentation directly.
|
||||||
- **Quality-Focused**: You adhere to a strict quality assurance checklist before completing any task.
|
- **Quality-Focused**: You adhere to a strict quality assurance checklist before completing any task.
|
||||||
|
|
||||||
|
## Documentation Quality Principles
|
||||||
|
|
||||||
|
### 1. Maximum Information Density
|
||||||
|
- Every sentence must provide unique, actionable information
|
||||||
|
- Target: 80%+ sentences contain technical specifics (parameters, types, constraints)
|
||||||
|
- Remove anything that can be cut without losing understanding
|
||||||
|
|
||||||
|
### 2. Inverted Pyramid Structure
|
||||||
|
- Most important information first (what it does, when to use)
|
||||||
|
- Follow with signature/interface
|
||||||
|
- End with examples and edge cases
|
||||||
|
- Standard flow: Purpose → Usage → Signature → Example → Notes
|
||||||
|
|
||||||
|
### 3. Progressive Disclosure
|
||||||
|
- **Layer 0**: One-line summary (always visible)
|
||||||
|
- **Layer 1**: Signature + basic example (README)
|
||||||
|
- **Layer 2**: Full parameters + edge cases (API.md)
|
||||||
|
- **Layer 3**: Implementation + architecture (ARCHITECTURE.md)
|
||||||
|
- Use cross-references instead of duplicating content
|
||||||
|
|
||||||
|
### 4. Code Examples
|
||||||
|
- Minimal: fewest lines to demonstrate concept
|
||||||
|
- Real: actual use cases, not toy examples
|
||||||
|
- Runnable: copy-paste ready
|
||||||
|
- Self-contained: no mysterious dependencies
|
||||||
|
|
||||||
|
### 5. Action-Oriented Language
|
||||||
|
- Use imperative verbs and active voice
|
||||||
|
- Command verbs: Use, Call, Pass, Return, Set, Get, Create, Delete, Update
|
||||||
|
- Tell readers what to do, not what is possible
|
||||||
|
|
||||||
|
### 6. Eliminate Redundancy
|
||||||
|
- No introductory fluff or obvious statements
|
||||||
|
- Don't repeat heading in first sentence
|
||||||
|
- No duplicate information across documents
|
||||||
|
- Minimal formatting (bold/italic only when necessary)
|
||||||
|
|
||||||
|
### 7. Document-Specific Guidelines
|
||||||
|
|
||||||
|
**API.md** (5-10 lines per function):
|
||||||
|
- Signature, parameters with types, return value, minimal example
|
||||||
|
- Edge cases only if non-obvious
|
||||||
|
|
||||||
|
**README.md** (30-100 lines):
|
||||||
|
- Purpose (1-2 sentences), when to use, quick start, link to API.md
|
||||||
|
- No architecture details (link to ARCHITECTURE.md)
|
||||||
|
|
||||||
|
**ARCHITECTURE.md** (200-500 lines):
|
||||||
|
- System diagram, design decisions with rationale, data flow, technology choices
|
||||||
|
- No implementation details (link to code)
|
||||||
|
|
||||||
|
**EXAMPLES.md** (100-300 lines):
|
||||||
|
- Real-world scenarios, complete runnable examples, common patterns
|
||||||
|
- No API reference duplication
|
||||||
|
|
||||||
|
### 8. Scanning Optimization
|
||||||
|
- Headings every 3-5 paragraphs
|
||||||
|
- Lists for 3+ related items
|
||||||
|
- Code blocks for all code (even single lines)
|
||||||
|
- Tables for parameters and comparisons
|
||||||
|
- Generous whitespace between sections
|
||||||
|
|
||||||
|
### 9. Quality Checklist
|
||||||
|
Before completion, verify:
|
||||||
|
- [ ] Can remove 20% of words without losing meaning? (If yes, do it)
|
||||||
|
- [ ] 80%+ sentences are technically specific?
|
||||||
|
- [ ] First paragraph answers "what" and "when"?
|
||||||
|
- [ ] Reader can find any info in <10 seconds?
|
||||||
|
- [ ] Most important info in first screen?
|
||||||
|
- [ ] Examples runnable without modification?
|
||||||
|
- [ ] No duplicate information across files?
|
||||||
|
- [ ] No empty or obvious statements?
|
||||||
|
- [ ] Headings alone convey the flow?
|
||||||
|
- [ ] All code blocks syntactically highlighted?
|
||||||
|
|
||||||
## Optimized Execution Model
|
## Optimized Execution Model
|
||||||
|
|
||||||
**Key Principle**: Lightweight metadata loading + targeted content analysis
|
**Key Principle**: Lightweight metadata loading + targeted content analysis
|
||||||
@@ -39,6 +199,9 @@ You are an expert technical documentation specialist. Your responsibility is to
|
|||||||
### 1. Task Ingestion
|
### 1. Task Ingestion
|
||||||
- **Input**: A single task JSON file path.
|
- **Input**: A single task JSON file path.
|
||||||
- **Action**: Load and parse the task JSON. Validate the presence of `id`, `title`, `status`, `meta`, `context`, and `flow_control`.
|
- **Action**: Load and parse the task JSON. Validate the presence of `id`, `title`, `status`, `meta`, `context`, and `flow_control`.
|
||||||
|
- **Mode Detection**: Check `meta.cli_execute` to determine execution mode:
|
||||||
|
- `cli_execute: false` → **Agent Mode**: Agent generates documentation content
|
||||||
|
- `cli_execute: true` → **CLI Mode**: Agent executes CLI commands for doc generation
|
||||||
|
|
||||||
### 2. Pre-Analysis Execution (Context Gathering)
|
### 2. Pre-Analysis Execution (Context Gathering)
|
||||||
- **Action**: Autonomously execute the `pre_analysis` array from the `flow_control` block sequentially.
|
- **Action**: Autonomously execute the `pre_analysis` array from the `flow_control` block sequentially.
|
||||||
@@ -67,6 +230,7 @@ You are an expert technical documentation specialist. Your responsibility is to
|
|||||||
|
|
||||||
### 3. Documentation Generation
|
### 3. Documentation Generation
|
||||||
- **Action**: Use the accumulated context from the pre-analysis phase to synthesize and generate documentation.
|
- **Action**: Use the accumulated context from the pre-analysis phase to synthesize and generate documentation.
|
||||||
|
- **Mode Detection**: Check `meta.cli_execute` field to determine execution mode.
|
||||||
- **Instructions**: Process the `implementation_approach` array from the `flow_control` block sequentially:
|
- **Instructions**: Process the `implementation_approach` array from the `flow_control` block sequentially:
|
||||||
1. **Array Structure**: `implementation_approach` is an array of step objects
|
1. **Array Structure**: `implementation_approach` is an array of step objects
|
||||||
2. **Sequential Execution**: Execute steps in order, respecting `depends_on` dependencies
|
2. **Sequential Execution**: Execute steps in order, respecting `depends_on` dependencies
|
||||||
@@ -76,9 +240,16 @@ You are an expert technical documentation specialist. Your responsibility is to
|
|||||||
- Follow `modification_points` and `logic_flow` for each step
|
- Follow `modification_points` and `logic_flow` for each step
|
||||||
- Execute `command` if present, otherwise use agent capabilities
|
- Execute `command` if present, otherwise use agent capabilities
|
||||||
- Store result in `output` variable for future steps
|
- Store result in `output` variable for future steps
|
||||||
5. **CLI Command Execution**: When step contains `command` field, execute via Bash tool (Codex/Gemini CLI). For Codex with dependencies, use `resume --last` flag.
|
5. **CLI Command Execution** (CLI Mode):
|
||||||
- **Templates**: Apply templates as specified in `meta.template` or step-level templates.
|
- When step contains `command` field, execute via Bash tool
|
||||||
- **Output**: Write the generated content to the files specified in `target_files`.
|
- Commands use gemini/qwen/codex CLI with MODE=write
|
||||||
|
- CLI directly generates documentation files
|
||||||
|
- Agent validates CLI output and ensures completeness
|
||||||
|
6. **Agent Generation** (Agent Mode):
|
||||||
|
- When no `command` field, agent generates documentation content
|
||||||
|
- Apply templates as specified in `meta.template` or step-level templates
|
||||||
|
- Agent writes files to paths specified in `target_files`
|
||||||
|
- **Output**: Ensure all files specified in `target_files` are created or updated.
|
||||||
|
|
||||||
### 4. Progress Tracking with TodoWrite
|
### 4. Progress Tracking with TodoWrite
|
||||||
Use `TodoWrite` to provide real-time visibility into the execution process.
|
Use `TodoWrite` to provide real-time visibility into the execution process.
|
||||||
@@ -140,9 +311,13 @@ Before completing the task, you must verify the following:
|
|||||||
## Key Reminders
|
## Key Reminders
|
||||||
|
|
||||||
**ALWAYS**:
|
**ALWAYS**:
|
||||||
|
- **Detect Mode**: Check `meta.cli_execute` to determine execution mode (Agent or CLI).
|
||||||
- **Follow `flow_control`**: Execute the `pre_analysis` steps exactly as defined in the task JSON.
|
- **Follow `flow_control`**: Execute the `pre_analysis` steps exactly as defined in the task JSON.
|
||||||
- **Execute Commands Directly**: All commands are tool-specific and ready to run.
|
- **Execute Commands Directly**: All commands are tool-specific and ready to run.
|
||||||
- **Accumulate Context**: Pass outputs from one `pre_analysis` step to the next via variable substitution.
|
- **Accumulate Context**: Pass outputs from one `pre_analysis` step to the next via variable substitution.
|
||||||
|
- **Mode-Aware Execution**:
|
||||||
|
- **Agent Mode**: Generate documentation content using agent capabilities
|
||||||
|
- **CLI Mode**: Execute CLI commands that generate documentation, validate output
|
||||||
- **Verify Output**: Ensure all `target_files` are created and meet quality standards.
|
- **Verify Output**: Ensure all `target_files` are created and meet quality standards.
|
||||||
- **Update Progress**: Use `TodoWrite` to track each step of the execution.
|
- **Update Progress**: Use `TodoWrite` to track each step of the execution.
|
||||||
- **Generate a Summary**: Create a detailed summary upon task completion.
|
- **Generate a Summary**: Create a detailed summary upon task completion.
|
||||||
@@ -151,4 +326,5 @@ Before completing the task, you must verify the following:
|
|||||||
- **Make Planning Decisions**: Do not deviate from the instructions in the task JSON.
|
- **Make Planning Decisions**: Do not deviate from the instructions in the task JSON.
|
||||||
- **Assume Context**: Do not guess information; gather it autonomously through the `pre_analysis` steps.
|
- **Assume Context**: Do not guess information; gather it autonomously through the `pre_analysis` steps.
|
||||||
- **Generate Code**: Your role is to document, not to implement.
|
- **Generate Code**: Your role is to document, not to implement.
|
||||||
- **Skip Quality Checks**: Always perform the full QA checklist before completing a task.
|
- **Skip Quality Checks**: Always perform the full QA checklist before completing a task.
|
||||||
|
- **Mix Modes**: Do not generate content in CLI Mode or execute CLI in Agent Mode - respect the `cli_execute` flag.
|
||||||
File diff suppressed because it is too large
Load Diff
132
.claude/commands/memory/load-skill-memory.md
Normal file
132
.claude/commands/memory/load-skill-memory.md
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
---
|
||||||
|
name: load-skill-memory
|
||||||
|
description: Manually activate specified SKILL package and load documentation based on task intent
|
||||||
|
argument-hint: "<skill_name> \"task intent description\""
|
||||||
|
allowed-tools: Bash(*), Read(*), Skill(*)
|
||||||
|
---
|
||||||
|
|
||||||
|
# Memory Load SKILL Command (/memory:load-skill-memory)
|
||||||
|
|
||||||
|
## 1. Overview
|
||||||
|
|
||||||
|
The `memory:load-skill-memory` command **manually activates a specified SKILL package** and intelligently loads documentation based on user's task intent. The system automatically determines which documentation files to read based on the intent description.
|
||||||
|
|
||||||
|
**Core Philosophy**:
|
||||||
|
- **Manual Activation**: User explicitly specifies which SKILL to activate
|
||||||
|
- **Intent-Driven Loading**: System analyzes task intent to determine documentation scope
|
||||||
|
- **Intelligent Selection**: Automatically chooses appropriate documentation level and modules
|
||||||
|
- **Direct Context Loading**: Loads selected documentation into conversation memory
|
||||||
|
|
||||||
|
**When to Use**:
|
||||||
|
- Manually activate a known SKILL package for a specific task
|
||||||
|
- Load SKILL context when system hasn't auto-triggered it
|
||||||
|
- Force reload SKILL documentation with specific intent focus
|
||||||
|
|
||||||
|
**Note**: Normal SKILL activation happens automatically via description triggers. Use this command only when manual activation is needed.
|
||||||
|
|
||||||
|
## 2. Parameters
|
||||||
|
|
||||||
|
- `<skill_name>` (Required): Name of SKILL package to activate
|
||||||
|
- Example: `hydro_generator_module`, `Claude_dms3`
|
||||||
|
- Must match directory name under `.claude/skills/`
|
||||||
|
|
||||||
|
- `"task intent description"` (Required): Description of what you want to do
|
||||||
|
- **Analysis tasks**: "分析builder pattern实现", "理解参数系统架构"
|
||||||
|
- **Modification tasks**: "修改workflow逻辑", "增强thermal template功能"
|
||||||
|
- **Learning tasks**: "学习接口设计模式", "了解测试框架使用"
|
||||||
|
|
||||||
|
## 3. Execution Flow
|
||||||
|
|
||||||
|
### Step 1: Activate SKILL and Analyze Intent
|
||||||
|
|
||||||
|
**Activate SKILL Package**:
|
||||||
|
```javascript
|
||||||
|
Skill(command: "${skill_name}")
|
||||||
|
```
|
||||||
|
|
||||||
|
**What Happens After Activation**:
|
||||||
|
1. If SKILL exists in memory: System reads `.claude/skills/${skill_name}/SKILL.md`
|
||||||
|
2. If SKILL not found in memory: Error - SKILL package doesn't exist
|
||||||
|
3. SKILL description triggers are loaded into memory
|
||||||
|
4. Progressive loading mechanism becomes available
|
||||||
|
5. Documentation structure is now accessible
|
||||||
|
|
||||||
|
**Intent Analysis**:
|
||||||
|
Based on task intent description, system determines:
|
||||||
|
- **Action type**: analyzing, modifying, learning
|
||||||
|
- **Scope**: specific module, architecture overview, complete system
|
||||||
|
- **Depth**: quick reference, detailed API, full documentation
|
||||||
|
|
||||||
|
### Step 2: Intelligent Documentation Loading
|
||||||
|
|
||||||
|
**Loading Strategy**:
|
||||||
|
|
||||||
|
The system automatically selects documentation based on intent keywords:
|
||||||
|
|
||||||
|
1. **Quick Understanding** ("了解", "快速理解", "什么是"):
|
||||||
|
- Load: Level 0 (README.md only, ~2K tokens)
|
||||||
|
- Use case: Quick overview of capabilities
|
||||||
|
|
||||||
|
2. **Specific Module Analysis** ("分析XXX模块", "理解XXX实现"):
|
||||||
|
- Load: Module-specific README.md + API.md (~5K tokens)
|
||||||
|
- Use case: Deep dive into specific component
|
||||||
|
|
||||||
|
3. **Architecture Review** ("架构", "设计模式", "整体结构"):
|
||||||
|
- Load: README.md + ARCHITECTURE.md (~10K tokens)
|
||||||
|
- Use case: System design understanding
|
||||||
|
|
||||||
|
4. **Implementation/Modification** ("修改", "增强", "实现"):
|
||||||
|
- Load: Relevant module docs + EXAMPLES.md (~15K tokens)
|
||||||
|
- Use case: Code modification with examples
|
||||||
|
|
||||||
|
5. **Comprehensive Learning** ("学习", "完整了解", "深入理解"):
|
||||||
|
- Load: Level 3 (All documentation, ~40K tokens)
|
||||||
|
- Use case: Complete system mastery
|
||||||
|
|
||||||
|
**Documentation Loaded into Memory**:
|
||||||
|
After loading, the selected documentation content is available in conversation memory for subsequent operations.
|
||||||
|
|
||||||
|
## 4. Usage Example
|
||||||
|
|
||||||
|
**User Command**:
|
||||||
|
```bash
|
||||||
|
/memory:load-skill-memory my_project "修改认证模块增加OAuth支持"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Execution**:
|
||||||
|
```javascript
|
||||||
|
// Step 1: Activate SKILL
|
||||||
|
Skill(command: "my_project")
|
||||||
|
|
||||||
|
// Intent Analysis
|
||||||
|
Keywords: ["修改", "认证模块", "增加", "OAuth"]
|
||||||
|
Action: modifying (implementation)
|
||||||
|
Scope: auth module + examples
|
||||||
|
|
||||||
|
// Step 2: Load documentation based on intent
|
||||||
|
Read(.workflow/docs/my_project/auth/README.md)
|
||||||
|
Read(.workflow/docs/my_project/auth/API.md)
|
||||||
|
Read(.workflow/docs/my_project/EXAMPLES.md)
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. Intent Keyword Mapping
|
||||||
|
|
||||||
|
**Quick Reference**:
|
||||||
|
- **Triggers**: "了解", "快速", "什么是", "简介"
|
||||||
|
- **Loads**: README.md only (~2K)
|
||||||
|
|
||||||
|
**Module-Specific**:
|
||||||
|
- **Triggers**: "XXX模块", "XXX组件", "分析XXX"
|
||||||
|
- **Loads**: Module README + API (~5K)
|
||||||
|
|
||||||
|
**Architecture**:
|
||||||
|
- **Triggers**: "架构", "设计", "整体结构", "系统设计"
|
||||||
|
- **Loads**: README + ARCHITECTURE (~10K)
|
||||||
|
|
||||||
|
**Implementation**:
|
||||||
|
- **Triggers**: "修改", "增强", "实现", "开发", "集成"
|
||||||
|
- **Loads**: Relevant module + EXAMPLES (~15K)
|
||||||
|
|
||||||
|
**Comprehensive**:
|
||||||
|
- **Triggers**: "完整", "深入", "全面", "学习整个"
|
||||||
|
- **Loads**: All documentation (~40K)
|
||||||
553
.claude/commands/memory/skill-memory.md
Normal file
553
.claude/commands/memory/skill-memory.md
Normal file
@@ -0,0 +1,553 @@
|
|||||||
|
---
|
||||||
|
name: skill-memory
|
||||||
|
description: Generate SKILL package index from project documentation
|
||||||
|
argument-hint: "[path] [--tool <gemini|qwen|codex>] [--regenerate] [--mode <full|partial>] [--cli-execute]"
|
||||||
|
allowed-tools: SlashCommand(*), TodoWrite(*), Bash(*), Read(*), Write(*)
|
||||||
|
---
|
||||||
|
|
||||||
|
# Memory SKILL Package Generator
|
||||||
|
|
||||||
|
## Orchestrator Role
|
||||||
|
|
||||||
|
**This command is a pure orchestrator**: Execute documentation generation workflow, then generate SKILL.md index. Does NOT create task JSON files.
|
||||||
|
|
||||||
|
**Execution Model - Auto-Continue Workflow**:
|
||||||
|
|
||||||
|
This workflow runs **fully autonomously** once triggered. Each phase completes and automatically triggers the next phase.
|
||||||
|
|
||||||
|
1. **User triggers**: `/memory:skill-memory [path] [options]`
|
||||||
|
2. **Phase 1 executes** → Parse arguments and prepare → Auto-continues
|
||||||
|
3. **Phase 2 executes** → Call `/memory:docs` to plan documentation → Auto-continues
|
||||||
|
4. **Phase 3 executes** → Call `/workflow:execute` to generate docs → Auto-continues
|
||||||
|
5. **Phase 4 executes** → Generate SKILL.md index → Reports completion
|
||||||
|
|
||||||
|
**Auto-Continue Mechanism**:
|
||||||
|
- TodoList tracks current phase status (in_progress/completed)
|
||||||
|
- After each phase completion, check TodoList and automatically execute next pending phase
|
||||||
|
- All phases run autonomously without user interaction
|
||||||
|
- Progress updates shown at each phase for visibility
|
||||||
|
- Each phase MUST update TodoWrite before triggering next phase
|
||||||
|
|
||||||
|
## Core Rules
|
||||||
|
|
||||||
|
1. **Start Immediately**: First action is TodoWrite initialization, second action is Phase 1 execution
|
||||||
|
2. **No Task JSON**: This command does not create task JSON files - delegates to /memory:docs
|
||||||
|
3. **Parse Every Output**: Extract required data from each command output (session_id, task_count, file paths)
|
||||||
|
4. **Auto-Continue via TodoList**: After completing each phase:
|
||||||
|
- Update TodoWrite to mark current phase completed
|
||||||
|
- Mark next phase as in_progress
|
||||||
|
- Immediately execute next phase (no waiting for user input)
|
||||||
|
- Check TodoList to identify next pending phase automatically
|
||||||
|
5. **Track Progress**: Update TodoWrite after EVERY phase completion before starting next phase
|
||||||
|
6. **Direct Generation**: Phase 4 directly generates SKILL.md using Write tool
|
||||||
|
7. **No Manual Steps**: User should never be prompted for decisions between phases - fully autonomous execution
|
||||||
|
|
||||||
|
## 4-Phase Execution
|
||||||
|
|
||||||
|
### Phase 1: Prepare Arguments
|
||||||
|
|
||||||
|
**Goal**: Parse command arguments and check existing documentation
|
||||||
|
|
||||||
|
**Step 1: Get Target Path and Project Name**
|
||||||
|
```bash
|
||||||
|
# Get current directory (or use provided path)
|
||||||
|
bash(pwd)
|
||||||
|
|
||||||
|
# Get project name from directory
|
||||||
|
bash(basename "$(pwd)")
|
||||||
|
|
||||||
|
# Get project root
|
||||||
|
bash(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Output**:
|
||||||
|
- `target_path`: `/d/my_project`
|
||||||
|
- `project_name`: `my_project`
|
||||||
|
- `project_root`: `/d/my_project`
|
||||||
|
|
||||||
|
**Step 2: Set Default Parameters**
|
||||||
|
```bash
|
||||||
|
# Default values (use these unless user specifies otherwise):
|
||||||
|
# - tool: "gemini"
|
||||||
|
# - mode: "full"
|
||||||
|
# - regenerate: false (no --regenerate flag)
|
||||||
|
# - cli_execute: false (no --cli-execute flag)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Step 3: Check Existing Documentation**
|
||||||
|
```bash
|
||||||
|
# Check if docs directory exists (replace project_name with actual value)
|
||||||
|
bash(test -d .workflow/docs/my_project && echo "exists" || echo "not_exists")
|
||||||
|
|
||||||
|
# Count existing documentation files
|
||||||
|
bash(find .workflow/docs/my_project -name "*.md" 2>/dev/null | wc -l || echo 0)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Output**:
|
||||||
|
- `docs_exists`: `exists` or `not_exists`
|
||||||
|
- `existing_docs`: `5` (or `0` if no docs)
|
||||||
|
|
||||||
|
**Step 4: Determine Execution Path**
|
||||||
|
|
||||||
|
**Decision Logic**:
|
||||||
|
```javascript
|
||||||
|
if (existing_docs > 0 && !regenerate_flag) {
|
||||||
|
// Documentation exists and no regenerate flag
|
||||||
|
SKIP_DOCS_GENERATION = true
|
||||||
|
message = "Documentation already exists, skipping Phase 2 and Phase 3. Use --regenerate to force regeneration."
|
||||||
|
} else if (regenerate_flag) {
|
||||||
|
// Force regeneration: delete existing docs
|
||||||
|
bash(rm -rf .workflow/docs/my_project 2>/dev/null || true)
|
||||||
|
SKIP_DOCS_GENERATION = false
|
||||||
|
message = "Regenerating documentation from scratch."
|
||||||
|
} else {
|
||||||
|
// No existing docs
|
||||||
|
SKIP_DOCS_GENERATION = false
|
||||||
|
message = "No existing documentation found, generating new documentation."
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
**Summary**:
|
||||||
|
- `PROJECT_NAME`: `my_project`
|
||||||
|
- `TARGET_PATH`: `/d/my_project`
|
||||||
|
- `DOCS_PATH`: `.workflow/docs/my_project`
|
||||||
|
- `TOOL`: `gemini` (default) or user-specified
|
||||||
|
- `MODE`: `full` (default) or user-specified
|
||||||
|
- `CLI_EXECUTE`: `false` (default) or `true` if --cli-execute flag
|
||||||
|
- `REGENERATE`: `false` (default) or `true` if --regenerate flag
|
||||||
|
- `EXISTING_DOCS`: Count of existing documentation files
|
||||||
|
- `SKIP_DOCS_GENERATION`: `true` if skipping Phase 2/3, `false` otherwise
|
||||||
|
|
||||||
|
**Completion Criteria**:
|
||||||
|
- All parameters extracted and validated
|
||||||
|
- Project name and paths confirmed
|
||||||
|
- Existing docs count retrieved
|
||||||
|
- Skip decision determined (SKIP_DOCS_GENERATION)
|
||||||
|
- Default values set for unspecified parameters
|
||||||
|
|
||||||
|
**TodoWrite**:
|
||||||
|
- If `SKIP_DOCS_GENERATION = true`: Mark phase 1 completed, phase 4 in_progress (skip phase 2 and 3)
|
||||||
|
- If `SKIP_DOCS_GENERATION = false`: Mark phase 1 completed, phase 2 in_progress
|
||||||
|
|
||||||
|
**After Phase 1**:
|
||||||
|
- If skipping: Display skip message → **Jump to Phase 4** (SKILL.md generation)
|
||||||
|
- If not skipping: Display preparation results → **Continue to Phase 2** (documentation planning)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 2: Call /memory:docs
|
||||||
|
|
||||||
|
**Note**: This phase is **skipped if SKIP_DOCS_GENERATION = true** (documentation already exists without --regenerate flag)
|
||||||
|
|
||||||
|
**Goal**: Trigger documentation generation workflow
|
||||||
|
|
||||||
|
**Command**:
|
||||||
|
```bash
|
||||||
|
SlashCommand(command="/memory:docs [targetPath] --tool [tool] --mode [mode] [--cli-execute]")
|
||||||
|
```
|
||||||
|
|
||||||
|
**Example**:
|
||||||
|
```bash
|
||||||
|
/memory:docs /d/my_app --tool gemini --mode full
|
||||||
|
/memory:docs /d/my_app --tool gemini --mode full --cli-execute
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note**: The `--regenerate` flag is handled in Phase 1 by deleting existing documentation. This command always calls `/memory:docs` without the regenerate flag, relying on docs.md's built-in update detection.
|
||||||
|
|
||||||
|
**Input**:
|
||||||
|
- `targetPath` from Phase 1
|
||||||
|
- `tool` from Phase 1
|
||||||
|
- `mode` from Phase 1
|
||||||
|
- `cli_execute` from Phase 1 (optional)
|
||||||
|
|
||||||
|
**Parse Output**:
|
||||||
|
- Extract session ID pattern: `WFS-docs-[timestamp]` (store as `docsSessionId`)
|
||||||
|
- Extract task count (store as `taskCount`)
|
||||||
|
|
||||||
|
**Completion Criteria**:
|
||||||
|
- `/memory:docs` command executed successfully
|
||||||
|
- Session ID extracted: `WFS-docs-[timestamp]`
|
||||||
|
- Task count retrieved from output
|
||||||
|
- Task files created in `.workflow/[docsSessionId]/.task/`
|
||||||
|
- workflow-session.json exists in session directory
|
||||||
|
|
||||||
|
**TodoWrite**: Mark phase 2 completed, phase 3 in_progress
|
||||||
|
|
||||||
|
**After Phase 2**: Display docs planning results (session ID, task count) → **Automatically continue to Phase 3** (no user input required)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 3: Execute Documentation Generation
|
||||||
|
|
||||||
|
**Note**: This phase is **skipped if SKIP_DOCS_GENERATION = true** (documentation already exists without --regenerate flag)
|
||||||
|
|
||||||
|
**Goal**: Execute documentation generation tasks
|
||||||
|
|
||||||
|
**Command**:
|
||||||
|
```bash
|
||||||
|
SlashCommand(command="/workflow:execute")
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note**: `/workflow:execute` automatically discovers active session from Phase 2
|
||||||
|
|
||||||
|
**Completion Criteria**:
|
||||||
|
- `/workflow:execute` command executed successfully
|
||||||
|
- Documentation files generated in `.workflow/docs/[projectName]/`
|
||||||
|
- All tasks marked as completed in session
|
||||||
|
- At minimum, module documentation files exist (API.md and/or README.md)
|
||||||
|
- For full mode: Project README, ARCHITECTURE, EXAMPLES files generated
|
||||||
|
|
||||||
|
**TodoWrite**: Mark phase 3 completed, phase 4 in_progress
|
||||||
|
|
||||||
|
**After Phase 3**: Display execution results (file count, module count) → **Automatically continue to Phase 4** (no user input required)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Phase 4: Generate SKILL.md Index
|
||||||
|
|
||||||
|
**Step 1: Read Key Files** (Use Read tool)
|
||||||
|
- `.workflow/docs/{project_name}/README.md` (required)
|
||||||
|
- `.workflow/docs/{project_name}/ARCHITECTURE.md` (optional)
|
||||||
|
|
||||||
|
**Step 2: Discover Structure**
|
||||||
|
```bash
|
||||||
|
bash(find .workflow/docs/{project_name} -name "*.md" | sed 's|.workflow/docs/{project_name}/||' | awk -F'/' '{if(NF>=2) print $1"/"$2}' | sort -u)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Step 3: Generate Intelligent Description**
|
||||||
|
|
||||||
|
Extract from README + structure: Function (capabilities), Modules (names), Keywords (API/CLI/auth/etc.)
|
||||||
|
|
||||||
|
**Format**: `{Project} {core capabilities} (located at {project_path}). Load this SKILL when analyzing, modifying, or learning about {domain_description} or files under this path, especially when no relevant context exists in memory.`
|
||||||
|
|
||||||
|
**Path Reference**: Use `TARGET_PATH` from Phase 1 for precise location identification.
|
||||||
|
|
||||||
|
**Domain Description**: Extract human-readable domain/feature area from README (e.g., "workflow management", "thermal modeling"), NOT the technical project_name.
|
||||||
|
|
||||||
|
**Trigger Optimization**:
|
||||||
|
- Include project path to improve triggering when users mention specific directories or file locations
|
||||||
|
- Emphasize "especially when no relevant context exists in memory" to prioritize SKILL as primary context source
|
||||||
|
- Cover three key actions: analyzing (分析), modifying (修改), learning (了解)
|
||||||
|
|
||||||
|
**Example**: "Workflow orchestration system with CLI tools and documentation generation (located at /d/Claude_dms3). Load this SKILL when analyzing, modifying, or learning about workflow management or files under this path, especially when no relevant context exists in memory."
|
||||||
|
|
||||||
|
**Step 4: Write SKILL.md** (Use Write tool)
|
||||||
|
```bash
|
||||||
|
bash(mkdir -p .claude/skills/{project_name})
|
||||||
|
```
|
||||||
|
|
||||||
|
`.claude/skills/{project_name}/SKILL.md`:
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
name: {project_name}
|
||||||
|
description: {intelligent description from Step 3}
|
||||||
|
version: 1.0.0
|
||||||
|
---
|
||||||
|
# {Project Name} SKILL Package
|
||||||
|
|
||||||
|
## Documentation: `../../../.workflow/docs/{project_name}/`
|
||||||
|
|
||||||
|
## Progressive Loading
|
||||||
|
### Level 0: Quick Start (~2K)
|
||||||
|
- [README](../../../.workflow/docs/{project_name}/README.md)
|
||||||
|
### Level 1: Core Modules (~8K)
|
||||||
|
{Module READMEs}
|
||||||
|
### Level 2: Complete (~25K)
|
||||||
|
All modules + [Architecture](../../../.workflow/docs/{project_name}/ARCHITECTURE.md)
|
||||||
|
### Level 3: Deep Dive (~40K)
|
||||||
|
Everything + [Examples](../../../.workflow/docs/{project_name}/EXAMPLES.md)
|
||||||
|
```
|
||||||
|
|
||||||
|
**Completion Criteria**:
|
||||||
|
- SKILL.md file created at `.claude/skills/{project_name}/SKILL.md`
|
||||||
|
- Intelligent description generated from documentation
|
||||||
|
- Progressive loading levels (0-3) properly structured
|
||||||
|
- Module index includes all documented modules
|
||||||
|
- All file references use relative paths
|
||||||
|
|
||||||
|
**TodoWrite**: Mark phase 4 completed
|
||||||
|
|
||||||
|
**After Phase 4**: Workflow complete → **Report final summary to user**
|
||||||
|
|
||||||
|
**Return to User**:
|
||||||
|
```
|
||||||
|
✅ SKILL Package Generation Complete
|
||||||
|
|
||||||
|
Project: {project_name}
|
||||||
|
Documentation: .workflow/docs/{project_name}/ ({doc_count} files)
|
||||||
|
SKILL Index: .claude/skills/{project_name}/SKILL.md
|
||||||
|
|
||||||
|
Generated:
|
||||||
|
- {task_count} documentation tasks completed
|
||||||
|
- SKILL.md with progressive loading (4 levels)
|
||||||
|
- Module index with {module_count} modules
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
- Load Level 0: Quick project overview (~2K tokens)
|
||||||
|
- Load Level 1: Core modules (~8K tokens)
|
||||||
|
- Load Level 2: Complete docs (~25K tokens)
|
||||||
|
- Load Level 3: Everything (~40K tokens)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## TodoWrite Pattern
|
||||||
|
|
||||||
|
**Auto-Continue Logic**: After updating TodoWrite at end of each phase, immediately check for next pending task and execute it.
|
||||||
|
|
||||||
|
**Two Execution Paths**:
|
||||||
|
1. **Full Path**: All 4 phases (no existing docs or --regenerate specified)
|
||||||
|
2. **Skip Path**: Phase 1 → Phase 4 (existing docs found, no --regenerate)
|
||||||
|
|
||||||
|
### Full Path (SKIP_DOCS_GENERATION = false)
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Initialize (before Phase 1)
|
||||||
|
// FIRST ACTION: Create TodoList with all 4 phases
|
||||||
|
TodoWrite({todos: [
|
||||||
|
{"content": "Parse arguments and prepare", "status": "in_progress", "activeForm": "Parsing arguments"},
|
||||||
|
{"content": "Call /memory:docs to plan documentation", "status": "pending", "activeForm": "Calling /memory:docs"},
|
||||||
|
{"content": "Execute documentation generation", "status": "pending", "activeForm": "Executing documentation"},
|
||||||
|
{"content": "Generate SKILL.md index", "status": "pending", "activeForm": "Generating SKILL.md"}
|
||||||
|
]})
|
||||||
|
// SECOND ACTION: Execute Phase 1 immediately
|
||||||
|
|
||||||
|
// After Phase 1 completes (SKIP_DOCS_GENERATION = false)
|
||||||
|
// Update TodoWrite: Mark Phase 1 completed, Phase 2 in_progress
|
||||||
|
TodoWrite({todos: [
|
||||||
|
{"content": "Parse arguments and prepare", "status": "completed", "activeForm": "Parsing arguments"},
|
||||||
|
{"content": "Call /memory:docs to plan documentation", "status": "in_progress", "activeForm": "Calling /memory:docs"},
|
||||||
|
{"content": "Execute documentation generation", "status": "pending", "activeForm": "Executing documentation"},
|
||||||
|
{"content": "Generate SKILL.md index", "status": "pending", "activeForm": "Generating SKILL.md"}
|
||||||
|
]})
|
||||||
|
// NEXT ACTION: Auto-continue to Phase 2 (execute /memory:docs command)
|
||||||
|
|
||||||
|
// After Phase 2 completes
|
||||||
|
// Update TodoWrite: Mark Phase 2 completed, Phase 3 in_progress
|
||||||
|
TodoWrite({todos: [
|
||||||
|
{"content": "Parse arguments and prepare", "status": "completed", "activeForm": "Parsing arguments"},
|
||||||
|
{"content": "Call /memory:docs to plan documentation", "status": "completed", "activeForm": "Calling /memory:docs"},
|
||||||
|
{"content": "Execute documentation generation", "status": "in_progress", "activeForm": "Executing documentation"},
|
||||||
|
{"content": "Generate SKILL.md index", "status": "pending", "activeForm": "Generating SKILL.md"}
|
||||||
|
]})
|
||||||
|
// NEXT ACTION: Auto-continue to Phase 3 (execute /workflow:execute command)
|
||||||
|
|
||||||
|
// After Phase 3 completes
|
||||||
|
// Update TodoWrite: Mark Phase 3 completed, Phase 4 in_progress
|
||||||
|
TodoWrite({todos: [
|
||||||
|
{"content": "Parse arguments and prepare", "status": "completed", "activeForm": "Parsing arguments"},
|
||||||
|
{"content": "Call /memory:docs to plan documentation", "status": "completed", "activeForm": "Calling /memory:docs"},
|
||||||
|
{"content": "Execute documentation generation", "status": "completed", "activeForm": "Executing documentation"},
|
||||||
|
{"content": "Generate SKILL.md index", "status": "in_progress", "activeForm": "Generating SKILL.md"}
|
||||||
|
]})
|
||||||
|
// NEXT ACTION: Auto-continue to Phase 4 (generate SKILL.md)
|
||||||
|
|
||||||
|
// After Phase 4 completes
|
||||||
|
// Update TodoWrite: Mark Phase 4 completed
|
||||||
|
TodoWrite({todos: [
|
||||||
|
{"content": "Parse arguments and prepare", "status": "completed", "activeForm": "Parsing arguments"},
|
||||||
|
{"content": "Call /memory:docs to plan documentation", "status": "completed", "activeForm": "Calling /memory:docs"},
|
||||||
|
{"content": "Execute documentation generation", "status": "completed", "activeForm": "Executing documentation"},
|
||||||
|
{"content": "Generate SKILL.md index", "status": "completed", "activeForm": "Generating SKILL.md"}
|
||||||
|
]})
|
||||||
|
// FINAL ACTION: Report completion summary to user
|
||||||
|
```
|
||||||
|
|
||||||
|
### Skip Path (SKIP_DOCS_GENERATION = true)
|
||||||
|
|
||||||
|
**Note**: Phase 4 (SKILL.md generation) is **NEVER skipped** - it always runs to generate or update the SKILL index.
|
||||||
|
|
||||||
|
```javascript
|
||||||
|
// Initialize (before Phase 1)
|
||||||
|
// FIRST ACTION: Create TodoList with all 4 phases (same as Full Path)
|
||||||
|
TodoWrite({todos: [
|
||||||
|
{"content": "Parse arguments and prepare", "status": "in_progress", "activeForm": "Parsing arguments"},
|
||||||
|
{"content": "Call /memory:docs to plan documentation", "status": "pending", "activeForm": "Calling /memory:docs"},
|
||||||
|
{"content": "Execute documentation generation", "status": "pending", "activeForm": "Executing documentation"},
|
||||||
|
{"content": "Generate SKILL.md index", "status": "pending", "activeForm": "Generating SKILL.md"}
|
||||||
|
]})
|
||||||
|
// SECOND ACTION: Execute Phase 1 immediately
|
||||||
|
|
||||||
|
// After Phase 1 completes (SKIP_DOCS_GENERATION = true)
|
||||||
|
// Update TodoWrite: Mark Phase 1 completed, Phase 2&3 skipped, Phase 4 in_progress
|
||||||
|
TodoWrite({todos: [
|
||||||
|
{"content": "Parse arguments and prepare", "status": "completed", "activeForm": "Parsing arguments"},
|
||||||
|
{"content": "Call /memory:docs to plan documentation", "status": "completed", "activeForm": "Calling /memory:docs"},
|
||||||
|
{"content": "Execute documentation generation", "status": "completed", "activeForm": "Executing documentation"},
|
||||||
|
{"content": "Generate SKILL.md index", "status": "in_progress", "activeForm": "Generating SKILL.md"}
|
||||||
|
]})
|
||||||
|
// Display skip message: "Documentation already exists, skipping Phase 2 and Phase 3. Use --regenerate to force regeneration."
|
||||||
|
// NEXT ACTION: Jump directly to Phase 4 (generate SKILL.md)
|
||||||
|
|
||||||
|
// After Phase 4 completes
|
||||||
|
// Update TodoWrite: Mark Phase 4 completed
|
||||||
|
TodoWrite({todos: [
|
||||||
|
{"content": "Parse arguments and prepare", "status": "completed", "activeForm": "Parsing arguments"},
|
||||||
|
{"content": "Call /memory:docs to plan documentation", "status": "completed", "activeForm": "Calling /memory:docs"},
|
||||||
|
{"content": "Execute documentation generation", "status": "completed", "activeForm": "Executing documentation"},
|
||||||
|
{"content": "Generate SKILL.md index", "status": "completed", "activeForm": "Generating SKILL.md"}
|
||||||
|
]})
|
||||||
|
// FINAL ACTION: Report completion summary to user
|
||||||
|
```
|
||||||
|
|
||||||
|
## Auto-Continue Execution Flow
|
||||||
|
|
||||||
|
**Critical Implementation Rules**:
|
||||||
|
|
||||||
|
1. **No User Prompts Between Phases**: Never ask user questions or wait for input between phases
|
||||||
|
2. **Immediate Phase Transition**: After TodoWrite update, immediately execute next phase command
|
||||||
|
3. **Status-Driven Execution**: Check TodoList status after each phase:
|
||||||
|
- If next task is "pending" → Mark it "in_progress" and execute
|
||||||
|
- If all tasks are "completed" → Report final summary
|
||||||
|
4. **Phase Completion Pattern**:
|
||||||
|
```
|
||||||
|
Phase N completes → Update TodoWrite (N=completed, N+1=in_progress) → Execute Phase N+1
|
||||||
|
```
|
||||||
|
|
||||||
|
**Execution Sequence**:
|
||||||
|
|
||||||
|
**Full Path** (no existing docs OR --regenerate specified):
|
||||||
|
```
|
||||||
|
User triggers command
|
||||||
|
↓
|
||||||
|
[TodoWrite] Initialize 4 phases (Phase 1 = in_progress)
|
||||||
|
↓
|
||||||
|
[Execute] Phase 1: Parse arguments
|
||||||
|
↓
|
||||||
|
[TodoWrite] Phase 1 = completed, Phase 2 = in_progress
|
||||||
|
↓
|
||||||
|
[Execute] Phase 2: Call /memory:docs
|
||||||
|
↓
|
||||||
|
[TodoWrite] Phase 2 = completed, Phase 3 = in_progress
|
||||||
|
↓
|
||||||
|
[Execute] Phase 3: Call /workflow:execute
|
||||||
|
↓
|
||||||
|
[TodoWrite] Phase 3 = completed, Phase 4 = in_progress
|
||||||
|
↓
|
||||||
|
[Execute] Phase 4: Generate SKILL.md
|
||||||
|
↓
|
||||||
|
[TodoWrite] Phase 4 = completed
|
||||||
|
↓
|
||||||
|
[Report] Display completion summary
|
||||||
|
```
|
||||||
|
|
||||||
|
**Skip Path** (existing docs found AND no --regenerate flag):
|
||||||
|
```
|
||||||
|
User triggers command
|
||||||
|
↓
|
||||||
|
[TodoWrite] Initialize 4 phases (Phase 1 = in_progress)
|
||||||
|
↓
|
||||||
|
[Execute] Phase 1: Parse arguments, detect existing docs
|
||||||
|
↓
|
||||||
|
[TodoWrite] Phase 1 = completed, Phase 2&3 = completed (skipped), Phase 4 = in_progress
|
||||||
|
↓
|
||||||
|
[Display] Skip message: "Documentation already exists, skipping Phase 2 and Phase 3"
|
||||||
|
↓
|
||||||
|
[Execute] Phase 4: Generate SKILL.md (always runs)
|
||||||
|
↓
|
||||||
|
[TodoWrite] Phase 4 = completed
|
||||||
|
↓
|
||||||
|
[Report] Display completion summary
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note**: Phase 4 (SKILL.md generation) is **NEVER skipped** - it always executes to generate or update the index file.
|
||||||
|
|
||||||
|
**Error Handling**:
|
||||||
|
- If any phase fails, mark it as "in_progress" (not completed)
|
||||||
|
- Report error details to user
|
||||||
|
- Do NOT auto-continue to next phase on failure
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/memory:skill-memory [path] [--tool <gemini|qwen|codex>] [--regenerate] [--mode <full|partial>] [--cli-execute]
|
||||||
|
```
|
||||||
|
|
||||||
|
- **path**: Target directory (default: current directory)
|
||||||
|
- **--tool**: CLI tool for documentation (default: gemini)
|
||||||
|
- `gemini`: Comprehensive documentation
|
||||||
|
- `qwen`: Architecture analysis
|
||||||
|
- `codex`: Implementation validation
|
||||||
|
- **--regenerate**: Force regenerate all documentation
|
||||||
|
- When enabled: Deletes existing `.workflow/docs/{project_name}/` before regeneration
|
||||||
|
- Ensures fresh documentation from source code
|
||||||
|
- **--mode**: Documentation mode (default: full)
|
||||||
|
- `full`: Complete docs (modules + README + ARCHITECTURE + EXAMPLES)
|
||||||
|
- `partial`: Module docs only
|
||||||
|
- **--cli-execute**: Enable CLI-based documentation generation (optional)
|
||||||
|
- When enabled: CLI generates docs directly in implementation_approach
|
||||||
|
- When disabled (default): Agent generates documentation content
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
### Example 1: Generate SKILL Package (Default)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/memory:skill-memory
|
||||||
|
```
|
||||||
|
|
||||||
|
**Workflow**:
|
||||||
|
1. Phase 1: Detects current directory, checks existing docs
|
||||||
|
2. Phase 2: Calls `/memory:docs . --tool gemini --mode full` (Agent Mode)
|
||||||
|
3. Phase 3: Executes documentation generation via `/workflow:execute`
|
||||||
|
4. Phase 4: Generates SKILL.md at `.claude/skills/{project_name}/SKILL.md`
|
||||||
|
|
||||||
|
### Example 2: Regenerate with Qwen
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/memory:skill-memory /d/my_app --tool qwen --regenerate
|
||||||
|
```
|
||||||
|
|
||||||
|
**Workflow**:
|
||||||
|
1. Phase 1: Parses target path, detects regenerate flag, deletes existing docs
|
||||||
|
2. Phase 2: Calls `/memory:docs /d/my_app --tool qwen --mode full`
|
||||||
|
3. Phase 3: Executes documentation regeneration
|
||||||
|
4. Phase 4: Generates updated SKILL.md
|
||||||
|
|
||||||
|
### Example 3: Partial Mode (Modules Only)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/memory:skill-memory --mode partial
|
||||||
|
```
|
||||||
|
|
||||||
|
**Workflow**:
|
||||||
|
1. Phase 1: Detects partial mode
|
||||||
|
2. Phase 2: Calls `/memory:docs . --tool gemini --mode partial` (Agent Mode)
|
||||||
|
3. Phase 3: Executes module documentation only
|
||||||
|
4. Phase 4: Generates SKILL.md with module-only index
|
||||||
|
|
||||||
|
### Example 4: CLI Execute Mode
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/memory:skill-memory --cli-execute
|
||||||
|
```
|
||||||
|
|
||||||
|
**Workflow**:
|
||||||
|
1. Phase 1: Detects CLI execute mode
|
||||||
|
2. Phase 2: Calls `/memory:docs . --tool gemini --mode full --cli-execute` (CLI Mode)
|
||||||
|
3. Phase 3: Executes CLI-based documentation generation
|
||||||
|
4. Phase 4: Generates SKILL.md at `.claude/skills/{project_name}/SKILL.md`
|
||||||
|
|
||||||
|
## Benefits
|
||||||
|
|
||||||
|
- ✅ **Pure Orchestrator**: No task JSON generation, delegates to /memory:docs
|
||||||
|
- ✅ **Auto-Continue**: Autonomous 4-phase execution
|
||||||
|
- ✅ **Simplified**: ~70% less code than previous version
|
||||||
|
- ✅ **Maintainable**: Changes to /memory:docs automatically apply
|
||||||
|
- ✅ **Direct Generation**: Phase 4 directly writes SKILL.md
|
||||||
|
- ✅ **Flexible**: Supports all /memory:docs options
|
||||||
|
|
||||||
|
## Architecture
|
||||||
|
|
||||||
|
```
|
||||||
|
skill-memory (orchestrator)
|
||||||
|
├─ Phase 1: Prepare (bash commands)
|
||||||
|
├─ Phase 2: /memory:docs (task planning)
|
||||||
|
├─ Phase 3: /workflow:execute (task execution)
|
||||||
|
└─ Phase 4: Write SKILL.md (direct file generation)
|
||||||
|
|
||||||
|
No task JSON created by this command
|
||||||
|
All documentation tasks managed by /memory:docs
|
||||||
|
```
|
||||||
@@ -447,7 +447,7 @@ bash(codex -C directory --full-auto exec "task") # Complex implementation: 90-1
|
|||||||
|
|
||||||
#### Write Operation Protection
|
#### Write Operation Protection
|
||||||
|
|
||||||
**⚠️ WRITE PROTECTION**: Local codebase write/modify requires EXPLICIT user confirmation
|
**⚠️ CRITICAL: Single-Use Explicit Authorization**: Each CLI execution (Gemini/Qwen/Codex) requires explicit user command instruction - one command authorizes ONE execution only. Analysis does NOT authorize write operations. Previous authorization does NOT carry over to subsequent actions. Each operation needs NEW explicit user directive.
|
||||||
|
|
||||||
**Mode Hierarchy**:
|
**Mode Hierarchy**:
|
||||||
- **Analysis Mode (default)**: Read-only, safe for auto-execution
|
- **Analysis Mode (default)**: Read-only, safe for auto-execution
|
||||||
|
|||||||
2746
CHANGELOG.md
2746
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
11
README.md
11
README.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
[]()
|
[]()
|
||||||
|
|
||||||
@@ -14,12 +14,13 @@
|
|||||||
|
|
||||||
**Claude Code Workflow (CCW)** transforms AI development from simple prompt chaining into a robust, context-first orchestration system. It solves execution uncertainty and error accumulation through structured planning, deterministic execution, and intelligent multi-model orchestration.
|
**Claude Code Workflow (CCW)** transforms AI development from simple prompt chaining into a robust, context-first orchestration system. It solves execution uncertainty and error accumulation through structured planning, deterministic execution, and intelligent multi-model orchestration.
|
||||||
|
|
||||||
> **🎉 Version 5.0: Less is More**
|
> **🎉 Version 5.2: Memory Commands Enhancement**
|
||||||
>
|
>
|
||||||
> **Core Improvements**:
|
> **Core Improvements**:
|
||||||
> - ✅ **Removed External Dependencies** - Using standard ripgrep/find instead of MCP code-index for better stability
|
> - ✅ **Batch Processing** - Single Level 1 task handles all module trees (67% fewer tasks)
|
||||||
> - ✅ **Streamlined Workflows** - Enhanced TDD workflow with conflict resolution mechanism
|
> - ✅ **Dual Execution Modes** - Agent Mode and CLI Mode (--cli-execute) support
|
||||||
> - ✅ **Focused on Role Analysis** - Simplified planning architecture centered on role documents
|
> - ✅ **Pre-computed Analysis** - Unified analysis eliminates redundant CLI calls (67% reduction)
|
||||||
|
> - ✅ **Performance Boost** - 67% fewer file reads, 33% fewer total tasks
|
||||||
>
|
>
|
||||||
> See [CHANGELOG.md](CHANGELOG.md) for full details.
|
> See [CHANGELOG.md](CHANGELOG.md) for full details.
|
||||||
|
|
||||||
|
|||||||
11
README_CN.md
11
README_CN.md
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
[](https://github.com/catlog22/Claude-Code-Workflow/releases)
|
||||||
[](LICENSE)
|
[](LICENSE)
|
||||||
[]()
|
[]()
|
||||||
|
|
||||||
@@ -14,12 +14,13 @@
|
|||||||
|
|
||||||
**Claude Code Workflow (CCW)** 将 AI 开发从简单的提示词链接转变为一个强大的、上下文优先的编排系统。它通过结构化规划、确定性执行和智能多模型编排,解决了执行不确定性和误差累积的问题。
|
**Claude Code Workflow (CCW)** 将 AI 开发从简单的提示词链接转变为一个强大的、上下文优先的编排系统。它通过结构化规划、确定性执行和智能多模型编排,解决了执行不确定性和误差累积的问题。
|
||||||
|
|
||||||
> **🎉 版本 5.0: 少即是多**
|
> **🎉 版本 5.2: 内存命令增强**
|
||||||
>
|
>
|
||||||
> **核心改进**:
|
> **核心改进**:
|
||||||
> - ✅ **移除外部依赖** - 使用标准 ripgrep/find 替代 MCP code-index,提升稳定性
|
> - ✅ **批量处理** - 单个 Level 1 任务处理所有模块树(减少 67% 任务)
|
||||||
> - ✅ **简化工作流** - 优化 TDD 流程,引入冲突解决机制
|
> - ✅ **双执行模式** - 支持 Agent 模式和 CLI 模式(--cli-execute)
|
||||||
> - ✅ **专注角色分析** - 以角色文档为核心,简化规划架构
|
> - ✅ **预计算分析** - 统一分析消除冗余 CLI 调用(减少 67%)
|
||||||
|
> - ✅ **性能提升** - 文件读取减少 67%,总任务数减少 33%
|
||||||
>
|
>
|
||||||
> 详见 [CHANGELOG.md](CHANGELOG.md)。
|
> 详见 [CHANGELOG.md](CHANGELOG.md)。
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user