Skip to content

Commit fd49f72

Browse files
authored
feat(cli): add skill command for SKILL.md generation (#40)
* feat(mcp-skill): extract skill module to new crate Phase 1 of generate-skill CLI command implementation: - Create mcp-skill crate with skill generation logic - Move parser, context, template modules from mcp-server - Add validate_server_id() and extract_skill_metadata() functions - Apply performance fixes (LazyLock for Handlebars template) - Apply security fixes (path canonicalization, symlink protection) - Add DoS protection tests (TooManyFiles, FileTooLarge) - Reduce code duplication between crates All 564 tests passing. * feat(cli): add skill command for SKILL.md generation Add CLI command to generate Claude Code skill files from progressive loading TypeScript files. Key features: - Parse JSDoc metadata (@tool, @server, @category, @Keywords, @description) - Build skill context with automatic categorization and examples - Multi-layer security: path traversal, symlink, DoS protection - Refactor main.rs to modular cli.rs/runner.rs structure The skill command outputs a structured prompt suitable for LLM-based SKILL.md generation. For optimal results, MCP server is recommended as it can leverage LLM summarization for more concise output. * style: fix formatting * fix: remove unnecessary raw string hashes (clippy) * fix: use char instead of string in starts_with (clippy) * fix: allow cast_possible_truncation in test * fix: update doc examples to use mcp_skill imports
1 parent b5b21f0 commit fd49f72

File tree

23 files changed

+2427
-987
lines changed

23 files changed

+2427
-987
lines changed

Cargo.lock

Lines changed: 18 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ dhat = "0.3"
2424
dialoguer = "0.12"
2525
dirs = "6.0"
2626
handlebars = "6.4"
27-
mcp-codegen = { path = "crates/mcp-codegen" }
28-
mcp-core = { path = "crates/mcp-core" }
29-
mcp-files = { path = "crates/mcp-files" }
30-
mcp-introspector = { path = "crates/mcp-introspector" }
31-
mcp-server = { path = "crates/mcp-server" }
27+
mcp-codegen = { path = "crates/mcp-codegen", version = "0.6.3" }
28+
mcp-core = { path = "crates/mcp-core", version = "0.6.3"}
29+
mcp-files = { path = "crates/mcp-files", version = "0.6.3" }
30+
mcp-introspector = { path = "crates/mcp-introspector", version = "0.6.3"}
31+
mcp-server = { path = "crates/mcp-server", version = "0.6.3"}
32+
mcp-skill = { path = "crates/mcp-skill", version = "0.6.3"}
3233
rayon = "1.11"
3334
regex = "1.12"
3435
rmcp = "0.12"

crates/mcp-cli/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ mcp-codegen = { workspace = true }
3232
mcp-core = { workspace = true }
3333
mcp-introspector = { workspace = true }
3434
mcp-files = { workspace = true }
35+
mcp-skill = { workspace = true }
3536
serde = { workspace = true, features = ["derive"] }
3637
serde_json = { workspace = true }
3738
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "fs"] }

crates/mcp-cli/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,44 @@ mcp-execution-cli introspect --http https://api.example.com/mcp \
160160
--header "Authorization=Bearer token"
161161
```
162162

163+
### `skill`
164+
165+
Generate Claude Code skill files (SKILL.md) from progressive loading tools:
166+
167+
```bash
168+
mcp-execution-cli skill --server <SERVER_ID> [OPTIONS]
169+
```
170+
171+
**Options**:
172+
173+
- `--server, -s <ID>`: Server identifier (required)
174+
- `--servers-dir <PATH>`: Custom servers directory
175+
- `--output, -o <PATH>`: Custom output path
176+
- `--skill-name <NAME>`: Custom skill name
177+
- `--hint <HINT>`: Use case hints (repeatable)
178+
- `--overwrite`: Overwrite existing SKILL.md
179+
180+
**Examples**:
181+
182+
```bash
183+
# Generate skill for GitHub server
184+
mcp-execution-cli skill --server github
185+
186+
# With custom output and hints
187+
mcp-execution-cli skill --server github \
188+
--output ~/.claude/skills/github/SKILL.md \
189+
--hint "managing pull requests" \
190+
--hint "code review"
191+
192+
# Overwrite existing skill
193+
mcp-execution-cli skill --server github --overwrite
194+
```
195+
196+
> [!TIP]
197+
> For optimal results, prefer using the MCP server (`mcp-server`) for skill generation.
198+
> The MCP server can leverage LLM capabilities to summarize tool descriptions and reduce
199+
> context size, resulting in more concise and effective skill files.
200+
163201
### `stats`
164202

165203
View cache statistics:
@@ -212,6 +250,7 @@ This crate is part of the [mcp-execution](https://github.com/bug-ops/mcp-executi
212250
- [`mcp-introspector`](../mcp-introspector) - MCP server analysis
213251
- [`mcp-codegen`](../mcp-codegen) - TypeScript code generation
214252
- [`mcp-files`](../mcp-files) - Virtual filesystem
253+
- [`mcp-skill`](../mcp-skill) - Skill generation
215254
- [`mcp-server`](../mcp-server) - MCP server
216255

217256
## MSRV Policy

0 commit comments

Comments
 (0)