agent-tool-selection — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited agent-tool-selection (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
When designing tool selection logic for AI agents, optimizing tool descriptions, building fallback chains, or analyzing tool usage patterns. Use for any scenario where an agent must choose between multiple tools to accomplish a task.
Core principle: Specificity over generality — when two tools can both handle a task, prefer the more specific one. It will be faster, cheaper, and more reliable. A hammer works for screws, but a screwdriver is better.
Input: task description + available tools
Step 1 — Capability Match:
- For each tool: does its capability set cover the task requirements?
- Eliminate tools that CANNOT handle the task (hard filter)
Step 2 — Rank by Specificity:
- More specific tool > more general tool
- Example: "Read file" > "Bash (cat)" for reading files
- Specificity = how narrow is the tool's intended use case?
Step 3 — Rank by Cost-Efficiency:
- Among equally capable tools: prefer cheaper/faster
- Read (free, instant) > Bash cat (process spawn) > API call (network)
Step 4 — Rank by Reliability:
- Among equal cost: prefer higher success rate
- Check historical success rate per tool per task type
Step 5 — Verify Preconditions:
- Does the selected tool's preconditions hold?
- Example: Edit requires file was previously Read
- If preconditions not met: add prerequisite steps
Output: ordered list of tools to try (primary + fallbacks) | Task Type | Primary Tool | Fallback 1 | Fallback 2 | Anti-pattern |
|--------------------|--------------|--------------|----------- |------------------|
| Read file content | Read | Bash (cat) | — | Grep (wrong use) |
| Search for pattern | Grep | Bash (grep) | Read + scan | Read all files |
| Edit existing file | Edit | Write | — | Bash (sed) |
| Create new file | Write | Bash (echo>) | — | Edit (no file) |
| Run tests | Bash | — | — | Read test output |
| Check file exists | Bash (ls) | Read (error) | — | Grep for path | Good description (specific, with examples):
"Read a file from disk. Use when you need to see file contents.
Supports text, images, PDFs. Prefer over Bash cat/head/tail.
NOT for directories (use Bash ls)."
Bad description (vague):
"Reads things from the filesystem."
Good description (with when-to-use and when-NOT-to-use):
"Edit an existing file by replacing exact string matches.
Use when: modifying 1-5 specific locations in a file.
Do NOT use when: rewriting >50% of the file (use Write instead).
Requires: file must have been Read in this session first."
Bad description (missing boundaries):
"Edits files."Rules:
Tier 1 — Free/Instant (prefer these):
- Read (file content)
- Edit (modify file)
- Write (create file)
- Grep (pattern search in known scope)
Tier 2 — Cheap/Fast (use when Tier 1 can't):
- Bash (shell commands — process spawn overhead)
- Glob (file path patterns)
Tier 3 — Moderate (use when necessary):
- LSP (language server queries)
- Web fetch (network requests)
Tier 4 — Expensive (use sparingly):
- Sub-agent spawn (full agent instantiation)
- Multi-file analysis (token-heavy)
- External API calls (rate-limited, costly)Rules:
Fallback chain structure:
1. Try primary tool (most specific, cheapest)
2. If fails (error, timeout, precondition unmet):
- Log failure reason
- Try fallback 1 (broader capability)
3. If fallback 1 fails:
- Try fallback 2 (most general/expensive)
4. If all fail:
- Escalate to user with: what was tried, why each failed, what's needed
Example:
Task: "Find where function X is defined"
1. Grep (fast, pattern-based) → found? done
2. LSP (semantic, language-aware) → found? done
3. Bash find + grep (brute force) → found? done
4. Escalate: "I couldn't locate function X. Can you point me to the file?"Rules:
Composition patterns:
Sequential: Tool A output → Tool B input
Example: Grep (find file) → Read (get content) → Edit (modify)
Parallel: Tool A + Tool B independently → merge results
Example: Grep (find usages) + Read (get definition) → understand full context
Conditional: If Tool A succeeds → Tool B, else → Tool C
Example: If Read(file) succeeds → Edit, else → Write (file doesn't exist)
Iterative: Repeat Tool A until condition met
Example: Bash(test) → fails → Edit(fix) → Bash(test) → passes → doneRules:
Disambiguation criteria (in priority order):
1. Fewer side effects: Read-only > Read-write (prefer observation over action)
2. More specific: Narrow tool > broad tool (Edit > Bash sed)
3. Cheaper: Less resource consumption > more
4. More reversible: Undoable > permanent (Edit > Write for existing files)
5. Better error messages: Tools with clear failure modes > opaque failures
If still tied after all criteria: pick the one that appears first in the
tool list (convention-based tie-breaking, prevents analysis paralysis)Before marking a task done when this skill was active:
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.