From d03a9a9eac3a3362c1b8d63475ffc78370ef6e6c Mon Sep 17 00:00:00 2001 From: Zhongwei Li Date: Sun, 30 Nov 2025 08:58:21 +0800 Subject: [PATCH] Initial commit --- .claude-plugin/plugin.json | 20 +++++++++++ README.md | 3 ++ agents/example-agent.md | 67 +++++++++++++++++++++++++++++++++++ commands/hello.md | 50 ++++++++++++++++++++++++++ hooks/user-prompt-submit.md | 27 ++++++++++++++ plugin.lock.json | 57 +++++++++++++++++++++++++++++ skills/example-skill/SKILL.md | 59 ++++++++++++++++++++++++++++++ 7 files changed, 283 insertions(+) create mode 100644 .claude-plugin/plugin.json create mode 100644 README.md create mode 100644 agents/example-agent.md create mode 100644 commands/hello.md create mode 100644 hooks/user-prompt-submit.md create mode 100644 plugin.lock.json create mode 100644 skills/example-skill/SKILL.md diff --git a/.claude-plugin/plugin.json b/.claude-plugin/plugin.json new file mode 100644 index 0000000..e7cbcd1 --- /dev/null +++ b/.claude-plugin/plugin.json @@ -0,0 +1,20 @@ +{ + "name": "example-plugin", + "description": "Example plugin demonstrating command structure", + "version": "0.0.1", + "author": { + "name": "{{OWNER_NAME}}" + }, + "skills": [ + "./skills" + ], + "agents": [ + "./agents" + ], + "commands": [ + "./commands" + ], + "hooks": [ + "./hooks" + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..afb2c22 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# example-plugin + +Example plugin demonstrating command structure diff --git a/agents/example-agent.md b/agents/example-agent.md new file mode 100644 index 0000000..0a37260 --- /dev/null +++ b/agents/example-agent.md @@ -0,0 +1,67 @@ +--- +name: Example Agent +description: Demonstrates autonomous agent for complex workflows +subagent_type: example-agent +--- + +# Example Agent + +An autonomous agent that handles multi-step workflows independently. + +## Purpose + +This agent is designed to: +- Execute complex sequences of operations +- Make decisions based on intermediate results +- Handle errors and retry logic automatically + +## When to Use + +Invoke this agent when you need to: +- Perform exploratory tasks +- Execute workflows with multiple decision points +- Handle tasks that require adaptive behavior + +## Capabilities + +The agent has access to: +- File system operations +- Search and analysis tools +- External API calls + +## Usage + +``` +Use the Task tool to launch this agent: +- subagent_type: "example-agent" +- prompt: Detailed task description +``` + +## Implementation Details + +The agent will: +1. Analyze the task requirements +2. Create an execution plan +3. Execute steps sequentially +4. Handle errors gracefully +5. Return a comprehensive report + +## Examples + +### Example 1: Analysis Task +``` +subagent_type: "example-agent" +prompt: "Analyze the project structure and identify optimization opportunities" +``` + +### Example 2: Automation Task +``` +subagent_type: "example-agent" +prompt: "Refactor all components to use new API pattern" +``` + +## Best Practices + +- Provide clear, specific task descriptions +- Set appropriate scope boundaries +- Review agent output before applying changes diff --git a/commands/hello.md b/commands/hello.md new file mode 100644 index 0000000..40f0d2f --- /dev/null +++ b/commands/hello.md @@ -0,0 +1,50 @@ +--- +description: Say hello to someone +argument-hint: [name] +--- + +## Name +example-plugin:hello + +## Synopsis +``` +/example-plugin:hello [name] +``` + +## Description +The `example-plugin:hello` command greets the specified person by name. If no name is provided, it greets "World". + +This is a simple example demonstrating the basic structure of a Claude Code plugin command. + +## Implementation + +1. **Parse Arguments**: Extract the name from the command arguments + - If no name is provided, default to "World" + +2. **Generate Greeting**: Create a friendly greeting message + - Format: "Hello, {name}!" + +3. **Return Response**: Output the greeting to the user + +## Return Value + +- **Format**: Text greeting +- **Example**: "Hello, Alice!" + +## Examples + +1. **Greet a specific person**: + ``` + /example-plugin:hello Alice + ``` + Output: "Hello, Alice!" + +2. **Default greeting**: + ``` + /example-plugin:hello + ``` + Output: "Hello, World!" + +## Arguments + +- `$1`: (Optional) The name of the person to greet. Defaults to "World" if not provided. diff --git a/hooks/user-prompt-submit.md b/hooks/user-prompt-submit.md new file mode 100644 index 0000000..5b8e93f --- /dev/null +++ b/hooks/user-prompt-submit.md @@ -0,0 +1,27 @@ +--- +event: user-prompt-submit +description: Example hook that runs before user prompts are submitted +--- + +# User Prompt Submit Hook + +This hook runs before a user's prompt is submitted to Claude, allowing you to modify or validate the input. + +## Implementation + +When this hook is triggered: + +1. **Validate Input**: Check if the user's input meets certain criteria +2. **Transform**: Optionally modify the prompt before submission +3. **Add Context**: Inject additional context or instructions + +## Example Use Cases + +- Add custom system prompts +- Validate user input +- Inject project-specific context +- Track usage patterns + +## Hook Execution + +This hook receives the user's prompt and can return a modified version or the original. diff --git a/plugin.lock.json b/plugin.lock.json new file mode 100644 index 0000000..2197259 --- /dev/null +++ b/plugin.lock.json @@ -0,0 +1,57 @@ +{ + "$schema": "internal://schemas/plugin.lock.v1.json", + "pluginId": "gh:stbenjam/claude-marketplace-template:plugins/example-plugin", + "normalized": { + "repo": null, + "ref": "refs/tags/v20251128.0", + "commit": "6b19f848d16ea9fcea08cd0a54a5c3c9dbfc9ecc", + "treeHash": "e02c30de0ba9b371b7bbf0c41d4b819da70038d79823cdf56372f2686151c0f8", + "generatedAt": "2025-11-28T10:28:26.745399Z", + "toolVersion": "publish_plugins.py@0.2.0" + }, + "origin": { + "remote": "git@github.com:zhongweili/42plugin-data.git", + "branch": "master", + "commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390", + "repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data" + }, + "manifest": { + "name": "example-plugin", + "description": "Example plugin demonstrating command structure", + "version": "0.0.1" + }, + "content": { + "files": [ + { + "path": "README.md", + "sha256": "27caef310bba0d71da7088dbe8619dbf8f3b60224e44af746fbe1570b79040f5" + }, + { + "path": "agents/example-agent.md", + "sha256": "c449ca17f7e1c11a34d6f24df366c0a5c8f6b25131ede862ad773628a554b462" + }, + { + "path": "hooks/user-prompt-submit.md", + "sha256": "9c2089fbae98ae708e8d61a9b9e5d0ee754e05d5505f841a15ffd6f2bea4abef" + }, + { + "path": ".claude-plugin/plugin.json", + "sha256": "4cdb1bddda0377a17b99e5903795ba21e229f6c7b534bfc567f5a90288f7a220" + }, + { + "path": "commands/hello.md", + "sha256": "a27be8db2041f61d2f8192edd4a6c145230c9f510241619ac372ea344360407c" + }, + { + "path": "skills/example-skill/SKILL.md", + "sha256": "2a964b0a8e7a1e7a14cc8390de8387467154feae431a6fb1bd39475a3f239a0e" + } + ], + "dirSha256": "e02c30de0ba9b371b7bbf0c41d4b819da70038d79823cdf56372f2686151c0f8" + }, + "security": { + "scannedAt": null, + "scannerVersion": null, + "flags": [] + } +} \ No newline at end of file diff --git a/skills/example-skill/SKILL.md b/skills/example-skill/SKILL.md new file mode 100644 index 0000000..2d08966 --- /dev/null +++ b/skills/example-skill/SKILL.md @@ -0,0 +1,59 @@ +--- +name: Example Skill +description: Demonstrates how to create a task-specific skill for complex operations +--- + +# Example Skill + +This skill provides detailed implementation guidance for a specific complex task. + +## When to Use This Skill + +Use this skill when you need to perform multi-step operations that require: +- Careful sequencing +- Error handling +- Domain-specific knowledge + +## Prerequisites + +- Required tools or dependencies +- Environment setup +- Access permissions + +## Implementation Steps + +### Step 1: Initialize + +Set up the necessary environment and validate prerequisites. + +```bash +# Example initialization +echo "Initializing..." +``` + +### Step 2: Execute Main Task + +Perform the core operation with proper error handling. + +### Step 3: Cleanup + +Clean up temporary resources and verify completion. + +## Error Handling + +- **Error Type 1**: How to handle and recover +- **Error Type 2**: Alternative approaches + +## Examples + +### Example 1: Basic Usage + +Demonstrates simple case... + +### Example 2: Advanced Usage + +Shows complex scenario... + +## Notes + +Additional considerations and best practices.