
Umbraco Controllers
- 310 installs
- 26 repo stars
- Updated August 1, 2026
- umbraco/umbraco-cms-backoffice-skills
umbraco-controllers is a Claude Code skill that explains and scaffolds Umbraco backoffice Controllers with host-element lifecycle methods for developers building reusable CMS UI logic.
About
umbraco-controllers is a version 1.0.0 Claude Code skill for Umbraco CMS backoffice development. Controllers are separate classes assigned to Host Elements that reuse logic across elements while staying connected to element lifecycles. The skill documents lifecycle methods—hostConnected, hostDisconnected, and destroy—for managing side effects, timers, subscriptions, and cleanup. Controllers can compose other controllers for modular backoffice behavior. Allowed tools are Read, Write, Edit, and WebFetch so agents can pull the latest Umbraco documentation before generating code. Developers reach for umbraco-controllers when implementing backoffice custom elements, sharing stateful logic between UI components, or ensuring proper teardown in the Umbraco managed backoffice environment.
- umbraco-controllers
- AI & Agent Building
- AI-coding skill
Umbraco Controllers by the numbers
- 310 all-time installs (skills.sh)
- +13 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #2,259 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/umbraco/umbraco-cms-backoffice-skills --skill umbraco-controllersAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 310 |
|---|---|
| repo stars | ★ 26 |
| Last updated | August 1, 2026 |
| Repository | umbraco/umbraco-cms-backoffice-skills ↗ |
How do you build Umbraco backoffice controllers?
Helps with ai & agent building tasks.
Who is it for?
Developers extending the Umbraco CMS backoffice who need reusable Controller classes with proper host-element lifecycle management.
Skip if: Developers building generic React apps, server-side Umbraco APIs only, or CMS platforms outside the Umbraco backoffice.
When should I use this skill?
The user asks to create or understand Umbraco backoffice Controllers, host-element lifecycle hooks, or controller composition patterns.
What you get
Umbraco Controller classes with host-element lifecycle methods, composed controller modules, and fetched official documentation references.
- Umbraco Controller class scaffolds
- Lifecycle hook implementations
By the numbers
- Skill version 1.0.0 in Umbraco backoffice skills manifest
- Documents 3 controller lifecycle methods: hostConnected, hostDisconnected, destroy
- Allows 4 tools: Read, Write, Edit, and WebFetch
Files
Umbraco Controllers
What is it?
Controllers are separate classes that contain or reuse logic across elements while maintaining connection to an element's lifecycle. A Controller is assigned to a Host Element and supports lifecycle methods (hostConnected, hostDisconnected, destroy) for managing side effects, timers, subscriptions, and cleanup. Controllers can host other controllers, enabling composition and reuse of functionality.
Documentation
Always fetch the latest docs before implementing:
- Main docs: https://docs.umbraco.com/umbraco-cms/customizing/foundation/umbraco-controller
- Write Custom Controller: https://docs.umbraco.com/umbraco-cms/customizing/foundation/umbraco-controller/write-your-own-controller
- Foundation: https://docs.umbraco.com/umbraco-cms/customizing/foundation
Workflow
1. Fetch docs - Use WebFetch on the URLs above 2. Ask questions - Need custom controller? What lifecycle events? What cleanup needed? 3. Generate code - Implement controller extending UmbControllerBase based on latest docs 4. Explain - Show what was created and how to host it
Minimal Examples
Basic Custom Controller
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class MyController extends UmbControllerBase {
constructor(host: UmbControllerHost) {
super(host);
// Auto-registers with host
}
override hostConnected() {
super.hostConnected();
console.log('Controller connected!');
}
override hostDisconnected() {
super.hostDisconnected();
console.log('Controller disconnected!');
}
override destroy() {
super.destroy();
console.log('Controller destroyed!');
}
}Timer Controller Example
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
export class TimerController extends UmbControllerBase {
#timer?: number;
#secondsAlive = 0;
constructor(host: UmbControllerHost) {
super(host);
}
override hostConnected() {
super.hostConnected();
// Start timer when element connects to DOM
this.#timer = window.setInterval(this.#onInterval, 1000);
}
override hostDisconnected() {
super.hostDisconnected();
// Clean up timer when element disconnects
if (this.#timer) {
clearInterval(this.#timer);
}
}
#onInterval = () => {
this.#secondsAlive++;
console.log(`Controller active for ${this.#secondsAlive} seconds`);
};
override destroy() {
super.destroy();
if (this.#timer) {
clearInterval(this.#timer);
}
}
getSecondsAlive(): number {
return this.#secondsAlive;
}
}Hosting a Controller in Element
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
import { TimerController } from './timer-controller.js';
export class MyElement extends UmbLitElement {
#timerController = new TimerController(this);
render() {
return html`
<div>
Active for: ${this.#timerController.getSecondsAlive()}s
</div>
`;
}
}Manual Registration (Not Recommended)
export class MyManualController {
#host: UmbControllerHost;
constructor(host: UmbControllerHost) {
this.#host = host;
// Manual registration required
this.#host.addUmbController(this);
}
hostConnected() {
console.log('Connected');
}
destroy() {
// Manual deregistration required
this.#host.removeUmbController(this);
}
}Controller with Context Access
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification';
export class NotificationController extends UmbControllerBase {
async showSuccess(message: string) {
// Controllers can access contexts via getContext
const context = await this.getContext(UMB_NOTIFICATION_CONTEXT);
context?.peek('positive', { data: { message } });
}
}Key Concepts
Host Element: Web component that hosts the controller (all Umbraco Elements can be hosts)
Lifecycle Methods:
hostConnected()- Called when host element connects to DOMhostDisconnected()- Called when host element disconnects from DOMdestroy()- Called when controller is permanently destroyed
Auto-Registration: Extending UmbControllerBase automatically registers/deregisters
Controller Composition: Controllers can host other controllers
Context Access: Controllers can consume contexts via getContext() and consumeContext()
Use Cases:
- Managing subscriptions and cleanup
- Handling timers and intervals
- Coordinating side effects
- Reusing logic across multiple elements
- Managing API calls and data fetching
API Calls: When making API calls from controllers, NEVER use raw fetch(). Always use a generated OpenAPI client configured with Umbraco's auth context. See the umbraco-openapi-client skill for setup.
That's it! Always fetch fresh docs, keep examples minimal, generate complete working code.
Related skills
How it compares
Pick umbraco-controllers when extending Umbraco backoffice custom elements rather than generic frontend component patterns.
FAQ
What is an Umbraco Controller in this skill?
The umbraco-controllers skill defines Controllers as separate classes assigned to Host Elements that hold reusable logic and respond to lifecycle methods hostConnected, hostDisconnected, and destroy for cleanup.
Can Umbraco controllers nest other controllers?
The umbraco-controllers skill states Controllers can host other controllers, enabling composition and reuse of backoffice functionality across multiple Umbraco UI elements.
What version is the umbraco-controllers skill?
The umbraco-controllers skill manifest lists version 1.0.0 as a managed skill with allowed tools Read, Write, Edit, and WebFetch for documentation-backed code generation.