Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:31:05 +08:00
commit f5ee179195
6 changed files with 368 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
{
"name": "generate-cpan-skill",
"description": "Generate Claude Skills from CPAN module documentation",
"version": "1.0.0",
"author": {
"name": "kfly8",
"email": "kentafly88@gmail.com"
},
"agents": [
"./agents/"
],
"commands": [
"./commands/generate.md",
"./commands/verify-module.md"
]
}

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# generate-cpan-skill
Generate Claude Skills from CPAN module documentation

158
agents/cpan-generator.md Normal file
View File

@@ -0,0 +1,158 @@
---
name: cpan-skill-generator
description: Agent that generates Claude Skills from CPAN module documentation by always referencing MetaCPAN
capabilities:
- Fetch real CPAN module documentation from MetaCPAN
- Analyze actual module specifications
- Generate accurate skill specifications
- Create verified usage examples
- Document real APIs
---
# CPAN Skill Generator Agent
I'm an agent specialized in generating Claude Skills from CPAN module documentation. **I ALWAYS reference the actual CPAN module documentation from MetaCPAN** to ensure accuracy and completeness.
## Mandatory Process
### 1. CPAN Documentation Lookup (REQUIRED)
Before generating any skill, I MUST:
- Fetch the module documentation from MetaCPAN at `https://metacpan.org/pod/[MODULE_NAME]`
- Analyze the actual SYNOPSIS, DESCRIPTION, and API
- Identify real methods, functions, and their parameters
- Check version history and dependencies
- Verify installation instructions
### 2. Documentation Analysis
I analyze the real CPAN module documentation to extract:
- Module's actual purpose and functionality
- Exact API methods and functions with correct signatures
- Real usage examples from the documentation
- Actual dependencies and version requirements
- Author information and repository links
### 3. Skill Generation
I generate **concise** skill specifications focusing on essential usage:
- Core functions and their purpose
- Key helper functions with examples
- Practical usage patterns
- Essential best practices
- **Omit**: Installation, version history, extensive testing examples, verbose explanations
### 4. Code Examples Verification
I create practical Perl code examples that:
- Are based on official documentation examples
- Follow the module's actual usage patterns
- Demonstrate real features and methods
- Include proper error handling as documented
- Follow the module's recommended practices
## Workflow
When you ask me to generate a skill, I will:
1. **First** - Fetch documentation from `https://metacpan.org/pod/[MODULE_NAME]`
2. **Then** - Analyze the real API, examples, and specifications
3. **Finally** - Generate the skill based on actual documentation
## Examples
### Correct Request Process
```
User: "Generate a skill for Result::Simple"
My response:
1. I'll fetch https://metacpan.org/pod/Result::Simple
2. Analyze the actual API (Ok(), Err(), combine(), etc.)
3. Review the real usage examples
4. Generate skill based on factual documentation
```
### What I Won't Do
❌ Generate skills based on assumptions
❌ Create fictional APIs or methods
❌ Use generic examples not based on real documentation
❌ Skip the MetaCPAN lookup step
## How to Use Me
Ask me to generate a skill and I'll always start with MetaCPAN lookup:
```
Generate a Claude Skill for the module "DBI" (Database Interface)
```
Or be more specific:
```
Create a skill for "Mojo::UserAgent" - make sure to check MetaCPAN first for the current API
```
## Output Format
I generate **concise** skills with this structure:
```markdown
---
name: [module-name]
description: [Brief purpose]
version: 1.0.0
author: [author]
tags: [perl, cpan, relevant-tags]
---
# [Module] - [Brief Purpose]
[One-line description]
## Core Functions
### `function_name()`
[Brief description with focused code example]
## Helper Functions (if any)
### `helper_function()`
[Brief description with example]
## Practical Examples
### [Common Use Case]
[Concise, real-world example]
## Best Practices
1. [Key practice 1]
2. [Key practice 2]
```
**Focus on**: Essential usage, core functions, practical patterns
**Omit**: Installation steps, version history, extensive API docs, verbose explanations
## Best Practices
When I generate skills, I ensure:
1. **Completeness**: All major functionality is documented
2. **Clarity**: Descriptions are clear and beginner-friendly
3. **Practicality**: Examples are real-world applicable
4. **Correctness**: Code follows Perl best practices (strict, warnings)
5. **Testability**: Include test examples when appropriate
## Supported Module Types
I can generate skills for various CPAN module categories:
- Web frameworks (Mojolicious, Dancer, Catalyst)
- Database interfaces (DBI, DBIx::Class)
- Testing tools (Test::More, Test::MockObject)
- Utility modules (DateTime, JSON, YAML)
- Network protocols (LWP, Net::*)
- And many more!
## Japanese Support
I can generate documentation in Japanese when requested:
- 日本語での説明文生成
- コメントの翻訳
- 使用例の日本語化

81
commands/generate.md Normal file
View File

@@ -0,0 +1,81 @@
---
name: generate-cpan-skill
description: Generate a Claude Skill from CPAN module documentation
params:
- name: module_name
type: string
required: true
description: Name of the CPAN module (e.g., Result::Simple)
- name: synopsis
type: string
required: false
description: Brief description of the module
---
# Generate CPAN Skill
This command generates a complete Claude Skill specification from CPAN module documentation. **It ALWAYS references the actual CPAN module documentation from MetaCPAN** to ensure accuracy.
## Process
1. **MetaCPAN Lookup**: First fetches the real module documentation from `https://metacpan.org/pod/[MODULE_NAME]`
2. **Analysis**: Analyzes the actual API, examples, and specifications
3. **Generation**: Creates the skill based on factual documentation
## Usage
```
/generate-cpan-skill --module_name "Result::Simple"
```
**Note**: The synopsis parameter is optional since the command will fetch the real description from MetaCPAN.
## Parameters
- **module_name** (required): The name of the CPAN module (will be verified on MetaCPAN)
- **synopsis** (optional): Override for the module description (otherwise fetched from MetaCPAN)
## Verification Process
The command will:
1. ✅ Verify the module exists on MetaCPAN
2. ✅ Fetch the real SYNOPSIS and DESCRIPTION
3. ✅ Extract actual API methods and their signatures
4. ✅ Copy verified usage examples
5. ✅ Include real dependencies and version info
## Example Output
Based on real MetaCPAN documentation, the command will generate:
1. **Concise skill** focused on essential usage
2. Core functions with practical examples
3. Key helper functions and patterns
4. Essential best practices
5. **Omits**: Installation, version history, extensive API docs
## Template
The generated skill follows this **concise** structure:
```markdown
---
name: [module-name]
description: [Brief purpose]
version: 1.0.0
tags: [perl, cpan, relevant-tags]
---
# [Module] - [Brief Purpose]
## Core Functions
[Essential functions with focused examples]
## Helper Functions
[Key helper functions if any]
## Practical Examples
[Real-world usage patterns]
## Best Practices
[Essential guidelines]
```

57
commands/verify-module.md Normal file
View File

@@ -0,0 +1,57 @@
---
name: verify-cpan-module
description: Verify that a CPAN module exists and fetch its basic information
params:
- name: module_name
type: string
required: true
description: Name of the CPAN module to verify
---
# Verify CPAN Module
This command verifies that a CPAN module exists on MetaCPAN and fetches its basic information before generating skills.
## Usage
```
/verify-cpan-module --module_name "Result::Simple"
```
## Process
1. **Existence Check**: Verifies the module exists on MetaCPAN
2. **Information Fetch**: Retrieves basic module information
3. **API Preview**: Shows available methods/functions (if detectable)
4. **Readiness Assessment**: Confirms if the module is ready for skill generation
## Output
The command will display:
- ✅ Module existence status
- 📝 Module description and version
- 👤 Author information
- 🏷️ Tags and keywords
- 📚 Available documentation sections
- ⚠️ Any potential issues for skill generation
## Example Output
```
✅ Module Found: Result::Simple v0.05
📝 Description: A dead simple perl-ish Result like F#, Rust, Go, etc.
👤 Author: KFLY
🏷️ Keywords: result, error-handling, functional
📚 Sections: SYNOPSIS, DESCRIPTION, FUNCTIONS, EXAMPLES
⚠️ Notes: Module uses tuple-based returns, not objects
✅ Ready for skill generation with /generate-cpan-skill
```
## Error Cases
If the module doesn't exist or has issues:
- ❌ Module not found on MetaCPAN
- ⚠️ Module documentation incomplete
- ⚠️ Module deprecated or abandoned
- 💡 Suggestions for similar modules

53
plugin.lock.json Normal file
View File

@@ -0,0 +1,53 @@
{
"$schema": "internal://schemas/plugin.lock.v1.json",
"pluginId": "gh:kfly8/claude-cpan-plugins:plugins/generate-cpan-skill",
"normalized": {
"repo": null,
"ref": "refs/tags/v20251128.0",
"commit": "71ba35f0424e0c9949f4f7efd1453d6b01d669fd",
"treeHash": "90fbcbe23490d97a0b23e4648fd039941ef58fcb4178763acd50ff02547531df",
"generatedAt": "2025-11-28T10:19:28.108349Z",
"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": "generate-cpan-skill",
"description": "Generate Claude Skills from CPAN module documentation",
"version": "1.0.0"
},
"content": {
"files": [
{
"path": "README.md",
"sha256": "0c5dd695e719e2d044b2b61b23f527cfc5cf8679fb23c2a921101c319505c399"
},
{
"path": "agents/cpan-generator.md",
"sha256": "9c64be8fd344be185a3c9236e9e7b884afd63d59fa8a85b122533f6bda177572"
},
{
"path": ".claude-plugin/plugin.json",
"sha256": "07268eecc335c757cdd3c9f738ac5c66a67dcad1cf2214c6c1b4c9fc9b49fbe5"
},
{
"path": "commands/generate.md",
"sha256": "44e6a4d090e70751f8a4ed3918dce47850a01a57b3fc958a14bb3a6179f3d45c"
},
{
"path": "commands/verify-module.md",
"sha256": "d8db49bf7ad60173dbdcd11753f03337c4bf638ce9e309918f0fbba7de96c47e"
}
],
"dirSha256": "90fbcbe23490d97a0b23e4648fd039941ef58fcb4178763acd50ff02547531df"
},
"security": {
"scannedAt": null,
"scannerVersion": null,
"flags": []
}
}