docs: 更新SKILL.md生成描述和变量替换指南,增强文档的清晰度和准确性

This commit is contained in:
catlog22
2025-11-05 20:15:18 +08:00
parent a38a216cc9
commit e898ebc322
3 changed files with 154 additions and 0 deletions

View File

@@ -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",

View File

@@ -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

View File

@@ -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