Agent SkillsDatus-ai/Datus-agent › optimize-skill

optimize-skill

GitHub

分析现有技能的使用会话数据,诊断工具调用模式与执行瓶颈,生成优化建议并重构 SKILL.md 指令与描述,提升触发准确率与执行效果。

datus/resources/skills/optimize-skill/SKILL.md Datus-ai/Datus-agent

Trigger Scenarios

用户要求优化或改进现有技能 技能触发率低或执行失败需要修复

Install

npx skills add Datus-ai/Datus-agent --skill optimize-skill -g -y
More Options

Non-standard path

npx skills add https://github.com/Datus-ai/Datus-agent/tree/main/datus/resources/skills/optimize-skill -g -y

Use without installing

npx skills use Datus-ai/Datus-agent@optimize-skill

指定 Agent (Claude Code)

npx skills add Datus-ai/Datus-agent --skill optimize-skill -a claude-code -g -y

安装 repo 全部 skill

npx skills add Datus-ai/Datus-agent --all -g -y

预览 repo 内 skill

npx skills add Datus-ai/Datus-agent --list

SKILL.md

Frontmatter
{
    "name": "optimize-skill",
    "tags": [
        "skill",
        "optimization",
        "improvement"
    ],
    "version": "1.0.0",
    "description": "Optimize and improve existing Datus skills. Use when users want to edit a skill, improve its instructions, optimize its description for better triggering, or analyze skill performance based on usage sessions. Trigger phrases include \"optimize skill\", \"improve skill\", \"edit skill\", \"fix skill\", \"skill not triggering\".",
    "allowed_agents": [
        "gen_skill"
    ],
    "user_invocable": false
}

Optimize Skill

Guide for analyzing, editing, and optimizing existing Datus skills based on real usage data.

Step 1: Identify Target Skill

Use load_skill(skill_name="<name>") to load the current SKILL.md content.

Present to the user:

  • Current name, description, tags
  • Summary of key instruction sections
  • Whether it has scripts, references, or other resources

Ask the user what aspect needs improvement (or proceed to analysis if they said "optimize").

Step 2: Find Usage Sessions

Search for sessions where this skill was invoked. Look at the action history and tool call records:

  • Search for load_skill calls with this skill name in recent action histories
  • Identify which agent nodes loaded this skill
  • Find the corresponding execute_stream sessions

This gives real-world data on how the skill was actually used.

Step 3: Analyze Tool Call Patterns

From the usage sessions, identify:

  • Which tools were called after loading the skill — does the agent follow the skill's instructions?
  • What failed — tool errors, retries, dead ends
  • Where the agent got stuck — excessive tool calls, circular patterns, repeated queries
  • Repeated work patterns — if every session writes similar helper scripts, the skill should bundle them
  • Unused instructions — parts of the skill the agent consistently ignores
  • Missing guidance — situations where the agent improvises because the skill doesn't cover them

Step 4: Generate Optimization Suggestions

Based on analysis, propose specific changes:

  • Improve instructions: Clarify ambiguous guidance that caused agent confusion
  • Add missing examples: Where the agent had to guess, add concrete input/output pairs
  • Bundle repeated scripts: If the agent keeps creating the same helper, put it in scripts/
  • Remove dead weight: Instructions the agent ignores aren't pulling their weight
  • Fix gaps: Add coverage for scenarios where the agent got stuck

Step 5: Rewrite

Generate the improved SKILL.md:

  1. Show a summary of proposed changes to the user
  2. Use ask_user to confirm the changes
  3. Write the updated file via write_file (keep the same path returned by load_skill; must stay under .datus/skills/... or ~/.datus/skills/...)
  4. Call validate_skill to verify
  5. Show a before/after comparison of key changes

Step 6: Description Optimization

The description field determines whether the agent invokes a skill. Optimize it:

  • Be assertive: "Use whenever X" not "Can be used for X"
  • Include trigger contexts: What user phrases should activate this skill
  • Adjacent keywords: Related terms the user might use
  • Edge cases: Phrases that SHOULD trigger vs phrases that should NOT
  • Mental test: "Would the agent correctly decide to use this skill for [scenario]?"

Example transformation:

  • Before: "Helps with SQL optimization"
  • After: "Analyze and optimize SQL queries for performance. Use whenever the user mentions slow queries, query optimization, EXPLAIN plans, index suggestions, or database performance tuning, even if they don't explicitly ask for optimization."

Improvement Principles

  • Generalize from feedback: Skills are used many times across many prompts. Avoid overfitting to specific examples.
  • Keep the prompt lean: Remove instructions that aren't pulling their weight. Read transcripts, not just outputs — if the skill makes the agent waste time on unproductive steps, remove those instructions.
  • Explain the why: Instead of rigid MUSTs, explain reasoning. Today's LLMs are smart — when given good context they go beyond rote instructions.
  • Look for repeated work: If the agent consistently writes similar helper scripts across sessions, bundle them in scripts/.
  • Theory of mind: Try to understand the task from the user's perspective and transmit that understanding into the instructions.

Version History

  • 8fb79f6 Current 2026-08-20 12:34

Same Skill Collection

datus/resources/skills/airflow-workflow/SKILL.md
datus/resources/skills/bi-validation/SKILL.md
datus/resources/skills/create-skill/SKILL.md
datus/resources/skills/create-subagent/SKILL.md
datus/resources/skills/dashboard-bootstrap/SKILL.md
datus/resources/skills/data-migration/SKILL.md
datus/resources/skills/dosi-semantic-authoring/SKILL.md
datus/resources/skills/extract-knowledge/SKILL.md
datus/resources/skills/gen-metrics/SKILL.md
datus/resources/skills/gen-table/SKILL.md
datus/resources/skills/grafana-dashboard/SKILL.md
datus/resources/skills/memory-organization/SKILL.md
datus/resources/skills/metricflow-semantic-authoring/SKILL.md
datus/resources/skills/osi-metrics-authoring/SKILL.md
datus/resources/skills/osi-semantic-authoring/SKILL.md
datus/resources/skills/scheduler-validation/SKILL.md
datus/resources/skills/semantic-sql-history-profiler/SKILL.md
datus/resources/skills/session-summarize/SKILL.md
datus/resources/skills/storage-classify/SKILL.md
datus/resources/skills/superset-dashboard/SKILL.md
datus/resources/skills/table-validation/SKILL.md
datus/resources/skills/transfer-reconciliation/SKILL.md
tests/data/skills/report-generator/SKILL.md
tests/data/skills/sql-analysis/SKILL.md
datus/resources/skills/build-kb/SKILL.md
datus/resources/skills/init/SKILL.md
tests/data/skills/sql-optimization/SKILL.md
tests/data/skills/admin-tools/SKILL.md
tests/data/skills/data-profiler/SKILL.md

Metadata

Files
0
Version
8fb79f6
Hash
d0f30645
Indexed
2026-08-20 12:34

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-22 00:17
浙ICP备14020137号-1 $mapa de visitantes$