sensei
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSensei
Sensei
"A true master teaches not by telling, but by refining." - The Skill Sensei
Automates skill frontmatter improvement using the Ralph loop pattern - iteratively improving skills until they reach Medium-High compliance with passing tests, then checking token usage and prompting for action.
“真正的大师不是通过说教,而是通过打磨来传授技艺。” —— Skill Sensei
使用Ralph循环模式自动完成Skill frontmatter的改进——迭代优化Skill,直至其达到中高合规性且测试通过,随后检查令牌使用情况并提示用户采取行动。
Help
帮助
When user says "sensei help" or asks how to use sensei, show this:
╔══════════════════════════════════════════════════════════════════╗
║ SENSEI - Skill Frontmatter Compliance Improver ║
╠══════════════════════════════════════════════════════════════════╣
║ ║
║ USAGE: ║
║ Run sensei on <skill-name> # Single skill ║
║ Run sensei on <skill-name> --skip-integration # Fast mode ║
║ Run sensei on <skill1>, <skill2>, ... # Multiple skills ║
║ Run sensei on all Low-adherence skills # Batch by score ║
║ Run sensei on all skills # All skills ║
║ ║
║ EXAMPLES: ║
║ Run sensei on appinsights-instrumentation ║
║ Run sensei on azure-security --skip-integration ║
║ Run sensei on azure-security, azure-networking ║
║ Run sensei on all Low-adherence skills ║
║ ║
║ WHAT IT DOES: ║
║ 1. READ - Load skill's SKILL.md, tests, and token count ║
║ 2. SCORE - Check compliance (Low/Medium/Medium-High/High) ║
║ 3. SCAFFOLD- Create tests from template if missing ║
║ 4. IMPROVE - Add USE FOR triggers + DO NOT USE FOR ║
║ 5. TEST - Run tests, fix if needed ║
║ 6. TOKENS - Check token budget, gather suggestions ║
║ 7. SUMMARY - Show before/after with suggestions ║
║ 8. PROMPT - Ask: Commit, Create Issue, or Skip? ║
║ 9. REPEAT - Until Medium-High score + tests pass ║
║ ║
║ TARGET SCORE: Medium-High ║
║ ✓ Description > 150 chars ║
║ ✓ Has "USE FOR:" trigger phrases ║
║ ✓ Has "DO NOT USE FOR:" anti-triggers ║
║ ✓ SKILL.md < 500 tokens (soft limit) ║
║ ║
║ MORE INFO: ║
║ See .github/skills/sensei/README.md for full documentation ║
║ ║
╚══════════════════════════════════════════════════════════════════╝当用户输入“sensei help”或询问如何使用sensei时,显示以下内容:
╔══════════════════════════════════════════════════════════════════╗
║ SENSEI - Skill Frontmatter合规性提升工具 ║
╠══════════════════════════════════════════════════════════════════╣
║ ║
║ 使用方法: ║
║ Run sensei on <skill-name> # 单个Skill ║
║ Run sensei on <skill-name> --skip-integration # 快速模式 ║
║ Run sensei on <skill1>, <skill2>, ... # 多个Skill ║
║ Run sensei on all Low-adherence skills # 按分数批量处理 ║
║ Run sensei on all skills # 所有Skill ║
║ ║
║ 示例: ║
║ Run sensei on appinsights-instrumentation ║
║ Run sensei on azure-security --skip-integration ║
║ Run sensei on azure-security, azure-networking ║
║ Run sensei on all Low-adherence skills ║
║ ║
║ 功能说明: ║
║ 1. 读取 - 加载Skill的SKILL.md、测试用例和令牌计数 ║
║ 2. 评分 - 检查合规性(低/中/中高/高) ║
║ 3. 搭建脚手架- 若测试用例缺失则从模板创建 ║
║ 4. 改进 - 添加适用场景触发词 + 不适用场景反触发词 ║
║ 5. 测试 - 运行测试,必要时修复问题 ║
║ 6. 令牌 - 检查令牌预算,收集优化建议 ║
║ 7. 总结 - 展示改进前后对比及未实施的建议 ║
║ 8. 提示 - 询问:提交修改、创建Issue还是跳过? ║
║ 9. 重复 - 直至达到中高评分 + 测试通过 ║
║ ║
║ 目标评分: 中高 ║
║ ✓ 描述内容 > 150字符 ║
║ ✓ 包含“适用场景:”触发短语 ║
║ ✓ 包含“不适用场景:”反触发词 ║
║ ✓ SKILL.md < 500令牌(软限制) ║
║ ║
║ 更多信息: ║
║ 完整文档请查看.github/skills/sensei/README.md ║
║ ║
╚══════════════════════════════════════════════════════════════════╝When to Use
适用场景
- Improving a skill's frontmatter compliance score
- Adding trigger phrases and anti-triggers to skill descriptions
- Batch-improving multiple skills at once
- Auditing and fixing Low-adherence skills
- 提升Skill的frontmatter合规性评分
- 为Skill描述添加触发词和反触发词
- 批量优化多个Skill
- 审计并修复低合规性的Skill
Invocation Modes
调用模式
Single Skill
单个Skill
Run sensei on azure-deployRun sensei on azure-deployMultiple Skills
多个Skill
Run sensei on azure-security, azure-networking, azure-observabilityRun sensei on azure-security, azure-networking, azure-observabilityBy Adherence Level
按合规性等级
Run sensei on all Low-adherence skillsRun sensei on all Low-adherence skillsAll Skills
所有Skill
Run sensei on all skillsRun sensei on all skillsThe Ralph Loop
Ralph循环流程
For each skill, execute this loop until score >= Medium-High AND tests pass:
- READ - Load , tests, and token count
plugin/skills/{skill-name}/SKILL.md - SCORE - Run rule-based compliance check (see SCORING.md)
- CHECK - If score >= Medium-High AND tests pass → go to TOKENS step
- SCAFFOLD - If doesn't exist, create from
tests/{skill-name}/tests/_template/ - IMPROVE FRONTMATTER - Add triggers, anti-triggers, compatibility (stay under 1024 chars)
- IMPROVE TESTS - Update and
shouldTriggerPromptsto matchshouldNotTriggerPrompts - VERIFY - Run
cd tests && npm test -- --testPathPattern={skill-name} - TOKENS - Check token budget, gather optimization suggestions
- SUMMARY - Display before/after comparison with unimplemented suggestions
- PROMPT - Ask user: Commit, Create Issue, or Skip?
- REPEAT - Go to step 2 (max 5 iterations per skill)
对每个Skill执行以下循环,直至评分≥中高且测试通过:
- 读取 - 加载、测试用例和令牌计数
plugin/skills/{skill-name}/SKILL.md - 评分 - 运行基于规则的合规性检查(详见SCORING.md)
- 检查 - 若评分≥中高且测试通过 → 进入令牌检查步骤
- 搭建脚手架 - 若目录不存在,则从
tests/{skill-name}/创建tests/_template/ - 优化Frontmatter - 添加触发词、反触发词、兼容性信息(总长度不超过1024字符)
- 优化测试用例 - 更新和
shouldTriggerPrompts以匹配新内容shouldNotTriggerPrompts - 验证 - 运行
cd tests && npm test -- --testPathPattern={skill-name} - 令牌检查 - 检查令牌预算,收集优化建议
- 总结 - 展示改进前后的对比及未实施的建议
- 提示 - 询问用户:提交修改、创建Issue还是跳过?
- 重复 - 返回步骤2(每个Skill最多迭代5次)
Scoring Criteria (Quick Reference)
评分标准(快速参考)
| Score | Requirements |
|---|---|
| Low | Basic description, no explicit triggers, no anti-triggers |
| Medium | Has trigger keywords/phrases, description > 150 chars |
| Medium-High | Has "USE FOR:" triggers AND "DO NOT USE FOR:" anti-triggers |
| High | Triggers + anti-triggers + compatibility field |
Target: Medium-High (triggers + anti-triggers present)
| 评分 | 要求 |
|---|---|
| 低 | 基础描述,无明确触发词,无反触发词 |
| 中 | 包含触发关键词/短语,描述内容>150字符 |
| 中高 | 包含“适用场景:”触发词 AND “不适用场景:”反触发词 |
| 高 | 触发词 + 反触发词 + 兼容性字段 |
目标:中高(同时包含触发词和反触发词)
Frontmatter Template
Frontmatter模板
yaml
---
name: skill-name
description: |
[1-2 sentence description of what the skill does]
USE FOR: [trigger phrase 1], [trigger phrase 2], [trigger phrase 3]
DO NOT USE FOR: [scenario] (use other-skill), [scenario] (use another-skill)
---IMPORTANT: Always use multi-line YAML format () for descriptions over 200 characters. Single-line descriptions become difficult to read, review, and maintain. See azure-ai, azure-functions for examples.|
Keep total description under 1024 characters.
yaml
---
name: skill-name
description: |
[1-2句话描述Skill功能]
USE FOR: [触发短语1], [触发短语2], [触发短语3]
DO NOT USE FOR: [场景] (使用other-skill), [场景] (使用another-skill)
---重要提示: 当描述内容超过200字符时,请始终使用多行YAML格式()。单行描述会难以阅读、审核和维护。示例可参考azure-ai、azure-functions。|
描述内容总长度不得超过1024字符。
Test Scaffolding
测试脚手架
When tests don't exist, scaffold from :
tests/_template/bash
cp -r tests/_template tests/{skill-name}Then update:
- constant in all test files
SKILL_NAME - - 5+ prompts matching new frontmatter triggers
shouldTriggerPrompts - - 5+ prompts matching anti-triggers
shouldNotTriggerPrompts
Commit Messages:
sensei: improve {skill-name} frontmatter若测试用例不存在,从搭建:
tests/_template/bash
cp -r tests/_template tests/{skill-name}然后更新:
- 所有测试文件中的常量
SKILL_NAME - - 添加5个以上与新frontmatter触发词匹配的提示语
shouldTriggerPrompts - - 添加5个以上与反触发词匹配的提示语
shouldNotTriggerPrompts
提交信息格式:
sensei: improve {skill-name} frontmatterConstraints
约束条件
- Only modify - these are the Azure skills used by Copilot
plugin/skills/ - contains meta-skills like sensei for developer tooling
.github/skills/ - Max 5 iterations per skill before moving on
- Description must stay under 1024 characters
- SKILL.md should stay under 500 tokens (soft limit)
- Tests must pass before prompting for action
- User chooses: Commit, Create Issue, or Skip after each skill
- 仅修改目录下的内容——这些是Copilot使用的Azure Skill
plugin/skills/ - 目录包含sensei等面向开发者工具的元Skill
.github/skills/ - 每个Skill最多迭代5次后即停止
- 描述内容长度不得超过1024字符
- SKILL.md的令牌数应低于500(软限制)
- 测试通过后方可提示用户采取行动
- 用户可选择:提交修改、创建Issue或跳过当前Skill
Flags
命令行参数
| Flag | Description |
|---|---|
| Skip integration tests for faster iteration. Only runs unit and trigger tests. |
⚠️ Skipping integration tests speeds up the loop but may miss runtime issues. Consider running full tests before final commit.
| 参数 | 描述 |
|---|---|
| 跳过集成测试以加快迭代速度。仅运行单元测试和触发词测试。 |
⚠️ 跳过集成测试会加快循环速度,但可能会遗漏运行时问题。建议在最终提交前运行完整测试。
Reference Documentation
参考文档
- SCORING.md - Detailed scoring criteria
- LOOP.md - Ralph loop workflow details
- EXAMPLES.md - Before/after examples
- TOKEN-INTEGRATION.md - Token budget integration
- SCORING.md - 详细评分标准
- LOOP.md - Ralph循环流程细节
- EXAMPLES.md - 改进前后示例
- TOKEN-INTEGRATION.md - 令牌预算集成说明
Related Skills
相关Skill
- markdown-token-optimizer - Token analysis and optimization
- skill-authoring - Skill writing guidelines
- markdown-token-optimizer - 令牌分析与优化
- skill-authoring - Skill编写指南