plugin-testing

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Plugin Testing

插件测试

Quick Start

快速开始

Test your plugin:
bash
undefined
测试你的插件:
bash
undefined

Validate structure

验证结构

/test-plugin my-plugin
/test-plugin my-plugin

Run all tests

运行所有测试

/test-plugin my-plugin --all
/test-plugin my-plugin --all

Detailed report

详细报告

/test-plugin my-plugin --report
undefined
/test-plugin my-plugin --report
undefined

Testing Levels

测试层级

Unit Tests

单元测试

Test individual components:
markdown
Agent:
  ✅ Description present and valid
  ✅ Capabilities list complete
  ✅ Content properly formatted
  ✅ Status and date included

Skill:
  ✅ Name lowercase-hyphens
  ✅ Quick Start code runs
  ✅ 3+ concepts documented
  ✅ Real projects included

Command:
  ✅ Executes without error
  ✅ Options documented
  ✅ Example output provided
测试独立组件:
markdown
Agent:
  ✅ 描述存在且有效
  ✅ 功能列表完整
  ✅ 内容格式正确
  ✅ 包含状态和日期

Skill:
  ✅ 名称为小写连字符格式
  ✅ 快速开始代码可运行
  ✅ 文档包含3个及以上概念
  ✅ 包含真实项目案例

Command:
  ✅ 可无错误执行
  ✅ 选项已文档化
  ✅ 提供示例输出

Integration Tests

集成测试

Test component interactions:
markdown
Agent → Agent:
  ✅ Agent A links to Agent B
  ✅ Both agents available
  ✅ Integration documented

Agent → Skill:
  ✅ Agent recommends skill
  ✅ Skill accessible
  ✅ Connection clear

Command → Agent:
  ✅ Command invokes agent
  ✅ Agent responds appropriately
  ✅ Workflow makes sense
测试组件间交互:
markdown
Agent → Agent:
  ✅ Agent A可链接到Agent B
  ✅ 两个Agent均可用
  ✅ 集成已文档化

Agent → Skill:
  ✅ Agent推荐Skill
  ✅ Skill可访问
  ✅ 关联逻辑清晰

Command → Agent:
  ✅ Command可调用Agent
  ✅ Agent响应符合预期
  ✅ 工作流合理

Test Checklist

测试检查清单

Structure Tests

结构测试

json
{
  "manifest_valid": {
    "description": "plugin.json valid JSON",
    "check": "JSON.parse(plugin.json)"
  },
  "files_exist": {
    "description": "All referenced files exist",
    "check": "For each agent/skill/command file"
  },
  "naming_correct": {
    "description": "Files follow naming conventions",
    "check": "lowercase-hyphens pattern"
  },
  "references_valid": {
    "description": "All manifested references valid",
    "check": "Check each file path"
  }
}
json
{
  "manifest_valid": {
    "description": "plugin.json为有效JSON",
    "check": "JSON.parse(plugin.json)"
  },
  "files_exist": {
    "description": "所有引用的文件均存在",
    "check": "检查每个agent/skill/command文件"
  },
  "naming_correct": {
    "description": "文件遵循命名规范",
    "check": "小写连字符格式"
  },
  "references_valid": {
    "description": "所有清单中的引用均有效",
    "check": "检查每个文件路径"
  }
}

Content Tests

内容测试

markdown
Agent:
  ✅ YAML frontmatter valid
  ✅ Description < 1024 chars
  ✅ Capabilities 5-10 items
  ✅ Content 250-400 lines
  ✅ Markdown properly formatted

Skill:
  ✅ YAML frontmatter valid
  ✅ Name < 64 chars, lowercase
  ✅ Quick Start code works
  ✅ Core concepts explained
  ✅ Real projects included

Command:
  ✅ Markdown valid
  ✅ Usage clear
  ✅ Options documented
  ✅ Example provided
  ✅ Next steps suggested
markdown
Agent:
  ✅ YAML前置内容有效
  ✅ 描述少于1024字符
  ✅ 功能项为5-10个
  ✅ 内容为250-400行
  ✅ Markdown格式正确

Skill:
  ✅ YAML前置内容有效
  ✅ 名称少于64字符且为小写
  ✅ 快速开始代码可正常运行
  ✅ 核心概念已解释
  ✅ 包含真实项目案例

Command:
  ✅ Markdown格式有效
  ✅ 使用说明清晰
  ✅ 选项已文档化
  ✅ 提供示例
  ✅ 给出后续步骤建议

Functionality Tests

功能测试

markdown
Agent Invocation:
  ✅ Agent loads without error
  ✅ Content renders correctly
  ✅ Integrations accessible
  ✅ No broken links

Skill Loading:
  ✅ Skill accessible from agent
  ✅ Code examples accurate
  ✅ Links functional
  ✅ Metadata correct

Command Execution:
  ✅ Command recognized
  ✅ Options work as documented
  ✅ Output as expected
  ✅ Next steps provided
markdown
Agent调用:
  ✅ Agent可无错误加载
  ✅ 内容渲染正确
  ✅ 集成项可访问
  ✅ 无失效链接

Skill加载:
  ✅ Skill可从Agent中访问
  ✅ 代码示例准确
  ✅ 链接可正常使用
  ✅ 元数据正确

Command执行:
  ✅ Command可被识别
  ✅ 选项按文档描述工作
  ✅ 输出符合预期
  ✅ 提供后续步骤

Test Report Example

测试报告示例

Full Test Report

完整测试报告

markdown
PLUGIN TEST REPORT
═══════════════════════════════════════
Plugin: my-plugin
Version: 1.0.0
Date: 2025-01-18

STRUCTURE TESTS
  ✅ Manifest valid (5/5)
  ✅ Files exist (8/8)
  ✅ Naming correct (6/6)
  ├─ Result: PASS

CONTENT TESTS
  ✅ Agents valid (3/3)
  ✅ Skills valid (5/5)
  ✅ Commands valid (4/4)
  ├─ Result: PASS

FUNCTIONALITY TESTS
  ✅ Agents invoke (3/3)
  ✅ Skills load (5/5)
  ✅ Commands execute (4/4)
  ├─ Result: PASS

QUALITY SCORE: 98% ✅
READY FOR PRODUCTION: YES ✅
═══════════════════════════════════════
markdown
插件测试报告
═══════════════════════════════════════
插件: my-plugin
版本: 1.0.0
日期: 2025-01-18

结构测试
  ✅ 清单有效 (5/5)
  ✅ 文件存在 (8/8)
  ✅ 命名正确 (6/6)
  ├─ 结果: 通过

内容测试
  ✅ Agent有效 (3/3)
  ✅ Skill有效 (5/5)
  ✅ Command有效 (4/4)
  ├─ 结果: 通过

功能测试
  ✅ Agent可调用 (3/3)
  ✅ Skill可加载 (5/5)
  ✅ Command可执行 (4/4)
  ├─ 结果: 通过

质量评分: 98% ✅
可用于生产环境: 是 ✅
═══════════════════════════════════════

Common Test Failures

常见测试失败情况

JSON Syntax Error

JSON语法错误

❌ Error in plugin.json line 15
  Missing comma after "name": "value"

Fix:
  "name": "value",  ← Add comma
  "version": "1.0.0"
❌ plugin.json第15行存在错误
  "name": "value"后缺少逗号

修复方法:
  "name": "value",  ← 添加逗号
  "version": "1.0.0"

File Not Found

文件未找到

❌ Agent agents/missing.md referenced but not found

Fix:
  1. Create the file, OR
  2. Remove reference from plugin.json
❌ 引用了agents/missing.md但文件不存在

修复方法:
  1. 创建该文件,或
  2. 从plugin.json中移除该引用

Invalid YAML

无效YAML

❌ Invalid YAML in agents/agent.md

Fix:
  - Check indentation (use spaces, not tabs)
  - Ensure quotes around values with special chars
  - Verify array syntax with dashes
❌ agents/agent.md中存在无效YAML

修复方法:
  - 检查缩进(使用空格,而非制表符)
  - 确保含特殊字符的值加引号
  - 验证数组的短横线语法

Content Too Short

内容过短

⚠️  Warning: Skill content only 150 lines
   Recommended: 200-300 lines

Fix:
  - Add more examples
  - Expand core concepts
  - Include more projects
⚠️  警告:Skill内容仅150行
   建议:200-300行

修复方法:
  - 添加更多示例
  - 扩展核心概念
  - 包含更多项目案例

Performance Testing

性能测试

Load Time Baseline

加载时间基准

Agent initialization:   < 500ms ✅
Skill loading:         < 300ms ✅
Command execution:     < 2s   ✅
Overall workflow:      < 5s   ✅
Agent初始化:   < 500ms ✅
Skill加载:         < 300ms ✅
Command执行:     < 2s   ✅
整体工作流:      < 5s   ✅

Size Limits

大小限制

Agent files:    < 400 lines ✅
Skill files:    < 300 lines ✅
Command files:  < 150 lines ✅
Manifest:       < 50KB      ✅
Agent文件:    < 400行 ✅
Skill文件:    < 300行 ✅
Command文件:  < 150行 ✅
清单文件:       < 50KB      ✅

Automated Testing

自动化测试

Test Command

测试命令

bash
undefined
bash
undefined

Quick test (5 min)

快速测试(5分钟)

/test-plugin my-plugin
/test-plugin my-plugin

Full test (10 min)

完整测试(10分钟)

/test-plugin my-plugin --full
/test-plugin my-plugin --full

Continuous monitoring

持续监控

/test-plugin my-plugin --watch
undefined
/test-plugin my-plugin --watch
undefined

Test Categories

测试类别

✅ Structure tests
✅ Content validation
✅ Format checking
✅ Reference validation
✅ Performance baseline
✅ Integration tests
✅ 结构测试
✅ 内容验证
✅ 格式检查
✅ 引用验证
✅ 性能基准测试
✅ 集成测试

Pre-Deployment Testing

部署前测试

Checklist

检查清单

markdown
[ ] All structure tests pass
[ ] All content validation passes
[ ] No broken references
[ ] Performance acceptable
[ ] Documentation complete
[ ] Examples working
[ ] Error messages helpful
[ ] Integration smooth
[ ] User acceptance tested
[ ] Ready for marketplace
markdown
[ ] 所有结构测试通过
[ ] 所有内容验证通过
[ ] 无失效引用
[ ] 性能符合要求
[ ] 文档完整
[ ] 示例可正常运行
[ ] 错误提示有帮助性
[ ] 集成顺畅
[ ] 用户验收测试完成
[ ] 可发布到市场

Release Testing

发布测试

Before release:
  ✅ Version bumped
  ✅ CHANGELOG updated
  ✅ All tests passing
  ✅ Documentation updated
  ✅ Examples verified
  ✅ Performance baseline met
  ✅ Code reviewed

Use this skill when:
  • Testing plugin components
  • Validating structure
  • Checking quality
  • Before deployment
  • Finding and fixing issues

Status: ✅ Production Ready | SASMP: v1.3.0 | Bonded Agent: 04-plugin-tester
发布前:
  ✅ 版本号已更新
  ✅ CHANGELOG已更新
  ✅ 所有测试通过
  ✅ 文档已更新
  ✅ 示例已验证
  ✅ 达到性能基准
  ✅ 代码已评审

在以下场景使用本Skill:
  • 测试插件组件
  • 验证结构
  • 检查质量
  • 部署前
  • 查找并修复问题

状态: ✅ 可用于生产环境 | SASMP: v1.3.0 | 关联Agent: 04-plugin-tester