Service-Integration

A coding mode for connecting an application to an internal or external API or service. It covers requests, responses, authentication, and error handling based on the service's documented contract.

In plain words
What is it for?
Use it to implement API integrations, including request construction, response parsing, authentication setup, and handling service errors.
Why use it?
It provides a structured way to turn API requirements into client code without overlooking methods, parameters, credentials, response formats, or failure cases.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/thesethrose/devrules/service-integration
Clone the repo
git clone --depth 1 https://github.com/TheSethRose/DevRules

Made for: Cursor.

Per session 31 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,342 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00031 $0.01342
Opus 5 $0.00015 $0.00671
Sonnet 5 $0.00006 $0.00268
Haiku 4.5 $0.00003 $0.00134

Measured yesterday against content hash 54fa64ad2a85, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

Service-Integration scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const response = await fetch(url, {
.cursor/rules/tasks/Service-Integration.mdc · 128 lines

How it starts

The opening of the file, as written. The whole thing — 128 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Implement Integration Mode

1. Role

You are an Integration Specialist. Your task is to write the client-side code necessary to communicate effectively with other APIs or services (internal or external), handling request construction, response parsing, authentication, and error management.

2. Process

  • Understand Integration Requirements:
    • Identify the target API/service endpoint(s) to interact with.
    • Clarify the goal of the interaction (e.g., fetch data, submit data, trigger an action).
    • Obtain the API contract/documentation: Required HTTP methods, paths, parameters (query, path, header), request body schema, expected response schemas, status codes, and error formats. Refer to @modes/design/design-api.mdc or external docs.
    • Determine the authentication method required (e.g., API Key, OAuth Bearer Token, Basic Auth) and where to obtain credentials (e.g., environment variables - use context from 01-project-context.mdc).
  • Choose HTTP Client/Library: Select or use the project's standard library for making HTTP requests (e.g., fetch API, axios, requests in Python, framework-specific clients). Check 01-project-context.mdc.
  • Plan Implementation:
    • Structure the code (e.g., dedicated API client class/module, function within a service).
    • Plan request construction: Setting method, URL, headers (including Content-Type, Accept, Authorization), query parameters, and request body serialization (e.g., JSON.stringify).
    • Plan response handling: Checking status code, parsing response body (e.g., response.json()), handling different success/error status codes.
    • Plan error handling: Network errors, timeouts, non-success HTTP status codes, response parsing errors.
    • Consider adding basic retry logic for transient network errors if appropriate.
  • Write Code: Implement the client logic:
    • Construct the request URL, headers, and body correctly based on the API contract.
    • Include authentication details securely (e.g., reading keys from environment variables).
    • Make the HTTP request using the chosen library.
    • Check the response status code and handle expected success and error codes appropriately.
    • Parse the response body based on the expected Content-Type.
    • Implement robust error handling for network issues and unexpected responses.
    • Return data in a useful format or throw appropriate exceptions.
  • Present Code: Provide the implemented client function or class.
  • Explain Implementation: Describe how the code interacts with the API, handles authentication, processes responses, and manages errors according to the specification.

Read the full file on GitHub · 128 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 128 lines · 31 tokens per session scan A 54fa64ad2a85

Subscribe to this mod's changes

Service-Integration is a cursor rule published in the GitHub repository TheSethRose/DevRules (25 stars, last pushed 1y ago), licensed MIT. It adds 31 tokens to every session and 1,342 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.