Logo de Wikimedia Petscan

Wikimedia Petscan

Comunidade
fuzheado
wikimedia-petscan

Use PetScan for multi-source Wikimedia queries — category intersections, template filtering, SPARQL integration, Wikidata item queries, and bulk data export via the URL API and PSID system

Visão geral

Publicado porfuzheado
RepositórioWikipedia-AI-Skills
Nome da habilidadewikimedia-petscan
Estrelas
27
Forks
10
Arquivos incluídos
Somente instruções
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Sem arquivos extras

    Tudo de que o modelo precisa está nas instruções — sem arquivos extras para sincronizar.

  • Código aberto

    Publicada por fuzheado no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Wikimedia Petscan no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-petscan
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/fuzheado/Wikipedia-AI-Skills.git /tmp/Wikipedia-AI-Skills
mkdir -p .claude/skills
cp -r /tmp/Wikipedia-AI-Skills/.claude/skills/wikimedia-petscan .claude/skills/wikimedia-petscan
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Wikimedia Petscan em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Wikimedia Petscan automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Wikimedia Petscan não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

ℹ️ User-Agent required: All API examples in this skill access PetScan (petscan.wmcloud.org). Include a descriptive User-Agent header as described in the wikimedia-api-access skill.

💡 Related skills for complementary query approaches:


SOP: What PetScan Is

PetScan is a powerful multi-source querying tool for Wikimedia, created by Magnus Manske as the successor to CatScan2. Winner of the Coolest Tool Award 2022.

It generates lists of pages or Wikidata items matching criteria across up to 6 source tabs simultaneously:

TabWhat it queriesExample
CategoriesCategory tree membership, intersection/union/differencePages in Category:Physics AND Category:Biography
Page propertiesNamespace, redirects, size, dates, edit types, ORES qualityFiles only, created after 2024, not redirects
Templates & linksTemplate presence, outlinks, incoming linksPages with {{Infobox scientist}} but NOT {{Unreferenced}}
Other sourcesSPARQL, manual list, PagePile, search queryAll QIDs from a SPARQL query, minus a manual exclusion list
WikidataWikidata item filters — statements, properties, sitelinks, labelsItems with an occupation but no image
OutputFormat, sorting, regex filter, file media typesJSON sorted by page size, with regex filter on title

The key insight: PetScan combines these sources into one result using configurable logic (subset/union/difference/at-least-N). You can mix categories with SPARQL, templates with manual lists, etc. — including cross-wiki via Wikidata.

Three Ways to Use PetScan

MethodWhenHow
Web UIOne-off queries, explorationhttps://petscan.wmcloud.org/ — fill forms, tabs, click "Do it!"
URL APIAutomation, scriptsAppend URL parameters to the base URL, get JSON/CSV/XML/...
PSIDShare, rerun, tool integrationEvery query gets a stable ID; ?psid=12345 re-runs it

SOP: PSID — Stable Query IDs

Since 2016, every submitted PetScan query is assigned a unique, stable numeric PSID (displayed in the result page). This enables:

  • Short URLs: https://petscan.wmcloud.org/?psid=552
  • Re-running queries without re-entering all parameters
  • Tool integration: Many tools (WD-FIST, PagePile, Massviews) accept PSID as input
  • Caching: PSID results are cached server-side for faster repeat access

PSIDs are anonymous — no user identity is stored with them.


SOP: URL Parameter Reference

PetScan accepts 50+ URL parameters across all six tabs. Here are the most commonly used ones in automation:

Categories Tab

ParameterDescription
languageWiki language code (en, de, commons, etc.)
projectWikimedia project (wikipedia, wiktionary, commons, wikidata)
categoriesPipe-separated category names (no Category: prefix). Append `
depthDefault category tree depth (0 = no recursion)
combinationsubset (AND — all categories), union (OR — any category)
negcatsPipe-separated categories to exclude

Page Properties Tab

ParameterDescription
ns[0], ns[6], etc.Namespace filter (set to 1 to include)
show_redirectsno (default), only, yes (include redirects)
show_soft_redirectsSame options for soft redirects
show_disambiguation_pagesSame options for disambiguation pages
after, beforeDate filter (YYYYMMDDHHMMSS format)
since_rev0Find pages created within a time window
larger, smallerPage size range in bytes
minlinks, maxlinksInternal link count range
edits[bots], edits[anons]Filter by last editor type (1 to require, 0 to exclude)
ores_predictionORES quality class (FA, GA, B, C, Start, Stub)
ores_prob_from, ores_prob_toORES probability range

Templates & Links Tab

ParameterDescription
templates_yesPipe-separated templates — page must have ALL of them
templates_anyPipe-separated templates — page must have at least ONE
templates_noPipe-separated templates — page must have NONE
outlinks_yes, outlinks_any, outlinks_noSame pattern for outgoing links
links_to_all, links_to_any, links_to_noSame pattern for incoming links

Other Sources Tab

ParameterDescription
sparqlRaw SPARQL query (URL-encoded) as a data source
manual_listNewline-separated page titles or QIDs
manual_list_wikiWiki for the manual list (e.g., enwiki, wikidatawiki)
pagepilePagePile ID
search_queryFree-text search query
search_max_resultsMax results from search source
source_combinationHow to combine sources: subset, union, or custom (e.g., manual NOT sparql)

Wikidata Tab

ParameterDescription
wikidata_itemwith, without, or any — whether items have a Wikidata ID
wikidata_source_sitesWiki to use as source for site links
wikidata_label_languageLanguage for labels in results
wpiuWikidata property item use filter
sitelinks_yes, sitelinks_any, sitelinks_noFilter by sitelink presence on specific wikis
labels_yes, labels_any, labels_noFilter by label presence in specific languages
min_sitelink_count, max_sitelink_countSitelink count range

Output Tab

ParameterDescription
formathtml, csv, tsv, wiki, json, jsonl, pagepile, kml, plain
sortbynone, title, size, date, incoming_links, random, etc.
sortorderascending or descending
output_limitMaximum number of results
rxp_filterRegular expression to filter titles/labels
file_media_typesPipe-separated media types (BITMAP, VIDEO, AUDIO, 3D, etc.)
page_imageInclude page image URL in output
json-prettyPretty-printed JSON (1)

SOP: Common API Patterns

All examples use curl. Replace language/project as needed.

Category Intersection (AND)

Pages in ALL categories — equivalent to category-intersect.py in the wikipedia-categories skill:

bash
curl -s 'https://petscan.wmcloud.org/\
  ?language=en\
  &project=wikipedia\
  &categories=Physicists%7CGerman%20scientists\
  &ns%5B0%5D=1\
  &combination=subset\
  &format=json' \
  -H 'User-Agent: MyTool/1.0 (contact@example.com)'

Category + Template Filter

Pages in Category:Physics that have {{WikiProject Physics}}:

bash
curl -s 'https://petscan.wmcloud.org/\
  ?language=en\
  &project=wikipedia\
  &categories=Physics\
  &templates_yes=WikiProject%20Physics\
  &ns%5B0%5D=1\
  &format=json' \
  -H 'User-Agent: ...'

Category + ORES Quality Filter

FA-class articles in a category:

bash
curl -s 'https://petscan.wmcloud.org/\
  ?language=en\
  &project=wikipedia\
  &categories=Physics\
  &ores_prediction=FA\
  &ns%5B0%5D=1\
  &format=json' \
  -H 'User-Agent: ...'

SPARQL as a Data Source

Get all items from a SPARQL query that are also in a category:

bash
SPARQL_ENC=$(python3 -c "import urllib.parse; print(urllib.parse.quote(\"\"\"\
SELECT ?item WHERE { ?item wdt:P31 wd:Q5 ; wdt:P106 wd:Q2519376 }
\"\"\"))")
curl -s "https://petscan.wmcloud.org/\
  ?language=en\
  &project=wikipedia\
  &categories=American%20jewellers\
  &sparql=$SPARQL_ENC\
  &combination=subset\
  &format=json" \
  -H 'User-Agent: ...'

Manual List + SPARQL Exclusion

QIDs from a manual list, minus those that already have a certain occupation:

bash
MANUAL="Q123\nQ456\nQ789"
MANUAL_ENC=$(python3 -c "import urllib.parse; print(urllib.parse.quote('''$MANUAL'''))")
SPARQL_EXCLUDE=$(python3 -c "import urllib.parse; print(urllib.parse.quote(\"\"\"\
SELECT ?item WHERE { ?item wdt:P31 wd:Q5 ; wdt:P106 wd:Q2519376 }\
\"\"\"))")
curl -s "https://petscan.wmcloud.org/\
  ?manual_list=$MANUAL_ENC\
  &manual_list_wiki=wikidatawiki\
  &sparql=$SPARQL_EXCLUDE\
  &source_combination=manual%20NOT%20sparql\
  &format=json" \
  -H 'User-Agent: ...'

Items Without Wikidata Statements (Data Quality)

Find English Wikipedia articles in a category that have a Wikidata item but no statements:

bash
curl -s 'https://petscan.wmcloud.org/\
  ?language=en\
  &project=wikipedia\
  &categories=United%20States%20geography%20stubs\
  &ns%5B0%5D=1\
  &wikidata_item=with\
  &wpiu_no_statements=1\
  &format=json' \
  -H 'User-Agent: ...'

Commons: Find Uncategorized Files with a Language Template

bash
curl -s 'https://petscan.wmcloud.org/\
  ?language=commons\
  &project=wikimedia\
  &categories=Uncategorized%20files\
  &depth=1\
  &ns%5B6%5D=1\
  &templates_yes=ro\
  &format=json' \
  -H 'User-Agent: ...'

PSID-Based Query

Re-run a previously saved query:

bash
curl -s 'https://petscan.wmcloud.org/?psid=552&format=json' \
  -H 'User-Agent: ...'

Output as Wiki Table

Any format parameter changes the output:

bash
curl -s 'https://petscan.wmcloud.org/\
  ?language=en&project=wikipedia&categories=Physics\
  &ns%5B0%5D=1&format=wiki' \
  -H 'User-Agent: ...'

SOP: Multi-Source Combination Logic

When using multiple sources (categories + SPARQL + manual list + pagepile + search), the combination parameter controls how they are merged. With source_combination, you get more control:

ValueEffect
subset (default)Return only results present in ALL sources (AND)
unionReturn results from ANY source (OR)
source1 NOT source2Results from first source minus second
source1 AND source2Explicit AND between named sources

Sources are ordered as: categories → manual_list → pagepile → sparql → search. Use source_combination to reorder or mix.

Cross-wiki magic: Use common_wiki=wikidata to merge results across different wikis. PetScan will resolve pages from different wikis through Wikidata to find common items.


SOP: Integration with Other Tools

ToolHow PetScan Feeds Into It
PagePileOutput format pagepile creates a new PagePile; or feed PSID into PagePile's "from external tool" field
Massviews AnalysisUse PagePile ID from PetScan as source → get pageviews for the query result set
WD-FISTPSID → find free images for a list of articles
QuickStatementsExport as JSON/CSV, transform to QuickStatements format

Relationship to Other Skills

  • wikipedia-categories — Covers category tree concepts and ships category-intersect.py (uses PetScan's URL API for basic AND intersection). This skill covers the full parameter surface PetScan offers.
  • wikimedia-search-cirrussearch — CirrusSearch is faster for simple keyword+category. PetScan is the right choice when you need category intersection/union/difference, multi-source combination (categories + templates + SPARQL), ORES filtering, or bulk export. See the comparison table in that skill.
  • wikidata — For complex SPARQL queries that exceed PetScan's single-query input, use the Wikidata Query Service directly.
  • wikimedia-commons-sparql — For Commons-specific MediaInfo queries; PetScan complements with file media type filtering and uncategorized file detection.

Perguntas frequentes

O que a habilidade de IA Wikimedia Petscan faz?

Use PetScan for multi-source Wikimedia queries — category intersections, template filtering, SPARQL integration, Wikidata item queries, and bulk data export via the URL API and PSID system

Por que usar Wikimedia Petscan no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Wikimedia Petscan é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Wikimedia Petscan no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-petscan. O TypingMind lê o arquivo SKILL.md e instala a habilidade para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Wikimedia Petscan?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Wikimedia Petscan?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Wikimedia Petscan com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Wikimedia Petscan é gratuita?

Sim. A habilidade é publicada no GitHub por fuzheado sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇