Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:18:06 +08:00
commit 0ca2134207
5 changed files with 142 additions and 0 deletions

36
commands/document.md Normal file
View File

@@ -0,0 +1,36 @@
---
description: Add documentation to functions/classes that have been modified
argument-hint: [file_path]
allowed-tools: Read, Edit, Bash(git status:*), Bash(git diff:*), Task
---
Add or improve documentation for functions and classes that have been modified in the current git diff.
Focus on (if provided): $ARGUMENTS
## Context
- Modified files: !`git status --short`
- Changes in staged files: !`git diff --cached`
- Changes in unstaged files: !`git diff`
## Your task
1. Read the relevant files, making note of what the user requested to focus on (if anything)
2. Analyze the git diff output above to identify which functions/classes/methods were modified
3. Focus ONLY on documenting the functions/classes that appear in the diff
4. Use the Edit tool to add documentation directly to the file
Documentation style guidelines:
- **Concise but complete**: Explain what's non-obvious, skip what's self-evident
- **Focus on "why" and "what"**: Explain purpose and behavior, not just repeating the code
- **Include types**: Document parameter and return types if not already typed
- **Keep it maintainable**: Don't over-document trivial code
Important:
- Do NOT change any code logic, only add/improve documentation
- Preserve existing code style and formatting
- Use language-appropriate documentation conventions
- For Python, use Google-style docstrings.
- For files with existing docs, improve them rather than duplicating
- ONLY document functions/classes that appear in the git diff context above

42
commands/review.md Normal file
View File

@@ -0,0 +1,42 @@
---
description: Review code changes in modified files since origin/HEAD
argument-hint: [file_path]
allowed-tools: Read, Bash(git diff:*), Bash(git log:*), Bash(git status:*), Task
---
Review all modified files since origin/HEAD, or focus on specific files if provided.
Focus on (if provided): $ARGUMENTS
## Context
- Modified files: !`git status --short`
- Branch comparison: !`git diff origin/HEAD...HEAD --stat`
- Recent commits: !`git log origin/HEAD..HEAD --oneline`
## Your task
1. Identify files that have been modified since origin/HEAD
2. If the user specified files in arguments, filter to only those files
3. For each modified file, launch an agent to review it (keeping in context the diff of related files)
4. Each review agent should analyze:
- **Code quality**: Logic clarity, maintainability, adherence to best practices
- **Potential issues**: Bugs, edge cases, error handling gaps
- **Security concerns**: Vulnerabilities, unsafe patterns, input validation
- **Performance**: Obvious inefficiencies or optimization opportunities
- **Testing**: Whether the changes would benefit from additional tests
- **Documentation**: Whether the changes are sufficiently documented
5. Compile the reviews and present a summary for each file
Review guidelines:
- **Be constructive**: Focus on actionable feedback
- **Prioritize**: Highlight critical issues before minor suggestions
- **Be specific**: Reference line numbers and code snippets
- **Context-aware**: Consider the file's purpose and the nature of changes
Important:
- Each agent should receive the git diff for their specific file and related files
- Focus primarily on the actual changes (diff), not the entire file
- If no files are modified, inform the user
- Format output clearly with file names as headers