⏳ This skill is pending AI review.
Scores will appear once the review pipeline completes.
s2-cli
Semantic Scholar CLI (`s2`) for on-demand citation graph lookup: papers a work cites, papers that cite a work, and graph search across 200M+ papers. Use whenever the user asks for Semantic Scholar, S2, cited papers, references, bibliography, citing papers, citation count from Semantic Scholar, or papers outside a local catalog. Prefer `s2` over curl or ad-hoc Graph API requests.
Choose how to use this skill
You do not need every option. Choose the path your AI client supports. The stable page stays the same; versioned files are immutable.
1. Native installer
This listing has no registered native installer command. Use the complete package or source fallback below, depending on what your client supports.
Do not guess an installer command or replace an existing version without reviewing the diff.
2. Complete package recommended
Download the ZIP when available. It includes SKILL.md plus the references, security notes and version metadata.
No complete ProSkills package is published for this listing yet.3. Prompt-only
Copy the prompt above when the agent can read the stable page or when you want to adopt the workflow without installing a skill.
Need only the instruction file?
Download SKILL.md only if your client requires a single file. The complete ZIP is safer for a full installation because it preserves the references and release context.
No path installs or executes anything by itself. Your agent still needs access to the project files. Before updating, compare the installed version and review the diff.
// RATINGS
// README
s2 CLI and Skill
A fast, read-only command-line client for the Semantic Scholar Graph API, alongside a Skill for coding agents.
Built to power Papers with Code's chat interface.
Use s2 to:
- list the papers a work cites (
s2 refs) - list the papers that cite a work (
s2 citations) - search the Semantic Scholar graph when a paper may not be in a local catalog
This CLI requires an API key. Set PWC_SEMANTIC_SCHOLAR_API_KEY or S2_API_KEY. Request a key at Semantic Scholar's API page.
s2 refs "Attention is All You Need"
s2 citations ARXIV:1706.03762 --limit 50
s2 search "image dehazing" --year 2025-2026 --limit 100 --json
Installation
Python 3.10 or newer is required.
With uv:
uv tool install git+https://github.com/huggingface/s2-cli.git
Or with pipx:
pipx install git+https://github.com/huggingface/s2-cli.git
From a clone:
git clone https://github.com/huggingface/s2-cli.git
cd s2-cli
uv tool install .
Confirm the installation:
s2 version
Add the CLI Skill
Copy SKILL.md into your agent's skills directory:
mkdir -p .agents/skills/s2-cli
curl -LsSf https://raw.githubusercontent.com/huggingface/s2-cli/main/SKILL.md \
-o .agents/skills/s2-cli/SKILL.md
Quick start
export S2_API_KEY=... # or PWC_SEMANTIC_SCHOLAR_API_KEY
s2 refs "Attention is All You Need"
s2 refs 1706.03762 --limit 50 --offset 20
s2 citations ARXIV:1706.03762 --json
s2 search "scene graph generation" --limit 100
s2 search "scene graph generation" --year 2025-2026 --limit 100 --json
PAPER accepts a quoted title, an arXiv ID (1706.03762, arXiv:1706.03762), a DOI, a 40-character Semantic Scholar paper ID, a prefixed ID (ARXIV:, DOI:, CorpusId:, PMID:, URL:), or an arXiv / Semantic Scholar URL. Titles are resolved with Semantic Scholar's closest-title match. The matched title, paper ID, arXiv ID, and match score are printed on stderr so a bad match is visible. Pass an ID if the header is wrong.
Command reference
| Command | Description |
|---|---|
s2 refs PAPER | Papers this paper cites (bibliography) |
s2 citations PAPER | Papers that cite this paper |
s2 search QUERY | Relevance search over the Semantic Scholar graph |
s2 version | Show the CLI version |
Shared flags: --limit, --offset, --json, --fields. s2 search also accepts --year (2025 or 2025-2026). Defaults are --limit 20. Search --limit maxes at 100; refs/citations max at 1000. There is no --all; rerun with --offset when stderr prints # more.
Citation requests must keep offset + limit <= 9999. Highly cited papers are not fully enumerable through this CLI.
Output and scripting
List commands print lossless TSV (paperId, year, cites, arxiv, title). Add --json for the raw Semantic Scholar payload wrapped as:
{
"schema_version": "v1",
"paper": {"id": "ARXIV:1706.03762"},
"data": {}
}
paper is present on refs and citations. Search JSON includes abstracts in data by default.
Stable exit codes:
| Code | Meaning |
|---|---|
0 | Success |
2 | Invalid usage or missing API key |
3 | Network, server, or exhausted rate-limit failure |
4 | Not found or invalid API response |
Configuration
| Variable | Meaning |
|---|---|
PWC_SEMANTIC_SCHOLAR_API_KEY | Preferred API key |
S2_API_KEY | Fallback API key if the preferred key is unset |
S2_REQUEST_DELAY | Seconds to wait between requests (default 1.5) |
The CLI never reads a secondary historical-backfill key. It sends x-api-key, honors Retry-After on HTTP 429, and identifies itself as s2-cli/<version>.
Development
uv run --with pytest pytest tests
// HOW IT'S BUILT
KEY FILES