/wikimedia-data-collection:wikidata-sparqlfrom wikimedia-data-collection
Collect structured facts from Wikidata via the Wikidata Query Service (WDQS) SPARQL endpoint — entities matching criteria, properties, relationships, cross-wiki identifiers, counts. Use whenever you need STRUCTURED/queryable data ("all X that are Y", "the population/coordinates/identifiers of …") rather than prose from an article. The structured-data counterpart to the Action API.
Ships in wikimedia-data-collection. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Query the knowledge graph directly instead of scraping infoboxes. Returns exactly the rows you asked for.
Prerequisites (Cowork): network access enabled; /outputs/ mounted.
https://query.wikidata.org/sparql, GET or POST, param query=<SPARQL>, header
Accept: application/sparql-results+json. Send a descriptive User-Agent
(required; WDQS blocks generic agents). Results: results.bindings[], each a map
of var → {type, value}.
LIMIT your
result set, avoid unbounded ?s ?p ?o.wdt:/wd: truthy predicates for simple facts; use labels via
the label service.import urllib.parse, urllib.request, json
EP = "https://query.wikidata.org/sparql"
UA = "WikimediaResearch/1.0 ([email protected]; collecting structured facts)"
SPARQL = """
SELECT ?city ?cityLabel ?population WHERE {
?city wdt:P31 wd:Q515 ; # instance of: city
wdt:P1082 ?population ; # population
wdt:P17 wd:Q55 . # country: Netherlands
SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
} ORDER BY DESC(?population) LIMIT 100
"""
req = urllib.request.Request(EP + "?" + urllib.parse.urlencode({"query": SPARQL}),
headers={"User-Agent": UA, "Accept": "application/sparql-results+json"})
rows = json.load(urllib.request.urlopen(req, timeout=70))["results"]["bindings"]
data = [{k: v["value"] for k, v in r.items()} for r in rows]
json.dump({"endpoint": EP, "query": SPARQL, "rows": data},
open("/outputs/nl_cities.json", "w"), indent=2)
query.wikidata.org, then paste the final
SPARQL into the skill.LIMIT/OFFSET and ORDER BY a stable key, or
narrow the constraints — don't try to pull the whole graph.list=search) or
wbsearchentities if you only have a label.Reference: WDQS · SPARQL examples · WDQS user manual.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub lgelauff/wikimedia-coding-agent-lessons --plugin wikimedia-data-collection4 skills in this plugin
/mediawiki-action-apiCollect content and metadata from any Wikimedia wiki (Wikipedia, Commons, Wiktionary, Meta…) via the MediaWiki Action API — article wikitext, revisions and revision history, page metadata, categories, links, backlinks, and search results. Use whenever you need data FROM a wiki page or set of pages and would otherwise be tempted to open/scrape the article HTML. API-first, never scrape./phabricator-conduitCollect tasks, comments, and project data from Wikimedia Phabricator via the Conduit API (maniphest.search, transaction.search, project.search, user.search) — filter tasks by project/status/assignee/date, page through results, and pull history. Use whenever you need data from phabricator.wikimedia.org instead of scraping the task web UI./wikimedia-analytics-apiCollect Wikimedia traffic and contribution metrics via the public REST Analytics (AQS) API — per-article and aggregate pageviews, unique devices, edits, editors, and registered-user counts, by project / time range / granularity / access method. Use whenever you need quantitative time-series about wiki readership or editing, instead of any dashboard scraping.