Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:49:02 +08:00
commit 9c8179f1ff
9 changed files with 485 additions and 0 deletions

43
commands/exec.md Normal file
View File

@@ -0,0 +1,43 @@
---
description: Execute a specific Fabric pattern by name
argument-hint: [pattern_name] [user_prompt]
allowed-tools: [Task]
category: utility
complexity: basic
mcp-servers: []
---
## Usage
```
/exec [pattern_name] [user_prompt]
```
## Arguments
- `pattern_name` - The name of the pattern to execute (e.g., "review_code", "summarize")
- `user_prompt` - The input text to process
## Examples
```
/exec review_code "analyze the login function"
/exec summarize "last 5 commits"
/exec analyze_security "[code here]"
```
## Execution
This command delegates to the pattern-executor subagent which uses the Sonnet model for high-quality analysis.
Use the pattern-executor subagent to execute the pattern with the following input:
--- PATTERN NAME ---
$1
--- INPUT START ---
$2
--- INPUT END ---
The pattern-executor will:
1. Extract the specified pattern from `${CLAUDE_PLUGIN_ROOT}/.fabric-core/pattern_extracts.json`
2. Apply the pattern to the provided input
3. Generate comprehensive analysis using Sonnet model
4. Return the formatted result

88
commands/orchestrate.md Normal file
View File

@@ -0,0 +1,88 @@
---
name: orchestrate
allowed-tools: [Task, TodoWrite]
description: "Orchestrate complete Fabric pattern workflows"
argument-hint: [user_prompt]
category: utility
complexity: intermediate
mcp-servers: []
---
## Usage
```
/orchestrate [user_prompt]
```
## Arguments
- `user_prompt` - Describe your complete workflow need
## Execution
This command orchestrates the complete pattern workflow:
1. **Get Pattern Suggestions**:
Use Task tool to call pattern-suggester with user prompt
2. **Parse Pattern Sequence**:
Extract the recommended pattern sequence from the response
3. **Execute Pattern Chain**:
For each pattern in the sequence:
- Use Task tool to call pattern-executor with the pattern name
- Pass the previous pattern's output as input to the next pattern
- Store each output for chaining
4. **Return Final Result**:
Return the last pattern's output directly to the user
## Detailed Workflow
### Step 1: Get Suggestions
Call pattern-suggester agent with user prompt to get pattern sequence
### Step 2: Parse Response
Extract the pattern sequence from suggester's response (e.g., `analyze → extract → create_summary`)
### Step 3: Execute Each Pattern
For each pattern in the sequence, use Task tool with:
- description: "Execute [pattern_name] pattern"
- prompt: "Execute [pattern_name] pattern with this input: [previous_output or original_input]"
- subagent_type: "pattern-executor"
### Step 4: Chain Outputs
- First pattern receives the original user input
- Each subsequent pattern receives the output from the previous pattern
- Continue until all patterns are executed
### Step 5: Return Result
Return the final pattern's output directly without modification
## Examples
### Documentation Generation
```
/orchestrate "Document my codebase with clean, formatted output"
```
Workflow:
1. pattern-suggester returns: `analyze_code → extract_structure → create_documentation`
2. Execute analyze_code with original code
3. Execute extract_structure with code analysis
4. Execute create_documentation with structure data
5. Return final documentation
### Security Analysis
```
/orchestrate "Analyze security vulnerabilities and create a report"
```
Workflow:
1. pattern-suggester returns: `analyze_security → extract_vulnerabilities → create_report`
2. Execute analyze_security with codebase
3. Execute extract_vulnerabilities with security analysis
4. Execute create_report with vulnerability list
5. Return security report
## Important Notes
- The command handles all orchestration directly
- Each pattern's output becomes the next pattern's input
- No intermediate agents are involved
- Final output is returned unmodified

37
commands/suggest.md Normal file
View File

@@ -0,0 +1,37 @@
---
name: suggest
argument-hint: [user_prompt]
allowed-tools: [Task]
description: "Suggest Fabric patterns based on user prompt analysis"
category: utility
complexity: basic
mcp-servers: []
---
## Usage
```
/suggest [user_prompt]
```
## Arguments
- `user_prompt` - Describe what you want to do
## Execution
Delegate to the `pattern-suggester` subagent with the provided user prompt for intelligent pattern suggestions based on semantic analysis.
The pattern-suggester agent will:
- Load and analyze the Fabric pattern library from `${CLAUDE_PLUGIN_ROOT}/.fabric-core/pattern_descriptions.json`
- Perform deep semantic analysis of the user prompt
- Identify primary intent, domain context, and specific requirements
- Match patterns based on tags, semantic similarity, and use case alignment
- Generate 3-5 targeted pattern recommendations with clear reasoning
- Suggest single patterns for simple tasks or multi-pattern workflows for complex tasks
- Provide alternative approaches for different outcomes
## Example
```
/suggest "I need to analyze security vulnerabilities in my codebase"
```
This will invoke the pattern-suggester subagent to recommend security-focused analysis patterns from the Fabric library.