agentleFS
yaohuangguanyaohuangguan/agent-playbook/skills/use-external-api/SKILL.md

use-external-api

Skill1 starsChanged 2 days agoMITView on GitHub

Use a library, SDK, CLI or web API correctly by checking the installed version and real docs instead of relying on memory. Use this whenever code calls a third-party package or service, when you are unsure of a method or parameter name, or when an API call fails. It prevents invented methods and outdated usage.

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 5 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈5

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Find the existing usage: Search this repository first, and copy how it creates clients, handles errors and sets timeouts.

    line 18
  2. Distinctive:

    Confirm that each name exists: Search the installed package for each method and parameter you plan to use.

    line 40
  3. Distinctive:

    Handle real conditions: Check each of these:

    line 46
  4. Distinctive:

    Isolate the integration: Keep calls to the service in one place, so that tests can stub the network and upgrades touch one file.

    line 54
  5. Very specific:

    Finish: Follow verify-and-report, and state which docs or version you used.

    line 60
  6. Distinctive:

    Ask first if the task did not call for one.

    line 64

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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

Use an external API

Your memory of an API may be wrong or out of date, and invented method names often look correct. The installed code and current docs are the truth.

When to use

Any time you call something you did not write, unless the same call already exists in this repository.

Steps

  1. Find the existing usage. Search this repository first, and copy how it creates clients, handles errors and sets timeouts.
  2. Find the exact version.

    StackCheck
    JavaScriptThe lockfile, or node_modules/<pkg>/package.json
    Pythonpip show <pkg>
    Gogo.mod, or go list -m <module>
    RustCargo.lock
    Javamvn dependency:tree
  3. Read the source of truth. In order of trust:

    1. Types or source of the installed package
    2. Official docs for that version
    3. The official changelog or migration guide

    Blog posts and forum answers can show you where to look, but confirm with one of these.

  4. Confirm that each name exists. Search the installed package for each method and parameter you plan to use. If you cannot find it, do not use it.
  5. Run a small check. Try the call in a small script or test, using a sandbox or test key. Do not use production data or paid operations for this.
  6. Handle real conditions. Check each of these:

    • Timeouts on every network call
    • Rate limits, and which errors can be retried
    • Pagination, so that you do not read only the first page
    • Idempotency keys for writes that may be retried
    • Partial failure, and a response in an unexpected shape
  7. Isolate the integration. Keep calls to the service in one place, so that tests can stub the network and upgrades touch one file.
  8. Test it. Stub at the network, with responses taken from real docs or real sandbox calls. Follow write-tests.
  9. Finish. Follow verify-and-report, and state which docs or version you used.

Adding a dependency

Ask first if the task did not call for one. Check that it is maintained, its license suits the project, and the standard library or an existing dependency cannot do the job. Confirm the exact package name from its official source, because similar names can be malicious. Pin it with the lockfile.

Stop and ask when

  • The call needs real credentials you do not have.
  • The call costs money, sends messages or changes real data.
  • Docs and installed code disagree, and you cannot tell which is right.

Common mistakes

Tempting moveWhy it failsDo this instead
Write the call from memoryNames and defaults changeCheck the installed version
Retry on any errorA repeated write can duplicate an effectRetry only safe errors
Read only the first pageSilently loses dataFollow pagination
Use latestBuilds change without noticePin the version
Fake a response from your imaginationThe test passes and production failsBase it on a real response
Put an API key in the codeIt leaks through historyRead it from the environment

Report

Package or API: <name, version>
Source checked: <installed types or docs URL>
Check run: <what you called, and the result>
Handles: <timeouts, retries, pagination, idempotency>
Not verified: <anything not exercised for real>

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.