My_harness tool_discovery

Tool Discovery Skill

install
source · Clone the upstream repo
git clone https://github.com/WeiJun0507/my_harness
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/WeiJun0507/my_harness "$T" && mkdir -p ~/.claude/skills && cp -r "$T/.cursor/skills/tool_discovery" ~/.claude/skills/weijun0507-my-harness-tool-discovery && rm -rf "$T"
manifest: .cursor/skills/tool_discovery/SKILL.md
source content

Tool Discovery Skill

Metadata

  • Name:
    tool_discovery
  • Description: Detect, rank, and invoke reusable tools for each prompt before creating new implementations

Purpose

For every user prompt, determine whether an existing callable tool can fulfill the request. Reuse first; create new only when necessary.

When to Trigger

  • On every user prompt (mandatory first-pass behavior).

Required Workflow

  1. Parse intent into candidate actions:

    • Primary action (what user wants done)
    • Domain entities (users, contacts, orders, etc.)
    • Constraints (filters, pagination, timing, context)
  2. Search tool registry/index and tool specs in the configured skills directory (for example

    ~/codex/skills/*
    ).

  3. Match and rank:

    • Exact intent match -> use directly
    • Close/partial match -> adapt arguments or select latest compatible version
    • No match -> trigger
      tool_creator
  4. Invoke tool using its declared schema and pass normalized arguments.

  5. Post-process output for the user's requested format (UI mapping, API response shaping, narrative explanation).

Invocation Contract

{
  "tool": "query_user_contacts",
  "arguments": {
    "page": 1,
    "limit": 50
  }
}

Priority Rules

  1. Always attempt tool reuse before writing inline logic.
  2. Never duplicate existing tools with the same intent.
  3. If a partial tool exists, prefer extension/versioning over creating a separate duplicate.
  4. If no suitable tool exists, immediately route to
    tool_creator
    .

Flutter Example (Reference)

Prompt: "When opening Contacts page, fetch user contact list."

  • Discovery finds
    query_user_contacts
    -> invoke it.
  • If missing -> trigger
    tool_creator
    to create:
    • model (if needed)
    • repository method (if needed)
    • use-case function
    • tool wrapper and registry entry
  • Then call the new tool.

Output Requirement

  • Must produce one of:
    • A concrete tool invocation (tool name + arguments), or
    • A
      tool_creator
      handoff request with normalized intent and requirements.
  • Must include brief reason for match decision (exact / partial / none).

Key Rule

Every prompt must go through tool discovery before implementation begins.