From e898ebc32291caa6a9d46b1a4c404a126f472c1a Mon Sep 17 00:00:00 2001 From: catlog22 Date: Wed, 5 Nov 2025 20:15:18 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0SKILL.md=E7=94=9F?= =?UTF-8?q?=E6=88=90=E6=8F=8F=E8=BF=B0=E5=92=8C=E5=8F=98=E9=87=8F=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E6=8C=87=E5=8D=97=EF=BC=8C=E5=A2=9E=E5=BC=BA=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E7=9A=84=E6=B8=85=E6=99=B0=E5=BA=A6=E5=92=8C=E5=87=86?= =?UTF-8?q?=E7=A1=AE=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../commands/memory/workflow-skill-memory.md | 35 +++++++ .../prompts/workflow/skill-aggregation.txt | 20 ++++ .../prompts/workflow/skill-index.txt | 99 +++++++++++++++++++ 3 files changed, 154 insertions(+) diff --git a/.claude/commands/memory/workflow-skill-memory.md b/.claude/commands/memory/workflow-skill-memory.md index 05ccfa86..cde3a7a0 100644 --- a/.claude/commands/memory/workflow-skill-memory.md +++ b/.claude/commands/memory/workflow-skill-memory.md @@ -200,18 +200,53 @@ Objectives: RULES: Template reference from skill-aggregation.txt " +3.5. **Generate SKILL.md Description** (CRITICAL for auto-loading): + + Read skill-index.txt template Section: "Description Field Generation" + + Execute command to get project root: + ```bash + git rev-parse --show-toplevel # Example output: /d/Claude_dms3 + ``` + + Apply description format: + ``` + Progressive workflow development history (located at {project_root}). + Load this SKILL when continuing development, analyzing past implementations, + or learning from workflow history, especially when no relevant context exists in memory. + ``` + + **Validation**: + - [ ] Path uses forward slashes (not backslashes) + - [ ] All three use cases present + - [ ] Trigger optimization phrase included + - [ ] Path is absolute (starts with / or drive letter) + 4. Read templates for formatting guidance: - ~/.claude/workflows/cli-templates/prompts/workflow/skill-sessions-timeline.txt - ~/.claude/workflows/cli-templates/prompts/workflow/skill-lessons-learned.txt - ~/.claude/workflows/cli-templates/prompts/workflow/skill-conflict-patterns.txt - ~/.claude/workflows/cli-templates/prompts/workflow/skill-index.txt + **CRITICAL**: From skill-index.txt, read these sections: + - "Description Field Generation" - Rules for generating description + - "Variable Substitution Guide" - All required variables + - "Generation Instructions" - Step-by-step generation process + - "Validation Checklist" - Final validation steps + 5. Update SKILL documents: - sessions-timeline.md: Append new session, update domain grouping - lessons-learned.md: Merge lessons into categories, update frequencies - conflict-patterns.md: Add conflicts, update recurring pattern frequencies - SKILL.md: Regenerate index with updated counts + **For SKILL.md generation**: + - Follow "Generation Instructions" from skill-index.txt (Steps 1-7) + - Use git command for project_root: `git rev-parse --show-toplevel` + - Apply "Description Field Generation" rules + - Validate using "Validation Checklist" + - Increment version (patch level) + 6. Return result JSON: { "status": "success", diff --git a/.claude/workflows/cli-templates/prompts/workflow/skill-aggregation.txt b/.claude/workflows/cli-templates/prompts/workflow/skill-aggregation.txt index 024b5c0f..3cbb4675 100644 --- a/.claude/workflows/cli-templates/prompts/workflow/skill-aggregation.txt +++ b/.claude/workflows/cli-templates/prompts/workflow/skill-aggregation.txt @@ -1,3 +1,23 @@ +# SKILL.md Index Generation Context + +## Description Field Requirements + +When generating final aggregated output, remember to prepare data for SKILL.md description field: + +**Required Data Points**: +- Project root path (to be obtained via git command) +- Use cases: "continuing development", "analyzing past implementations", "learning from workflow history" +- Trigger phrase: "especially when no relevant context exists in memory" + +**Description Format**: +``` +Progressive workflow development history (located at {project_root}). +Load this SKILL when continuing development, analyzing past implementations, +or learning from workflow history, especially when no relevant context exists in memory. +``` + +--- + You are aggregating workflow session history to generate a progressive SKILL package. ## Your Task diff --git a/.claude/workflows/cli-templates/prompts/workflow/skill-index.txt b/.claude/workflows/cli-templates/prompts/workflow/skill-index.txt index e38054ca..fa2bb9f3 100644 --- a/.claude/workflows/cli-templates/prompts/workflow/skill-index.txt +++ b/.claude/workflows/cli-templates/prompts/workflow/skill-index.txt @@ -123,3 +123,102 @@ Load Level 3 from workflow-progress SKILL for complete development history - Group sessions by primary tag - Include only top 5 recent sessions in Quick Access - Include top 3 watch patterns + +--- + +## Variable Substitution Guide + +### Required Variables +- `{project_root}`: Absolute project path from git root (e.g., "/d/Claude_dms3") +- `{semantic_version}`: Version string (e.g., "1.0.0", increment patch for each update) +- `{session_count}`: Total number of archived sessions +- `{domain_list}`: Comma-separated unique tags sorted by frequency +- `{earliest_date}`: Earliest session archived_at timestamp +- `{latest_date}`: Most recent session archived_at timestamp + +### Generated Variables +- `{one_line_description}`: Extract from session description (first sentence, max 80 chars) +- `{domain_category}`: Primary tag from session metadata +- `{most_frequent_watch_pattern}`: Top recurring watch pattern across sessions +- `{date}`: Session archived_at in YYYY-MM-DD format + +### Description Field Generation + +**Format Template**: +``` +Progressive workflow development history (located at {project_root}). +Load this SKILL when continuing development, analyzing past implementations, +or learning from workflow history, especially when no relevant context exists in memory. +``` + +**Generation Rules**: +1. **Project Root**: Use `git rev-parse --show-toplevel` to get absolute path +2. **Use Cases**: ALWAYS include these trigger phrases: + - "continuing development" (开发延续) + - "analyzing past implementations" (分析历史) + - "learning from workflow history" (学习历史) +3. **Trigger Optimization**: MUST include "especially when no relevant context exists in memory" +4. **Path Format**: Use forward slashes for cross-platform compatibility (e.g., "/d/project") + +**Why This Matters**: +- **Auto-loading precision**: Path reference ensures Claude loads correct project's SKILL +- **Context awareness**: "when no relevant context exists" prevents redundant loading +- **Action coverage**: Three use cases cover all workflow scenarios + +--- + +## Generation Instructions + +### Step 1: Get Project Root +```bash +git rev-parse --show-toplevel # Returns: /d/Claude_dms3 +``` + +### Step 2: Read Manifest +```bash +cat .workflow/.archives/manifest.json +``` + +Extract: +- Total session count +- All session tags (for domain list) +- Date range (earliest/latest archived_at) + +### Step 3: Aggregate Session Data +- Count sessions per domain +- Extract top 5 recent sessions +- Identify top 3 watch patterns from lessons + +### Step 4: Generate Description +Apply format template with project_root from Step 1. + +### Step 5: Calculate Version +- Read existing SKILL.md version (if exists) +- Increment patch version (e.g., 1.0.5 → 1.0.6) +- Use 1.0.0 for new SKILL package + +### Step 6: Build Progressive Loading Sections +- Level 0: Recent 5 sessions + Top 3 conflicts +- Level 1: Recent 10 sessions + Best practices +- Level 2: All sessions + Full lessons + Full conflicts +- Level 3: Include IMPL_PLAN and TODO_LIST references + +### Step 7: Write SKILL.md +- Apply all variable substitutions +- Use relative paths: `../../../.workflow/.archives/` +- Validate all referenced files exist + +--- + +## Validation Checklist + +- [ ] `{project_root}` uses absolute path with forward slashes +- [ ] Description includes all three use cases +- [ ] Description includes trigger optimization phrase +- [ ] Version incremented correctly +- [ ] All session references use relative paths +- [ ] Domain list sorted by frequency +- [ ] Date range matches manifest +- [ ] Quick Access section has exactly 5 recent sessions +- [ ] Top Watch Patterns section has exactly 3 items +- [ ] All referenced files exist in archives