science-skills-common

Provides a shared Python HTTP client with rate limiting, retries, and exponential backoff for scientific APIs.

Updated Jan 8, 2026
One-click install
npx skills add https://github.com/arslan9024/White-Caves --skill science-skills-common-arslan9024
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: science-skills-common
Source: https://github.com/arslan9024/White-Caves/tree/main/.agents/skills/science_skills_common
Command: npx skills add https://github.com/arslan9024/White-Caves --skill science-skills-common-arslan9024

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Scientific APIs like NCBI, PubChem, and ChEMBL enforce strict rate limits and return transient errors (429, 5xx) that break naive scripts. This shared package gives every Science Skill a single, dependency-free HTTP client that handles throttling, retries, and backoff consistently. ## Core Features & Use Cases - Cross-Process Rate Limiting: A file-lock based limiter enforces per-host QPS limits even when multiple scripts run in parallel. - Automatic Retries with Backoff: Retries transient HTTP 429/5xx and network errors using exponential backoff with jitter and Retry-After header support. - Proactive Backpressure: Parses the X-Throttling-Control header from PubChem/NCBI to slow down before hitting hard limits. - Streaming Support: Streams large responses line-by-line or in byte chunks for big downloads like UniProt result sets or PDFs. - Use Case: A bioinformatics skill querying NCBI E-utilities imports this client to fetch JSON at 3 QPS, automatically retrying on 503 responses without writing any retry logic. ## Quick Start Import http_client from the science_skills_common package and use it to fetch JSON from the NCBI E-utilities API with a 3 queries-per-second limit.

Frequently Asked Questions about science-skills-common

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I rate limit API requests in Python across multiple processes?▼

Use the HttpClient from this package, which enforces per-host QPS limits through a shared file lock in /tmp. Multiple processes coordinate through the same lock file, so the combined request rate never exceeds the configured limit.

How to handle HTTP 429 and 503 errors when calling NCBI or PubChem APIs?▼

The HttpClient automatically retries 429 and 5xx responses with exponential backoff, jitter, and Retry-After header support. It also parses the X-Throttling-Control header to slow down proactively before a hard limit is reached.

Does this HTTP client require third-party Python packages?▼

No, the client is built entirely on the Python standard library using urllib.request for transport. It is installed automatically as a dependency declared in each skill's uv script header.

Can I stream large API responses without loading them into memory?▼

Yes, the stream_lines and stream_bytes methods yield response content incrementally with automatic gzip decompression. This suits large downloads such as UniProt stream endpoints or PDF files, though retries only apply during the connection phase.

Why do I get HTTP 403 errors when fetching from scientific APIs?▼

Some APIs block requests based on the User-Agent header. Set the SCIENCE_SKILLS_USER_AGENT environment variable to a custom value identifying your application, as suggested in the client's error hint for 403 responses.