Wikimedia Url Shortener logo

Wikimedia Url Shortener

Community
fuzheado
wikimedia-url-shortener

Create and expand w.wiki short URLs (Wikimedia's URL shortener) — redirect behavior, the missing expansion API, the browser CORS trap, server-side resolution patterns, and creation via the meta.wikimedia.org API

Overview

Publisherfuzheado
RepositoryWikipedia-AI-Skills
Skill namewikimedia-url-shortener
Stars
27
Forks
10
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by fuzheado on GitHub. Read the source before you install it.

Installation

Install the Wikimedia Url Shortener AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-url-shortener
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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-url-shortener .claude/skills/wikimedia-url-shortener
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Wikimedia Url Shortener in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Wikimedia Url Shortener on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Wikimedia Url Shortener is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Wikimedia URL Shortener (w.wiki)

⚠️ User-Agent required: All requests to w.wiki and meta.wikimedia.org need a descriptive User-Agent. See the wikimedia-api-access skill.

What It Is

w.wiki is the Wikimedia Foundation's URL shortener, built on the Extension:UrlShortener extension. Short URLs look like https://w.wiki/TR9R (or bare w.wiki/TR9R) and 301-redirect to the target URL.

  • Create short URLs at https://meta.wikimedia.org/wiki/Special:UrlShortener or via the API (below). Requires edit rights on Meta-Wiki.
  • Expand a short URL: there is no expansion API (see Gotcha 1) — the only way is to follow the redirect.
  • QR code for any URL: https://meta.wikimedia.org/wiki/Special:QrCode?url=<url> (302s to a PNG).

Quick Reference

TaskMethod
Expand a short URL (server-side)curl -sI https://w.wiki/CODE → read location: header (or curl -sL to follow)
Expand in Nodeawait fetch(url) — resp.url is the final target after redirects
Expand in Pythonrequests.head(url, allow_redirects=True) → resp.url
Create (API)POST https://meta.wikimedia.org/w/api.php?action=shortenurl&url=...&format=json (auth required)
Create (UI)https://meta.wikimedia.org/wiki/Special:UrlShortener
QR codehttps://meta.wikimedia.org/wiki/Special:QrCode?url=<encoded>
Manage short URLshttps://meta.wikimedia.org/wiki/Special:ManageShortUrls

Verified Facts (2026-08-12)

  • https://w.wiki/TR9R → 301 → https://commons.wikimedia.org/wiki/Commons:WikiPortraits/Bento-demo.json.
  • The 301 response carries access-control-allow-origin: *, but the target page sends no CORS headers — see Gotcha 2 for why browser-side expansion fails.
  • No API on w.wiki itself: https://w.wiki/api.php?... is treated as a short code and returns an HTML "Wikimedia Error / Short URL Not Found" page. The action=shortenurl API module lives on meta.wikimedia.org (verified via action=paraminfo&modules=shortenurl), not w.wiki.
  • shortenurl params: url (required, string), qrcode (boolean).
  • Rate limits (per meta.wikimedia.org/wiki/Wikimedia_URL_Shortener): 10 creations / 2 minutes for IPs, 50 / 2 minutes for logged-in users.
  • Special:UrlShortener (HTTP 200) and Special:QrCode?url=... (HTTP 302 → QR PNG) both exist on meta.

Gotchas (don't rediscover these)

  1. There is no way to "look up" a w.wiki code without following the redirect. No expansion endpoint exists — not on w.wiki, not in the API. The extension docs mention action=shortenurl (creation only). Expand by following the redirect and reading the final URL.

  2. Browsers cannot expand w.wiki links to wiki pages. fetch('https://w.wiki/CODE') in a browser fails with TypeError: Failed to fetch: the browser follows the 301 (whose own response is CORS-permitted), then the target page (e.g. commons.wikimedia.org) sends no CORS headers, so the final response is blocked. redirect: 'manual' gives an opaque response with no readable Location header. Fix: expand server-side (curl / Node / Python), or add a same-origin resolver endpoint to your own server that follows the redirect and returns the final URL as JSON (see deploy/server.js /api/resolve in the WikiBento project for a working Node 20 zero-dependency implementation).

  3. w.wiki is not a MediaWiki API surface. Anything under w.wiki/ is interpreted as a short code — api.php, w/, etc. all 404 with "Short URL Not Found". Route API calls to meta.wikimedia.org instead.

  4. Creating short URLs requires authentication (edit rights on Meta-Wiki) and the action is a write op: use POST with a CSRF token (see wikimedia-auth-oauth). Anonymous POST returns a generic Wikimedia Error page, not JSON.

  5. Rate limits are per-user/IP and low (10/2 min anon). For bulk shortening, batch is not a thing here — pace requests or use the UI.

SOP 1: Expand a w.wiki Short URL

curl (read the Location header — no body fetched)

bash
curl -sI "https://w.wiki/TR9R" | grep -i '^location:'
# location: https://commons.wikimedia.org/wiki/Commons:WikiPortraits/Bento-demo.json

Node (browser-unavailable; server-side only)

javascript
const resp = await fetch('https://w.wiki/TR9R', { redirect: 'follow' });
console.log(resp.url); // final URL after redirects

Python

python
import requests
resp = requests.head('https://w.wiki/TR9R', allow_redirects=True, timeout=15)
print(resp.url)  # final URL after redirects

Browser (the CORS trap — needs a server-side helper)

A browser fetch() cannot read the target (Gotcha 2). Pattern that works: your own server exposes GET /api/resolve?url=<https-url>, follows the redirect server-side, and returns {"url": "<final>"}; the client then fetches the target through a CORS-enabled path (e.g. the MediaWiki Action API action=parse&prop=wikitext&origin=* for wiki pages). See the WikiBento src/lib/share.js + deploy/server.js for a tested reference implementation.

SOP 2: Create a Short URL (API)

Requires a logged-in session with edit rights on meta.wikimedia.org.

bash
# 1. Get a CSRF token
TOKEN=$(curl -s "https://meta.wikimedia.org/w/api.php?action=query&meta=tokens&type=csrf&format=json" \
  -b cookies.txt -A "$WIKIMEDIA_USER_AGENT" | python3 -c "import json,sys; print(json.load(sys.stdin)['query']['tokens']['csrftoken'])")

# 2. Shorten
curl -s -X POST "https://meta.wikimedia.org/w/api.php?action=shortenurl&format=json" \
  -b cookies.txt -A "$WIKIMEDIA_USER_AGENT" \
  --data-urlencode "url=https://commons.wikimedia.org/wiki/Commons:WikiPortraits/Bento-demo.json" \
  --data-urlencode "token=$TOKEN"
# → { "shortenurl": { "shorturl": "https://w.wiki/XXXX", ... } }

Pass qrcode=1 to also get QR code data in the response.

Use Cases

  • Shareable dashboard configs: https://wikibento.toolforge.org/?config=https://w.wiki/TR9R — short, phone-friendly URLs that survive QR scanning (WikiBento verified this end-to-end 2026-08-12).
  • QR codes for demos/GLAM events: Special:QrCode?url=... gives a PNG without any API call.
  • Link shorteners in templates/messages where full URLs bloat wikitext.

Frequently asked questions

What does the Wikimedia Url Shortener AI skill do?

Create and expand w.wiki short URLs (Wikimedia's URL shortener) — redirect behavior, the missing expansion API, the browser CORS trap, server-side resolution patterns, and creation via the meta.wikimedia.org API

Why use Wikimedia Url Shortener on TypingMind?

Because you install it once and use it with any model. Wikimedia Url Shortener is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Wikimedia Url Shortener in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikimedia-url-shortener. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Wikimedia Url Shortener?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Wikimedia Url Shortener?

As many as you like. As long as a model supports skills, you can use Wikimedia Url Shortener with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Wikimedia Url Shortener AI skill free?

Yes. It is published on GitHub by fuzheado under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇