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.
npx agentmods add rules/pauljphilp/effectpatterns/handle-resource-timeoutsgit clone --depth 1 https://github.com/PaulJPhilp/EffectPatternsWrote 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/handle-resource-timeouts)<a href="https://agentmods.dev/rules/pauljphilp/effectpatterns/handle-resource-timeouts"><img src="https://agentmods.dev/badge/rules/pauljphilp/effectpatterns/handle-resource-timeouts.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.00702 | $0.00702 |
| Opus 5 | $0.00351 | $0.00351 |
| Sonnet 5 | $0.00140 | $0.00140 |
| Haiku 4.5 | $0.00070 | $0.00070 |
Grade A, and why
handle-resource-timeouts scanned grade A with 0 findings 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.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
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.
description: Always set timeouts on resource acquisition to prevent indefinite waits. globs: "**/*.ts" alwaysApply: true
Handle Resource Timeouts
Rule: Always set timeouts on resource acquisition to prevent indefinite waits.
Example
import { Effect, Duration, Scope } from "effect"
// ============================================
// 1. Define a resource with slow acquisition
// ============================================
interface Connection {
readonly id: string
readonly query: (sql: string) => Effect.Effect<unknown>
}
const acquireConnection = Effect.gen(function* () {
yield* Effect.log("Attempting to connect...")
// Simulate slow connection
yield* Effect.sleep("2 seconds")
const connection: Connection = {
id: crypto.randomUUID(),
query: (sql) => Effect.succeed({ rows: [] }),
}
yield* Effect.log(`Connected: ${connection.id}`)
return connection
})
const releaseConnection = (conn: Connection) =>
Effect.log(`Released: ${conn.id}`)
// ============================================
// 2. Timeout on acquisition
// ============================================
const acquireWithTimeout = acquireConnection.pipe(
Effect.timeout("1 second"),
Effect.catchTag("TimeoutException", () =>
Effect.fail(new Error("Connection timeout - database unreachable"))
)
)
// ============================================
// 3. Timeout on usage
// ============================================
const queryWithTimeout = (conn: Connection, sql: string) =>
conn.query(sql).pipe(
Effect.timeout("5 seconds"),
Effect.catchTag("TimeoutException", () =>
Effect.fail(new Error(`Query timeout: ${sql}`))
)
)
// ============================================
// 4. Full resource lifecycle with timeouts
// ============================================
const useConnectionWithTimeouts = Effect.acquireRelease(
acquireWithTimeout,
releaseConnection
).pipe(
Effect.flatMap((conn) =>
Effect.gen(function* () {
yield* Effect.log("Running queries...")
// Each query has its own timeout
const result1 = yield* queryWithTimeout(conn, "SELECT 1")
const result2 = yield* queryWithTimeout(conn, "SELECT 2")
return [result1, result2]
})
),
Effect.scoped
)
// ============================================
// 5. Timeout on entire operation
// ============================================
const entireOperationWithTimeout = useConnectionWithTimeouts.pipe(
Effect.timeout("10 seconds"),
Effect.catchTag("TimeoutException", () =>
Effect.fail(new Error("Entire operation timed out"))
)
)
// ============================================
// 6. Run with different scenarios
// ============================================
const program = Effect.gen(function* () {
yield* Effect.log("=== Testing timeouts ===")
const result = yield* entireOperationWithTimeout.pipe(
Effect.catchAll((error) =>
Effect.gen(function* () {
yield* Effect.logError(`Failed: ${error.message}`)
return []
})
)
)
yield* Effect.log(`Result: ${JSON.stringify(result)}`)
})
Effect.runPromise(program)
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 · 128 lines · 702 tokens per session scan A 7bc80d969ee1
handle-resource-timeouts is a cursor rule published in the GitHub repository PaulJPhilp/EffectPatterns (796 stars, last pushed 2mo ago), licensed MIT. It adds 702 tokens to every session, about $0.0035 per session on Opus 5. A static security scan graded it A with 0 findings. 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
python--typescript-guide-cursorrules-prompt-file
Cursor rules for Python development with TypeScript guide integration.
django-python
Rules for writing Python services at PostHog (Python servers powered by the Django framework).
nestjs
This guide provides opinionated, actionable best practices for building robust, scalable, and maintainable NestJS applications using TypeScript, emphasizing modern patterns and common pitfalls.
standard-nestjs-module-hierarchy
Establish a consistent NestJS module structure in the API application where each resource is encapsulated in its own module with proper hierarchical organization to enhance maintainability, scalabilit... .
nestjs-best-practices
../../.claude/rules/nestjs-best-practices.md.
api-design-typescript
API Design for TypeScript — Express, NestJS, Fastify patterns, middleware, validation, and error handling. Extends core/rules/api-design.mdc with TypeScript-specific guidance.