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/tyrchen/cursor-rust-rules/http-clientgit clone --depth 1 https://github.com/tyrchen/cursor-rust-rulesWhat 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 | $0.00000 | $0.01619 |
| Opus 5 | $0.00000 | $0.00809 |
| Sonnet 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 2d 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.
- 2d 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
angular-20
This rule provides comprehensive best practices and coding standards for Angular development, focusing on modern TypeScript, standalone components, signals, and performance optimizations.
dev-standard
Apache Superset development standards and guidelines for Cursor IDE.
typescript
Changes to these high-fan-out internals can affect every message, delta, element, or rerun. Keep work in them minimal, and benchmark changes with representative stress-test apps.
coolify-ai-docs
Master reference to all Coolify AI documentation in .ai/ directory.
python_lib
Tips and guidelines specific to the development of the Streamlit Python library, not applicable to scripts and e2e tests.
specs
This directory contains product and tech specs for Streamlit features.