Skip to content

feat(optimize-skill): skill to optimize existing skills via the security-suite refactor patterns#427

Merged
potiuk merged 1 commit into
apache:mainfrom
potiuk:optimize-skill
Jun 1, 2026
Merged

feat(optimize-skill): skill to optimize existing skills via the security-suite refactor patterns#427
potiuk merged 1 commit into
apache:mainfrom
potiuk:optimize-skill

Conversation

@potiuk

@potiuk potiuk commented Jun 1, 2026

Copy link
Copy Markdown
Member

What & why

Adds optimize-skill (capability:setup) — the refactoring sibling of
write-skill. write-skill authors a net-new skill; optimize-skill takes an
existing one (or sweeps a set) and makes it leaner without changing what it
does
, applying the five restructuring patterns proven on the security-skill
suite. Every pass is a behavior-preserving proposal the maintainer signs off on,
gated by the skill validator (green-before / green-after).

This is also the tool to close the P14 gap surfaced in the PRINCIPLES.md audit
(#147): 14 SKILL.md files currently exceed the proposed 500-line cap.

The five passes (each distilled from a landed PR)

Pass Smell Exemplar
split SKILL.md over the 500-line cap #410 (3425→658)
config-lift concrete names baked into the body #386 / #387 / #388
out-of-context full body loaded to touch one field #412 / #424
fetch-upfront per-item round-trips #347
preflight-classifier LLM pass on obvious no-ops #414 / #416

Each carries an explicit behavior-preservation guarantee — moved bytes are
identical bytes
; rewires change how a step runs, never what it decides.
A pass that would alter the prose a human signs off on is out of scope.

Contents

  • .claude/skills/optimize-skill/SKILL.md — 297 lines (under the cap it enforces).
  • .claude/skills/optimize-skill/patterns.md — the pass catalogue (smell / exemplar / mechanics / guarantee / validation).
  • tools/skill-evals/evals/optimize-skill/step-diagnose/ — 5 auto-comparable eval cases incl. an injection-resistance case, so the skill ships with an eval (P8).
  • Wired into the capability→skill map (docs/labels-and-capabilities.md) and the eval index.

Reads only framework-internal files → no injection-guard / Privacy-LLM callouts.

Testing

pre-commit full suite green (skill-and-tool validator incl. capability-sync, placeholder linter, markdownlint); eval runner parses all 5 cases; lychee link/anchor check clean.

Generated-by: Claude Code (Opus 4.8)

@potiuk potiuk force-pushed the optimize-skill branch 2 times, most recently from 6e24085 to 8d23e57 Compare June 1, 2026 11:50
…ity-suite refactor patterns

Adds `optimize-skill` (capability:setup) — the refactoring sibling of
`write-skill`. It takes an existing framework skill (or sweeps a set)
and applies the five restructuring patterns proven on the security
suite, as behavior-preserving proposals gated by the validator
(green-before / green-after):

- split — slim an oversized SKILL.md into linked siblings (the apache#410
  pattern; addresses the PRINCIPLES.md P14 cap)
- config-lift — move concrete values into <project-config> (apache#386/apache#387/apache#388)
- out-of-context — read/PATCH one field without loading the body
  (apache#412 github-body-field, apache#424 github-rollup)
- fetch-upfront — batch per-item round-trips (apache#347)
- preflight-classifier — skip obvious no-ops before LLM passes (apache#414/apache#416)

SKILL.md is 297 lines; the pass catalogue (smell / exemplar PR /
mechanics / behavior-preservation guarantee / validation) lives in
the patterns.md sibling. Reads only framework-internal files, so no
injection-guard / Privacy-LLM callouts.

Ships a step-diagnose eval (5 auto-comparable cases incl. an
injection-resistance case) so the skill is not released without an
eval (P8). Wires the skill into the capability->skill map and the
eval index.

Generated-by: Claude Code (Opus 4.8)
@potiuk potiuk merged commit 58481cc into apache:main Jun 1, 2026
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant