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.
git clone --depth 1 https://github.com/tyrchen/cursor-rust-rulesWrote 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/tyrchen/cursor-rust-rules/http-client)<a href="https://agentmods.dev/rules/tyrchen/cursor-rust-rules/http-client"><img src="https://agentmods.dev/badge/rules/tyrchen/cursor-rust-rules/http-client/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/rules/tyrchen/cursor-rust-rules/http-client"><img src="https://agentmods.dev/badge/rules/tyrchen/cursor-rust-rules/http-client.svg" alt="Reviewed on agentmods" width="80" 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.00000 | $0.01619 |
| Opus 5.5 | $0.00000 | $0.00648 |
| Sonnet 5.5 | $0.00000 | $0.00324 |
| Haiku 4.5 | $0.00000 | $0.00162 |
Grade A, and why
http-client 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 1mo 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 — 257 lines — stays where its author put it; the contents beside it link to each section on GitHub.
🌐 HTTP CLIENT BEST PRACTICES
TL;DR: Modern HTTP client patterns using reqwest with proper error handling, timeouts, and security configurations.
🔍 HTTP CLIENT ARCHITECTURE STRATEGY
graph TD
Start["HTTP Client Requirements"] --> ClientType{"Client<br>Usage Pattern?"}
ClientType -->|Simple Requests| SimpleClient["Simple Request Pattern"]
ClientType -->|Complex Integration| AdvancedClient["Advanced Client Pattern"]
ClientType -->|Service Integration| ServiceClient["Service Client Pattern"]
SimpleClient --> BasicConfig["Basic Configuration"]
AdvancedClient --> BuilderPattern["Builder Pattern"]
ServiceClient --> TypedClient["Typed Client"]
BasicConfig --> ErrorHandling["Error Handling"]
BuilderPattern --> ErrorHandling
TypedClient --> ErrorHandling
ErrorHandling --> RetryLogic["Retry Logic"]
RetryLogic --> Authentication["Authentication"]
Authentication --> Monitoring["Request Monitoring"]
Monitoring --> Testing["Client Testing"]
Testing --> Production["Production HTTP Client"]
style Start fill:#4da6ff,stroke:#0066cc,color:white
style SimpleClient fill:#4dbb5f,stroke:#36873f,color:white
style AdvancedClient fill:#ffa64d,stroke:#cc7a30,color:white
style ServiceClient fill:#d94dbb,stroke:#a3378a,color:white
🔧 REQWEST CONFIGURATION
Standard Dependencies
# Cargo.toml - HTTP client configuration
[dependencies]
reqwest = { version = "0.12", default-features = false, features = [
"charset",
"rustls-tls-webpki-roots",
"http2",
"json",
"cookies",
"gzip",
"brotli",
"zstd",
"deflate"
] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
tokio = { version = "1.45", features = ["macros", "rt-multi-thread"] }
anyhow = "1.0"
thiserror = "2.0"
url = "2.5"
🏗️ CLIENT BUILDER PATTERN
Configurable HTTP Client
use reqwest::{Client, ClientBuilder, Response};
use serde::{Deserialize, Serialize};
use std::time::Duration;
use url::Url;
pub struct HttpClient {
client: Client,
base_url: Url,
default_timeout: Duration,
}
impl HttpClient {
pub fn builder() -> HttpClientBuilder {
HttpClientBuilder::new()
}
pub async fn get<T>(&self, path: &str) -> Result<T, HttpError>
where
T: for<'de> Deserialize<'de>,
{
let url = self.base_url.join(path)?;
let response = self
.client
.get(url)
.timeout(self.default_timeout)
.send()
.await?;
self.handle_response(response).await
}
pub async fn post<T, B>(&self, path: &str, body: &B) -> Result<T, HttpError>
where
T: for<'de> Deserialize<'de>,
B: Serialize,
{
let url = self.base_url.join(path)?;
let response = self
.client
.post(url)
.json(body)
.timeout(self.default_timeout)
.send()
.await?;
self.handle_response(response).await
}
async fn handle_response<T>(&self, response: Response) -> Result<T, HttpError>
where
T: for<'de> Deserialize<'de>,
{
let status = response.status();
if status.is_success() {
let text = response.text().await?;
serde_json::from_str(&text).map_err(|e| HttpError::Deserialization {
error: e.to_string(),
body: text,
})
} else {
let body = response.text().await.unwrap_or_default();
Err(HttpError::UnexpectedStatus {
status: status.as_u16(),
body,
})
}
}
}
pub struct HttpClientBuilder {
base_url: Option<String>,
timeout: Option<Duration>,
user_agent: Option<String>,
headers: Vec<(String, String)>,
accept_invalid_certs: bool,
}
impl HttpClientBuilder {
pub fn new() -> Self {
Self {
base_url: None,
timeout: Some(Duration::from_secs(30)),
user_agent: Some("rust-http-client/1.0".to_string()),
headers: Vec::new(),
accept_invalid_certs: false,
}
}
pub fn base_url(mut self, url: &str) -> Self {
self.base_url = Some(url.to_string());
self
}
pub fn timeout(mut self, timeout: Duration) -> Self {
self.timeout = Some(timeout);
self
}
pub fn build(self) -> Result<HttpClient, HttpError> {
let base_url = self.base_url
.ok_or_else(|| HttpError::Configuration("Base URL is required".to_string()))?;
let mut client_builder = ClientBuilder::new()
.danger_accept_invalid_certs(self.accept_invalid_certs);
if let Some(timeout) = self.timeout {
client_builder = client_builder.timeout(timeout);
}
if let Some(user_agent) = &self.user_agent {
client_builder = client_builder.user_agent(user_agent);
}
let client = client_builder.build()?;
let parsed_url = Url::parse(&base_url)?;
Ok(HttpClient {
client,
base_url: parsed_url,
default_timeout: self.timeout.unwrap_or(Duration::from_secs(30)),
})
}
}
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.
- 1mo ago First seen · 257 lines · 0 tokens per session scan A adb7494ad711
http-client is a cursor rule published in the GitHub repository tyrchen/cursor-rust-rules (27 stars, last pushed 1y ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,619 tokens. 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-08-30.
Other cursor rules, from other repositories
rust
Rules for writing Rust services at PostHog. Focuses on writing async Rust with Tokio and encoding general Rust best practices from the Rust book and docs.
actix-web
Definitive guidelines for building high-performance, maintainable, and secure web applications with actix-web 4, focusing on modern Rust best practices.
rocket
Definitive guidelines for building robust, performant, and maintainable backend services with Rocket 0.5+, focusing on modern Rust async patterns, API design, and testing.
axum
Comprehensive best practices for Axum 0.8+ development with WebSocket support.
core
Core STT/TTS abstraction layer documentation.
rust-hexagonal
Règles Rust Architecture Hexagonale avec gRPC (tonic).