From moodle
Migrate Moodle themes from version 3.x or 4.x to Moodle 5. Use when refactoring a Boost-based or custom Moodle theme for compatibility with Moodle 5.0+, including Bootstrap 5 migration, data attribute updates, SCSS/CSS changes, mustache template updates, renderer modifications, and version.php configuration. Covers the transition from Bootstrap 4 to Bootstrap 5, jQuery to vanilla JavaScript, and Moodle 5.1+ public folder structure.
How this skill is triggered — by the user, by Claude, or both
Slash command
/moodle:moodle-theme-migrationThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Migrate Moodle 3.x/4.x themes to Moodle 5, addressing Bootstrap 5 upgrade, deprecated features, and structural changes.
Migrate Moodle 3.x/4.x themes to Moodle 5, addressing Bootstrap 5 upgrade, deprecated features, and structural changes.
data-* → data-bs-*)Update version.php:
$plugin->version = 2025010100;
$plugin->requires = 2024100700; // Moodle 5.0
$plugin->supported = [500, 501];
$plugin->component = 'theme_yourtheme';
$plugin->release = '5.0.0';
$plugin->maturity = MATURITY_STABLE;
For Moodle 5.1+, note theme location changes to /public/theme/yourtheme/.
See references/bootstrap5-migration.md for complete class mapping.
| Bootstrap 4 | Bootstrap 5 |
|---|---|
.ml-*, .mr-* | .ms-*, .me-* |
.pl-*, .pr-* | .ps-*, .pe-* |
.float-left/right | .float-start/end |
.text-left/right | .text-start/end |
.border-left/right | .border-start/end |
.badge-* | .text-bg-* |
.badge-pill | .rounded-pill |
.sr-only | .visually-hidden |
.font-weight-* | .fw-* |
.font-italic | .fst-italic |
.no-gutters | .g-0 |
.close | .btn-close |
.rounded-sm/lg | .rounded-1/3 |
.form-group | margin utilities |
.form-inline | .d-flex .flex-wrap .align-items-center |
.custom-select | .form-select |
.custom-check | .form-check |
.media | .d-flex + flex utilities |
.card-deck | .row .row-cols-* |
.dropdown-menu-left/right | .dropdown-menu-start/end |
.input-group-append/prepend | direct children |
Replace all Bootstrap data attributes:
<!-- Before -->
<button data-toggle="tooltip" data-target="#modal" data-dismiss="alert">
<!-- After -->
<button data-bs-toggle="tooltip" data-bs-target="#modal" data-bs-dismiss="alert">
Common attributes: toggle, target, dismiss, placement, content, trigger, html, container, parent, slide, ride, interval.
For gradual migration, use the BS4 compat layer:
$PAGE->requires->js_call_amd('theme_boost/bs4-compat', 'init');
Or in mustache:
{{#js}}
require(['theme_boost/bs4-compat'], function(BS4Compat) {
BS4Compat.init();
});
{{/js}}
Warning: This is deprecated and will be removed in Moodle 6.0.
hover, hover-focus, plain-hover-focus, hover-focus-activefloat-left, float-right, float-nonenav-divider, img-retina, text-hide, invisibleform-control-focus, text-emphasis-variant, sizesr-only() → visually-hidden()// Before (Bootstrap 4)
theme-color-level('primary', 1);
// After (Bootstrap 5)
shift-color($primary, 10%);
// Level 1 = 10%, Level 2 = 20%, etc.
// Before: targets < md
@include media-breakpoint-down(sm) { }
// After: targets < md (use the breakpoint itself)
@include media-breakpoint-down(md) { }
Update templates in templates/ directory:
data-bs-*theme/yourtheme/templates/core/template_name.mustache
theme/yourtheme/templates/mod_forum/template_name.mustache
Convert jQuery Bootstrap calls to vanilla JavaScript:
// Before
import $ from 'jquery';
$('#myModal').modal('show');
$('[data-toggle="tooltip"]').tooltip();
// After
import Modal from 'theme_boost/bootstrap/modal';
import Tooltip from 'theme_boost/bootstrap/tooltip';
const modal = new Modal(document.getElementById('myModal'));
modal.show();
document.querySelectorAll('[data-bs-toggle="tooltip"]')
.forEach(el => new Tooltip(el));
Import from theme_boost/bootstrap/:
alert, button, carousel, collapse, dropdown, modal, offcanvas, popover, scrollspy, tab, toast, tooltip
If overriding core renderers in classes/output/:
export_for_template() returns valid dataEnsure config.php has:
$THEME->parents = ['boost'];
$THEME->rendererfactory = theme_overridden_renderer_factory::class;
$THEME->scss = function($theme) {
return theme_yourtheme_get_main_scss_content($theme);
};
For Moodle 5.1+, themes move to /public/theme/yourtheme/:
moodle/
├── public/
│ ├── theme/
│ │ └── yourtheme/
│ ├── mod/
│ └── blocks/
├── lib/
├── admin/
└── config.php
Use scripts/scan_theme.py to identify migration issues in theme files.
See references/bootstrap5-migration.md for detailed class and component mapping with code examples.
Searches MemPalace before answering questions about past work, people, projects, or prior decisions. Returns verbatim stored content instead of guessing from model memory.
Guides Payload CMS config (payload.config.ts), collections, fields, hooks, access control, APIs. Debugs validation errors, security, relationships, queries, transactions, hook behavior.
Implements vector databases with Pinecone, Weaviate, Qdrant, Milvus, pgvector for semantic search, RAG, recommendations, and similarity systems. Optimizes embeddings, indexing, and hybrid search.
npx claudepluginhub camauger/dev-skills --plugin moodle