shinpr/skill-optimization
Evaluates and optimizes skill file quality using 8 content patterns and 9 editing principles. Use when creating skills, refining skill content, or auditing skill quality.
npx skills add https://github.com/shinpr/ai-coding-project-boilerplate --skill skill-optimization
Issues that directly reduce LLM execution accuracy when consuming the skill.
| Detection | Transform |
|-----------|-----------|
| "don't", "do not", "never", "avoid" in skill instructions | State the desired action or allowed state first. Preserve an explicit prohibition only when the violation is an irreversible operational action, the caller cannot normally recover it, and a positive-only rewrite would blur the boundary. Pair the prohibition with the safe alternative and the condition that authorizes crossing the boundary. Rewrite reviewable quality policies in positive form. |
Exception boundary examples:
Quality policies, role boundaries, scoring criteria, and general work rules always use positive form. Outputs that the caller validates, overwrites, or discards are never irreversible.
Skill example:
userId not x)"Why critical for skills: A prohibition alone leaves the executable target state unspecified.
| Detection | Transform |
|-----------|-----------|
| Vague term ("appropriate", "good", "proper", "best", "should be clear") that leaves a decision the intended outcome requires, where plausible interpretations would materially change execution or verification | Resolve it with the least-restrictive sufficient criterion, following the resolution steps below |
| Unspecified format, length, scope, tone, or success criteria whose plausible interpretations satisfy the intended outcome equally well | Treat as acceptable flexibility; add a constraint only when one interpretation is required (for a format a downstream consumer requires, see BP-003) |
Resolution steps (first-row findings):
Skill exception: Expressions that the LLM can resolve unambiguously from input context (e.g., "where the user left gaps" when the user's prompt is available for comparison) are not vague — they describe a deterministic operation, not a subjective judgment.
Skill example:
Why critical for skills: A vague instruction forces the model to choose an outcome-relevant behavior without a supplied criterion.
| Detection | Transform |
|-----------|-----------|
| Skill describes what to do but not the expected deliverable format | Add an output section defining the structure, fields, and ordering required by the output consumer (parsing, routing, comparison, verification), rather than selecting a format by convention |
For a skill review, the output contract contains BP-001 through BP-008 coverage, unique finding IDs, severity, location, quoted evidence, one resolution per finding, preservation requirements, unresolved inputs, and the final grade. For skill creation, the output is the complete SKILL.md content plus any required same-directory references or scripts.
Skill example:
## Issues Found as a table the report renderer parses: | Severity | Location | Description | Suggested Fix |"Why critical for skills: Structured output constraints reduce hallucination and make skill results consistent.
Issues that reduce skill effectiveness when addressed.
| Detection | Transform |
|-----------|-----------|
| Wall of text without headings | Apply standard section order (see below) |
| Multiple topics mixed in one section | Split into distinct headed sections |
| No tables for reference data | Convert lists of criteria/patterns to tables |
Standard skill section order:
Conditional: Skip restructuring if skill is under 30 lines and covers a single topic.
| Detection | Transform |
|-----------|-----------|
| Skill assumes knowledge not stated | Add Prerequisites section listing required context |
| Domain terms used without definition | Add definitions inline or in a glossary table. Skill exception: Terms within the LLM's baseline knowledge (widely-used technical terminology, standard domain vocabulary) require no definition. Only project-specific terms, internal naming conventions, or domain jargon outside common LLM training data need explicit definition. |
| No "when to use" guidance | Add trigger conditions with concrete scenarios |
| Duplicated, distracting, or unactionable context with no downstream effect | Condense repeated facts into one operative statement; keep raw background behind a path or reference when only an extracted fact is needed; name the source for project-specific facts |
Skill example:
| Detection | Transform |
|-----------|-----------|
| 3+ objectives in one instruction | Break into numbered steps; each step names its output evidence and the transition condition that permits the next step |
| Sequential dependencies not explicit | Make each step's transition condition depend on the prior step's output evidence |
| Multiple dependent actions presented as one step | Split so each produces observable completion evidence before the next begins |
Conditional: Skip decomposition for simple reference tables or single-criteria rules.
Key insight: Goal is externally visible state progression — each step produces evidence that controls whether the next step is valid, not decomposition for its own sake.
For creation and comprehensive review, use three gates in order:
Incremental improvements for specific contexts.
| Detection | Transform |
|-----------|-----------|
| Examples restate behavior already known to the LLM | Replace with a concise rule or consumer-required output shape, and remove the examples |
| Examples encode a domain-, product-, or organization-specific mapping, non-obvious exception, or boundary a rule cannot express | Keep the smallest set that covers those mappings; map each example to the ambiguity it removes |
| Multiple examples remove the same ambiguity, or all share the same surface pattern | Reduce to the smallest covering set; add a different case only when it removes a distinct ambiguity |
| Detection | Transform |
|-----------|-----------|
| Skill demands definitive answers always | Classify claims as observed, inferred, or unknown; add escalation criteria for ambiguous cases |
| No "when to stop" guidance | When an unknown blocks the next step, stop at that gate and name the exact evidence or user decision required to continue |
Skill example:
Measurable quality criteria for skill content. Each principle includes a pass/fail test.
| # | Principle | Pass Criteria | Fail Example |
|---|-----------|---------------|--------------|
| 1 | Context efficiency | Every sentence contributes to LLM decision-making. No filler. | "This is an important skill that helps with..." |
| 2 | Deduplication | No concept is explained twice at the same abstraction level within one skill. Duplication across independently loaded pure skills is valid when each copy is required for standalone execution; evaluate those copies for semantic consistency rather than replacing them with sibling-skill references | The same rule appears twice in one skill without adding a distinct execution role |
| 3 | Grouping | Related criteria in single section (minimize read operations) | Scattered error handling rules across 4 sections |
| 4 | Measurability | Criteria name observable evidence, deterministic decision rules, or justified thresholds | "Write clean code" without an observable condition |
| 5 | Positive form | Instructions state what to do (BP-001 applied) | "Don't use any" instead of "Use only X" |
| 6 | Consistent notation | Uniform heading levels, list styles, table formats | Mix of -, *, 1. in same context |
| 7 | Explicit prerequisites | Project-specific and non-baseline prerequisites are stated or linked; baseline technical knowledge is left concise | Uses "DI" without defining Dependency Injection |
| 8 | Priority ordering | Most important items first, exceptions last | Edge cases before common patterns |
| 9 | Scope boundaries | Explicitly state what the skill covers and the conditions that activate conditional content. A pure skill contains the context required for standalone execution. Cross-skill references are reserved for skills whose role is orchestration or skill selection | A pure skill omits an operative rule because another independently loaded skill also contains it |
Take shinpr/skill-optimization from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.