agentleFS
catlog22catlog22/Claude-Code-Workflow/.claude/skills/skill-tuning/SKILL.md

skill-tuning

Skill2.1k starsChanged 7 months agoMITArchived repositoryView on GitHub

Universal skill diagnosis and optimization tool. Detect and fix skill execution issues including context explosion, long-tail forgetting, data flow disruption, and agent coordination failures. Supports Gemini CLI for deep analysis. Triggers on "skill tuning", "tune skill", "skill diagnosis", "optimize skill", "skill debug".

5 other projects use a version of this, 2 of them edited.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Reversible: All changes with backup checkpoints

    line 131

“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Skill Tuning

Autonomous diagnosis and optimization for skill execution issues.

Architecture

┌─────────────────────────────────────────────────────┐
│  Phase 0: Read Specs (mandatory)                    │
│  → problem-taxonomy.md, tuning-strategies.md         │
└─────────────────────────────────────────────────────┘
                        ↓
┌─────────────────────────────────────────────────────┐
│  Orchestrator (state-driven)                         │
│  Read state → Select action → Execute → Update → ✓ │
└─────────────────────────────────────────────────────┘
        ↓                           ↓
┌──────────────────────┐   ┌──────────────────┐
│  Diagnosis Phase     │   │ Gemini CLI       │
│  • Context          │   │ Deep analysis    │
│  • Memory           │   │ (on-demand)      │
│  • DataFlow         │   │                  │
│  • Agent            │   │ Complex issues   │
│  • Docs             │   │ Architecture     │
│  • Token Usage      │   │ Performance      │
└──────────────────────┘   └──────────────────┘
                ↓
        ┌───────────────────┐
        │  Fix & Verify     │
        │  Apply → Re-test  │
        └───────────────────┘

Core Issues Detected

PriorityProblemRoot CauseFix Strategy
P0Authoring ViolationIntermediate files, state bloat, file relayeliminate_intermediate, minimize_state
P1Data Flow DisruptionScattered state, inconsistent formatsstate_centralization, schema_enforcement
P2Agent CoordinationFragile chains, no error handlingerror_wrapping, result_validation
P3Context ExplosionUnbounded history, full content passingsliding_window, path_reference
P4Long-tail ForgettingEarly constraint lossconstraint_injection, checkpoint_restore
P5Token ConsumptionVerbose prompts, state bloatprompt_compression, lazy_loading

Problem Categories (Detailed Specs)

See specs/problem-taxonomy.md for:

  • Detection patterns (regex/checks)
  • Severity calculations
  • Impact assessments

Tuning Strategies (Detailed Specs)

See specs/tuning-strategies.md for:

  • 10+ strategies per category
  • Implementation patterns
  • Verification methods

Workflow

StepActionOrchestrator DecisionOutput
1action-initstatus='pending'Backup, session created
2action-analyze-requirementsAfter initRequired dimensions + coverage
3Diagnosis (6 types)Focus areasstate.diagnosis.{type}
4action-gemini-analysisCritical issues OR user requestDeep findings
5action-generate-reportAll diagnosis completestate.final_report
6action-propose-fixesIssues foundstate.proposed_fixes[]
7action-apply-fixPending fixesApplied + verified
8action-completeQuality gates passsession.status='completed'

Action Reference

CategoryActionsPurpose
Setupaction-initInitialize backup, session state
Analysisaction-analyze-requirementsDecompose user request via Gemini CLI
Diagnosisaction-diagnose-{context,memory,dataflow,agent,docs,token_consumption}Detect category-specific issues
Deep Analysisaction-gemini-analysisGemini CLI: complex/critical issues
Reportingaction-generate-reportConsolidate findings → final_report
Fixingaction-propose-fixes, action-apply-fixGenerate + apply fixes
Verifyaction-verifyRe-run diagnosis, check gates
Exitaction-complete, action-abortFinalize or rollback

Full action details: phases/actions/

State Management

Single source of truth: .workflow/.scratchpad/skill-tuning-{ts}/state.json

{
  "status": "pending|running|completed|failed",
  "target_skill": { "name": "...", "path": "..." },
  "diagnosis": {
    "context": {...},
    "memory": {...},
    "dataflow": {...},
    "agent": {...},
    "docs": {...},
    "token_consumption": {...}
  },
  "issues": [{"id":"...", "severity":"...", "category":"...", "strategy":"..."}],
  "proposed_fixes": [...],
  "applied_fixes": [...],
  "quality_gate": "pass|fail",
  "final_report": "..."
}

See phases/state-schema.md for complete schema.

Orchestrator Logic

See phases/orchestrator.md for:

  • Decision logic (termination checks → action selection)
  • State transitions
  • Error recovery

Key Principles

  1. Problem-First: Diagnosis before any fix
  2. Data-Driven: Record traces, token counts, snapshots
  3. Iterative: Multiple rounds until quality gates pass
  4. Reversible: All changes with backup checkpoints
  5. Non-Invasive: Minimal changes, maximum clarity

Usage Examples

# Basic skill diagnosis
/skill-tuning "Fix memory leaks in my skill"

# Deep analysis with Gemini
/skill-tuning "Architecture issues in async workflow"

# Focus on specific areas
/skill-tuning "Optimize token consumption and fix agent coordination"

# Custom issue
/skill-tuning "My skill produces inconsistent outputs"

Output

After completion, review:

  • .workflow/.scratchpad/skill-tuning-{ts}/state.json - Full state with final_report
  • state.final_report - Markdown summary (in state.json)
  • state.applied_fixes - List of applied fixes with verification results

Reference Documents

DocumentPurpose
specs/problem-taxonomy.mdClassification + detection patterns
specs/tuning-strategies.mdFix implementation guide
specs/dimension-mapping.mdDimension ↔ Spec mapping
specs/quality-gates.mdQuality verification criteria
phases/orchestrator.mdWorkflow orchestration
phases/state-schema.mdState structure definition
phases/actions/Individual action implementations

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.