Logo di Wikipedia Templates

Wikipedia Templates

Community
fuzheado
wikipedia-templates

Create, design, and understand Wikipedia and MediaWiki templates — template syntax, parser functions, magic words, transclusion vs substitution, Lua modules, template types taxonomy, API detection, and maintenance workflows

Panoramica

Pubblicato dafuzheado
RepositoryWikipedia-AI-Skills
Nome della skillwikipedia-templates
Stelle
27
Fork
10
File inclusi
8
LicenzaMIT
Link
  • Istruzioni in Markdown

    Un file SKILL.md che il modello carica quando serve, consumando token solo quando una richiesta è effettivamente pertinente.

  • Funziona con qualsiasi LLM

    Le skill IA sono in semplice Markdown, non in codice specifico di un fornitore, quindi funzionano con GPT, Claude, Gemini, Grok o un modello locale.

  • File inclusi: 8

    Script, template e riferimenti che il modello può leggere mentre lavora. I file sono di sola lettura e non vengono mai eseguiti.

  • Open source

    Pubblicata da fuzheado su GitHub. Leggi i sorgenti prima di installarla.

Installazione

Installa la skill IA Wikipedia Templates in TypingMind per usarla con qualsiasi LLM, oppure copiala in un altro agente in grado di leggere SKILL.md.

1

Installa in TypingMind

TypingMind installa una skill direttamente dalla sua cartella GitHub: legge SKILL.md, raccoglie i file delle risorse e salva il risultato in locale.

  1. Apri l'app e vai su Plugin → Skill.
  2. Scegli "Installa da GitHub".
  3. Incolla l'URL della cartella della skill riportato qui sotto e conferma.
    https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikipedia-templates
  4. Attiva la skill in ogni chat in cui vuoi averla a disposizione.
Plugin → Skill → Aggiungi skill → Da URL GitHub, poi incolla l'URL della cartella e premi Continua.
2

Installa in un altro agente

Qualsiasi agente che legge il formato Agent Skills può usare questa skill: copia la cartella della skill nella directory delle skill di quell'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/wikipedia-templates .claude/skills/wikipedia-templates
Dopo la copia, riavvia Claude Code per caricare la nuova skill.

Usala in TypingMind

Attiva Wikipedia Templates in qualsiasi chat di TypingMind e al resto pensa il modello. Il nome e la descrizione della skill sono nel prompt di sistema e, non appena arriva una richiesta pertinente, il modello carica da solo le istruzioni complete: non devi mai richiamarla manualmente e non consuma token finché non viene effettivamente usata.

Il modello carica automaticamente Wikipedia Templates non appena riceve una richiesta pertinente.

Funziona con qualsiasi modello IA

Le skill IA sono semplici istruzioni in Markdown, non codice specifico di un fornitore, quindi Wikipedia Templates non è vincolata al modello per cui è stata scritta. Installala una sola volta in TypingMind e usala con GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama o un modello locale che esegui tu, sempre con le tue chiavi API.

  • Caricata solo quando serve

    Il prompt di sistema contiene solo il nome e la descrizione. Le istruzioni vengono recuperate alla prima richiesta pertinente, quindi una skill inutilizzata non costa nulla.

  • Cambia modello durante la chat

    Poiché la skill è composta da istruzioni e non da codice, continua a funzionare anche se cambi modello: il nuovo modello legge lo stesso file SKILL.md.

Istruzioni della skill

Questo è il contenuto di SKILL.md che il modello carica. Leggilo prima dell'installazione: una skill è un insieme di istruzioni che il tuo modello seguirà.

⚠️ User-Agent required: The API examples below hit Wikimedia endpoints. All requests must include a descriptive User-Agent header. See the wikimedia-api-access skill for the correct format.

📖 Prerequisites: For general article structure (infoboxes, categories, navboxes), see wikipedia-page-anatomy. For AST-based programmatic manipulation of template wikitext, see wikimedia-wikitext. For bulk template operations (mass replacement, harvesting infoboxes into Wikidata), see pywikibot.


SOP: How Templates Work

Templates are reusable wiki pages transcluded via double braces:

wikitext
{{Template name}}
{{Template name|param1=value1|param2=value2}}

They live in the Template namespace (NS 10). Shortcuts like {{cn}} resolve to Template:Cn.

Transclusion vs. Substitution

MechanismSyntaxBehaviorUse Case
Transclusion{{Template}}Content included dynamically — edits to the template update every page using itInfoboxes, navboxes, maintenance tags
Substitution{{subst:Template}}Content copied into the page at save time — no link to template afterwardSignatures (~~~~), user talk messages, template documentation
Safe substitution{{safesubst:Template}}Works in both transcluded and substituted contextsTemplates that must work correctly when called from other templates

Transclusion (the default) means the template content is not part of the page's raw wikitext. Use action=parse or the REST API /html endpoint to see the fully rendered page. Substitution places the expanded content directly into the page's wikitext — useful for signatures, page moves, and one-time messages.

Template Parameters

Templates accept parameters in two forms:

wikitext
{{Template
| named_param    = value          ← Named parameter (preferred for clarity)
| positional     = value          ← Or use bare values without names
}}

<!-- Positional parameters: the first unnamed arg is {{{1}}}, second is {{{2}}}, etc. -->
{{Infobox person|Albert Einstein|14 March 1879}}

Inside the template, parameters are accessed as:

wikitext
{{{1}}}                   ← Positional parameter (required — shows {{{1}}} if omitted)
{{{named_param|default}}} ← Named parameter with default value
{{{1|}}}                  ← Positional parameter that defaults to empty string
{{{named_param}}}         ← Named parameter (required — shows {{{named_param}}} if omitted)
{{{named_param|}}}        ← Named parameter that defaults to empty string

Key rules:

  • Named parameters can use spaces, underscores, or mixed case — {{Template|param name=value}} works
  • Parameter names are case-insensitive after normalization (underscores → spaces, first letter upper-cased)
  • A blank parameter (|param=) is different from an omitted parameter — use {{{param|}}} to default blank to empty
  • Trailing whitespace in parameter values is stripped
  • Pipe characters inside values must be escaped with {{!}}

Inclusion Control Tags

These tags control what part of a template page gets transcluded:

TagEffect
<noinclude>...</noinclude>Content visible on the template page itself but not transcluded into articles
<includeonly>...</includeonly>Content hidden on the template page but included when transcluded
<onlyinclude>...</onlyinclude>Only this content is transcluded; everything else is ignored

Typical use:

wikitext
<noinclude>{{Documentation}}</noinclude>
<includeonly>[[Category:Navigation templates]]</includeonly>
{{Navbox | name = ...
}}
  • <noinclude> wraps documentation, categories for the template page, and interwiki links
  • <includeonly> wraps categories that should apply to pages using the template, not the template itself
  • <onlyinclude> is for templates whose entire transcluded content is a subset of the page (rare)

Key Design Principles

  1. Keep templates simple. Complex logic belongs in Lua modules (see SOP: Lua Modules below).
  2. Always provide defaults. Use {{{param|default}}} so the template degrades gracefully.
  3. Document your parameters. Use <noinclude> for a /doc page or inline comments.
  4. Avoid expensive parser functions. Each {{#if:}}, {{#ifeq:}}, {{#switch:}}, and {{#time:}} counts toward the 500-node limit.
  5. Test in a sandbox. Create Template:Templatename/sandbox and Template:Templatename/testcases.

SOP: Parser Functions

Parser functions are wiki-text functions that process arguments and return values. They are called with the {{#function:}} syntax.

Conditional Functions

FunctionSyntaxDescription
#if`{{#if: {{{param|}}}then
#ifeq`{{#ifeq: ab
#iferror`{{#iferror: {{#expr:1/0}}error
#ifexpr`{{#ifexpr: 1+1=2yes
#ifexist`{{#ifexist: Page titleexists
#switch{{#switch: {{{type|}}} | case1 = value1 | case2 = value2 | #default = fallback}}Multi-way branch

Common patterns:

wikitext
{{#if: {{{image|}}}
| [[File:{{{image}}}|thumb]]
| <!-- No image — display nothing -->
}}

{{#switch: {{{type|}}}
| person = {{Infobox person}}
| place  = {{Infobox settlement}}
| book   = {{Infobox book}}
| #default = {{Infobox generic}}
}}

{{#ifeq: {{{url|}}} | {{{archive-url|}}}
| <!-- URL and archive are the same — show one -->
| {{cite web |url={{{url|}}} |archive-url={{{archive-url|}}}
           |archive-date={{{archive-date|}}} }}
}}

Data Functions

FunctionSyntaxDescription
#expr{{#expr: 1+1}}Evaluates a mathematical expression and returns the result
#time{{#time: Y-m-d}}Formats a date/time, defaulting to the current UTC time
#timel{{#timel: Y-m-d}}Same as #time but in the wiki's local time

Common #time format strings:

CodeOutputExample
Y4-digit year2026
y2-digit year26
FFull month nameJune
MAbbreviated monthJun
m2-digit month06
jDay of month (no leading zero)8
d2-digit day of month08
H2-digit hour (00–23)14
i2-digit minute30
s2-digit second05

Technical Functions

FunctionSyntaxDescription
#tag{{#tag: ref | citation text | name=foo}}Generates an XML-like tag (<ref>...</ref>)
#invoke`{{#invoke: ModuleNamefunctionName
#property{{#property: P18}}Fetches a Wikidata property for the current page's item
#statements{{#statements: P18|from=Q123}}Fetches a Wikidata property for a specific Q-item
#invokeSee SOP: Lua Modules below

String Functions (via #invoke:String)

Common string operations are available through Module:String:

wikitext
{{#invoke:String|len|S}}         ← Length
{{#invoke:String|sub|S|start|end}}  ← Substring
{{#invoke:String|match|S|pattern}}  ← Regex match
{{#invoke:String|find|S|target}}    ← Find position
{{#invoke:String|replace|S|old|new}} ← Replace
{{#invoke:String|trim|S}}         ← Strip whitespace

Performance Notes

  • #if is cheaper than #ifeq (no comparison needed)
  • #switch is more efficient than nested #ifeq chains (uses a hash lookup)
  • #ifexist is expensive — each call hits the database; limit to ~10 per page
  • #expr is slower than a precomputed value
  • #time with #time: Y (year only) is cached; complex #time formats are not
  • See Limits and Quotas below for hard caps

SOP: Magic Words

Magic words are special strings that return wiki metadata or behavior. They are recognized by MediaWiki's parser.

Behavior Switches

These control page behavior and are placed anywhere in the wikitext:

WordEffect
__NOTOC__Hides the table of contents
__FORCETOC__Forces the TOC to appear before the first heading
__TOC__Places the TOC at this position
__NOEDITSECTION__Hides edit links next to section headings
__HIDDENCAT__Hides the category from readers (on category pages)
__EXPECTUNUSEDCATEGORY__Suppresses "unused category" warnings
__DISAMBIG__Marks the page as a disambiguation page
__NEWSECTIONLINK__Adds a "new section" tab on talk pages
__NONEWSECTIONLINK__Removes the "new section" tab
__NOGALLERY__Displays file links instead of galleries on category pages
__INDEX__ / __NOINDEX__Allows or disallows search engine indexing

Variables

Variables return page-specific or wiki-specific data:

VariableReturnsExample Output
{{PAGENAME}}Current page title (without namespace)Albert Einstein
{{PAGENAMEE}}URL-encoded page nameAlbert_Einstein
{{FULLPAGENAME}}Full page title with namespaceTemplate:Infobox person
{{FULLPAGENAMEE}}URL-encoded full titleTemplate:Infobox_person
{{NAMESPACE}}Namespace nameTemplate
{{NAMESPACEE}}URL-encoded namespaceTemplate
{{NAMESPACENUMBER}}Namespace number10
{{SITENAME}}Wiki site nameWikipedia
{{SERVER}}Wiki domain URLhttps://en.wikipedia.org
{{SERVERNAME}}Wiki domain nameen.wikipedia.org
{{SCRIPTPATH}}Script path/w
{{CURRENTYEAR}}Current year2026
{{CURRENTMONTH}}Current month (01–12)06
{{CURRENTMONTHNAME}}Current month nameJune
{{CURRENTDAY}}Current day of month8
{{CURRENTDAYNAME}}Current day nameMonday
{{CURRENTTIME}}Current time (HH:mm)14:30
{{CURRENTTIMESTAMP}}Current ISO timestamp20260608143005
{{REVISIONID}}Current revision ID123456789
{{REVISIONDAY}}Day of last revision8
{{REVISIONMONTH}}Month of last revision06
{{REVISIONYEAR}}Year of last revision2026
{{REVISIONTIMESTAMP}}Timestamp of last revision20260608143005
{{REVISIONUSER}}User who made the last editExampleUser
{{SITENAME}}Wiki site nameWikipedia
{{CONTENTLANGUAGE}}Wiki content languageen
{{PAGESINCATEGORY:Category name}}Page count in category42
{{PAGESIZE:Page title}}Size of a page in bytes12345
{{PROTECTIONLEVEL:action}}Protection level for an actionautoconfirmed, sysop, or empty
{{PROTECTIONEXPIRY:action}}Protection expiry timestampinfinity or date

Template-Specific Magic Words

WordEffect
{{TALKPAGENAME}}Full talk page title
{{SUBPAGENAME}}Subpage name (after the last /)
{{REVISIONID}}Current revision ID (useful in templates for cache busting)

SOP: Lua Modules

Some complex templates are backed by Lua modules through the Scribunto extension. Instead of parser function logic in wikitext, the logic lives in a Lua module in the Module: namespace (NS 828).

How to Identify Lua-Backed Templates

Check the template source for {{#invoke:}}:

wikitext
{{#invoke:Infobox|infobox}}
{{#invoke:Check for unknown parameters|check|unknown={{Main other|_VALUE_{{PAGENAME}}}}}}
{{#invoke:String|replace|source=...|old=...|new=...}}

Common Lua-backed templates include:

  • {{Infobox settlement}} — Module:Infobox with Module:Infobox settlement
  • {{Cite web}}, {{Cite book}}, etc. — Module:Citation/CS1
  • {{sfn}}, {{harvnb}} — Module:Footnotes
  • {{Authority control}} — Module:Authority control
  • Navigation boxes — Module:Navbox (with Module:Navbox/configuration)

Module Structure

Module:Name/
├── Module:Name               ← Main module code
├── Module:Name/configuration ← Configuration data
├── Module:Name/data          ← Large data tables
└── Module:Name/i18n          ← Internationalization strings

How #invoke Works

wikitext
{{#invoke:ModuleName|functionName|arg1|arg2|named_param=value}}

The Lua function receives a frame object:

lua
local p = {}

function p.functionName(frame)
    local arg1 = frame.args[1]            -- Positional argument
    local named = frame.args["named_param"] -- Named argument
    local parent = frame:getParent()      -- Caller's arguments
    return "result"
end

return p

Detection via API

action=query&prop=templates&titles=Infobox_settlement&format=json

Look for entries with ns=828 (Module namespace) to identify Lua dependencies.

When to Use a Module vs. Wikitext-Only Template

SituationBest Approach
Simple parameter displayWikitext template
Conditional formatting with ≤5 branches{{#switch}}
Complex data processing, loops, or string manipulationLua module
Citation formatting (hundreds of edge cases)Lua module
Algorithmic logic with conditional branchingLua module
When template exceeds post-expand include size (2 MB)Lua module

⚠️ Editing Lua modules requires templateeditor or sysop rights on most wikis. You can view the source, but changes must be suggested on the talk page or made by an authorized editor.


SOP: Template Types Taxonomy

Templates on Wikipedia serve many distinct purposes. Here is the taxonomy with examples:

Infoboxes

Right-aligned summary tables presenting key facts:

TemplatePurposeLua?
{{Infobox person}}PeopleNo
{{Infobox settlement}}Cities, townsYes
{{Infobox country}}Sovereign statesNo
{{Infobox film}}MoviesNo
{{Infobox company}}OrganizationsNo
{{Infobox scientist}}ResearchersNo
{{Infobox book}}BooksNo
{{Infobox military conflict}}Battles, warsNo

Citation Templates

Inline reference formatting (see wikipedia-citations skill for details):

TemplateFor
{{cite web}}Web pages
{{cite news}}News articles
{{cite book}}Books
{{cite journal}}Academic papers
{{sfn}}Shortened footnote (Lua-backed)
{{harvnb}}Harvard-style citation

Navigation Templates

TypeTemplatePurpose
Navbox{{Navbox}}Collapsible navigation at bottom of article
Navbox with collapsible groups{{Navbox with collapsible groups}}Multi-section navbox
Sidebar{{Sidebar}}Right-aligned navigation column
Series box{{Sister project links}}Links to related wiki projects
Authority control{{Authority control}}Library catalog identifiers
Portal bar{{Portal bar}}Links to related portals

Maintenance Templates

Tags that signal article issues (see wikipedia-page-anatomy for full list):

wikitext
{{cn}}              {{POV}}
{{dead link}}        {{clarify}}
{{expand section}}   {{stub}}
{{original research}} {{weasel inline}}
{{better source}}    {{failed verification}}

Banners and Assessment

Talk page templates for WikiProject coordination:

wikitext
{{WikiProject Biography|living=yes|class=B|importance=High}}
{{WikiProject Physics|class=C|importance=Mid}}
{{ArticleHistory}}
{{Annual report}}

Structural Templates

Templates that organize the page itself:

wikitext
{{About|the physicist}}           ← Hatnote disambiguation
{{For|other uses}}                ← Other uses
{{Distinguish|OtherPerson}}       ← Similar name confusion
{{Redirect|Einstein}}             ← Redirect hatnote
{{TOC left}}                      ← Floating table of contents
{{Clear}}                         ← Clear floating elements
{{-}}                             ← Same as {{clear}}

Media and Linking Templates

wikitext
{{Commons category}}
{{Wikiquote}}
{{External media}}
{{Superimpose}}                   ← Image overlay
{{Image label}}                   ← Labels on images
{{Listen}}                        ← Audio file player
{{Multiple image}}                ← Gallery layout

Stub Templates

wikitext
{{stub}}              {{physics-stub}}
{{bio-stub}}          {{film-stub}}
{{geo-stub}}          {{sci-stub}}

SOP: Template Detection and API Usage

Find All Templates on a Page

action=query&prop=templates&titles=Albert_Einstein&format=json

Returns all templates transcluded on the page, with namespace (ns=10 for templates, ns=828 for modules):

json
{
  "query": {
    "pages": {
      "123": {
        "templates": [
          { "ns": 10, "title": "Template:Infobox person" },
          { "ns": 10, "title": "Template:Authority control" },
          { "ns": 10, "title": "Template:Navbox" },
          { "ns": 828, "title": "Module:Infobox" },
          { "ns": 10, "title": "Template:Cn" }
        ]
      }
    }
  }
}

⚠️ Response shape differs by API and formatversion.

  • With action=query&prop=templates (above), each entry has ns + title (and only lists templates on already-saved pages).
  • With action=parse&prop=templates and default formatversion=1, entries use ns + * (and "exists": "" only if the template exists) — the template title is under the * key, not title.
  • With action=parse&prop=templates and formatversion=2, entries use ns + title + boolean exists (true or false).

Detect Non-Existent or Deleted Templates in Unsaved Wikitext (action=parse)

POST /w/api.php
action=parse&title=Sandbox&text={{UnsavedWikitext}}&prop=templates|text&contentmodel=wikitext&formatversion=2&format=json

When previewing or validating unsaved wikitext before publishing, include templates in action=parse's prop list (prop=templates reports both Template: ns 10 and Scribunto Module: ns 828 transclusions; do not confuse with prop=modules, which returns ResourceLoader web bundles). Any transcluded template or Lua module that does not exist on the target wiki (such as a hallucinated shorthand like {{i|...}} on a wiki without Template:I, a typo, or a recently deleted template) is flagged in two places:

  1. Structured parse.templates array (formatversion=2):
    json
    {
      "ns": 10,
      "title": "Template:NonExistentTemplate",
      "exists": false
    }
    (In formatversion=1, non-existent templates omit the "exists" key entirely, whereas existing templates have "exists": "".)
  2. Rendered HTML (parse.text): MediaWiki emits red links (class="new", action=edit&redlink=1) for missing templates, whereas missing Lua modules invoked via {{#invoke:...}} render inline Scribunto error spans:
    html
    <!-- Missing template (ns 10) -->
    <a href="/w/index.php?title=Template:NonExistentTemplate&amp;action=edit&amp;redlink=1"
       class="new"
       title="Template:NonExistentTemplate (page does not exist)">Template:NonExistentTemplate</a>
    
    <!-- Missing Lua module (ns 828) -->
    <strong class="error"><span class="scribunto-error mw-scribunto-error-...">Script error: No such module &quot;MissingModule&quot;.</span></strong>

Filtering parse.templates for entry.get("exists") is False (with formatversion=2) gives a unified, zero-extra-request pre-save gate that reliably catches missing direct and nested template/module transclusions before modifying the wiki:

python
missing = [
    t["title"] for t in parse_data.get("templates", [])
    if t.get("exists") is False  # Requires formatversion=2
]

Find All Pages Using a Template

action=query&list=embeddedin&eititle=Template:Infobox_person&format=json

Pagination via eicontinue. Limit with eilimit. Filter by namespace with einamespace.

Expand a Template

action=expandtemplates&text={{Infobox_person|name=Test}}&format=json

Returns the fully expanded wikitext (all templates, parser functions, and magic words resolved). Useful for debugging what a template actually produces.

Get Template Source

action=raw&title=Template:Infobox_person

Returns the raw wikitext of the template page (no transclusion expansion).

Get Rendered Template

Use the REST API:

GET https://en.wikipedia.org/w/rest.php/v1/page/Template:Infobox_person/html

Returns the template page rendered as HTML5 via Parsoid. For templates that produce visible output, this shows what the template looks like.


SOP: Template Protection and Limits

Protection Levels

LevelRequired RightWho Can Edit
None—Any autoconfirmed user
autoconfirmededitsemiprotectedUsers 4+ days and 10+ edits
templateeditortemplateeditorTrusted template editors
sysop (full)editprotectedAdministrators

High-use templates (transcluded on 500,000+ pages) are typically protected at templateeditor or sysop level. Check protection:

action=query&prop=info&inprop=protection&titles=Template:Infobox_person&format=json

Template Limits

LimitCapWhat Happens When Exceeded
Post-expand include size2,048,000 bytesTemplates beyond the limit are not expanded — raw {{...}} shown
Template argument size2,048,000 bytesSame — template call is preserved unexpanded
Expensive parser function calls500 per page#ifexist calls beyond 500 produce errors
Nodes in AST~10,000,000 soft limitPages exceeding this may fail to render
Template inclusion depth40 levelsDeeply nested templates will fail to expand

How to Check Limits

action=parse&page=Albert_Einstein&prop=limitreportdata&format=json

Returns the limitreport with current usage vs. limits (key 0 = current value, 1 = limit):

json
{
 "parse": {
   "limitreportdata": [
     { "name": "limitreport-ppvisitednodes", "0": 11174, "1": 1000000 },
     { "name": "limitreport-postexpandincludesize", "0": 478489, "1": 2097152 },
     { "name": "limitreport-expensivefunctioncount", "0": 2, "1": 500 }
   ]
 }
}

⚠️ Do NOT use prop=modules for this. prop=modules returns the page's ResourceLoader JS/CSS modules (ext.cite.ux-enhancements, mediawiki.page.media, …), not Lua modules and not the limit report. Lua (Scribunto) module dependencies come from prop=templates filtered to ns=828 (see SOP: Lua Modules above). The human-readable variant is prop=limitreport.


SOP: Template Maintenance

Creating a New Template

  1. Create the page Template:YourTemplateName
  2. Add the template code with parameter defaults
  3. Add <noinclude>{{Documentation}}</noinclude> at the end
  4. Create Template:YourTemplateName/doc with usage examples
  5. Add categories to the doc page (<includeonly>[[Category:Your template category]]</includeonly>)
  6. Create Template:YourTemplateName/sandbox for testing
  7. Create Template:YourTemplateName/testcases for automated test cases

Template Documentation (Doc Pages)

Every template should have a /doc subpage:

wikitext
<!-- Template:YourTemplateName/doc -->
{{Documentation subpage}}
<!-- Description goes here -->
This template displays [purpose].

== Usage ==
{{YourTemplateName |param1= |param2= }}

== Example ==
{{YourTemplateName |param1=Hello |param2=World}}

== TemplateData ==
<templatedata>
{
  "description": "Template purpose",
  "params": {
    "param1": {
      "label": "Parameter 1",
      "description": "What this parameter does",
      "type": "string",
      "required": true
    },
    "param2": {
      "label": "Parameter 2",
      "description": "Another parameter",
      "type": "string",
      "required": false
    }
  }
}
</templatedata>

<includeonly>{{Sandbox other||
<!-- Categories below this line -->
[[Category:Your template category]]
}}</includeonly>

Tracking Categories

Templates often use <includeonly> to add pages to maintenance categories:

wikitext
<includeonly>{{#if:{{{url|}}}|<!-- OK -->|[[Category:Pages with missing URL]]}}</includeonly>

Common tracking categories:

  • Category:Pages with missing parameters — required parameter omitted
  • Category:Pages using duplicate arguments in template calls — same param used twice
  • Category:Pages with template errors — template fails to render
  • Category:Wikipedia template protection — protected templates

Testing Templates

  • Sandbox: Template:Name/sandbox — experimental changes without affecting production
  • Test cases: Template:Name/testcases — parameter combinations with expected output
  • What links here: Special:WhatLinksHere/Template:Name — pages using the template
  • Transclusion count: Special:PageInfo/Template:Name — shows usage count
  • TemplateData: Structured parameter documentation used by the Visual Editor

SOP: Link Tracking for Template-Generated Content

Special:RecentChangesLinked, Special:WhatLinksHere, and prop=links read the wiki's link tables, never the rendered HTML. A page can therefore visibly list 20 pages that the change feeds believe do not exist.

Symptom: a dashboard or index page lists pages (via {{Special:Prefixindex}}, a module, a template, or another dynamic construct), but "Related changes" on that page returns nothing — or only changes to the few pages that also appear as literal links.

What gets recorded, and attributed to whom

ConstructIn a link table?Attributed to
[[Wikilink]] in the page's own wikitext✅ pagelinksthat page
Link emitted by a parser tag/function placed directly on the page (e.g. <dynamicpagelist> on the page)✅ pagelinksthat page
Link inside a transcluded template or Lua module✅ — butthe template/module, not the including page (the includer only gets a templatelinks row)
Transcluded special page ({{Special:Prefixindex}}, {{Special:RecentChanges}}, {{Special:CategoryTree}})❌ nowhere—
Raw HTML <a href> built by an extension or JavaScript❌—
Links inside <nowiki>, HTML comments, or <pre>❌—
[[Category:X]] — including when emitted by a transcluded template✅ categorylinksthe including page (the opposite rule to plain links)
[https://example.org …] external link✅ externallinks (separate table; not usable for internal feeds)that page

Consequence worth remembering: a navbox template's links belong to the template's link table, so one template edit reaches thousands of pages for categories (cascade to the includer) but not for links. This is also why WhatLinksHere on a target often lists the template rather than the articles that display the link.

Diagnose in three calls

bash
TITLE="Wikimedia Futures Lab/Dashboard/Experiment Tracker"
UA="MyTool/1.0 (https://example.org/me)"

# 1. What IS recorded for the page? (empty/minimal result = not link-tracked)
curl -s -H "User-Agent: $UA" \
  "https://meta.wikimedia.org/w/api.php?action=query&titles=${TITLE}&prop=links|categories|templates&pllimit=max&format=json"

# 2. Reproduce the symptom: count rendered change rows on Related changes
curl -s -H "User-Agent: $UA" \
  "https://meta.wikimedia.org/wiki/Special:RecentChangesLinked?target=${TITLE}&days=30&limit=50" | grep -c mw-changeslist-line

Compare (1) and (2) against the page's rendered output. If the visible list is far larger than prop=links, the list comes from a construct in the table above that is not tracked. Note that a non-existent target returns HTTP 404, not an empty list — do not read that as "no changes".

Recipe 1 — category anchor (general fix, self-maintaining)

  1. Put [[Category:Name]] on every page in the list. For generated pages, add it to the preload template so future pages self-categorize; backfill existing pages with a bot run or JWB/AWB.
  2. Point Related Changes at the category instead of the page: https://{wiki}/wiki/Special:RecentChangesLinked?target=Category:Name&days=30&limit=100
  3. Verify membership landed (category links are applied by deferred jobs, so a new category can lag — a null edit on the page forces it): https://{wiki}/w/api.php?action=query&list=categorymembers&cmtitle=Category:Name&format=json

This works regardless of how the list is generated (prefixindex, DPL, module, bot), which is why it is the general answer when "Related changes" must keep working.

Recipe 2 — hidden DynamicPageList block (Related changes on the page itself)

Meta and the Wikinews projects run the legacy DynamicPageList (Intersection); its tag output is link-tracked. Keep the pretty display and add a hidden block whose only job is to populate the page's link table:

text
<div style="display:none">
<dynamicpagelist>
category=Name
count=100
mode=unordered
suppresserrors=true
</dynamicpagelist>
</div>

Constraints: category-driven only (no prefix/titlematch), output is cached, and it will not be installed on further WMF wikis. Put it on the page itself — inside a template, the links would be attributed to the template.

Recipe 3 — feed from the API (no wiki edits at all)

Enumerate the list yourself, then ask for the changes per page and merge:

python
import json, time, urllib.parse, urllib.request

UA = "MyTool/1.0 (https://example.org/me)"  # descriptive User-Agent is required
API = "https://meta.wikimedia.org/w/api.php"

def get(params):
    url = API + "?" + urllib.parse.urlencode(dict(params, format="json"))
    req = urllib.request.Request(url, headers={"User-Agent": UA})
    with urllib.request.urlopen(req, timeout=45) as resp:
        return json.loads(resp.read())

prefix = "Wikimedia Futures Lab/Dashboard/Experiment Tracker/"
pages, cont = [], {}
while True:
    data = get({"action": "query", "list": "allpages", "apprefix": prefix,
                "apnamespace": "0", "aplimit": "500", **cont})
    pages += [p["title"] for p in data["query"]["allpages"]]
    if "continue" not in data:
        break
    cont = data["continue"]

events = []
for title in pages:
    data = get({"action": "query", "list": "recentchanges", "rctitle": title,
                "rcprop": "title|timestamp|user|comment|sizes", "rclimit": "10",
                "rcdir": "older", "rcend": "2026-08-12T00:00:00Z"})
    events += data["query"]["recentchanges"]
    time.sleep(1)  # >=1s pacing outside Toolforge/WMCS

for event in sorted(events, key=lambda e: e["timestamp"], reverse=True)[:20]:
    print(event["timestamp"], event["title"], event["user"], event["comment"])

Personal variant needing no code: watch the pages and use Special:Watchlist (30-day window) plus its RSS/Atom feed. Real-time variant: EventStreams filtered client-side (see wikimedia-eventstreams).

Pitfalls

  • Category lag. categorylinks rows are written by deferred jobs; a freshly added category may not appear in Related changes for a moment. Force with a null edit, or wait for the job queue.
  • 404 ≠ empty. A Related changes target that does not exist returns 404 — check the target spelling before concluding there are no changes.
  • 30-day horizon. The UI defaults to 30 days; RSS/Atom feeds serve short windows only, so "all changes ever" needs the API or a database replica.
  • Template attribution surprise. Links rendered by a transcluded template are recorded against the template: point Related changes at the template page only when every page in the list transcludes it.
  • Cached parser output. DPL and other extension output is cached; changes to the underlying category may not re-render the page immediately.

Tooling

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

🔧 Expand Template (scripts/expand-template.sh)

Expand a template with parameters via the Action API, showing the fully rendered wikitext:

bash
# Expand a simple template call
./scripts/expand-template.sh "Infobox_person" "name=Albert Einstein|birth_date=14 March 1879"

# Read template call from stdin
echo "{{Infobox_person|name=Test}}" | ./scripts/expand-template.sh -

🔧 Template Usage Lookup (scripts/template-usage.sh)

Find all pages using a template, with count and pagination:

bash
# Show all pages using Template:Cn
./scripts/template-usage.sh "Cn"

# Show with namespaces and total count
./scripts/template-usage.sh "Infobox person" --count

# Limit results
./scripts/template-usage.sh "Stub" --limit 20

🔧 Inspect Template (scripts/inspect-template.sh)

Get comprehensive information about a template: source, protection, Lua dependencies, transclusion count, and tracking categories:

bash
# Full inspection
./scripts/inspect-template.sh "Infobox person"

# Just check protection level
./scripts/inspect-template.sh "Infobox person" --protection

# Show source code only
./scripts/inspect-template.sh "Cite web" --source

📚 Parser Functions Reference (references/parser-functions.md)

Complete reference covering all parser functions with examples, performance notes, and common pitfalls.

📚 Magic Words Reference (references/magic-words.md)

Complete catalog of all magic words organized by category (behavior switches, variables, template-specific).

📚 Template Types Reference (references/template-types.md)

Full taxonomy of template types with examples, usage patterns, and Lua-backing information.

🐍 Template Inspector (assets/template-inspector.py)

Python script that fetches and analyzes a template's structure:

bash
# Full analysis
python3 assets/template-inspector.py "Infobox person"

# Get parameters only
python3 assets/template-inspector.py "Infobox person" --parameters

# Show Lua module dependencies
python3 assets/template-inspector.py "Infobox settlement" --modules

# JSON output for programmatic use
python3 assets/template-inspector.py "Cite web" --format json

🐍 Template Scanner (assets/template-scanner.py)

Python script that scans a page for all template usage, classifying each template by type:

bash
# Scan a Wikipedia article
python3 assets/template-scanner.py "Albert Einstein"

# Group by template type (infobox, citation, navbox, maintenance, etc.)
python3 assets/template-scanner.py "Berlin" --by-type

# Output as JSON
python3 assets/template-scanner.py "Python (programming language)" --format json

# Show Lua module usage
python3 assets/template-scanner.py "Berlin" --modules

Cross-References

Related SkillWhy
wikimedia-api-accessUser-Agent and API patterns for template detection
wikipedia-page-anatomyArticle structure — where templates appear (infoboxes, navboxes, citations)
wikimedia-wikitextAST-based template parsing with mwparserfromhell
wikipedia-citationsCitation templates — the most common template type on Wikipedia
wikipedia-talk-pageWikiProject banners on talk pages are templates
wikipedia-wikitablesTable templates and wikitable generation
pywikibotBulk template operations (mass replacement, infobox harvesting)

File inclusi

Il modello legge questi file quando servono, mentre la skill è caricata. Sono accessibili in sola lettura e non vengono mai eseguiti.

Domande frequenti

Cosa fa la skill IA Wikipedia Templates?

Create, design, and understand Wikipedia and MediaWiki templates — template syntax, parser functions, magic words, transclusion vs substitution, Lua modules, template types taxonomy, API detection, and maintenance workflows

Perché usare Wikipedia Templates su TypingMind?

Perché la installi una volta e la usi con qualsiasi modello. Wikipedia Templates è scritta in semplice Markdown anziché in codice specifico di un fornitore, quindi la stessa skill funziona con GPT-5, Claude, Gemini, Grok o un modello locale, e puoi cambiare modello durante la chat senza che la skill smetta di funzionare. TypingMind usa le tue chiavi API, quindi paghi direttamente i fornitori anziché un abbonamento per posto utente, e le tue skill e chat restano nel tuo spazio di archiviazione.

Come installo Wikipedia Templates in TypingMind?

Apri Plugin → Skill → Installa da GitHub in TypingMind e incolla https://github.com/fuzheado/Wikipedia-AI-Skills/tree/main/.claude/skills/wikipedia-templates. TypingMind legge il file SKILL.md, include i file associati e installa la skill, che puoi abilitare per ogni singola chat.

Quali modelli IA possono usare Wikipedia Templates?

Qualsiasi modello che colleghi a TypingMind. Le skill IA sono semplici istruzioni in Markdown anziché codice specifico di un fornitore, quindi GPT, Claude, Gemini, Grok e i modelli locali possono tutti caricare questa skill quando una richiesta corrisponde al suo scopo.

Quanti modelli IA posso usare con Wikipedia Templates?

Quanti ne vuoi. Se un modello supporta le skill, puoi usarlo con Wikipedia Templates: GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e molti altri, tutti su TypingMind con le tue chiavi API.

La skill IA Wikipedia Templates è gratuita?

Sì. È pubblicata su GitHub da fuzheado con licenza MIT. Paghi solo il tuo fornitore IA per i token che usi.

Cosa sono le skill IA?

Una skill IA è un pacchetto di istruzioni riutilizzabili che insegna a un modello IA come svolgere un'attività specifica. Segue il formato aperto Agent Skills: un file SKILL.md con un nome e una descrizione, più eventuali script, template o file di riferimento di cui il modello potrebbe aver bisogno. Il modello legge le istruzioni solo quando la tua richiesta corrisponde alla skill, quindi una skill installata non comporta costi finché non viene usata.

In cosa si differenziano le skill IA dai plugin o dai server MCP?

Un plugin o un server MCP fornisce a un modello nuovi strumenti da richiamare: codice che viene eseguito da qualche parte e restituisce un risultato. Una skill IA, invece, fornisce al modello conoscenze e procedure: come affrontare un'attività, quali passaggi seguire e quali caratteristiche deve avere un buon output. Le skill sono semplici istruzioni in Markdown, quindi non richiedono server, chiavi API né ambienti di esecuzione e funzionano con qualsiasi modello.

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇