Getting it into your agent
It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.
git clone --depth 1 https://github.com/PaulJPhilp/EffectPatternsnpx agentmods add rules/pauljphilp/effectpatterns/create-a-testable-http-client-serviceWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/rules/pauljphilp/effectpatterns/create-a-testable-http-client-service)<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/create-a-testable-http-client-service"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/create-a-testable-http-client-service.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01005 | $0.01005 |
| Opus 5 | $0.00502 | $0.00502 |
| Sonnet 5 | $0.00201 | $0.00201 |
| Haiku 4.5 | $0.00101 | $0.00101 |
Grade A, and why
create-a-testable-http-client-service 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 3d ago.
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.
fetch(url).then((res) => res.json() as T) How it starts
The opening of the file, as written. The whole thing — 145 lines — stays where its author put it; the contents beside it link to each section on GitHub.
description: Define an HttpClient service with distinct Live and Test layers to enable testable API interactions. globs: "**/*.ts" alwaysApply: true
Create a Testable HTTP Client Service
Rule: Define an HttpClient service with distinct Live and Test layers to enable testable API interactions.
Example
1. Define the Service
import { Effect, Data, Layer } from "effect";
interface HttpErrorType {
readonly _tag: "HttpError";
readonly error: unknown;
}
const HttpError = Data.tagged<HttpErrorType>("HttpError");
interface HttpClientType {
readonly get: <T>(url: string) => Effect.Effect<T, HttpErrorType>;
}
class HttpClient extends Effect.Service<HttpClientType>()("HttpClient", {
sync: () => ({
get: <T>(url: string): Effect.Effect<T, HttpErrorType> =>
Effect.tryPromise<T>(() =>
fetch(url).then((res) => res.json() as T)
).pipe(Effect.catchAll((error) => Effect.fail(HttpError({ error })))),
}),
}) {}
// Test implementation
const TestLayer = Layer.succeed(
HttpClient,
HttpClient.of({
get: <T>(_url: string) => Effect.succeed({ title: "Mock Data" } as T),
})
);
// Example usage
const program = Effect.gen(function* () {
const client = yield* HttpClient;
yield* Effect.logInfo("Fetching data...");
const data = yield* client.get<{ title: string }>(
"https://api.example.com/data"
);
yield* Effect.logInfo(`Received data: ${JSON.stringify(data)}`);
});
// Run with test implementation
Effect.runPromise(Effect.provide(program, TestLayer));
2. Create the Live Implementation
import { Effect, Data, Layer } from "effect";
interface HttpErrorType {
readonly _tag: "HttpError";
readonly error: unknown;
}
const HttpError = Data.tagged<HttpErrorType>("HttpError");
interface HttpClientType {
readonly get: <T>(url: string) => Effect.Effect<T, HttpErrorType>;
}
class HttpClient extends Effect.Service<HttpClientType>()("HttpClient", {
sync: () => ({
get: <T>(url: string): Effect.Effect<T, HttpErrorType> =>
Effect.tryPromise({
try: () => fetch(url).then((res) => res.json()),
catch: (error) => HttpError({ error }),
}),
}),
}) {}
// Test implementation
const TestLayer = Layer.succeed(
HttpClient,
HttpClient.of({
get: <T>(_url: string) => Effect.succeed({ title: "Mock Data" } as T),
})
);
// Example usage
const program = Effect.gen(function* () {
const client = yield* HttpClient;
yield* Effect.logInfo("Fetching data...");
const data = yield* client.get<{ title: string }>(
"https://api.example.com/data"
);
yield* Effect.logInfo(`Received data: ${JSON.stringify(data)}`);
});
// Run with test implementation
Effect.runPromise(Effect.provide(program, TestLayer));
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.
- 3d ago First seen · 145 lines · 1,005 tokens per session scan A 2627cad825c5
create-a-testable-http-client-service is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (796 stars, last pushed 2mo ago), licensed MIT. It adds 1,005 tokens to every session, about $0.0050 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-09-03.
Other cursor rules, from other repositories
issues-tests
Backend test conventions — QuarkusTest, REST Assured, Given, ArchUnit.
htmx-go-and-fiber-best-practices-general
Applies general best practices for HTMX, Go, and Fiber development to Go files. Focuses on Fiber framework usage.
tech-stack-configuration
Specifies the tech stack to be used, including AI Model, Frontend framework (Flutter), State Management (Riverpod), and BaaS (Firebase).
fastapi-startup-and-shutdown-events
Recommends minimizing the use of startup and shutdown events in favor of lifespan context managers.
django-orm-for-database-operations
Specifies that Django's ORM should be used for interacting with the database when defining models. This encourages a consistent approach to database operations across the project.
core-spec-templates
Ready-to-use specification templates — OpenAPI, JSON Schema, Gherkin, ADR, Pact, AsyncAPI.