← Browse

@jgkme/torrent-client-handler-patterns

B

Implement and review torrent client API handlers consistently across this repository. Use when adding or fixing files in api_handlers, authentication flow, request formatting, or post-add operations like labels, categories, and directories.

skillclaude

Install

agr install @jgkme/torrent-client-handler-patterns --target claude

Writes 1 file into .claude/skills/, pinned to git-a089ba68.

  • .claude/skills/torrent-client-handler-patterns/SKILL.md

Document


name: torrent-client-handler-patterns description: Implement and review torrent client API handlers consistently across this repository. Use when adding or fixing files in api_handlers, authentication flow, request formatting, or post-add operations like labels, categories, and directories.

Torrent Client Handler Patterns

Handler Design Rules

Use these conventions for api_handlers/* changes:

  1. Keep auth/session flow explicit and isolated per server profile.
  2. Normalize error handling into readable, user-facing messages.
  3. Preserve compatibility with older client variants when supported.
  4. Avoid assuming content-type correctness for torrent files; handle fallbacks.
  5. Keep test-connection logic separate from add-torrent logic.

Implementation Checklist

  • Confirm URL construction for base URL + relative path edge cases.
  • Add required headers (for example origin/referer/basic auth) when applicable.
  • Treat optional capabilities defensively (missing RPC methods, partial stats).
  • Keep parsing strict and predictable for JSON/XML responses.
  • Maintain backward compatibility for stored server config fields.

Regression Hotspots

  • Multi-server session leakage.
  • Client version specific endpoints.
  • Label/category/tag not applied after add.
  • Race conditions around "latest torrent hash" detection.
  • Silent failures in connection tests.

Validation

  • Build with bun run build.
  • Manually validate one happy path and one failure path for the edited client.

Trustgrade B

  • passBody integrity

    Whether the stored document is plausibly the kind of file the artifact declares, rather than something fetched by mistake.

  • passType matchnot applicable to this artifact type

    Whether the artifact is really the kind of thing its metadata claims it is.

  • passFreshness

    How long since the source repository was last pushed to.

  • passPrompt injection

    Scans the artifact's own text for instructions aimed at your agent rather than at you.

  • warnLicensecopyleft/unknown — index-and-link only

    Whether the source repository declares an SPDX license permissive enough to redistribute.

How the grade is calculated

Each check contributes 0 points when it passes, 1 when it warns, and 2 when it fails. The total maps to a letter:

  • Aevery check passed
  • Bone warning
  • Ctwo warnings
  • Dprompt injection or body integrity failed, or three warnings
  • Fone of those failed, and something else is wrong

These are automated hygiene checks, not a security audit, and not a dependency or vulnerability scan. A grade of A means nothing was flagged — not that the artifact is safe.

Versions

  • git-a089ba686c7e2026-07-31