Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:47:23 +08:00
commit eb42d25f7b
51 changed files with 9966 additions and 0 deletions

24
commands/a.md Normal file
View File

@@ -0,0 +1,24 @@
---
description: "[Express] Analyze code - alias for /analyze-code"
allowed-tools: Read, Glob, Grep
---
# Express Analyze (/a)
Quick alias for code analysis. Uses the same functionality as `/analyze-code`.
## Usage
- `/a` - Analyze current project
- `/a <file-path>` - Analyze specific file
- `/a security` - Focus on security analysis
- `/a perf` - Focus on performance analysis
$ARGUMENTS
Analyze for:
1. Code quality and maintainability
2. Performance bottlenecks
3. Security vulnerabilities
4. Best practice violations
Output findings with severity levels: CRITICAL, HIGH, MEDIUM, LOW.

75
commands/context-setup.md Normal file
View File

@@ -0,0 +1,75 @@
---
description: Configure and optimize project context (MCP servers, agent selection)
allowed-tools: Read, Glob, Grep, Write, AskUserQuestion
---
# Context Setup
Interactively configure project context settings.
**[Activate Skill: context-manager]**
## Tasks
### 1. Project Analysis
Detect project type by checking:
- `package.json` - Node.js/JavaScript/TypeScript
- `requirements.txt` / `pyproject.toml` - Python
- `go.mod` - Go
- `Cargo.toml` - Rust
- `Dockerfile` / `docker-compose.yml` - DevOps
- `*.tf` / `Chart.yaml` - Infrastructure
- Directory structure (src/, app/, internal/, etc.)
### 2. Preset Recommendations
Recommend presets based on detected project type:
- **web-dev**: React, Vue, Next.js (web frontend)
- **python-web**: FastAPI, Django, Flask (Python web)
- **go-backend**: Gin, Echo, Fiber, Chi (Go backend)
- **rust-systems**: Actix-web, Axum (Rust systems)
- **devops**: Docker, Kubernetes, Terraform (DevOps)
- **api-dev**: Express, NestJS (backend API)
- **data-science**: Pandas, TensorFlow (data/ML)
- **full-stack**: Web + API + Database (full stack)
- **minimal**: Core tools only (maximum token savings)
### 3. Interactive Selection
Using AskUserQuestion:
1. Select preset or Custom
2. If Custom: Select individual MCP servers
3. If Custom: Select agent categories
### 4. Generate Config Files
- `.claude/context-profile.json`: Project settings
- `.claude/.mcp.json`: MCP server settings
### 5. Restart Instructions
Guide user to restart Claude Code for MCP settings to take effect.
## Output Example
```
Analyzing project...
Detected: React + TypeScript (Next.js)
Recommended preset: Web Development
Expected token savings: ~28,000 tokens (14%)
[Preset selection question]
---
Setup complete!
Active MCP servers:
- github, playwright, brave-search
Active agents:
- react-expert, vue-expert, css-expert, nodejs-expert, frontend-optimizer
Generated files:
- .claude/context-profile.json
- .claude/.mcp.json
Restart Claude Code to apply MCP settings.
```

View File

@@ -0,0 +1,62 @@
---
description: Display current project context configuration status
allowed-tools: Read, Glob
---
# Context Status
Check current project context configuration.
## Checks
### 1. Project Profile
Read `.claude/context-profile.json` for current settings.
### 2. MCP Configuration
Read `.claude/.mcp.json` for active MCP servers.
### 3. Compare with Global Settings
Compare with `~/.claude/claude_code_config.json` to show active/inactive status.
## Output Format
**With profile:**
```
## Current Context Status
**Profile**: [profile name]
**Project**: [project path]
**Last updated**: [date]
### MCP Servers (N/M active)
[x] github - GitHub integration
[x] playwright - Browser automation
[x] brave-search - Web search
[ ] filesystem - Filesystem (inactive)
[ ] openrouter - AI routing (inactive)
### Active Agents
react-expert, vue-expert, css-expert, nodejs-expert, frontend-optimizer
### Inactive Agents
ios-expert, android-expert, flutter-expert, ml-engineer, ...
### Token Savings
Expected: ~28,000 tokens (14%)
---
Change settings: /context-setup
```
**Without profile:**
```
## Context Status
No context profile configured for this project.
**Detected project type**: [detected type]
**Recommended preset**: [preset]
**Expected token savings**: ~[N] tokens
Run `/context-setup` to optimize context.
```

26
commands/cs.md Normal file
View File

@@ -0,0 +1,26 @@
---
description: "[Express] Context setup - alias for /context-setup"
allowed-tools: Read, Write, Glob, Grep, AskUserQuestion
---
# Express Context Setup (/cs)
Quick alias for context configuration. Uses the same functionality as `/context-setup`.
## Usage
- `/cs` - Interactive context setup wizard
- `/cs <preset>` - Apply specific preset (minimal, web-dev, python-web, etc.)
- `/cs auto` - Auto-detect and configure
$ARGUMENTS
Available presets:
- `minimal` - Core tools only (~45k tokens saved)
- `web-dev` - React/Vue/Next.js frontend
- `python-web` - FastAPI/Django/Flask
- `go-backend` - Gin/Echo/Fiber
- `rust-systems` - Actix-web/Axum
- `devops` - Docker/K8s/Terraform
- `api-dev` - Backend microservices
- `data-science` - ML/AI projects
- `full-stack` - Combined stack

25
commands/d.md Normal file
View File

@@ -0,0 +1,25 @@
---
description: "[Express] Debug mode - alias for /debug"
allowed-tools: Read, Write, Glob
---
# Express Debug (/d)
Quick alias for debug mode toggle. Uses the same functionality as `/debug`.
## Usage
- `/d` - Toggle debug mode
- `/d on` - Enable debug mode
- `/d off` - Disable debug mode
- `/d status` - Show current debug status
$ARGUMENTS
When debug mode is enabled:
- Show skill selection reasoning
- Display context token counts
- Log MCP server calls
- Show performance metrics
- Verbose hook execution logs
Debug logs are stored in `~/.claude/claude-vibe/debug.log`

119
commands/debug.md Normal file
View File

@@ -0,0 +1,119 @@
---
description: Toggle debug mode for verbose skill and context information
allowed-tools: Read, Write
---
# Debug Mode
Enable or disable verbose debugging output for troubleshooting.
## Usage
```
/debug [on|off|status]
```
## Parameters
- `on`: Enable debug mode
- `off`: Disable debug mode
- `status`: Show current debug status (default)
## What Debug Mode Shows
When enabled, debug mode provides additional output:
### 1. Skill Selection Reasoning
```
[DEBUG] Skill Selection:
- Analyzing prompt: "Review my API endpoint"
- Candidate skills: fastapi-reviewer (0.85), go-api-reviewer (0.32), api-documenter (0.28)
- Selected: fastapi-reviewer (highest match)
- Reason: Found "fastapi" in requirements.txt, prompt mentions "API"
```
### 2. Context Token Usage
```
[DEBUG] Context Tokens:
- System prompt: 4,200 tokens
- Skill content: 2,100 tokens
- MCP tools: 8,500 tokens
- Conversation: 12,300 tokens
- Available: 172,900 tokens
- Usage: 13.5%
```
### 3. MCP Server Calls
```
[DEBUG] MCP Call:
- Server: github
- Tool: search_code
- Query: "def create_user"
- Duration: 234ms
- Result: 3 matches
```
### 4. File Operations
```
[DEBUG] File Read:
- Path: src/api/users.py
- Size: 2.4KB
- Lines: 89
- Tokens: ~450
```
## Output Format
**Status Check:**
```
## Debug Mode Status
**Current**: OFF
When enabled, shows:
- Skill selection reasoning
- Context token breakdown
- MCP server call details
- File operation metrics
- Performance timing
To enable: /debug on
```
**When Enabled:**
```
## Debug Mode
**Status**: ON ✓
Debug information will appear in [DEBUG] blocks.
Example output:
[DEBUG] Skill Selection: python-reviewer (confidence: 0.92)
[DEBUG] Tokens: 15,200 / 200,000 (7.6%)
To disable: /debug off
```
## Configuration
Debug settings can be persisted in `.claude/settings.json`:
```json
{
"debug": {
"enabled": false,
"showSkillSelection": true,
"showTokenUsage": true,
"showMCPCalls": true,
"showFileOps": false
}
}
```
## Notes
- Debug mode adds overhead to responses
- Useful for understanding skill behavior
- Recommended to disable in normal usage
- Does not persist across sessions by default

25
commands/e.md Normal file
View File

@@ -0,0 +1,25 @@
---
description: "[Express] Explain code - alias for /explain-code"
allowed-tools: Read, Glob, Grep
---
# Express Explain (/e)
Quick alias for code explanation. Uses the same functionality as `/explain-code`.
## Usage
- `/e` - Explain current file/function
- `/e <file-path>` - Explain specific file
- `/e <function-name>` - Explain specific function
- `/e architecture` - Explain overall architecture
$ARGUMENTS
Provide clear explanation including:
1. Purpose and functionality
2. How it works (step by step)
3. Key algorithms or patterns used
4. Dependencies and side effects
5. Usage examples
Adjust explanation depth based on code complexity.

23
commands/f.md Normal file
View File

@@ -0,0 +1,23 @@
---
description: "[Express] Fix issues - quick bug fix command"
allowed-tools: Read, Write, Edit, Glob, Grep, Bash
---
# Express Fix (/f)
Quick command to fix identified issues, errors, or bugs.
## Usage
- `/f` - Fix the last mentioned issue
- `/f <error-message>` - Fix specific error
- `/f <file-path>` - Fix issues in specific file
$ARGUMENTS
Fix workflow:
1. Identify the root cause
2. Implement the minimal fix
3. Verify the fix doesn't break existing functionality
4. Suggest any related issues that should be addressed
Focus on minimal, targeted fixes rather than refactoring.

60
commands/init-agents.md Normal file
View File

@@ -0,0 +1,60 @@
---
description: Initialize AGENTS.md with codebase documentation
allowed-tools: Read, Glob, Grep, Write, Bash, LS
---
# Initialize AGENTS.md
**Check if AGENTS.md exists before proceeding.**
- If exists: Inform user and ask if they want to update manually
- If not exists: Create comprehensive AGENTS.md in project root
## Required Sections
### 1. Project Overview
- Brief project description
- Main technologies and frameworks
- Project structure overview
### 2. Build & Run Commands
- Install dependencies
- Build project
- Run project
- Run tests
### 3. Code Style & Conventions
- Naming conventions (files, functions, variables, classes)
- Code formatting rules
- Import/export patterns
- Error handling patterns
### 4. Architecture Guidelines
- Directory structure explanation
- Key design patterns
- Module organization
### 5. Agent Instructions
- Key directives for AI agents
- Important constraints (MUST, NEVER, ALWAYS)
- Project-specific rules
### 6. Progress Management (AGENTS_PROGRESS.md)
- Create AGENTS_PROGRESS.md for tracking work progress
- Keep only recent 5 items (including completed)
- Format: `[status] Task description (timestamp)`
- Statuses: `[ ]` Pending, `[~]` In Progress, `[x]` Completed
- Clean up old items to prevent document bloat
## Analysis Steps
1. Scan config files: package.json, Cargo.toml, pyproject.toml, go.mod, pom.xml
2. Check README.md, CONTRIBUTING.md for context
3. Analyze directory structure
4. Check .editorconfig, .prettierrc, eslint config
5. Identify test frameworks and patterns
6. Look for CI/CD configurations
## Output
Create AGENTS.md in project root with all gathered information, formatted clearly and concisely.

28
commands/init.md Normal file
View File

@@ -0,0 +1,28 @@
---
description: "[Express] Initialize AGENTS.md - alias for /init-agents"
allowed-tools: Read, Write, Glob, Grep
---
# Express Init (/init)
Quick alias for AGENTS.md initialization. Uses the same functionality as `/init-agents`.
## Usage
- `/init` - Initialize AGENTS.md for current project
- `/init minimal` - Create minimal AGENTS.md
- `/init full` - Create comprehensive AGENTS.md
$ARGUMENTS
Initialize workflow:
1. Detect project type and structure
2. Analyze existing codebase patterns
3. Generate appropriate AGENTS.md content
4. Include relevant context for Claude Code
AGENTS.md sections:
- Project overview
- Tech stack
- Key conventions
- Important files
- Testing approach

24
commands/r.md Normal file
View File

@@ -0,0 +1,24 @@
---
description: "[Express] Review PR - alias for /review-pr"
allowed-tools: Read, Glob, Grep, Task
---
# Express Review (/r)
Quick alias for PR/code review. Uses the same functionality as `/review-pr`.
## Usage
- `/r` - Review current changes
- `/r <pr-number>` - Review specific PR
- `/r <file-path>` - Review specific file
$ARGUMENTS
Review the code thoroughly for:
1. Logic errors and bugs
2. Security vulnerabilities
3. Performance issues
4. Code style and best practices
5. Test coverage gaps
Provide actionable feedback with specific line references.

25
commands/rf.md Normal file
View File

@@ -0,0 +1,25 @@
---
description: "[Express] Refactor code - alias for /refactor-code"
allowed-tools: Read, Write, Edit, Glob, Grep
---
# Express Refactor (/rf)
Quick alias for code refactoring. Uses the same functionality as `/refactor-code`.
## Usage
- `/rf` - Suggest refactoring for current code
- `/rf <file-path>` - Refactor specific file
- `/rf extract` - Extract methods/functions
- `/rf simplify` - Simplify complex logic
$ARGUMENTS
Refactoring focus:
1. Improve code readability
2. Reduce complexity
3. Remove duplication (DRY)
4. Improve naming
5. Apply design patterns where appropriate
Maintain existing behavior - no functional changes unless requested.

88
commands/skill-log.md Normal file
View File

@@ -0,0 +1,88 @@
---
description: View skill activation history and logs
allowed-tools: Read, Glob
---
# Skill Log
View the history of skill activations in the current session.
## Usage
```
/skill-log [options]
```
## Options
- `--tail <n>`: Show last N entries (default: 10)
- `--filter <skill>`: Filter by skill name
- `--verbose`: Show detailed activation context
## Workflow
### Step 1: Check Log Location
Look for skill activation logs in:
- Session memory (current conversation)
- `.claude/logs/skill-activations.json` (if persistent logging enabled)
### Step 2: Parse Log Entries
Each entry contains:
- Timestamp
- Activated skill name
- Trigger reason
- User prompt (truncated)
- Token usage estimate
### Step 3: Display Results
**Output Format:**
```
## Skill Activation Log
### Recent Activations (Last 10)
| Time | Skill | Trigger | Tokens |
|------|-------|---------|--------|
| 14:32:15 | fastapi-reviewer | "Review my FastAPI code" | ~2.1k |
| 14:28:03 | python-reviewer | "Check this Python file" | ~1.8k |
| 14:15:22 | security-scanner | "Is this code secure?" | ~2.5k |
### Session Summary
- **Total Activations**: 12
- **Most Used**: python-reviewer (4x)
- **Est. Tokens Used**: ~24,000
### Activation Details (--verbose)
**14:32:15 - fastapi-reviewer**
```
Trigger: User prompt contained "FastAPI"
Detection: Found fastapi in requirements.txt
Context: Reviewing routers/users.py
Token estimate: 2,100 tokens
```
```
## Examples
### View Last 5 Activations
```
/skill-log --tail 5
```
### Filter by Skill
```
/skill-log --filter security-scanner
```
### Verbose Output
```
/skill-log --verbose
```
## Notes
- Log is session-scoped by default
- Enable persistent logging in settings for cross-session history
- Useful for understanding token usage patterns

84
commands/skill-test.md Normal file
View File

@@ -0,0 +1,84 @@
---
description: Test skill detection and activation logic
allowed-tools: Read, Glob, Grep
---
# Skill Test
Test a skill's detection logic against the current project or sample input.
## Usage
```
/skill-test [skill-name]
```
## Parameters
- `skill-name` (optional): Specific skill to test. If omitted, tests all skills.
## Workflow
### Step 1: Load Skill Definition
Read the specified skill's SKILL.md file from `skills/<skill-name>/SKILL.md`.
### Step 2: Parse Detection Rules
Extract detection criteria from the skill:
- Project detection patterns (files, dependencies)
- WHEN conditions
- WHEN NOT conditions
### Step 3: Test Against Current Project
Check the current project for:
- File patterns (Glob)
- Dependencies (package.json, requirements.txt, etc.)
- Code patterns (Grep)
### Step 4: Report Results
**Output Format:**
```
## Skill Test Results
### [skill-name]
**Detection Status**: ✓ Would Activate / ✗ Would Not Activate
**Matched Criteria:**
- [x] File detected: package.json
- [x] Dependency found: react
- [x] Pattern matched: src/components/**
**Unmatched Criteria:**
- [ ] File not found: next.config.js
- [ ] Dependency missing: next
**WHEN Conditions:**
- "React project review" → Matches current context
**WHEN NOT Conditions:**
- "Next.js specific" → Not triggered (no Next.js detected)
**Confidence Score**: 85%
**Recommendation**: This skill would activate for general React review.
```
## Examples
### Test Specific Skill
```
/skill-test fastapi-reviewer
```
### Test All Skills
```
/skill-test
```
Output shows which skills would activate for current project.
## Notes
- This is a dry-run test; no actual skill activation occurs
- Useful for debugging custom skills
- Helps understand skill selection logic

22
commands/st.md Normal file
View File

@@ -0,0 +1,22 @@
---
description: "[Express] Skill test - alias for /skill-test"
allowed-tools: Read, Glob, Grep
---
# Express Skill Test (/st)
Quick alias for skill testing. Uses the same functionality as `/skill-test`.
## Usage
- `/st` - Test skill detection for current context
- `/st <skill-name>` - Test specific skill
- `/st <file-path>` - Test which skills match file
$ARGUMENTS
Test workflow:
1. Analyze input/context
2. Run skill detection logic
3. Show matched skills and confidence scores
4. Display generated prompts (dry run)
5. Validate SKILL.md syntax if testing specific skill

23
commands/t.md Normal file
View File

@@ -0,0 +1,23 @@
---
description: "[Express] Generate tests - alias for /generate-tests"
allowed-tools: Read, Write, Glob, Grep
---
# Express Test (/t)
Quick alias for test generation. Uses the same functionality as `/generate-tests`.
## Usage
- `/t` - Generate tests for recent changes
- `/t <file-path>` - Generate tests for specific file
- `/t <function-name>` - Generate tests for specific function
$ARGUMENTS
Generate comprehensive tests including:
1. Unit tests for individual functions
2. Edge cases and boundary conditions
3. Error handling scenarios
4. Integration tests where appropriate
Use the project's existing test framework and conventions.

167
commands/validate-skill.md Normal file
View File

@@ -0,0 +1,167 @@
---
description: Validate custom skill definition for correctness
allowed-tools: Read, Glob
---
# Validate Skill
Validate a custom skill's SKILL.md file for correct structure and format.
## Usage
```
/validate-skill <skill-name|path>
```
## Parameters
- `skill-name`: Name of skill in skills/ directory
- `path`: Direct path to SKILL.md file
## Validation Checks
### 1. YAML Frontmatter
- [ ] Has valid YAML frontmatter (between `---` markers)
- [ ] Contains `name` field
- [ ] Contains `description` field
- [ ] Description uses WHEN/WHAT/WHEN NOT format
### 2. Required Sections
- [ ] Has `# [Skill Name] Skill` heading
- [ ] Has `## Purpose` section
- [ ] Has `## When to Use` section
- [ ] Has `## Workflow` section
### 3. Description Format
- [ ] WHEN: Describes trigger conditions
- [ ] WHAT: Lists capabilities
- [ ] WHEN NOT: Specifies exclusions
### 4. Content Quality
- [ ] Has code examples
- [ ] Has detection rules table
- [ ] Has response template
- [ ] Has integration section
## Output Format
**Valid Skill:**
```
## Skill Validation: my-custom-skill
**Status**: ✓ VALID
### Frontmatter
- [x] Valid YAML syntax
- [x] name: my-custom-skill
- [x] description: WHEN/WHAT/WHEN NOT format ✓
### Required Sections
- [x] Purpose
- [x] When to Use
- [x] Workflow
- [x] Detection Rules
### Content Quality
- [x] Code examples present
- [x] Response template defined
- [x] Integration references
**Result**: Skill is ready for use.
```
**Invalid Skill:**
```
## Skill Validation: my-custom-skill
**Status**: ✗ INVALID
### Errors (3)
1. **Missing WHEN NOT in description**
Line 3: description field should include "WHEN NOT:" clause
```yaml
description: |
WHEN: ...
WHAT: ...
WHEN NOT: ... # Missing!
```
2. **Missing Workflow section**
Expected `## Workflow` heading not found
3. **No code examples**
Skill should include code examples in detection rules
### Warnings (1)
1. **No Response Template**
Consider adding a response template for consistent output
**Result**: Fix 3 errors before using this skill.
```
## Example Validations
### Validate by Name
```
/validate-skill fastapi-reviewer
```
### Validate by Path
```
/validate-skill ./my-skills/custom-reviewer/SKILL.md
```
### Validate All Skills
```
/validate-skill --all
```
## Creating Valid Skills
### Minimum Valid Structure
```markdown
---
name: my-skill
description: |
WHEN: Trigger conditions
WHAT: Capabilities
WHEN NOT: Exclusions
---
# My Skill
## Purpose
Brief description of what this skill does.
## When to Use
- Condition 1
- Condition 2
## Workflow
### Step 1: Analyze
Description of first step.
## Detection Rules
| Check | Recommendation | Severity |
|-------|----------------|----------|
| Issue | Fix | HIGH |
## Response Template
```
## Results
...
```
## Integration
- Related skill 1
- Related skill 2
```
## Notes
- Run validation before deploying custom skills
- Fix all errors; warnings are optional
- Use `--verbose` for detailed syntax checking