mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-01 15:03:57 +08:00
docs: add VitePress documentation site
- Add docs directory with VitePress configuration - Add GitHub Actions workflow for docs build and deploy - Support bilingual (English/Chinese) documentation - Include search, custom theme, and responsive design
This commit is contained in:
56
docs/commands/codex/index.md
Normal file
56
docs/commands/codex/index.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# Codex Prompts
|
||||
|
||||
## One-Liner
|
||||
|
||||
**Codex Prompts is the prompt template system used by Codex CLI** — standardized prompt formats ensure consistent code quality and review effectiveness.
|
||||
|
||||
## Core Concepts
|
||||
|
||||
| Concept | Description | Use Cases |
|
||||
|----------|-------------|-----------|
|
||||
| **Prep Prompts** | Project context preparation prompts | Analyze project structure, extract relevant files |
|
||||
| **Review Prompts** | Code review prompts | Multi-dimensional code quality checks |
|
||||
|
||||
## Prompt List
|
||||
|
||||
### Prep Series
|
||||
|
||||
| Prompt | Function | Use Cases |
|
||||
|--------|----------|-----------|
|
||||
| [`memory:prepare`](./prep.md#memory-prepare) | Project context preparation | Prepare structured project context for tasks |
|
||||
|
||||
### Review Series
|
||||
|
||||
| Prompt | Function | Use Cases |
|
||||
|--------|----------|-----------|
|
||||
| [`codex-review`](./review.md#codex-review) | Interactive code review | Code review using Codex CLI |
|
||||
|
||||
## Prompt Template Format
|
||||
|
||||
All Codex Prompts follow the standard CCW CLI prompt template:
|
||||
|
||||
```
|
||||
PURPOSE: [objective] + [reason] + [success criteria] + [constraints/scope]
|
||||
TASK: • [step 1] • [step 2] • [step 3]
|
||||
MODE: review
|
||||
CONTEXT: [review target description] | Memory: [relevant context]
|
||||
EXPECTED: [deliverable format] + [quality criteria]
|
||||
CONSTRAINTS: [focus constraints]
|
||||
```
|
||||
|
||||
## Field Descriptions
|
||||
|
||||
| Field | Description | Example |
|
||||
|-------|-------------|---------|
|
||||
| **PURPOSE** | Objective and reason | "Identify security vulnerabilities to ensure code safety" |
|
||||
| **TASK** | Specific steps | "• Scan for injection vulnerabilities • Check authentication logic" |
|
||||
| **MODE** | Execution mode | analysis, write, review |
|
||||
| **CONTEXT** | Context information | "@CLAUDE.md @src/auth/**" |
|
||||
| **EXPECTED** | Output format | "Structured report with severity levels" |
|
||||
| **CONSTRAINTS** | Constraint conditions | "Focus on actionable suggestions" |
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Claude Commands](../claude/)
|
||||
- [CLI Invocation System](../../features/cli.md)
|
||||
- [Code Review](../../features/)
|
||||
168
docs/commands/codex/prep.md
Normal file
168
docs/commands/codex/prep.md
Normal file
@@ -0,0 +1,168 @@
|
||||
# Prep Prompts
|
||||
|
||||
## One-Liner
|
||||
|
||||
**Prep prompts are standardized templates for project context preparation** — generating structured project core content packages through agent-driven analysis.
|
||||
|
||||
## Core Content Package Structure
|
||||
|
||||
```json
|
||||
{
|
||||
"task_context": "Task context description",
|
||||
"keywords": ["keyword1", "keyword2"],
|
||||
"project_summary": {
|
||||
"architecture": "Architecture description",
|
||||
"tech_stack": ["tech1", "tech2"],
|
||||
"key_patterns": ["pattern1", "pattern2"]
|
||||
},
|
||||
"relevant_files": [
|
||||
{
|
||||
"path": "file path",
|
||||
"relevance": "relevance description",
|
||||
"priority": "high|medium|low"
|
||||
}
|
||||
],
|
||||
"integration_points": [
|
||||
"integration point 1",
|
||||
"integration point 2"
|
||||
],
|
||||
"constraints": [
|
||||
"constraint 1",
|
||||
"constraint 2"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## memory:prepare
|
||||
|
||||
**Function**: Delegate to universal-executor agent, analyzing project via Gemini/Qwen CLI and returning JSON core content package for task context.
|
||||
|
||||
**Syntax**:
|
||||
```
|
||||
/memory:prepare [--tool gemini|qwen] "task context description"
|
||||
```
|
||||
|
||||
**Options**:
|
||||
- `--tool=tool`: Specify CLI tool (default: gemini)
|
||||
- `gemini`: Large context window, suitable for complex project analysis
|
||||
- `qwen`: Gemini alternative with similar capabilities
|
||||
|
||||
**Execution Flow**:
|
||||
|
||||
```mermaid
|
||||
graph TD
|
||||
A[Start] --> B[Analyze Project Structure]
|
||||
B --> C[Load Documentation]
|
||||
C --> D[Extract Keywords]
|
||||
D --> E[Discover Files]
|
||||
E --> F[CLI Deep Analysis]
|
||||
F --> G[Generate Content Package]
|
||||
G --> H[Load to Main Thread Memory]
|
||||
```
|
||||
|
||||
**Agent Call Prompt**:
|
||||
```
|
||||
## Mission: Prepare Project Memory Context
|
||||
|
||||
**Task**: Prepare project memory context for: "{task_description}"
|
||||
**Mode**: analysis
|
||||
**Tool Preference**: {tool}
|
||||
|
||||
### Step 1: Foundation Analysis
|
||||
1. Project Structure: get_modules_by_depth.sh
|
||||
2. Core Documentation: CLAUDE.md, README.md
|
||||
|
||||
### Step 2: Keyword Extraction & File Discovery
|
||||
1. Extract core keywords from task description
|
||||
2. Discover relevant files using ripgrep and find
|
||||
|
||||
### Step 3: Deep Analysis via CLI
|
||||
Execute Gemini/Qwen CLI for deep analysis
|
||||
|
||||
### Step 4: Generate Core Content Package
|
||||
Return structured JSON with required fields
|
||||
|
||||
### Step 5: Return Content Package
|
||||
Load JSON into main thread memory
|
||||
```
|
||||
|
||||
**Examples**:
|
||||
|
||||
```bash
|
||||
# Basic usage
|
||||
/memory:prepare "develop user authentication on current frontend"
|
||||
|
||||
# Specify tool
|
||||
/memory:prepare --tool qwen "refactor payment module API"
|
||||
|
||||
# Bug fix context
|
||||
/memory:prepare "fix login validation error"
|
||||
```
|
||||
|
||||
**Returned Content Package**:
|
||||
|
||||
```json
|
||||
{
|
||||
"task_context": "develop user authentication on current frontend",
|
||||
"keywords": ["frontend", "user", "authentication", "auth", "login"],
|
||||
"project_summary": {
|
||||
"architecture": "TypeScript + React frontend, Vite build system",
|
||||
"tech_stack": ["React", "TypeScript", "Vite", "TailwindCSS"],
|
||||
"key_patterns": [
|
||||
"State management via Context API",
|
||||
"Functional components with Hooks pattern",
|
||||
"API calls wrapped in custom hooks"
|
||||
]
|
||||
},
|
||||
"relevant_files": [
|
||||
{
|
||||
"path": "src/components/Auth/LoginForm.tsx",
|
||||
"relevance": "Existing login form component",
|
||||
"priority": "high"
|
||||
},
|
||||
{
|
||||
"path": "src/contexts/AuthContext.tsx",
|
||||
"relevance": "Authentication state management context",
|
||||
"priority": "high"
|
||||
},
|
||||
{
|
||||
"path": "CLAUDE.md",
|
||||
"relevance": "Project development standards",
|
||||
"priority": "high"
|
||||
}
|
||||
],
|
||||
"integration_points": [
|
||||
"Must integrate with existing AuthContext",
|
||||
"Follow component organization pattern: src/components/[Feature]/",
|
||||
"API calls should use src/hooks/useApi.ts wrapper"
|
||||
],
|
||||
"constraints": [
|
||||
"Maintain backward compatibility",
|
||||
"Follow TypeScript strict mode",
|
||||
"Use existing UI component library"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Quality Checklist
|
||||
|
||||
Before generating content package, verify:
|
||||
- [ ] Valid JSON format
|
||||
- [ ] All required fields complete
|
||||
- [ ] relevant_files contains minimum 3-10 files
|
||||
- [ ] project_summary accurately reflects architecture
|
||||
- [ ] integration_points clearly specify integration paths
|
||||
- [ ] keywords accurately extracted (3-8 keywords)
|
||||
- [ ] Content is concise, avoid redundancy (< 5KB total)
|
||||
|
||||
## Memory Persistence
|
||||
|
||||
- **Session Scope**: Content package valid for current session
|
||||
- **Subsequent References**: All subsequent agents/commands can access
|
||||
- **Reload Required**: New sessions need to re-execute `/memory:prepare`
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Memory Commands](../claude/memory.md)
|
||||
- [Review Prompts](./review.md)
|
||||
- [CLI Invocation System](../../features/cli.md)
|
||||
197
docs/commands/codex/review.md
Normal file
197
docs/commands/codex/review.md
Normal file
@@ -0,0 +1,197 @@
|
||||
# Review Prompts
|
||||
|
||||
## One-Liner
|
||||
|
||||
**Review prompts are standardized templates for code review** — multi-dimensional code quality checks ensuring code meets best practices.
|
||||
|
||||
## Review Dimensions
|
||||
|
||||
| Dimension | Check Items | Severity |
|
||||
|-----------|-------------|----------|
|
||||
| **Correctness** | Logic errors, boundary conditions, type safety | Critical |
|
||||
| **Security** | Injection vulnerabilities, authentication, input validation | Critical |
|
||||
| **Performance** | Algorithm complexity, N+1 queries, caching opportunities | High |
|
||||
| **Maintainability** | SOLID principles, code duplication, naming conventions | Medium |
|
||||
| **Documentation** | Comment completeness, README updates | Low |
|
||||
|
||||
## codex-review
|
||||
|
||||
**Function**: Interactive code review using Codex CLI via ccw endpoint, supporting configurable review targets, models, and custom instructions.
|
||||
|
||||
**Syntax**:
|
||||
```
|
||||
/cli:codex-review [--uncommitted|--base <branch>|--commit <sha>] [--model <model>] [--title <title>] [prompt]
|
||||
```
|
||||
|
||||
**Parameters**:
|
||||
- `--uncommitted`: Review staged, unstaged, and untracked changes
|
||||
- `--base <branch>`: Compare changes with base branch
|
||||
- `--commit <sha>`: Review changes introduced by specific commit
|
||||
- `--model <model>`: Override default model (gpt-5.2, o3, gpt-4.1, o4-mini)
|
||||
- `--title <title>`: Optional commit title for review summary
|
||||
|
||||
**Note**: Target flags and prompt are mutually exclusive (see constraints section)
|
||||
|
||||
### Review Focus Selection
|
||||
|
||||
| Focus | Template | Key Checks |
|
||||
|-------|----------|------------|
|
||||
| **Comprehensive Review** | Universal template | Correctness, style, bugs, documentation |
|
||||
| **Security Focus** | Security template | Injection, authentication, validation, exposure |
|
||||
| **Performance Focus** | Performance template | Complexity, memory, queries, caching |
|
||||
| **Code Quality** | Quality template | SOLID, duplication, naming, tests |
|
||||
|
||||
### Prompt Templates
|
||||
|
||||
#### Comprehensive Review Template
|
||||
|
||||
```
|
||||
PURPOSE: Comprehensive code review to identify issues, improve quality, and ensure best practices; success = actionable feedback and clear priorities
|
||||
TASK: • Review code correctness and logic errors • Check coding standards and consistency • Identify potential bugs and edge cases • Evaluate documentation completeness
|
||||
MODE: review
|
||||
CONTEXT: {target description} | Memory: Project conventions from CLAUDE.md
|
||||
EXPECTED: Structured review report with: severity levels (Critical/High/Medium/Low), file:line references, specific improvement suggestions, priority rankings
|
||||
CONSTRAINTS: Focus on actionable feedback
|
||||
```
|
||||
|
||||
#### Security Focus Template
|
||||
|
||||
```
|
||||
PURPOSE: Security-focused code review to identify vulnerabilities and security risks; success = all security issues documented with fixes
|
||||
TASK: • Scan for injection vulnerabilities (SQL, XSS, command) • Check authentication and authorization logic • Evaluate input validation and sanitization • Identify sensitive data exposure risks
|
||||
MODE: review
|
||||
CONTEXT: {target description} | Memory: Security best practices, OWASP Top 10
|
||||
EXPECTED: Security report with: vulnerability classification, applicable CVE references, fix code snippets, risk severity matrix
|
||||
CONSTRAINTS: Security-first analysis | Flag all potential vulnerabilities
|
||||
```
|
||||
|
||||
#### Performance Focus Template
|
||||
|
||||
```
|
||||
PURPOSE: Performance-focused code review to identify bottlenecks and optimization opportunities; success = measurable improvement suggestions
|
||||
TASK: • Analyze algorithm complexity (Big-O) • Identify memory allocation issues • Check N+1 queries and blocking operations • Evaluate caching opportunities
|
||||
MODE: review
|
||||
CONTEXT: {target description} | Memory: Performance patterns and anti-patterns
|
||||
EXPECTED: Performance report with: complexity analysis, bottleneck identification, optimization suggestions with expected impact, benchmark recommendations
|
||||
CONSTRAINTS: Performance optimization focus
|
||||
```
|
||||
|
||||
#### Code Quality Template
|
||||
|
||||
```
|
||||
PURPOSE: Code quality review to improve maintainability and readability; success = cleaner, more maintainable code
|
||||
TASK: • Evaluate SOLID principles compliance • Identify code duplication and abstraction opportunities • Review naming conventions and clarity • Evaluate test coverage impact
|
||||
MODE: review
|
||||
CONTEXT: {target description} | Memory: Project coding standards
|
||||
EXPECTED: Quality report with: principle violations, refactoring suggestions, naming improvements, maintainability score
|
||||
CONSTRAINTS: Code quality and maintainability focus
|
||||
```
|
||||
|
||||
### Usage Examples
|
||||
|
||||
#### Direct Execution (No Interaction)
|
||||
|
||||
```bash
|
||||
# Review uncommitted changes with default settings
|
||||
/cli:codex-review --uncommitted
|
||||
|
||||
# Compare with main branch
|
||||
/cli:codex-review --base main
|
||||
|
||||
# Review specific commit
|
||||
/cli:codex-review --commit abc123
|
||||
|
||||
# Use custom model
|
||||
/cli:codex-review --uncommitted --model o3
|
||||
|
||||
# Security focus review
|
||||
/cli:codex-review --uncommitted security
|
||||
|
||||
# Full options
|
||||
/cli:codex-review --base main --model o3 --title "Authentication feature" security
|
||||
```
|
||||
|
||||
#### Interactive Mode
|
||||
|
||||
```bash
|
||||
# Start interactive selection (guided flow)
|
||||
/cli:codex-review
|
||||
```
|
||||
|
||||
### Constraints and Validation
|
||||
|
||||
**Important**: Target flags and prompt are mutually exclusive
|
||||
|
||||
Codex CLI has a constraint that target flags (`--uncommitted`, `--base`, `--commit`) cannot be used with the `[PROMPT]` positional parameter:
|
||||
|
||||
```
|
||||
error: the argument '--uncommitted' cannot be used with '[PROMPT]'
|
||||
error: the argument '--base <BRANCH>' cannot be used with '[PROMPT]'
|
||||
error: the argument '--commit <SHA>' cannot be used with '[PROMPT]'
|
||||
```
|
||||
|
||||
**Valid Combinations**:
|
||||
|
||||
| Command | Result |
|
||||
|---------|--------|
|
||||
| `codex review "focus on security"` | ✓ Custom prompt, reviews uncommitted (default) |
|
||||
| `codex review --uncommitted` | ✓ No prompt, uses default review |
|
||||
| `codex review --base main` | ✓ No prompt, uses default review |
|
||||
| `codex review --commit abc123` | ✓ No prompt, uses default review |
|
||||
| `codex review --uncommitted "prompt"` | ✗ Invalid - mutually exclusive |
|
||||
| `codex review --base main "prompt"` | ✗ Invalid - mutually exclusive |
|
||||
| `codex review --commit abc123 "prompt"` | ✗ Invalid - mutually exclusive |
|
||||
|
||||
**Valid Examples**:
|
||||
```bash
|
||||
# ✓ Valid: Prompt only (defaults to reviewing uncommitted)
|
||||
ccw cli -p "focus on security" --tool codex --mode review
|
||||
|
||||
# ✓ Valid: Target flags only (no prompt)
|
||||
ccw cli --tool codex --mode review --uncommitted
|
||||
ccw cli --tool codex --mode review --base main
|
||||
ccw cli --tool codex --mode review --commit abc123
|
||||
|
||||
# ✗ Invalid: Target flags with prompt (will fail)
|
||||
ccw cli -p "review this" --tool codex --mode review --uncommitted
|
||||
```
|
||||
|
||||
## Focus Area Mapping
|
||||
|
||||
| User Selection | Prompt Focus | Key Checks |
|
||||
|----------------|--------------|------------|
|
||||
| Comprehensive Review | Comprehensive | Correctness, style, bugs, documentation |
|
||||
| Security Focus | Security-first | Injection, authentication, validation, exposure |
|
||||
| Performance Focus | Optimization | Complexity, memory, queries, caching |
|
||||
| Code Quality | Maintainability | SOLID, duplication, naming, tests |
|
||||
|
||||
## Error Handling
|
||||
|
||||
### No Changes to Review
|
||||
|
||||
```
|
||||
No changes found for review target. Suggestions:
|
||||
- For --uncommitted: Make some code changes first
|
||||
- For --base: Ensure branch exists and has diverged
|
||||
- For --commit: Verify commit SHA exists
|
||||
```
|
||||
|
||||
### Invalid Branch
|
||||
|
||||
```bash
|
||||
# Show available branches
|
||||
git branch -a --list | head -20
|
||||
```
|
||||
|
||||
### Invalid Commit
|
||||
|
||||
```bash
|
||||
# Show recent commits
|
||||
git log --oneline -10
|
||||
```
|
||||
|
||||
## Related Documentation
|
||||
|
||||
- [Prep Prompts](./prep.md)
|
||||
- [CLI Tool Commands](../claude/cli.md)
|
||||
- [Code Review](../../features/)
|
||||
Reference in New Issue
Block a user