Λογότυπο Wikimedia Database

Wikimedia Database

Κοινότητα
fuzheado
wikimedia-database

Execute SQL queries against Wikipedia database replicas (enwiki, wikidata, commonswiki) via an SSH tunnel to Toolforge, with connection management and data handling guardrails

Επισκόπηση

Εκδότηςfuzheado
ΑποθετήριοWikipedia-AI-Skills
Όνομα δεξιότηταςwikimedia-database
Αστέρια
27
Forks
10
Συνοδευτικά αρχεία
7
Άδεια χρήσηςMIT
Σύνδεσμοι
  • Οδηγίες σε Markdown

    Ένα αρχείο SKILL.md που το μοντέλο φορτώνει όταν χρειάζεται, ώστε να καταναλώνει token μόνο όταν ένα αίτημα είναι πράγματι σχετικό.

  • Λειτουργεί με οποιοδήποτε LLM

    Οι δεξιότητες AI είναι απλό Markdown, όχι κώδικας για συγκεκριμένο πάροχο, επομένως αυτή η δεξιότητα λειτουργεί με GPT, Claude, Gemini, Grok ή ένα τοπικό μοντέλο.

  • 7 συνοδευτικά αρχεία

    Σενάρια, πρότυπα και υλικό αναφοράς που μπορεί να διαβάζει το μοντέλο καθώς εργάζεται. Τα αρχεία είναι μόνο για ανάγνωση και δεν εκτελούνται ποτέ.

  • Ανοιχτού κώδικα

    Δημοσιεύτηκε από fuzheado στο GitHub. Διαβάστε το πηγαίο περιεχόμενο πριν εγκαταστήσετε τη δεξιότητα.

Εγκατάσταση

Εγκαταστήστε τη δεξιότητα AI Wikimedia Database στο TypingMind για να τη χρησιμοποιείτε με οποιοδήποτε LLM ή προσθέστε τη σε άλλον πράκτορα AI που διαβάζει αρχεία SKILL.md.

1

Εγκατάσταση στο TypingMind

Το TypingMind εγκαθιστά μια δεξιότητα απευθείας από τον φάκελό της στο GitHub — διαβάζει το SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία σε πακέτο και αποθηκεύει το αποτέλεσμα τοπικά.

  1. Ανοίξτε την εφαρμογή και μεταβείτε στα Πρόσθετα → Δεξιότητες.
  2. Επιλέξτε «Εγκατάσταση από GitHub».
  3. Επικολλήστε το παρακάτω URL του φακέλου της δεξιότητας και επιβεβαιώστε.
    https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-database
  4. Ενεργοποιήστε τη δεξιότητα σε κάθε συνομιλία όπου θέλετε να είναι διαθέσιμη.
Πρόσθετα → Δεξιότητες → Νέα δεξιότητα → Από URL του GitHub, έπειτα επικολλήστε το URL του φακέλου και πατήστε «Συνέχεια».
2

Εγκατάσταση σε άλλον πράκτορα AI

Κάθε πράκτορας AI που διαβάζει τη μορφή Agent Skills μπορεί να χρησιμοποιήσει αυτή τη δεξιότητα — αντιγράψτε τον φάκελο στον κατάλογο δεξιοτήτων του.

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-database .claude/skills/wikimedia-database
Επανεκκινήστε το Claude Code μετά την αντιγραφή, ώστε να εντοπίσει τη νέα δεξιότητα.

Χρησιμοποιήστε τη στο TypingMind

Ενεργοποιήστε τη δεξιότητα Wikimedia Database σε οποιαδήποτε συνομιλία στο TypingMind και το μοντέλο αναλαμβάνει τα υπόλοιπα. Το όνομα και η περιγραφή της περιλαμβάνονται στην προτροπή συστήματος και, μόλις προκύψει ένα σχετικό αίτημα, το μοντέλο φορτώνει μόνο του τις πλήρεις οδηγίες — δεν χρειάζεται ποτέ να την καλείτε χειροκίνητα και δεν καταναλώνει token μέχρι να χρησιμοποιηθεί πραγματικά.

Το μοντέλο φορτώνει αυτόματα τη δεξιότητα Wikimedia Database μόλις λάβει ένα σχετικό αίτημα.

Λειτουργεί με οποιοδήποτε μοντέλο AI

Οι δεξιότητες AI είναι απλές οδηγίες Markdown και όχι κώδικας για συγκεκριμένο πάροχο, οπότε η δεξιότητα Wikimedia Database δεν περιορίζεται στο μοντέλο για το οποίο γράφτηκε. Εγκαταστήστε τη μία φορά στο TypingMind και χρησιμοποιήστε τη με GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ή ένα τοπικό μοντέλο που εκτελείτε εσείς — πάντα με τα δικά σας κλειδιά API.

  • Φόρτωση μόνο όταν χρειάζεται

    Η προτροπή συστήματος περιλαμβάνει μόνο το όνομα και την περιγραφή. Οι οδηγίες ανακτώνται με το πρώτο σχετικό αίτημα, οπότε μια δεξιότητα που δεν χρησιμοποιείται δεν έχει κόστος.

  • Αλλάξτε μοντέλα κατά τη συνομιλία

    Επειδή η δεξιότητα αποτελείται από οδηγίες και όχι από κώδικα, η αλλαγή μοντέλου δεν επηρεάζει τη λειτουργία της — το επόμενο μοντέλο διαβάζει το ίδιο αρχείο SKILL.md.

Οδηγίες δεξιότητας

Αυτό είναι το περιεχόμενο του αρχείου SKILL.md που φορτώνει το μοντέλο. Διαβάστε το πριν από την εγκατάσταση — μια δεξιότητα αποτελείται από οδηγίες που θα ακολουθήσει το μοντέλο σας.

⚠️ User-Agent required: While this skill primarily uses SQL via SSH tunnel, any direct API calls (e.g., for verification via curl or requests) must include a descriptive User-Agent header. See the wikimedia-api-access skill for the correct format.

Enables the agent to execute dynamic SQL queries against Wikimedia production replicas (e.g., enwiki, enwiki_p, wikidata, commonswiki) by leveraging a local SSH tunnel and specific environment variables for multi-layer authentication.

⚠️ Commons links tables moved to a separate cluster (x4) on 2026-09-08. The links tables on commonswiki (categorylinks, pagelinks, templatelinks, imagelinks, globalimagelinks, linktarget, externallinks, iwlinks, langlinks, existencelinks, collation) are no longer on the core cluster. Connect to links.commonswiki.analytics.db.svc.wikimedia.cloud for those tables, and join them to page / redirect / revision in application code — cross-cluster JOINs are not possible. The old copies on the core cluster are no longer updated, so any query still hitting them silently returns stale data. Table/column names are unchanged, and page + redirect remain available on both clusters. Since 2026-09-14 the x4 section is exposed on the Wiki Replicas, so the links hostnames return fresh data again (the s4 copies are no longer reachable from the replicas). Details: News/2026 Commons links tables database split and references/schema-replicas.md (hostname mapping + code-side join pattern).

Prerequisites

  • Authentication: The following variables must be set in the .env file:

  • TOOLFORGE_USER: The shell/LDAP username for SSH (e.g., janesmith).

  • TOOLFORGE_SQL_USER: The replica database username (e.g., u1234).

  • TOOLFORGE_SQL_PASSWORD: The replica database password.

  • TOOLFORGE_DB_PORT: The local port for the SSH tunnel (default: 3307). Set if you need a different port to avoid conflicts with a local MySQL/MariaDB instance.

  • SSH Config: The user must have their SSH keys added to the ssh-agent to allow non-interactive connections.

Standard Operating Procedure (SOP)

1. Connection Management

Before executing any SQL, the agent must ensure the tunnel is active.

  • Check: Attempt a connection to 127.0.0.1:${TOOLFORGE_DB_PORT:-3307}.
  • Auto-Establish: If the port is closed, the agent should attempt to spawn a background SSH process: ssh -L ${TOOLFORGE_DB_PORT:-3307}:enwiki.analytics.db.svc.wikimedia.cloud:3306 ${TOOLFORGE_USER}@login.toolforge.org -N
  • Persistence (Recommended): For long-running data generation, use autossh instead of plain ssh. Autossh monitors the connection and re-establishes it if the tunnel drops, which happens frequently during multi-hour sessions. Install with brew install autossh (macOS) or apt install autossh (Linux), then use: autossh -M 0 -o "ServerAliveInterval 30" -o "ServerAliveCountMax 3" -L ${TOOLFORGE_DB_PORT:-3307}:enwiki.analytics.db.svc.wikimedia.cloud:3306 ${TOOLFORGE_USER}@login.toolforge.org -N -v
  • Escalation: If the tunnel fails to open, provide the user with the command above to run manually.

2. Implementation Pattern (Python)

The agent should use pymysql to interact with the replicas.

python
import os
import socket
import subprocess
import pymysql
from dotenv import load_dotenv

load_dotenv()

def get_db_connection(db_name='enwiki_p'):
    host = '127.0.0.1'
    port = int(os.getenv('TOOLFORGE_DB_PORT', '3307'))
    
    # Check if tunnel is open
    with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
        s.settimeout(1)
        if s.connect_ex((host, port)) != 0:
            user = os.getenv("TOOLFORGE_USER")
            # Spawn persistent background tunnel
            cmd = ["ssh", "-L", f"{port}:enwiki.analytics.db.svc.wikimedia.cloud:3306", f"{user}@login.toolforge.org", "-N"]
            subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
            
    return pymysql.connect(
        host=host,
        port=port,
        user=os.getenv("TOOLFORGE_SQL_USER"),
        password=os.getenv("TOOLFORGE_SQL_PASSWORD"),
        database=db_name,
        cursorclass=pymysql.cursors.DictCursor,
        charset='utf8mb4'
    )

def query_wiki(sql, db='enwiki_p'):
    conn = get_db_connection(db)
    try:
        with conn.cursor() as cursor:
            cursor.execute(sql)
            return cursor.fetchall()
    finally:
        conn.close()

3. Data Handling Guardrails

  • Read-Only: Only generate SELECT statements.
  • Namespace Filtering: Always consider page_namespace (e.g., 0 for Main/Article space).
  • Binary Decoding: Many strings (titles, user names) are stored as Varbinary. If the output looks like b'Title', the agent must apply .decode('utf-8').
  • Safety Limits: Every exploratory query must include a LIMIT (suggested default: 10-50).
  • Database Naming: Project names must end in _p (e.g., wikidatawiki_p, commonswiki_p).

MySQL 9+ compatibility

If you get ERROR 2059: Authentication plugin 'mysql_native_password' cannot be loaded when using the mysql CLI, this is because MySQL 9.x removed the mysql_native_password plugin entirely from the client — both as a loadable .so and as a compiled-in implementation. Neither --default-auth nor any other flag can work around this.

The fix is to use pymysql (pure Python). It implements the MySQL protocol natively and handles mysql_native_password authentication without any external plugins:

bash
pip install pymysql python-dotenv

The query.sh script will automatically use pymysql if available, falling back to the mysql CLI only if Python dependencies are missing.

Example Use Cases

  • Prompt: "What are the 5 oldest pages in the 'Draft' namespace?"

  • Action: Execute SELECT page_title, page_touched FROM page WHERE page_namespace = 118 ORDER BY page_id ASC LIMIT 5;

  • Prompt: "Count revisions by 'ExampleUser' on enwiki."

  • Action: Execute SELECT COUNT(*) FROM revision_userindex JOIN actor ON rev_actor = actor_id WHERE actor_name = 'ExampleUser';

  • Prompt: "Search edit summaries mentioning 'revert' by a specific user."

  • Action: Execute constrained SQL — the comment table has no full-text index, so queries MUST include both actor_name and rev_timestamp filters to avoid timeouts. See references/edit-summary-search.md for the full guide to edit-summary search across all approaches (SQL, Sigma tool, XML dumps, EventStreams).


Tooling

This skill includes helper scripts, reference docs, and templates:

🔧 Tunnel Management (scripts/setup-tunnel.sh)

Establishes an SSH tunnel to Toolforge. Auto-detects if tunnel is already active, prefers autossh for auto-reconnecting, and verifies the connection.

bash
./scripts/setup-tunnel.sh --yes                    # defaults
./scripts/setup-tunnel.sh [db_host] [local_port]

Refuses to run with no arguments: its default action is to background a long-lived SSH tunnel, so that has to be requested. Use --yes for the defaults.

Requires: TOOLFORGE_USER environment variable and SSH key loaded in agent.

🔧 Query Runner (scripts/query.sh)

Run a SQL query against a replica and see results in the terminal.

bash
./scripts/query.sh "SELECT page_title, page_len FROM page LIMIT 10" [database]

Includes safety guardrails: only SELECT allowed, missing env vars detected.

🔧 Tunnel Closer (scripts/close-tunnel.sh)

Cleanly tear down the SSH tunnel.

bash
./scripts/close-tunnel.sh [local_port]

📚 Schema Reference (references/schema-replicas.md)

Full reference of Wikimedia replica database tables (page, revision, actor, page_props, categorylinks, pagelinks) with column descriptions and common queries.

📚 Edit Summary Search (references/edit-summary-search.md)

Comprehensive guide to searching Wikipedia edit summaries. Covers the comment table indexing gap, constrained SQL patterns, the Σ (Sigma) Toolforge tool, XML dump processing, and EventStreams filtering. Load this when the task involves finding edits by their summary text.

📚 Connection Guide (references/connection-guide.md)

Step-by-step guide for setting up Toolforge access, getting credentials, and troubleshooting common issues.

🧩 Environment Template (assets/.env.example)

bash
cp assets/.env.example .env
# Edit .env with your credentials

🧩 Sample SQL Queries (assets/sample-queries.sql)

50+ pre-built SQL queries organized by category (page info, stats, categories, pageviews, Wikidata, revisions, links, cross-refs, user activity).


Cross-References

Related SkillWhy
wikimedia-toolforgeSSH tunnel setup and Toolforge access
wikimedia-page-assessmentPageAssessments queries use the same database connection pattern
wikimedia-pageviewsPageview SQL queries via page_props table
wikimedia-api-accessUser-Agent format for any follow-up API calls

Συνοδευτικά αρχεία

Το μοντέλο τα διαβάζει όποτε χρειάζεται, όσο η δεξιότητα είναι φορτωμένη. Διατίθενται ως αρχεία για ανάγνωση και δεν εκτελούνται ποτέ.

Συχνές ερωτήσεις

Τι κάνει η δεξιότητα AI Wikimedia Database;

Execute SQL queries against Wikipedia database replicas (enwiki, wikidata, commonswiki) via an SSH tunnel to Toolforge, with connection management and data handling guardrails

Γιατί να χρησιμοποιήσετε τη δεξιότητα Wikimedia Database στο TypingMind;

Επειδή την εγκαθιστάτε μία φορά και τη χρησιμοποιείτε με οποιοδήποτε μοντέλο. Η Wikimedia Database είναι απλό Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως η ίδια δεξιότητα λειτουργεί με GPT-5, Claude, Gemini, Grok ή ένα τοπικό μοντέλο — και μπορείτε να αλλάξετε μοντέλο κατά τη διάρκεια της συνομιλίας χωρίς να διακοπεί η λειτουργία της. Το TypingMind λειτουργεί με τα δικά σας κλειδιά API, οπότε πληρώνετε απευθείας τους παρόχους αντί για συνδρομή ανά θέση χρήστη, ενώ οι δεξιότητες και οι συνομιλίες σας παραμένουν στον δικό σας χώρο αποθήκευσης.

Πώς εγκαθιστώ τη Wikimedia Database στο TypingMind;

Στο TypingMind, ανοίξτε Πρόσθετα → Δεξιότητες → Εγκατάσταση από το GitHub και επικολλήστε το https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-database. Το TypingMind διαβάζει το αρχείο SKILL.md, συγκεντρώνει τα συνοδευτικά αρχεία και εγκαθιστά τη δεξιότητα, την οποία μπορείτε να ενεργοποιείτε ανά συνομιλία.

Ποια μοντέλα AI μπορούν να χρησιμοποιήσουν τη δεξιότητα Wikimedia Database;

Οποιοδήποτε μοντέλο συνδέετε στο TypingMind. Οι δεξιότητες AI είναι απλές οδηγίες Markdown και όχι κώδικας ειδικά για κάποιον πάροχο, επομένως τα GPT, Claude, Gemini, Grok και τα τοπικά μοντέλα μπορούν όλα να φορτώσουν αυτή τη δεξιότητα όταν ένα αίτημα αντιστοιχεί σε αυτή.

Με πόσα μοντέλα AI μπορώ να χρησιμοποιήσω τη Wikimedia Database;

Με όσα θέλετε. Εφόσον ένα μοντέλο υποστηρίζει δεξιότητες, μπορείτε να χρησιμοποιήσετε τη Wikimedia Database με αυτό — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama και άλλα — όλα στο TypingMind με τα δικά σας κλειδιά API.

Είναι δωρεάν η δεξιότητα AI Wikimedia Database;

Ναι. Δημοσιεύεται στο GitHub από τον χρήστη fuzheado με την άδεια χρήσης MIT. Πληρώνετε μόνο τον δικό σας πάροχο AI για τα token που χρησιμοποιείτε.

Τι είναι οι δεξιότητες AI;

Μια δεξιότητα AI είναι ένα επαναχρησιμοποιήσιμο πακέτο οδηγιών που διδάσκει σε ένα μοντέλο AI πώς να εκτελεί μια συγκεκριμένη εργασία. Ακολουθεί την ανοιχτή μορφή Agent Skills: ένα αρχείο SKILL.md με όνομα και περιγραφή, μαζί με τυχόν σενάρια κώδικα, πρότυπα ή αρχεία αναφοράς που μπορεί να χρειαστεί το μοντέλο. Το μοντέλο διαβάζει τις οδηγίες μόνο όταν το αίτημά σας αντιστοιχεί στη δεξιότητα, οπότε μια εγκατεστημένη δεξιότητα δεν κοστίζει τίποτα μέχρι να χρησιμοποιηθεί.

Σε τι διαφέρουν οι δεξιότητες AI από τα πρόσθετα ή τους συνδέσμους MCP;

Ένα πρόσθετο ή ένας σύνδεσμος MCP παρέχει στο μοντέλο νέα εργαλεία που μπορεί να καλέσει — κώδικα που εκτελείται κάπου και επιστρέφει ένα αποτέλεσμα. Μια δεξιότητα AI παρέχει αντί γι’ αυτό γνώσεις και διαδικασίες στο μοντέλο: πώς να προσεγγίσει μια εργασία, ποια βήματα να ακολουθήσει και ποια χαρακτηριστικά έχει ένα καλό αποτέλεσμα. Οι δεξιότητες είναι απλό Markdown, επομένως δεν χρειάζονται διακομιστή, κλειδί API ή περιβάλλον εκτέλεσης και λειτουργούν με οποιοδήποτε μοντέλο.

Προβολή όλων

Στήστε δικό σας χώρο εργασίας AI τώρα

Εγγραφείτε στο ενημερωτικό μας δελτίο για να ενημερώνεστε για νέες λειτουργίες και μελλοντικές κληρώσεις δώρων 👇