agentleFS
SumitShinde0702SumitShinde0702/aipaysdk/skills/add-plugin/SKILL.md

add-plugin

Skill2 starsChanged 4 months agoMITView on GitHub

Use this skill when the user wants to add, refactor, or generalize a `agentpay <plugin>` integration like Bitrefill. Follow the shared plugin registration path under `src/plugins`, keep plugin-specific API or scraping code under `src/lib/<plugin>` or `src/lib/<plugin>/`, reuse the existing Rust daemon signing and policy path through the shared CLI plugin context instead of reimplementing signing, and add focused CLI tests for the new plugin.

7 other projects use a version of this.

Adopted by

Most recently taken up by

The file

Show its rules and text

We split this skill into the rules it gives an agent

20 rules. 0 are common, 5 are distinctive, and 15 are very specific to this project.

  • 0

    Common

    Most of the 7 edited versions we read keep these.

  • 5

    Distinctive

    This author's own choices. Worth a look.

  • 15

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill when the task is "add another plugin like Bitrefill" or "make plugin onboarding more reusable."

    line 8
  2. Very specific:

    Keep plugin-local API normalization, transports, cookies, scraping, or challenge handling in src/lib/<plugin>*.

    line 23
  3. Very specific:

    Keep src/cli.ts responsible only for assembling shared dependencies and calling registerBuiltinCliPlugins(...).

    line 24
  4. Very specific:

    Do not add another large inline .command('<plugin>') block to src/cli.ts.

    line 29
  5. Distinctive:

    Do not reimplement signing, nonce management, or policy logic in the plugin.

    line 30
  6. Very specific:

    If the plugin needs onchain payment, default to preview-first behavior and make live payment explicit with --broadcast.

    line 31
  7. Very specific:

    If the plugin only needs a quote plus an optional live payment path, prefer one buy-style command over a redundant separate price command.

    line 32
  8. Distinctive:

    Keep plugin-specific error handling inside the plugin module when possible.

    line 33
  9. Distinctive:

    If a remote API needs browser bootstrap, Cloudflare handling, or cookies, isolate that behind the plugin's transport/client layer instead …

    line 34
  10. Very specific:

    Add or extend the plugin client under src/lib/<plugin>*.

    line 40
  11. Very specific:

    Add a new CliPlugin implementation under src/plugins/<plugin>.ts.

    line 41
  12. Very specific:

    If the plugin needs signing or broadcast, use context.config, context.agent, and context.broadcast instead of shelling around the shared …

    line 43
  13. Very specific:

    Add a focused CLI test file or extend the closest existing one under test/.

    line 44
  14. Very specific:

    Run the plugin-focused tests and at least one agentpay <plugin> --help smoke check.

    line 45
  15. Distinctive:

    Prefer mocked CLI/integration tests over live third-party dependencies.

    line 49
  16. Very specific:

    If the plugin supports --broadcast, cover both preview-only and broadcast-backed flows.

    line 51
  17. Very specific:

    Read src/plugins/types.ts for the shared context contract.

    line 55
  18. Very specific:

    Read src/plugins/index.ts for plugin registration.

    line 56
  19. Very specific:

    Read src/plugins/bitrefill.ts for the current plugin pattern.

    line 57
  20. Very specific:

    Read the matching src/lib/<plugin>* module only when implementing that plugin's remote API behavior.

    line 58

“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “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

Add Plugin

Use this skill when the task is "add another plugin like Bitrefill" or "make plugin onboarding more reusable."

Ground Truth

  • src/cli.ts is the main CLI entrypoint, but plugin-specific command trees should not be wired inline there.
  • src/plugins/types.ts defines the shared CliPluginContext and the generic plugin registrar shape.
  • src/plugins/index.ts is the registry for built-in plugins.
  • src/plugins/bitrefill.ts is the reference implementation for a plugin that owns its own command tree.
  • Plugin-specific HTTP or browser/bootstrap code belongs in src/lib/<plugin>.ts or src/lib/<plugin>/.
  • Signing, policy checks, manual approval handling, and raw transaction broadcast plumbing stay on the existing AgentPay path exposed through CliPluginContext.

Default Architecture

  1. Create src/plugins/<plugin>.ts.
  2. Register the plugin in src/plugins/index.ts.
  3. Keep plugin-local API normalization, transports, cookies, scraping, or challenge handling in src/lib/<plugin>*.
  4. Keep src/cli.ts responsible only for assembling shared dependencies and calling registerBuiltinCliPlugins(...).
  5. Reuse context.agent.runJson(...) plus context.broadcast.* for any payment flow that reaches the daemon.

Implementation Rules

  • Do not add another large inline .command('<plugin>') block to src/cli.ts.
  • Do not reimplement signing, nonce management, or policy logic in the plugin.
  • If the plugin needs onchain payment, default to preview-first behavior and make live payment explicit with --broadcast.
  • If the plugin only needs a quote plus an optional live payment path, prefer one buy-style command over a redundant separate price command.
  • Keep plugin-specific error handling inside the plugin module when possible.
  • If a remote API needs browser bootstrap, Cloudflare handling, or cookies, isolate that behind the plugin's transport/client layer instead of leaking it into the shared CLI.
  • Pass only shared helpers through CliPluginContext; keep plugin business logic inside the plugin module.

Deterministic Workflow

  1. Inspect src/plugins/bitrefill.ts to copy the current plugin structure and command style.
  2. Add or extend the plugin client under src/lib/<plugin>*.
  3. Add a new CliPlugin implementation under src/plugins/<plugin>.ts.
  4. Register it in src/plugins/index.ts.
  5. If the plugin needs signing or broadcast, use context.config, context.agent, and context.broadcast instead of shelling around the shared flow.
  6. Add a focused CLI test file or extend the closest existing one under test/.
  7. Run the plugin-focused tests and at least one agentpay <plugin> --help smoke check.

Testing Rule

  • Prefer mocked CLI/integration tests over live third-party dependencies.
  • Cover command registration, happy path output, unsupported modes, and any explicit challenge or approval state.
  • If the plugin supports --broadcast, cover both preview-only and broadcast-backed flows.

References

  • Read src/plugins/types.ts for the shared context contract.
  • Read src/plugins/index.ts for plugin registration.
  • Read src/plugins/bitrefill.ts for the current plugin pattern.
  • Read the matching src/lib/<plugin>* module only when implementing that plugin's remote API behavior.

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.