In SKILL.md
【免费下载链接】ruflo🌊 The original agent meta-harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, RAG integration, and native Claude Code / Codex / Hermes and many more Integrated项目地址: https://gitcode.com/GitHub_Trending/cl/ruflo
See Advanced Configuration for complex scenarios. See API Reference for complete documentation. Use template:resources/templates/api-template.js
Claude will load these files ONLY if needed
**收益量化**:安装 100+ 个技能仅占用约 6KB 上下文;只有激活技能的正文(1–10KB)才会进入上下文。这正是 Ruflo 能同时承载 40+ 打包技能(含 v3 生态中 `@claude-flow` 各模块技能)而不会拖垮会话的底层原因。 ## 6. SKILL.md 内容结构:推荐的 4 级内容模型 一份好的技能正文应遵循从"概览"到"罕见场景参考"的 4 层递进,让不同需求深度的调用方各取所需:name: "Your Skill Name" description: "What it does and when to use it"
Your Skill Name
Level 1: Overview (Always Read First)
Brief 2-3 sentence description of the skill.
Prerequisites
- Requirement 1
- Requirement 2
What This Skill Does
- Primary function
- Secondary function
- Key benefit
Level 2: Quick Start (For Fast Onboarding)
Basic Usage
# Simplest use case command --option valueCommon Scenarios
- Scenario 1: How to...
- Scenario 2: How to...
Level 3: Detailed Instructions (For Deep Work)
Step-by-Step Guide
Step 1: Initial Setup
# CommandsExpected output:
Success messageStep 2: Configuration
- Configuration option 1
- Configuration option 2
Step 3: Execution
- Run the main command
- Verify results
Advanced Options
Option 1: Custom Configuration
# Advanced usageOption 2: Integration
# Integration stepsLevel 4: Reference (Rarely Needed)
Troubleshooting
Issue: Common Problem
Symptoms: What you seeCause: Why it happensSolution: How to fix
# Fix commandIssue: Another Problem
Solution: Steps to resolve
Complete API Reference
See API_REFERENCE.md
Examples
See examples/
Related Skills
- Related Skill 1
- Related Skill 2
> 注:上述 `docs/`、`resources/` 路径属于某个技能目录**内部的相对引用**示例,并非本仓库文件;它们演示的是"技能正文保持精简、把深度内容外置并按需加载"的写法。 ## 7. 内容编写最佳实践 ### 7.1 写出高命中率的 description **关键词前置(Front-Load Keywords)**:Claude 通过扫描 description 匹配技能,关键词必须出现在开头: ```yaml # ✅ GOOD: Keywords first description: "Generate TypeScript interfaces from JSON schema. Use when converting schemas, creating types, or building API clients." # ❌ BAD: Keywords buried description: "This skill helps developers who need to work with JSON schemas by providing a way to generate TypeScript interfaces."显式声明触发条件(Include Trigger Conditions):
# ✅ GOOD: Clear "when" clause description: "Debug React performance issues using Chrome DevTools. Use when components re-render unnecessarily, investigating slow updates, or optimizing bundle size." # ❌ BAD: No trigger conditions description: "Helps with React performance debugging."描述要具体(Be Specific):
# ✅ GOOD: Specific technologies description: "Create Express.js REST endpoints with Joi validation, Swagger docs, and Jest tests. Use when building new APIs or adding endpoints." # ❌ BAD: Too generic description: "Build API endpoints with proper validation and testing."7.2 渐进式写作原则
- Level 1 保持简短:概览用 1–2 句话讲清"做什么、几步骤完成";
- Level 2 覆盖 80% 高频路径:给出最常用的一条命令即达;
- Level 3 展开细节:逐步引导完成主流程与高级选项;
- Level 4 收纳边界场景:复杂场景(HOC、render props、自定义 hooks 等)一律外链到
ADVANCED.md等独立文档。
仓库实例佐证:以 plugin/skills/pair-programming/SKILL.md(1202 行)为例,它的正文结构是标准的"
## What This Skill Does(能力清单)→## Prerequisites(前置条件)→## Quick Start(基础会话与 TDD 会话两条快路径)→## Complete Guide(Session 控制、模式、验证等长文档)";description 同时写明了 what 与 when。这正是 Skill Builder 规范在真实技能上的落地样本。
8. 添加脚本与资源
8.1 scripts/ 目录
可执行脚本统一放在技能目录下的scripts/,并在SKILL.md中引用:
# In skill directory scripts/ ├── setup.sh # Initialization script ├── validate.js # Validation logic ├── generate.py # Code generation └── deploy.sh # Deployment script## Setup Run the setup script: ```bash ./scripts/setup.shValidation
Validate your configuration:
node scripts/validate.js config.json### 8.2 resources/ 目录 模板、示例、schema 等静态资源放入 `resources/`,供脚本引用或复制: ```bash resources/ ├── templates/ │ ├── component.tsx.template │ ├── test.spec.ts.template │ └── story.stories.tsx.template ├── examples/ │ ├── basic-example/ │ ├── advanced-example/ │ └── integration-example/ └── schemas/ ├── config.schema.json └── output.schema.json## Templates Use the component template: ```bash cp resources/templates/component.tsx.template src/components/MyComponent.tsxExamples
See working examples inresources/examples/:
basic-example/- Simple componentadvanced-example/- With hooks and context
9. 文件引用与导航模式
Claude 能够自动导航到被引用的文件,支持三种引用写法:
Markdown 链接(跨文档):
See Advanced Configuration for complex scenarios. See Troubleshooting Guide if you encounter errors.相对路径(引用目录/资源):
Use the template located at `resources/templates/api-template.js` See examples in `resources/examples/basic-usage/`内联文件内容(贴出关键片段):
## Example Configuration See `resources/examples/config.json`: ```json { "option": "value" }**核心实践建议:让 SKILL.md 保持精简(约 2–5KB),长内容拆分到独立文件并在正文引用。** Claude 只会按需加载被访问的文件,这是控制上下文开销的关键杠杆。 ## 10. 发布前的验证清单 在发布技能前逐项核对: **YAML Frontmatter:** - [ ] 以 `---` 开头 - [ ] 包含 `name` 字段(≤64 字符) - [ ] 包含 `description` 字段(≤1024 字符) - [ ] description 同时含 "what" 与 "when" - [ ] 以 `---` 结束 - [ ] 无 YAML 语法错误 **文件结构:** - [ ] `SKILL.md` 存在于技能目录中 - [ ] 目录直接位于 `~/.claude/skills/[skill-name]/` 或 `.claude/skills/[skill-name]/` - [ ] 目录名清晰、有描述性 - [ ] **无嵌套子目录**(Claude Code 要求顶层结构) **内容质量:** - [ ] Level 1(概览)简短清晰 - [ ] Level 2(快速开始)给出常见用例 - [ ] Level 3(细节)提供逐步指南 - [ ] Level 4(参考)链接到进阶内容 - [ ] 示例具体且可运行 - [ ] Troubleshooting 覆盖常见问题 **渐进式披露:** - [ ] 核心指令留在 `SKILL.md`(约 2–5KB) - [ ] 进阶内容置于独立 `docs/` - [ ] 大型资源放入 `resources/` 目录 - [ ] 层级间导航清晰 **测试:** - [ ] 技能出现在 Claude 技能列表 - [ ] description 能被相关提问触发 - [ ] 指令清晰可执行 - [ ] 内置脚本执行成功 - [ ] 示例按文档可用 > **仓库工程化延伸**:人工清单之外,Ruflo 用脚本将上述校验自动化。执行 `node scripts/audit-skill-frontmatter.mjs` 即可全仓扫描(也支持 `--format json` 输出机器可读结果、`--only <plugin>` 单插件聚焦);其检查项(frontmatter 闭合、`name`/`description` 非空、`allowed-tools` 非通配、name 与目录名一致)与本文清单形成互补。退出码约定:`0` 无违规、`1` 存在违规、`2` 扫描错误(找不到插件目录)。 ## 11. 开箱即用的三套模板 ### 模板 1:基础技能(最小可用) ````text --- name: "My Basic Skill" description: "One sentence what. One sentence when to use." --- # My Basic Skill ## What This Skill Does [2-3 sentences describing functionality] ## Quick Start ```bash # Single command to get startedStep-by-Step Guide
Step 1: Setup
[Instructions]
Step 2: Usage
[Instructions]
Step 3: Verify
[Instructions]
Troubleshooting
- Issue: Problem description
- Solution: Fix description
模板 2:进阶技能(带脚本)
--- name: "My Intermediate Skill" description: "Detailed what with key features. When to use with specific triggers: scaffolding, generating, building." --- # My Intermediate Skill ## Prerequisites - Requirement 1 - Requirement 2 ## What This Skill Does 1. Primary function 2. Secondary function 3. Integration capability ## Quick Start ```bash ./scripts/setup.sh ./scripts/generate.sh my-project ``` ## Configuration Edit `config.json`: ```json { "option1": "value1", "option2": "value2" } ``` ## Step-by-Step Guide ### Basic Usage [Steps for 80% use case] ### Advanced Usage [Steps for complex scenarios] ## Available Scripts - `scripts/setup.sh` - Initial setup - `scripts/generate.sh` - Code generation - `scripts/validate.sh` - Validation ## Resources - Templates: `resources/templates/` - Examples: `resources/examples/` ## Troubleshooting [Common issues and solutions] ```模板 3:高级技能(完整功能)
--- name: "My Advanced Skill" description: "Comprehensive what with all features and integrations. Use when [trigger 1], [trigger 2], or [trigger 3]. Supports [technology stack]." --- # My Advanced Skill ## Overview [Brief 2-3 sentence description] ## Prerequisites - Technology 1 (version X+) - Technology 2 (version Y+) - API keys or credentials ## What This Skill Does 1. **Core Feature**: Description 2. **Integration**: Description 3. **Automation**: Description --- ## Quick Start (60 seconds) ### Installation ```bash ./scripts/install.sh ``` ### First Use ```bash ./scripts/quickstart.sh ``` Expected output: ``` ✓ Setup complete ✓ Configuration validated → Ready to use ``` --- ## Configuration ### Basic Configuration Edit `config.json`: ```json { "mode": "production", "features": ["feature1", "feature2"] } ``` ### Advanced Configuration See [Configuration Guide](https://link.gitcode.com/i/42a061ba185f933fc0d2e1f4046ffb9e) --- ## Step-by-Step Guide ### 1. Initial Setup [Detailed steps] ### 2. Core Workflow [Main procedures] ### 3. Integration [Integration steps] --- ## Advanced Features ### Feature 1: Custom Templates ```bash ./scripts/generate.sh --template custom ``` ### Feature 2: Batch Processing ```bash ./scripts/batch.sh --input data.json ``` ### Feature 3: CI/CD Integration See CI/CD Guide --- ## Scripts Reference | Script | Purpose | Usage | |--------|---------|-------| | `install.sh` | Install dependencies | `./scripts/install.sh` | | `generate.sh` | Generate code | `./scripts/generate.sh [name]` | | `validate.sh` | Validate output | `./scripts/validate.sh` | | `deploy.sh` | Deploy to environment | `./scripts/deploy.sh [env]` | --- ## Resources ### Templates - `resources/templates/basic.template` - Basic template - `resources/templates/advanced.template` - Advanced template ### Examples - `resources/examples/basic/` - Simple example - `resources/examples/advanced/` - Complex example - `resources/examples/integration/` - Integration example ### Schemas - `resources/schemas/config.schema.json` - Configuration schema - `resources/schemas/output.schema.json` - Output validation --- ## Troubleshooting ### Issue: Installation Failed **Symptoms**: Error during `install.sh` **Cause**: Missing dependencies **Solution**: ```bash # Install prerequisites npm install -g required-package ./scripts/install.sh --force ``` ### Issue: Validation Errors **Symptoms**: Validation script fails **Solution**: See Troubleshooting Guide --- ## API Reference Complete API documentation: API_REFERENCE.md ## Related Skills - Related Skill 1 - Related Skill 2 ```三套模板覆盖了技能的典型演化路径:先以模板 1 跑通"能被发现、能被触发",再按需引入脚本与资源(模板 2),最终演进为含配置体系、脚本引用表、故障排查、CI/CD 集成的完整技能(模板 3)。
12. 实战范例解析
范例 1:文档生成类技能
--- name: "README Generator" description: "Generate comprehensive README.md files for GitHub repositories. Use when starting new projects, documenting code, or improving existing READMEs." --- # README Generator ## What This Skill Does Creates well-structured README.md files with badges, installation, usage, and contribution sections. ## Quick Start ```bash # Answer a few questions ./scripts/generate-readme.sh # README.md created with: # - Project title and description # - Installation instructions # - Usage examples # - Contribution guidelines ``` ## Customization Edit sections in `resources/templates/sections/` before generating. ```解读:description 把 what(生成完整 README)与 when(新项目、写文档、改进旧 README)压缩在同一句里;正文通过 Quick Start 快速展示产物结构,把可定制面收敛到resources/templates/sections/一处——典型的 Level 2 快路径 + Level 3 深度定位设计。
范例 2:代码生成类技能
--- name: "React Component Generator" description: "Generate React functional components with TypeScript, hooks, tests, and Storybook stories. Use when creating new components, scaffolding UI, or following component architecture patterns." --- # React Component Generator ## Prerequisites - Node.js 18+ - React 18+ - TypeScript 5+ ## Quick Start ```bash ./scripts/generate-component.sh MyComponent # Creates: # - src/components/MyComponent/MyComponent.tsx # - src/components/MyComponent/MyComponent.test.tsx # - src/components/MyComponent/MyComponent.stories.tsx # - src/components/MyComponent/index.ts ``` ## Step-by-Step Guide ### 1. Run Generator ```bash ./scripts/generate-component.sh ComponentName ``` ### 2. Choose Template - Basic: Simple functional component - With State: useState hooks - With Context: useContext integration - With API: Data fetching component ### 3. Customize Edit generated files in `src/components/ComponentName/` ## Templates See `resources/templates/` for available component templates. ``` `【免费下载链接】ruflo🌊 The original agent meta-harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, RAG integration, and native Claude Code / Codex / Hermes and many more Integrated项目地址: https://gitcode.com/GitHub_Trending/cl/ruflo
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考