Install
openclaw skills install @elisabeth15501/skill-refactor-clawhub-pubRefactor/optimize any SKILL.md for progressive disclosure: precise-trigger frontmatter, layered body (hard constraints vs single-run flow), a flow of five steps or fewer, permission/context declarations, and a token budget. Triggers: "optimize / refactor / slim down this SKILL.md", "make the skill trigger more precisely", "the body is too long / hard constraints get lost when the context compacts", "split this SKILL.md into a lean body plus references". Three modes: refactor (default, emits the optimized file + a changelog), audit (read-only diagnostic), and readme (polish the companion README.md - structure, badges, install, usage examples, license). NOT for: auditing the code a skill calls (skill-clean-audit), a publish-time security/compliance gate (skill-publish-gate), or from-scratch creation (skill-creator). No external network and no required secrets; the linter runs offline.
openclaw skills install @elisabeth15501/skill-refactor-clawhub-pubHybrid skill: methodology + deterministic linter.
scripts/check_skillmd.pygives reproducible red/amber/green calls on the mechanical checks; this file gives the criteria and a five-step flow for the judgment layer. The read-only mode (audit) never modifies the original.Natural-language note: every instruction below is plain guidance for the agent. No command, tool, or external call is required to follow them.
If the context has been compacted, this section must be preserved and re-applied. Violating any item is an execution failure — "the user did not emphasize it" is not an excuse.
| # | Constraint | Rationale |
|---|---|---|
| H1 | Never silently drop rules. Refactoring only moves content (down into references/) and adds a pointer; it does not delete any substantive rule. Deletion requires the user's explicit confirmation. | Same contract as a read-only audit |
| H2 | Never overwrite. Back up the original before writing back (a <name>.bak or git commit); if the target name already exists, choose a different one. | Reversibility |
| H3 | Every change is traceable. Record each change in the changelog table: old -> new + reason + "assumed?" + "P0?". Any change that assumes a default must be explicitly marked "assumed". | Trust |
| H4 | No network, no secrets. Do not make requests, read keys, or call external APIs. | Compliance red line |
| H5 | Never guess the target. If no SKILL.md is named, ask first; if it cannot be read, give a three-step self-check (spelling / relative path / list the directory) and do not fall back to auditing a different file. | Reliability |
| H6 | Mechanical checks go to the script. Frontmatter syntax, name rules, character/line budgets, and dangling references are decided by scripts/check_skillmd.py, never by impression. | Cross-agent reproducibility |
| H7 | Stay in lane. Optimize SKILL.md text and structure only; do not audit the code the skill calls (skill-clean-audit) or run a publish gate (skill-publish-gate). | Division of labor |
| H8 | Declarations must match behavior. If anything new reads env / calls a binary / uses the network, declare it; default is zero-network. | Consistency |
| H9 | Do not guess the output language. Follow explicit zh/en > inferred interaction language > ask; do not switch mid-run. | Consistency |
This skill serves multilingual users; artifact language is decided by three states, fixed for the whole run (no mid-run switch):
Priority: your explicit zh/en > inferred auto > ask as a fallback. No locale is
hard-set, so this is not a single-language lock; if you must pin a locale, state the
reason and an exit here. Full policy detail and the layering rules live in
references/i18n_policy.md.
Root premise: SKILL.md is shared context with the host agent. Every line must
earn its token cost.
Key reversal: stuffing variant details, platform matrices, and changelog
templates into the body raises per-run cost. Sink what is not used every turn into
references/; keep only per-turn essentials plus navigation pointers in the body.
Four criteria:
Each step states input / action / output / fallback.
refactor
(default, optimizes a SKILL.md), audit (read-only diagnostic), or readme
(polish the companion README.md — see references/readme_quality.md). Pick the
platform profile (ClawHub / SkillHub / Claude-WorkBuddy; default to the host
profile).scripts/check_skillmd.py <file> [--platform p] [--token-budget 3500] to get the
red/amber/green calls and the budget read.disable-model-invocation: true or narrow the tool list, and mark it "assumed".skillmd_audit_<name>.md only; do not
touch the original (H1).BLOCKER=0 AND MEDIUM=0 (LOW/reminder items may remain and be
reported, never silently dropped - H1). If any BLOCKER or MEDIUM remains, return to
Step 3 with the linter's "diagnosis + suggested fix" hints (human fallback).Input: any SKILL.md (frontmatter and body). Refuses binaries / pure data /
non-skill files.
| When | Read |
|---|---|
| A routine optimization or audit | this file's five-step flow |
| Per-platform frontmatter fields (Claude / ClawHub / SkillHub) | references/platform-frontmatter.md |
| Trigger/boundary wording and the changelog template | references/trigger_boundary_changelog.md |
| Token budget and compaction headroom | references/token_budget.md |
| i18n / Natural-Language Policy + non-Chinese-user checklist | references/i18n_policy.md |
| Polishing the companion README.md (structure, badges, install, examples, license) | references/readme_quality.md (skeleton: assets/readme_template.md) |
| The audit-mode output contract (read-only diagnostic report shape) | references/skillmd_audit_sample.md |
| A quick mechanical screen | scripts/check_skillmd.py <file> [--platform p] |
Typical trigger: "This skill's SKILL.md is too long and the hard constraints get
lost when the context compacts; refactor it for progressive disclosure and give me
the full file plus a changelog." -> recognize as Step 1, refactor mode, host
platform, run the five steps.
Explicit non-trigger: "Help me audit whether scripts/gate.py inside this skill is
well written." -> that is a code-quality audit; route to skill-clean-audit. This
skill optimizes SKILL.md text and structure only; it does not review the called
scripts.
Easy-to-confuse boundary: "Run every check before I publish." -> that is a publish-time security/compliance gate; route to skill-publish-gate. This skill only optimizes SKILL.md structure and triggering; it does not run a publish preflight.
Readme-mode trigger: "This skill's README is too long and missing install steps —
polish it." -> recognize as Step 1, readme mode, host platform, read
references/readme_quality.md, run its five steps.
references/. Core rules stay within the first ~3000 tokens.metadata.openclaw.requires and license: MIT-0. Host-side fields such as
allowed-tools, context: fork, and disable-model-invocation are per-host and
documented in references/platform-frontmatter.md, not invented into the published
schema.references/platform-frontmatter.md.references/i18n_policy.md and references/readme_quality.md; both reuse the
three-state language choice, so they never duplicate language handling. The
readme mode only polishes the companion README.md — it does not fix called
code or run a publish gate.