AGENT SKILL

skill-optimization

Audit and refactor library components to eliminate redundancy and staleness. Use during periodic library maintenance, after adding multiple new skills or rules, when a role's token budget is too high, or after retrospectives identify component issues.

License 许可
MIT
所属仓库
muratovv/ai-hats
最近更新
2026-11-05
Stars
★ 3
Forks
1

01 前言 Front Matter

name
skill-optimization
ai_hats
{ "type": "skill", "schema_version": 1 }
license
MIT
description
Audit and refactor library components to eliminate redundancy and staleness. Use during periodic library maintenance, after adding multiple new skills or rules, when a role's token budget is too high, or after retrospectives identify component issues.

03 SKILL.md 正文

Skill Optimization

Audit and refactor library components (rules, skills, traits) to eliminate redundancy, verbosity, and stale instructions.

When to Use

Cross-component audit — dedup, staleness, and token-budget trimming across the whole rule/skill/trait library. Authoring or validating a single skill's structure is skill-template, not this. And the upstream act of turning a retro finding into a new framework component is retro-to-framework; this skill optimises what already exists.

Procedure

  1. Audit: Review <ai_hats_dir>/sessions/retros/ for recurring issues. List all active rules and skills in the current role composition.

  2. Identify Debt:

    • Redundancy: two components covering the same behavior
    • Stale instructions: references to removed tools, obsolete workflows
    • Verbosity: rules that can be condensed without losing meaning
    • Misplaced content: rule that should be a skill (has a procedure), or skill that should be a rule (is just a constraint)
    • Prohibition-led wording, and unowned silences — both are debt here, and skill-template's validation checklist is where they are stated as authoring rules; audit against it, so the two do not drift apart
  3. Refactor:

    • Merge fragmented rules into existing traits or skills
    • Condense verbose content into declarative checklists
    • Delete deprecated items
    • Move misplaced content to the right component type
  4. Validate:

    • Run composer.compose() for affected roles — 0 errors
    • Run test suite — all green
    • Spot-check assembled prompt — no regressions

Completion

  • Audit report produced with identified debt
  • Refactoring applied and validated (0 errors, tests green)
  • Token impact measured before/after

Anti-Patterns

  • Refactoring without measuring token impact — optimization must be quantified
  • Deleting components without checking wiring — verify every trait/role still resolves
  • Cosmetic changes disguised as optimization — focus on real redundancy and staleness

04 同仓库更多 Skills

muratovv
muratovv/ai-hats

tool-evaluation-protocol

Time-bounded protocol for evaluating new tools, libraries, or methodologies before adoption. Use when evaluating a candidate dependency for the project, researching a methodology (e.g. ML/LLM frameworks, testing approaches), or following up on a hype-driven recommendation.

★ 3
muratovv
muratovv/ai-hats

systematic-debugging

4-phase bug-fix protocol (evidence, pattern, hypothesis, verify). Use when investigating any error, failure, or unexpected behavior, handling bug reports from users or monitoring, or diagnosing test failures with non-obvious causes.

★ 3
muratovv
muratovv/ai-hats

skill-template

Canonical template and validation guide for ai-hats skills. Use when creating a new skill, reviewing an existing one for structural compliance, or deciding which pattern fits a new behavior.

Skill与智能体开发
★ 3
muratovv
muratovv/ai-hats

silent-fallback-gate

PreToolUse hook — refuses an Edit or Write that adds an inert broad except. Use when a Python edit was blocked for a silent fallback.

★ 3
muratovv
muratovv/ai-hats

retro-to-framework

Convert an observation about agent behavior — from a retrospective or from a single incident — into a framework-level change (hook, rule, skill, skill update). Use after a retrospective identifies problems that are not project-specific, after an incident where an agent misapplied a component it had read, when CLAUDE.md band-aids accumulate (more than 3 per-project rules that could be generic), or when the same problem recurs across multiple projects.

Skill与智能体开发
★ 3
muratovv
muratovv/ai-hats

py-security-lint

PostToolUse hook — reports the project's own ruff security (`S`) findings on every `.py` you Edit/Write, non-blockingly; fail-open, no manual invocation.

代码审查
★ 3