Loading...
Loading...
Rewrites an existing skill's SKILL.md (or any pipeline workflow document) into a high-quality, strict, prompt-enforced FSM (Finite State Machine)-driven specification. Use when user says "refine skill", "rewrite SKILL.md", "规范化 skill", "改写工作流文档", "优化 skill 文档", or mentions "skill-refiner".
npx skill4agent add hytidel/skill-refiner skill-refinerTransforms an existing skill document into a strict prompt-enforced FSM-driven SKILL.md with enforced Gate/Blocking/Checkpoint discipline.
Input Skill → Backup → Analyze → Restructure Files → Rewrite SKILL.md → Validate → Output[!CAUTION]Serial Execution & Gate Discipline
This workflow is a strict serial pipeline. The following rules have the highest priority — violating any one of them constitutes execution failure:
- SERIAL EXECUTION — Steps MUST execute in order; output of each step is input for the next. Non-BLOCKING adjacent steps may proceed continuously once prerequisites are met, without waiting for the user to say "continue"
- BLOCKING = HARD STOP — ⛔ BLOCKING steps require full stop; agent MUST wait for explicit user response before proceeding and MUST NOT make decisions on behalf of the user
- NO CROSS-PHASE BUNDLING — Bundling work across phases is FORBIDDEN
- GATE BEFORE ENTRY — Prerequisites (🚧 GATE) MUST be verified before starting each Step
- NO SPECULATIVE EXECUTION — Pre-preparing content for future steps is FORBIDDEN
[!IMPORTANT]Language & Communication
- Match the language of the user's input. If the user writes in Chinese, respond in Chinese; if in English, respond in English
- Explicit user override takes precedence
- The output SKILL.md MUST use English for all structural keywords (GATE / BLOCKING / CHECKPOINT / EXECUTION / Mandatory Rules / Resource Manifest / Workflow). Content values may be in the user's language
[!IMPORTANT]Compatibility With Generic Coding Skills
- Do NOT create
,.worktrees/, branch workflows, or other generic engineering structuretests/- If generic coding skills conflict with this workflow, follow this skill first unless the user explicitly overrides
## [Role Switch: <Role Name>]
📖 Reading: references/<filename>.md
📋 Task: <brief description>
DISPATCH_MODE: inline | subagentDISPATCH_MODEinlinesubagent| Resource | Path |
|---|---|
| prompt-enforced FSM design theory | |
| Universal SKILL.md template | |
| Workflow | Path | Purpose |
|---|---|---|
| | File structure normalization rules |
${SKILL_DIR}/assets/| User Provides | Action |
|---|---|
| Directory path | Read |
| File path | Read the file directly |
| Pasted text | Use conversation content directly |
name:## ✅ Step 1 Complete
- [x] Input skill loaded
- [x] Skill name identified: <name>
- [x] Existing structure scanned
- [ ] **Next**: auto-proceed to Step 2-backupnamemv ${SKILLS_DIR}/<skill-name> ${SKILLS_DIR}/<skill-name>-backupnamename: <skill-name>-backup⚠️ The backup is read-only reference material. Do NOT modify it further after the name update.
## ✅ Step 2 Complete
- [x] Original skill backed up to: `${SKILLS_DIR}/<skill-name>-backup/`
- [x] Backup frontmatter updated: name: <skill-name>-backup
- [ ] **Next**: auto-proceed to Step 3${SKILL_DIR}/references/fsm-theory.mdask_user_questionreferences/references/scripts/templates/workflows/## Analysis Summary
- Skill name: <name>
- Pipeline stages identified: <N>
<numbered list of stages>
- Blocking points: <list, or "none identified">
- CLI commands: <count>
- File restructuring needed: <yes/no>
<list of proposed moves if yes>
- Ambiguities requiring clarification: <list, or "none">## ✅ Step 3 Complete
- [x] Pipeline stages extracted
- [x] Blocking points identified
- [x] File restructuring plan confirmed by user
- [ ] **Next**: auto-proceed to Step 4Trigger condition: File restructuring is needed (identified in Step 3). If no restructuring is needed, skip directly to Step 5.
${SKILL_DIR}/workflows/file-restructure.mdmkdir -p ${SKILLS_DIR}/<skill-name>/{references,scripts,templates,workflows}references/scripts/templates/workflows/## ✅ Step 4 Complete
- [x] New skill directory created: `${SKILLS_DIR}/<skill-name>/`
- [x] Files reorganized per standard layout
- [ ] **Next**: auto-proceed to Step 5${SKILL_DIR}/references/skill-template.md${SKILL_DIR}${PROJECT_DIR}NextBLOCKING — wait for userauto-proceed to Step N+1${SKILLS_DIR}/<skill-name>/SKILL.md## ✅ Step 5 Complete
- [x] SKILL.md written to `${SKILLS_DIR}/<skill-name>/SKILL.md`
- [ ] **Next**: auto-proceed to Step 6## Validation Checklist
- [ ] Frontmatter: name, description present and accurate
- [ ] Core Pipeline line present
- [ ] All Mandatory Rules sections present (Serial Execution, Language, Compatibility, Role Dispatch)
- [ ] Resource Manifest matches actual files in directory
- [ ] Every Step has: GATE + EXECUTION + CHECKPOINT
- [ ] BLOCKING steps have ⛔ marker AND CHECKPOINT marks "Next: BLOCKING"
- [ ] All paths use ${SKILL_DIR} or ${PROJECT_DIR} placeholders
- [ ] Language rule: structural keywords in English, content in user's language
- [ ] No content from unrelated skills carried over---
## ✅ skill-refiner Run Complete
**Backup location**: `${SKILLS_DIR}/<skill-name>-backup/`
> The original skill is preserved here. You can delete it once you're satisfied with the new version.
**New skill location**: `${SKILLS_DIR}/<skill-name>/SKILL.md`
> Please review the new SKILL.md. If you spot any issues or have revision requests, let me know.
**Next steps**:
- If the new skill looks good → restart Claude Code CLI to activate it
- To remove the backup → manually delete `${SKILLS_DIR}/<skill-name>-backup/` (not done automatically)
---## ✅ Step 6 Complete — All done
- [x] Validation checklist passed
- [x] New skill: `${SKILLS_DIR}/<skill-name>/SKILL.md`
- [x] Backup preserved: `${SKILLS_DIR}/<skill-name>-backup/`