agentleFS
bhaumikmaanbhaumikmaan/claude-code-master-skills/skills/effective-tool-use/SKILL.md

effective-tool-use

Skill3 starsChanged 7 months agoMITView on GitHub

Optimal tool selection, parallelism, and safety for coding tasks. Covers the IDE tool preference matrix, parallel vs sequential execution, git safety, sandbox awareness, and file operation hygiene. Use when writing tool calls, running commands, managing files, or performing git operations.

  • Reads credentials
  • Installs packages

The file

Show its rules and text

We split this skill into the rules it gives an agent

29 rules. About 0 are common, 20 are distinctive, and 9 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈20

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 9

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Always use the dedicated tool instead of its shell equivalent:

    line 13
  2. Distinctive:

    When research spans >5 files, spawn a subagent via the Agent tool to research in an isolated context and return a summary.

    line 36
  3. Distinctive:

    Read files before editing them.

    line 40
  4. Distinctive:

    Write tool requires a prior Read of the target file.

    line 41
  5. Distinctive:

    When you already know which section you need (from a Grep match with line numbers), read just that range.

    line 43
  6. Distinctive:

    Prefer Edit over Write for modifying existing files — Edit sends only the diff.

    line 44
  7. Distinctive:

    Never create documentation files (*.md) or READMEs unless the user explicitly asks.

    line 45
  8. Distinctive:

    Use when operations are independent and can run simultaneously:

    line 50
  9. Distinctive:

    Use when operations depend on each other:

    line 57
  10. Distinctive:

    Use only when you need sequential execution but don't care if earlier commands fail:

    line 63
  11. Distinctive:

    Never use newlines to separate commands in a single Bash call (newlines OK inside quoted strings).

    line 67
  12. Very specific:

    Don't use & to background processes — use the run_in_background parameter instead.

    line 68
  13. Very specific:

    Don't sleep between commands that can run immediately.

    line 69
  14. Distinctive:

    Don't retry failing commands in a sleep loop.

    line 70
  15. Very specific:

    Before creating new directories or files, run ls to verify the parent directory exists and is the correct location.

    line 74
  16. Distinctive:

    Always quote file paths containing spaces with double quotes.

    line 75
  17. Distinctive:

    When checking if a file/resource exists before operating on it, prefer operating directly and handling the error (avoids TOCTOU race …

    line 77
  18. Very specific:

    Never use interactive flags (-i) like git rebase -i or git add -i — they require terminal input that isn't supported.

    line 95
  19. Distinctive:

    Never update the git config.

    line 96
  20. Distinctive:

    If CI is configured for the project, check pipeline status after pushing.

    line 97
  21. Distinctive:

    When running in a sandboxed environment:

    line 101
  22. Very specific:

    Use $TMPDIR for temporary files, NOT /tmp directly.

    line 102
  23. Distinctive:

    If a command fails with "Operation not permitted" or access denied errors, the sandbox may be restricting it.

    line 103
  24. Distinctive:

    Default to running commands within the sandbox.

    line 104
  25. Very specific:

    Don't suggest adding sensitive paths (~/.bashrc, ~/.zshrc, ~/.ssh/*, credential files) to the sandbox allowlist.

    line 105
  26. Very specific:

    Use run_in_background for commands you don't need results from immediately.

    line 110
  27. Distinctive:

    Don't sleep as a first action.

    line 111
  28. Very specific:

    When building constrained tool flows for specialized tasks, apply prompt-engineering patterns.

    line 119
  29. Very specific:

    If user-config.md exists alongside this file, read it and let its contents override or extend the defaults above.

    line 123

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “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

Effective Tool Use

CRITICAL: Prefer dedicated IDE tools over shell equivalents. They provide better user experience, clearer diffs, and easier permission review.

Tool Preference Matrix

Always use the dedicated tool instead of its shell equivalent:

TaskUse ThisNOT This
Find files by patternGlobfind, ls -R
Search file contentsGrepgrep, rg, ag
Read a fileReadcat, head, tail
Edit an existing fileEditsed, awk, inline scripts
Create / overwrite a fileWriteecho >, cat <<EOF >, tee
Communicate with the userDirect text outputecho, printf

Reserve the shell (Bash) tool for actual system commands: git, npm, docker, make, curl, test runners, build tools, and other CLI operations that have no dedicated tool equivalent.

Token Cost Hierarchy

Tools differ drastically in token cost. Always narrow before you read:

  1. Glob (near-zero tokens) — Returns file paths only. Start here to map the landscape.
  2. Grep with -C 3 (lightweight) — Returns matched lines plus context. Use head_limit to cap results for common terms. Often sufficient without a full file read.
  3. Read (heavy, 500-5000+ tokens) — Full file content. Use ONLY after Glob/Grep confirmed the file is relevant.

For meaning-based queries ("how does authentication work"), check if MCP tools like search_code are available before falling back to broad Grep with keywords and synonyms.

When research spans >5 files, spawn a subagent via the Agent tool to research in an isolated context and return a summary. This prevents context exhaustion in the main session.

Reading Files

  • Read files before editing them. An edit to unread code is a guess, not a fix.
  • Write tool requires a prior Read of the target file. It will fail otherwise.
  • For large files, use offset/limit to read only the relevant section. Don't load 2000 lines when you need 20.
  • When you already know which section you need (from a Grep match with line numbers), read just that range.
  • Prefer Edit over Write for modifying existing files — Edit sends only the diff. Use Write for new files or complete rewrites.
  • Never create documentation files (*.md) or READMEs unless the user explicitly asks.

Parallel vs Sequential Execution

Parallel (separate tool calls in one message)

Use when operations are independent and can run simultaneously:

  • Multiple Grep searches for different patterns
  • git status and git diff at the same time
  • Reading multiple unrelated files
  • Independent test runs across different modules

Sequential (&& chaining in a single Bash call)

Use when operations depend on each other:

  • mkdir -p dir && cp file dir/ — directory must exist before copy
  • git add file && git commit — file must be staged before commit
  • npm install && npm build — deps before build

Fire-and-forget (; chaining)

Use only when you need sequential execution but don't care if earlier commands fail:

  • rm -f old.log ; echo "cleaned" — proceed regardless

Rules

  • Never use newlines to separate commands in a single Bash call (newlines OK inside quoted strings).
  • Don't use & to background processes — use the run_in_background parameter instead.
  • Don't sleep between commands that can run immediately. If you need to wait for a background task you started with run_in_background, you'll be notified when it completes — don't poll.
  • Don't retry failing commands in a sleep loop. Diagnose the root cause.

File Operations

  • Before creating new directories or files, run ls to verify the parent directory exists and is the correct location.
  • Always quote file paths containing spaces with double quotes.
  • Maintain your working directory — use absolute paths and avoid cd unless the user requests it.
  • When checking if a file/resource exists before operating on it, prefer operating directly and handling the error (avoids TOCTOU race conditions).

Git Safety

  • Prefer new commits over amending. After pre-commit hook failure, the commit did NOT happen — --amend would modify the PREVIOUS commit and risk destroying work.
  • Never skip hooks (--no-verify, --no-gpg-sign) unless the user explicitly asks. If a hook fails, investigate and fix the underlying issue.
  • Never force-push to main/master. Warn the user if they request it.
  • Never run destructive commands (reset --hard, checkout ., clean -f, branch -D) unless the user explicitly requests them.
  • Stage specific files by name rather than git add -A or git add ., which can accidentally include secrets or binaries.
  • HEREDOC for commit messages to preserve formatting:
git commit -m "$(cat <<'EOF'
Commit message here.
EOF
)"
  • Never use interactive flags (-i) like git rebase -i or git add -i — they require terminal input that isn't supported.
  • Never update the git config.
  • If CI is configured for the project, check pipeline status after pushing. A green local build with a red CI pipeline is not "done."

Sandbox Awareness

When running in a sandboxed environment:

  • Use $TMPDIR for temporary files, NOT /tmp directly. The sandbox sets $TMPDIR to the correct writable directory.
  • If a command fails with "Operation not permitted" or access denied errors, the sandbox may be restricting it. Check the sandbox configuration before retrying.
  • Default to running commands within the sandbox. Only disable sandboxing when you see clear evidence of sandbox-caused failure (not general command failures).
  • Don't suggest adding sensitive paths (~/.bashrc, ~/.zshrc, ~/.ssh/*, credential files) to the sandbox allowlist.

Command Timeouts and Background Tasks

  • Commands have a default timeout. For long-running operations (builds, large test suites), set an appropriate timeout.
  • Use run_in_background for commands you don't need results from immediately. You'll be notified when they complete — no polling needed.
  • Don't sleep as a first action. If waiting for rate limiting or deliberate pacing, keep it under 2 seconds.

CRITICAL REMINDER: Use dedicated IDE tools over shell equivalents. Narrow searches with Glob/Grep before reading full files. Read before editing. Never skip git hooks or force-push without explicit user consent.

Related Skills

  • For search-heavy workflows, apply codebase-exploration patterns for systematic investigation.
  • Git commit and PR creation workflows interact with disciplined-coding scope and verification standards.
  • When building constrained tool flows for specialized tasks, apply prompt-engineering patterns.

Project Customization

If user-config.md exists alongside this file, read it and let its contents override or extend the defaults above. Common customizations:

  • Project-specific shell commands and aliases
  • Custom sandbox allowlist paths
  • Git workflow conventions (branch naming, commit message format)
  • Preferred package manager and build commands

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.