Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 17:57:35 +08:00
commit 7dd6421034
11 changed files with 639 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
---
allowed-tools: Task
description: Use doc-curator agent to generate README following template standards
argument-hint: [target-file] [template-mode]
model: claude-3-5-haiku-20241022
---
# Generate README
Use the doc-curator sub-agent to generate comprehensive `README.md` following `TEMPLATE_MODE` standards from `TARGET_FILE` template, ensuring no business-specific references or credentials are included.
## Variables
TARGET_FILE: $1 (default: README.md)
TEMPLATE_MODE: $2 (default: ai-docs/readme-template.yaml)
OUTPUT_DIRECTORY: current project root
TEMPLATE_NAME: structured YAML template format
## Workflow
1. Use the doc-curator sub-agent to analyze current project structure
2. Load template from `@ai-docs/readme-template.yaml`
3. Extract metadata from configuration files (package.json, setup.py)
4. Apply security filtering to remove business references and credentials
5. Substitute template variables with sanitized project-specific content
6. Generate navigation structure and setup instructions
7. Write final README.md with comprehensive documentation
## Report
README Generation Complete
File: `TARGET_FILE`
Template: `TEMPLATE_MODE` format applied
Key Components:
- Project metadata and description
- Installation and setup instructions
- Navigation structure
- Security-sanitized content (no credentials/business refs)
## Relevant Files
- @ai-docs/readme-template.yaml
- @package.json
- @CLAUDE.md

View File

@@ -0,0 +1,9 @@
---
allowed-tools: Bash, Read, Edit
description: Update project CHANGELOG.md automatically from git commits
model: claude-sonnet-4-5-20250929
---
# Update Changelog
Run `npm run changelog:force` to automatically update CHANGELOG.md from git commits. Review generated entry for $ARGUMENTS version, edit to follow conventions in ai-docs/changelog-conventions.md (proper categorization, clear descriptions, technical context), and commit the updated CHANGELOG.md file.

85
commands/update-claude.md Normal file
View File

@@ -0,0 +1,85 @@
---
allowed-tools: Bash(git diff:*), Bash(git log:*), Bash(git status:*), Bash(find:*), Bash(grep:*), Bash(wc:*), Bash(ls:*), mcp__serena__*
description: Update CLAUDE.md using Serena-first analysis of recent code changes
argument-hint: [--directory target-dir]
flags:
--directory: Create/update CLAUDE.md for a specific directory instead of project root
model: claude-sonnet-4-5-20250929
---
# Update Claude.md
Use Serena-first analysis to update CLAUDE.md based on recent code changes and git history.
## Variables
TARGET_DIRECTORY: {{if flags.directory}}{{flags.directory}}{{else}}.{{endif}}
CLAUDE_FILE: {{if flags.directory}}{{flags.directory}}/CLAUDE.md{{else}}CLAUDE.md{{endif}}
ANALYSIS_SCOPE: {{if flags.directory}}directory-specific{{else}}project-wide{{endif}}
## Workflow
### 1. Initial Setup
- Check Serena onboarding: `mcp__serena__check_onboarding_performed`
- If not onboarded, complete onboarding process first
- Use `mcp__serena__think_about_task_adherence` to validate update scope
### 2. Git Analysis
- Get current status: !`git status --porcelain`
- Review recent commits: !`git log --oneline -10`
- Analyze changed files: !`git diff HEAD~5 --name-only | head -20`
- Check key file modifications: !`git diff --name-status HEAD~10 | grep "^M" | head -10`
- Store git insights: `mcp__serena__write_memory --memory_name="git_analysis"`
### 3. Serena Codebase Analysis
- Analyze directory structure: `mcp__serena__list_dir --relative_path="TARGET_DIRECTORY" --recursive=true`
- For each modified file from git analysis:
- Get symbol overview: `mcp__serena__get_symbols_overview --relative_path="<FILE>"`
- Find new symbols: `mcp__serena__find_symbol --name_path="<NEW_SYMBOLS>"`
- Check symbol impact: `mcp__serena__find_referencing_symbols --name_path="<KEY_SYMBOLS>"`
- Store symbol analysis: `mcp__serena__write_memory --memory_name="symbol_changes"`
### 4. Content Integration
- Read existing CLAUDE.md file: @CLAUDE_FILE
- Use `mcp__serena__think_about_collected_information` to validate analysis
- Update CLAUDE.md based on @ai-docs/serena-enhanced-claude-template.md:
- Project overview with new architecture patterns
- Save updated CLAUDE.md to CLAUDE_FILE location
### 5. Validation
- Use `mcp__serena__think_about_whether_you_are_done` to verify completeness
- Store update insights: `mcp__serena__write_memory --memory_name="claude_update_ANALYSIS_SCOPE"`
## Report
CLAUDE.md Update Complete
File: `CLAUDE_FILE`
Analysis Scope: ANALYSIS_SCOPE
Key Updates:
- Symbol-level changes documented in serena memory
- Architecture patterns updated
- Development workflow enhanced
- Integration points clarified
Memory Stored: claude_update_ANALYSIS_SCOPE
## Template Reference
Use the comprehensive template from: @ai-docs/serena-enhanced-claude-template.md
### Template Selection Logic
{{if flags.directory}}
- Apply directory-specific template sections from the referenced file
- Focus on symbol-based architecture and development workflow patterns
{{else}}
- Apply full project root template structure from the referenced file
- Include all Serena-first development patterns and core command references
{{endif}}

152
commands/update-docs.md Normal file
View File

@@ -0,0 +1,152 @@
---
allowed-tools: Task, Bash(git diff:*), Bash(git log:*), Bash(git status:*), Bash(find:*), Bash(ls:*)
description: Update existing documentation in docs/ directory based on uncommitted or recent code changes
argument-hint: [--depth 5|10|20] [--focus api|config|usage|architecture] [--uncommitted]
flags:
--depth: Number of commits to analyze for changes (default: 10)
--focus: Specific documentation area to prioritize (default: all)
--uncommitted: Only analyze uncommitted changes (working directory and staged)
model: claude-sonnet-4-5-20250929
---
# Update Docs
Use the doc-curator subagent to surgically update existing documentation in the `docs/` directory based on recent code changes. This command focuses on intelligent, incremental updates to keep documentation synchronized with code changes.
## Variables
DOCS_DIR: docs
COMMIT_DEPTH: {{if flags.depth}}{{flags.depth}}{{else}}10{{endif}}
FOCUS_AREA: {{if flags.focus}}{{flags.focus}}{{else}}all{{endif}}
ANALYZE_MODE: {{if flags.uncommitted}}uncommitted{{else}}all{{endif}}
## Workflow
### 1. Quick Documentation Inventory
- Check docs directory exists: !`ls docs/ 2>/dev/null | head -5`
- List existing documentation files: !`find docs/ -type f -name "*.md" -o -name "*.rst" -o -name "*.txt" | sort`
### 2. Identify What Changed
#### Check for uncommitted changes first:
- Working directory changes: !`git status --short | head -20`
- Unstaged modifications: !`git diff --stat | head -15`
- Staged changes: !`git diff --cached --stat | head -15`
- Show uncommitted function changes: !`git diff --function-context | grep -E "^@@|^\+\+\+|function|class|def|interface" | head -30`
#### If no uncommitted changes, analyze recent commits:
- Get recent commits: !`git log --oneline -COMMIT_DEPTH --name-status | grep -E "^[AM]" | head -20`
- Show committed changes: !`git diff HEAD~COMMIT_DEPTH --stat | head -15`
- Identify committed function changes: !`git diff HEAD~COMMIT_DEPTH --function-context | grep -E "^@@|^\+\+\+|function|class|def|interface" | head -30`
### 3. Launch Doc-Curator for Surgical Updates
Use the doc-curator subagent with specific instructions based on FOCUS_AREA:
```
Analyze these code changes (both uncommitted and recent commits) and update ONLY the affected sections in existing documentation:
Uncommitted changes:
- [Output from git diff for working directory]
- [Output from git diff --cached for staged changes]
Recent committed changes (if analyzing history):
- [Output from git diff HEAD~COMMIT_DEPTH]
- [Specific functions/APIs that changed]
Documentation focus: FOCUS_AREA
Target directory: docs/
Instructions:
1. Read existing documentation files in docs/
2. Identify which docs reference the changed code
3. Make surgical updates ONLY where needed:
- Update function signatures if they changed
- Update configuration options if modified
- Update API endpoints if altered
- Update example code if it's now incorrect
- Add brief notes for new features
- Mark deprecated features
4. Preserve all other content exactly as is
5. Do NOT rewrite entire sections unless absolutely necessary
6. Focus on accuracy over comprehensive rewrites
```
### 4. Types of Surgical Updates
#### For API Changes (focus: api)
- Update endpoint paths if renamed
- Update request/response formats if changed
- Update parameter descriptions if modified
- Add new endpoints to existing lists
- Mark deprecated endpoints
#### For Configuration Changes (focus: config)
- Update environment variable names
- Update default values if changed
- Add new configuration options
- Remove obsolete settings
- Update example configurations
#### For Usage Changes (focus: usage)
- Update command-line examples
- Fix code snippets that no longer work
- Update import statements if paths changed
- Adjust setup instructions if process changed
#### For Architecture Changes (focus: architecture)
- Update component diagrams if structure changed
- Revise data flow descriptions
- Update dependency lists
- Adjust system requirements
## Report
Documentation Synchronization Complete
Directory: `DOCS_DIR`
Commits Analyzed: COMMIT_DEPTH
Focus Area: FOCUS_AREA
Surgical Updates Applied:
- [List of specific sections updated]
- [Line-by-line changes made]
- [New content added where needed]
Update Summary:
- Files Modified: [count and list]
- Sections Updated: [specific sections touched]
- Code Examples Fixed: [count]
- Configuration Updates: [count]
- API Changes Reflected: [count]
## Examples of Surgical Updates
**Function Signature Change:**
```diff
- `processData(input: string): void`
+ `processData(input: string, options?: ProcessOptions): Promise<void>`
```
**Configuration Update:**
```diff
- `API_TIMEOUT`: 5000 (milliseconds)
+ `API_TIMEOUT`: 10000 (milliseconds, increased for stability)
```
**Deprecated Feature:**
```diff
+ **Deprecated:** The `oldMethod()` function is deprecated as of v2.0. Use `newMethod()` instead.
```