[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CYGBEZ2Q4AXDDNADWW4Q9H":3,"skill-same:01M7CYGBEZ2Q4AXDDNADWW4Q9H":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7CYGBEZ2Q4AXDDNADWW4Q9H","umbraco-performance",null,"Keeping a package fast on the sites that install it: the published cache over the services layer, tree traversal, caching lookups and clearing them, data type config and converter cache levels, output cache eviction, light hot paths, and backoffice screens that don't over-fetch. Use when writing, changing or reviewing code that runs per request, per save, per indexed item or at startup (property value converters, notification handlers, indexing), code that loops over every content item (a full rebuild, an import, a sync), or a list or search screen. Not for a site's own templates.","mattbrailsford\u002Fumbraco-devkit","mattbrailsford","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F527305?v=4","01M7CY974D4XX1P90YSXQC1T39","Matt Brailsford","01M7CY9751PSRA3EHBH03G936J",3,"MIT","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-performance\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: umbraco-performance\ndescription: >-\n  Keeping a package fast on the sites that install it: the published cache over the services\n  layer, tree traversal, caching lookups and clearing them, data type config and converter\n  cache levels, output cache eviction, light hot paths, and backoffice screens that don't\n  over-fetch. Use when writing, changing or reviewing code that runs per request, per save, per\n  indexed item or at startup (property value converters, notification handlers, indexing),\n  code that loops over every content item (a full rebuild, an import, a sync), or a list or\n  search screen. Not for a site's own templates.\n\n---\n\n# Performance for Umbraco packages\n\nA package's code runs on sites its author never sees: a 50-page brochure site and a\n200,000-node multi-site install get the same DLL. Write for the big one. Every rule below\nis a pattern that's harmless on the demo site and costly in production.\n\nThis skill covers code a package ships: property value converters, content finders,\nManagement API endpoints, notification handlers, indexers, background jobs, Delivery API\noutput, and backoffice extensions. A site's own templates and its tuning (cache seed counts,\nturning output caching on, cache size limits) belong to the site owner. A package must\nstay fast with the site's defaults, not depend on the owner changing them.\n\nVerify version-specific APIs against the CMS source and docs for the major the project\ntargets (`umbraco-cms-source`, `umbraco-docs`). The published content cache was rebuilt in\nv15, so caching advice written for v13 and earlier is often wrong now. Search changes in\nv19: Umbraco Search (`Umbraco.Cms.Search`) replaces the built-in Examine indexes and their\nhooks. It's also an add-on for v17 and v18, so check which one the site uses, not just the\nmajor.\n\n## *🎯 Why: Design for Change*\n\nSlow code gets fixed by adding caches, and caches added late get bolted on in the wrong\nplace, with no plan for clearing them. Deciding up front where data is read from, and what\nclears it, keeps a later speed fix a local change instead of a redesign.\n\n## Read published content from the cache, not the services layer\n\nThe services layer (`IContentService`, `IMediaService`, `IRelationService` and friends)\nreads and writes the database. It's for changing data, not reading it on a hot path. Package\ncode that runs per front-end or Delivery API request (a converter, a content finder, a\nrendered component) reads from the published cache instead:\n\n```csharp\n\u002F\u002F Hits the database on every call\nvar item = _contentService.GetById(key);\n\n\u002F\u002F Reads the published cache\nvar item = _publishedContentCache.GetById(key);\n```\n\nThe published cache is lazy-loaded: an item is read from the database the first time it's\nrequested, then served from memory. A cold item costs a database call, which matters when\npackage code touches thousands of them (next section).\n\nSource: [Common pitfalls](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fapplication-code\u002Fcommon-pitfalls),\n[Cache seeding](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fextend-your-project\u002Fserver-side-extensions\u002Fcache\u002Fcache-seeding).\n\n## Don't walk the whole tree\n\n`Descendants()` \u002F `DescendantsOrSelf()` visit every node below the starting point and load\neach one. From the root, that's the whole site. A filter after it still loads everything\nfirst:\n\n```csharp\n\u002F\u002F Loads every node in the site to find the products\nvar products = root\n    .DescendantsOrSelf(_navigationQueryService, _publishedStatusFilteringService)\n    .Where(x => x.ContentType.Alias == \"product\");\n```\n\nSince v15 this costs more than it used to: each `IPublishedContent` is rebuilt from the\ncache when it's accessed, and items not yet cached come from the database. Package code that\nwalked a large tree comfortably on v13 has been reported many times slower on v15 to v17.\nTest anything that traverses (sitemaps, feeds, link checkers, reports) against a large\ncontent tree on the target major, with the site's default cache settings.\n\n- Ask the navigation service tree questions. `IDocumentNavigationQueryService` (and its\n  media counterpart) answers parent\u002Fchild\u002Fdescendant\u002Fancestor questions from an in-memory\n  structure of keys, without loading content. Filter by key and type there, then load only\n  the items you need from the cache.\n- Search the index, don't traverse. \"Find every product with tag X\" is a query, not a\n  tree walk. On v19, or v17\u002Fv18 with the Umbraco Search add-on, get an `ISearcher` from\n  `ISearcherResolver` and filter, sort and page in the query (`skip`\u002F`take`). Without the\n  add-on on v17\u002Fv18, query Examine.\n- Work that must cover the whole tree (a full sitemap, an export) runs in a background\n  job or on demand, and caches its result. It doesn't run per request.\n- A descendant walk is fine when the subtree is small by design (a settings folder). Say so\n  in a comment, so a reviewer doesn't have to guess.\n\nSource: [Common pitfalls](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fapplication-code\u002Fcommon-pitfalls),\n[Umbraco Search](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-search),\nCMS issues [#18869](https:\u002F\u002Fgithub.com\u002Fumbraco\u002FUmbraco-CMS\u002Fissues\u002F18869) and\n[#18892](https:\u002F\u002Fgithub.com\u002Fumbraco\u002FUmbraco-CMS\u002Fissues\u002F18892).\n\n## Navigation extensions: pass the services in\n\n`Children()`, `Parent()`, `Ancestors()`, `Descendants()`, `Siblings()` and the rest of the\n`IPublishedContent` navigation extensions (`Umbraco.Extensions`) are backed by the\nnavigation service. Each has an overload that takes the navigation service\n(`IDocumentNavigationQueryService`, or `IMediaNavigationQueryService` for media) and\n`IPublishedStatusFilteringService`. Package code calls those overloads, with both services\ninjected through the constructor:\n\n```csharp\ninternal sealed class ProductListingService(\n    IDocumentNavigationQueryService navigationQueryService,\n    IPublishedStatusFilteringService publishedStatusFilteringService)\n{\n    public IEnumerable\u003CIPublishedContent> GetProducts(IPublishedContent category)\n        => category.Children(navigationQueryService, publishedStatusFilteringService)\n            .Where(x => x.ContentType.Alias == \"product\");\n}\n```\n\nThe short forms without those parameters (`content.Children()`, mostly in\n`FriendlyPublishedContentExtensions` in `Umbraco.Web.Common`) look both services up from\n`StaticServiceProvider` on every call. That's a service-locator lookup per call, repeated in\nevery loop, plus a hidden dependency a unit test can't replace. A package project that only\nreferences `Umbraco.Core` doesn't get most of them at all. They're for templates, not\npackage code.\n\nThe `IPublishedContent.Children` *property* is obsolete in v17 and removed in v18. Use the\nextension method.\n\nSource: `PublishedContentExtensions` and `FriendlyPublishedContentExtensions` in the CMS\nsource (17.7.1, 18.2.1, `v19\u002Fdev`); `IPublishedContent` at 17.7.1.\n\n## Cache your own expensive lookups\n\nAnything slow that package code repeats (a relation lookup, a call to an external API, a\ncomputed aggregate) goes through Umbraco's `AppCaches`, not a static field or a private\n`MemoryCache`:\n\n- `AppCaches.RuntimeCache` (`IAppPolicyCache`) for values shared across requests, with an\n  expiry.\n- `AppCaches.RequestCache` for values reused within one request.\n\n```csharp\nvar relations = _appCaches.RuntimeCache.GetCacheItem(\n    $\"MyPackage_ChildRelations_{key}\",\n    () => _relationService.GetByChildId(id, \"umbDocument\"),\n    TimeSpan.FromMinutes(5));\n```\n\n- **Prefix every cache key** with your package name. The runtime cache is shared with core\n  and every other package.\n- **Decide what clears it, at design time.** An expiry alone means stale data for that\n  long. If the data changes when your entity is saved, clear the key there. An integration\n  test of that clearing needs `umbraco-dotnet-testing`, or it passes whatever the code does.\n- **Clear it on every server.** On a load-balanced site the clear goes through a cache\n  refresher (`umbraco-extensibility`'s catalogue, row 4).\n- **Refresh many items in one call.** `DistributedCache.Refresh(refresherId, ids)` or\n  `RefreshByPayload(refresherId, payloads)` with the whole set, not one call per item in a\n  loop. Outside a web request (a background job, an import), each call is written to the\n  database for the other servers straight away.\n- **Never hold a request-scoped object in a singleton or static field.** `UmbracoHelper`,\n  `IUmbracoContext` and anything resolved per request belong to one request. Kept longer,\n  they pin memory and can serve one user's data to another.\n\nSource: [Accessing the cache](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fextend-your-project\u002Fserver-side-extensions\u002Fcache\u002Fapplication-cache),\n[Common pitfalls](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fapplication-code\u002Fcommon-pitfalls),\n`BatchedDatabaseServerMessenger` in the CMS source.\n\n## Read data type configuration from its cache\n\nConverters, value editors and data sources often need their data type's configuration. Read\nit from `IDataTypeConfigurationCache` (`GetConfigurationAs\u003CT>(dataTypeKey)`), not\n`IDataTypeService`. The service goes to the repository and clones the result on every call,\nand a value editor runs once per property, per variant, per load.\n\nSource: CMS issue [#14936](https:\u002F\u002Fgithub.com\u002Fumbraco\u002FUmbraco-CMS\u002Fissues\u002F14936) and\nPR [#15731](https:\u002F\u002Fgithub.com\u002Fumbraco\u002FUmbraco-CMS\u002Fpull\u002F15731).\n\n## Property value converters: set the cache level\n\n`GetPropertyCacheLevel` decides how often a converter runs. Pick it deliberately:\n\n| Level | Converted again when | Use for |\n|---|---|---|\n| `Element` | the owning page or block changes | the default; values that only depend on their own data |\n| `Elements` | any content changes | values that reference other content (pickers) |\n| `None` | every read | almost never; it's a large cost on every read |\n\n`PropertyValueConverterBase` returns `Snapshot`, which is obsolete and treated as `None`\nby the current published cache. A converter that inherits the base class without\noverriding `GetPropertyCacheLevel` runs its conversion on every read. Always override it.\n\nA converter that also implements `IDeliveryApiPropertyValueConverter` sets two more:\n`GetDeliveryApiPropertyCacheLevel` and `GetDeliveryApiPropertyCacheLevelForExpansion`\n(which defaults to the first). The same table applies, and `Snapshot` means `None` here\ntoo, even where a docs example uses it. Expanded output depends on each request's `expand`\nand `fields`, so a cached copy is served to requests that asked for a different shape.\nOverride `GetDeliveryApiPropertyCacheLevelForExpansion` to return `None` rather than\ninheriting the default; the built-in converters do the same through `Snapshot`. Never put per-request data (the current time, the\ncurrent user) in a converter's output: any cache level serves it stale, and it stops a site\nusing Delivery API output caching.\n\nSource: [Property value converters](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fextend-your-project\u002Fbackoffice-extensions\u002Fproperty-editors\u002Fproperty-value-converters),\n[Custom property editors support](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fheadless-and-apis\u002Fcontent-delivery-api\u002Fcustom-property-editors-support);\n`PublishedProperty.GetCacheValues` in `Umbraco.PublishedCache.HybridCache`.\n\n## Output caching: evict when your data changes\n\nFrom 17.4 (and every 18.x), a site can cache whole rendered pages and whole Delivery API\nresponses. The package doesn't turn this on, but has to work when the site does:\n\n- **If package data feeds pages or API responses** and it changes outside a content\n  publish (a product price, a review count from your own tables), evict what shows it:\n  `IWebsiteOutputCacheManager` and `IDeliveryApiOutputCacheManager` evict by content key or\n  by tag. Otherwise visitors see the old value until the cache expires.\n- **If the package renders output that differs per visitor** (a member's name, a basket),\n  mark that response as not cacheable. A cached copy of it is served to the next visitor.\n\nSource: [Website output caching](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fcaching\u002Fwebsite-output-caching),\n[Delivery API output caching](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fheadless-and-apis\u002Fcontent-delivery-api\u002Foutput-caching).\n\n## Keep hot paths light\n\nSome code runs far more often than it looks like it does:\n\n- **Notification handlers** on save\u002Fpublish run inside the editor's save. A bulk publish\n  runs them once per item. Do slow work (external calls, reindexing your own data)\n  after the save: record it and let a background job pick it up. An in-memory queue loses\n  work on a restart.\n- **Bulk operations** (an import, a sync, a migration over many items) run in one scope, so\n  the work is one transaction and its notifications fire once, when the scope completes.\n  `scope.Notifications.Suppress()` stops them entirely, which is only safe for data your\n  package owns. Suppressing around content or media service calls leaves the published\n  cache and search index stale until they're rebuilt.\n- **Indexing code** runs once per item indexed, and a full rebuild runs it for every\n  document and media item. With Umbraco Search, that's `IContentIndexer.GetIndexFieldsAsync`\n  and `IPropertyValueHandler.GetIndexFields`. With Examine on v17\u002Fv18, it's\n  `TransformingIndexValues` and similar events. For the Delivery API index, on any of them,\n  it's `IContentIndexHandler.GetFieldValues`. A service lookup in there is one database\n  call per item. Build fields from the content item you're handed. If you need related\n  data, read it from the published cache or a cached lookup, not a service.\n- **Startup** code runs on every app start, on every site that installs the package. Do\n  work lazily, when it's first needed. Run one-time setup through a migration, which\n  records that it ran, not a check on every boot.\n- **Volatile data doesn't belong in content nodes.** Counters, form entries, logs and\n  imported bulk data go in your own tables (`ef-core-data`). Content saves are slow by\n  design: versioning, notifications, cache updates, reindexing.\n\nSource: [Common pitfalls](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fapplication-code\u002Fcommon-pitfalls),\n[ContentService notifications](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fextend-your-project\u002Fserver-side-extensions\u002Fnotifications\u002Fcontentservice-notifications),\n[Umbraco Search](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-search).\n\n## Management API endpoints: return what the list needs\n\n- **Page anything that can grow.** A list endpoint takes `skip`\u002F`take` and returns a total.\n  Never return \"all items\" for the screen to page.\n- **List-sized models.** A list returns what its columns show; the full model is for the\n  detail endpoint.\n- **No per-item URL building in lists.** Resolving a content URL is slow next to loading\n  the item. Core moved URLs out of its own document response into a separate endpoint for\n  this reason. Return keys, and let the screen ask for URLs where it shows them.\n\nSource: CMS issue [#18910](https:\u002F\u002Fgithub.com\u002Fumbraco\u002FUmbraco-CMS\u002Fissues\u002F18910).\n\n## Backoffice extensions: don't over-fetch\n\n- **Use the paging the screen already has.** Collection views have paging built in; wire\n  them to the endpoint's `skip`\u002F`take`.\n- **Debounce search-as-you-type.** Use `debounce` from `@umbraco-cms\u002Fbackoffice\u002Futils`, so\n  a search fires when typing pauses, not on every key press.\n- **Fetch once, share it.** Two elements on one screen that need the same data read it from\n  a shared context or repository, not one request each.\n- **Don't refetch when an element reconnects.** Block editors' sorting removes and re-adds\n  elements, so `connectedCallback` runs again on every drag. Server-rendered previews and\n  other expensive fetches cache their result (for example by a hash of the value) and reuse\n  it.\n\nSource: Block Preview issue [#149](https:\u002F\u002Fgithub.com\u002Frickbutterfield\u002FBlockPreview\u002Fissues\u002F149).\n\n## *Reviewing a diff for performance*\n\n- A services-layer read (`IContentService`, `IMediaService`, `IDataTypeService`, ...) on a\n  per-request, per-property or per-item path.\n- `Descendants()`\u002F`DescendantsOrSelf()` from a root or other large node, on a per-request\n  path or without a comment saying why the subtree is small.\n- A navigation extension (`Children()`, `Ancestors()`, ...) called without the injected\n  navigation and published-status services, or the obsolete `.Children` property.\n- A converter with no `GetPropertyCacheLevel` override, or any cache level (including the\n  Delivery API one) set to `None` or `Snapshot` without a stated reason. The Delivery API\n  expansion level is the exception: flag it when it's anything but `None` or `Snapshot`.\n- A cache added with no rule for what clears it.\n- A cache key without the package prefix.\n- A request-scoped object stored in a singleton or static field.\n- Package data shown on pages or in Delivery API responses, changed with no output cache\n  eviction.\n- A database or HTTP call inside a notification handler, a content indexer, a property\n  value handler, an Examine event, or a loop over content.\n- Bulk work outside a single scope, or `Suppress()` around content or media service calls.\n- A list endpoint without paging, or with per-item URLs; a search box without a debounce;\n  an expensive fetch in `connectedCallback` with no cache.\n","# Performance for Umbraco packages\n\nA package's code runs on sites its author never sees: a 50-page brochure site and a\n200,000-node multi-site install get the same DLL. Write for the big one. Every rule below\nis a pattern that's harmless on the demo site and costly in production.\n\nThis skill covers code a package ships: property value converters, content finders,\nManagement API endpoints, notification handlers, indexers, background jobs, Delivery API\noutput, and backoffice extensions. A site's own templates and its tuning (cache seed counts,\nturning output caching on, cache size limits) belong to the site owner. A package must\nstay fast with the site's defaults, not depend on the owner changing them.\n\nVerify version-specific APIs against the CMS source and docs for the major the project\ntargets (`umbraco-cms-source`, `umbraco-docs`). The published content cache was rebuilt in\nv15, so caching advice written for v13 and earlier is often wrong now. Search changes in\nv19: Umbraco Search (`Umbraco.Cms.Search`) replaces the built-in Examine indexes and their\nhooks. It's also an add-on for v17 and v18, so check which one the site uses, not just the\nmajor.\n\n## *🎯 Why: Design for Change*\n\nSlow code gets fixed by adding caches, and caches added late get bolted on in the wrong\nplace, with no plan for clearing them. Deciding up front where data is read from, and what\nclears it, keeps a later speed fix a local change instead of a redesign.\n\n## Read published content from the cache, not the services layer\n\nThe services layer (`IContentService`, `IMediaService`, `IRelationService` and friends)\nreads and writes the database. It's for changing data, not reading it on a hot path. Package\ncode that runs per front-end or Delivery API request (a converter, a content finder, a\nrendered component) reads from the published cache instead:\n\n```csharp\n\u002F\u002F Hits the database on every call\nvar item = _contentService.GetById(key);\n\n\u002F\u002F Reads the published cache\nvar item = _publishedContentCache.GetById(key);\n```\n\nThe published cache is lazy-loaded: an item is read from the database the first time it's\nrequested, then served from memory. A cold item costs a database call, which matters when\npackage code touches thousands of them (next section).\n\nSource: [Common pitfalls](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fapplication-code\u002Fcommon-pitfalls),\n[Cache seeding](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fextend-your-project\u002Fserver-side-extensions\u002Fcache\u002Fcache-seeding).\n\n## Don't walk the whole tree\n\n`Descendants()` \u002F `DescendantsOrSelf()` visit every node below the starting point and load\neach one. From the root, that's the whole site. A filter after it still loads everything\nfirst:\n\n```csharp\n\u002F\u002F Loads every node in the site to find the products\nvar products = root\n    .DescendantsOrSelf(_navigationQueryService, _publishedStatusFilteringService)\n    .Where(x => x.ContentType.Alias == \"product\");\n```\n\nSince v15 this costs more than it used to: each `IPublishedContent` is rebuilt from the\ncache when it's accessed, and items not yet cached come from the database. Package code that\nwalked a large tree comfortably on v13 has been reported many times slower on v15 to v17.\nTest anything that traverses (sitemaps, feeds, link checkers, reports) against a large\ncontent tree on the target major, with the site's default cache settings.\n\n- Ask the navigation service tree questions. `IDocumentNavigationQueryService` (and its\n  media counterpart) answers parent\u002Fchild\u002Fdescendant\u002Fancestor questions from an in-memory\n  structure of keys, without loading content. Filter by key and type there, then load only\n  the items you need from the cache.\n- Search the index, don't traverse. \"Find every product with tag X\" is a query, not a\n  tree walk. On v19, or v17\u002Fv18 with the Umbraco Search add-on, get an `ISearcher` from\n  `ISearcherResolver` and filter, sort and page in the query (`skip`\u002F`take`). Without the\n  add-on on v17\u002Fv18, query Examine.\n- Work that must cover the whole tree (a full sitemap, an export) runs in a background\n  job or on demand, and caches its result. It doesn't run per request.\n- A descendant walk is fine when the subtree is small by design (a settings folder). Say so\n  in a comment, so a reviewer doesn't have to guess.\n\nSource: [Common pitfalls](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fapplication-code\u002Fcommon-pitfalls),\n[Umbraco Search](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-search),\nCMS issues [#18869](https:\u002F\u002Fgithub.com\u002Fumbraco\u002FUmbraco-CMS\u002Fissues\u002F18869) and\n[#18892](https:\u002F\u002Fgithub.com\u002Fumbraco\u002FUmbraco-CMS\u002Fissues\u002F18892).\n\n## Navigation extensions: pass the services in\n\n`Children()`, `Parent()`, `Ancestors()`, `Descendants()`, `Siblings()` and the rest of the\n`IPublishedContent` navigation extensions (`Umbraco.Extensions`) are backed by the\nnavigation service. Each has an overload that takes the navigation service\n(`IDocumentNavigationQueryService`, or `IMediaNavigationQueryService` for media) and\n`IPublishedStatusFilteringService`. Package code calls those overloads, with both services\ninjected through the constructor:\n\n```csharp\ninternal sealed class ProductListingService(\n    IDocumentNavigationQueryService navigationQueryService,\n    IPublishedStatusFilteringService publishedStatusFilteringService)\n{\n    public IEnumerable\u003CIPublishedContent> GetProducts(IPublishedContent category)\n        => category.Children(navigationQueryService, publishedStatusFilteringService)\n            .Where(x => x.ContentType.Alias == \"product\");\n}\n```\n\nThe short forms without those parameters (`content.Children()`, mostly in\n`FriendlyPublishedContentExtensions` in `Umbraco.Web.Common`) look both services up from\n`StaticServiceProvider` on every call. That's a service-locator lookup per call, repeated in\nevery loop, plus a hidden dependency a unit test can't replace. A package project that only\nreferences `Umbraco.Core` doesn't get most of them at all. They're for templates, not\npackage code.\n\nThe `IPublishedContent.Children` *property* is obsolete in v17 and removed in v18. Use the\nextension method.\n\nSource: `PublishedContentExtensions` and `FriendlyPublishedContentExtensions` in the CMS\nsource (17.7.1, 18.2.1, `v19\u002Fdev`); `IPublishedContent` at 17.7.1.\n\n## Cache your own expensive lookups\n\nAnything slow that package code repeats (a relation lookup, a call to an external API, a\ncomputed aggregate) goes through Umbraco's `AppCaches`, not a static field or a private\n`MemoryCache`:\n\n- `AppCaches.RuntimeCache` (`IAppPolicyCache`) for values shared across requests, with an\n  expiry.\n- `AppCaches.RequestCache` for values reused within one request.\n\n```csharp\nvar relations = _appCaches.RuntimeCache.GetCacheItem(\n    $\"MyPackage_ChildRelations_{key}\",\n    () => _relationService.GetByChildId(id, \"umbDocument\"),\n    TimeSpan.FromMinutes(5));\n```\n\n- **Prefix every cache key** with your package name. The runtime cache is shared with core\n  and every other package.\n- **Decide what clears it, at design time.** An expiry alone means stale data for that\n  long. If the data changes when your entity is saved, clear the key there. An integration\n  test of that clearing needs `umbraco-dotnet-testing`, or it passes whatever the code does.\n- **Clear it on every server.** On a load-balanced site the clear goes through a cache\n  refresher (`umbraco-extensibility`'s catalogue, row 4).\n- **Refresh many items in one call.** `DistributedCache.Refresh(refresherId, ids)` or\n  `RefreshByPayload(refresherId, payloads)` with the whole set, not one call per item in a\n  loop. Outside a web request (a background job, an import), each call is written to the\n  database for the other servers straight away.\n- **Never hold a request-scoped object in a singleton or static field.** `UmbracoHelper`,\n  `IUmbracoContext` and anything resolved per request belong to one request. Kept longer,\n  they pin memory and can serve one user's data to another.\n\nSource: [Accessing the cache](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fextend-your-project\u002Fserver-side-extensions\u002Fcache\u002Fapplication-cache),\n[Common pitfalls](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fapplication-code\u002Fcommon-pitfalls),\n`BatchedDatabaseServerMessenger` in the CMS source.\n\n## Read data type configuration from its cache\n\nConverters, value editors and data sources often need their data type's configuration. Read\nit from `IDataTypeConfigurationCache` (`GetConfigurationAs\u003CT>(dataTypeKey)`), not\n`IDataTypeService`. The service goes to the repository and clones the result on every call,\nand a value editor runs once per property, per variant, per load.\n\nSource: CMS issue [#14936](https:\u002F\u002Fgithub.com\u002Fumbraco\u002FUmbraco-CMS\u002Fissues\u002F14936) and\nPR [#15731](https:\u002F\u002Fgithub.com\u002Fumbraco\u002FUmbraco-CMS\u002Fpull\u002F15731).\n\n## Property value converters: set the cache level\n\n`GetPropertyCacheLevel` decides how often a converter runs. Pick it deliberately:\n\n| Level | Converted again when | Use for |\n|---|---|---|\n| `Element` | the owning page or block changes | the default; values that only depend on their own data |\n| `Elements` | any content changes | values that reference other content (pickers) |\n| `None` | every read | almost never; it's a large cost on every read |\n\n`PropertyValueConverterBase` returns `Snapshot`, which is obsolete and treated as `None`\nby the current published cache. A converter that inherits the base class without\noverriding `GetPropertyCacheLevel` runs its conversion on every read. Always override it.\n\nA converter that also implements `IDeliveryApiPropertyValueConverter` sets two more:\n`GetDeliveryApiPropertyCacheLevel` and `GetDeliveryApiPropertyCacheLevelForExpansion`\n(which defaults to the first). The same table applies, and `Snapshot` means `None` here\ntoo, even where a docs example uses it. Expanded output depends on each request's `expand`\nand `fields`, so a cached copy is served to requests that asked for a different shape.\nOverride `GetDeliveryApiPropertyCacheLevelForExpansion` to return `None` rather than\ninheriting the default; the built-in converters do the same through `Snapshot`. Never put per-request data (the current time, the\ncurrent user) in a converter's output: any cache level serves it stale, and it stops a site\nusing Delivery API output caching.\n\nSource: [Property value converters](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fextend-your-project\u002Fbackoffice-extensions\u002Fproperty-editors\u002Fproperty-value-converters),\n[Custom property editors support](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fheadless-and-apis\u002Fcontent-delivery-api\u002Fcustom-property-editors-support);\n`PublishedProperty.GetCacheValues` in `Umbraco.PublishedCache.HybridCache`.\n\n## Output caching: evict when your data changes\n\nFrom 17.4 (and every 18.x), a site can cache whole rendered pages and whole Delivery API\nresponses. The package doesn't turn this on, but has to work when the site does:\n\n- **If package data feeds pages or API responses** and it changes outside a content\n  publish (a product price, a review count from your own tables), evict what shows it:\n  `IWebsiteOutputCacheManager` and `IDeliveryApiOutputCacheManager` evict by content key or\n  by tag. Otherwise visitors see the old value until the cache expires.\n- **If the package renders output that differs per visitor** (a member's name, a basket),\n  mark that response as not cacheable. A cached copy of it is served to the next visitor.\n\nSource: [Website output caching](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fcaching\u002Fwebsite-output-caching),\n[Delivery API output caching](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fheadless-and-apis\u002Fcontent-delivery-api\u002Foutput-caching).\n\n## Keep hot paths light\n\nSome code runs far more often than it looks like it does:\n\n- **Notification handlers** on save\u002Fpublish run inside the editor's save. A bulk publish\n  runs them once per item. Do slow work (external calls, reindexing your own data)\n  after the save: record it and let a background job pick it up. An in-memory queue loses\n  work on a restart.\n- **Bulk operations** (an import, a sync, a migration over many items) run in one scope, so\n  the work is one transaction and its notifications fire once, when the scope completes.\n  `scope.Notifications.Suppress()` stops them entirely, which is only safe for data your\n  package owns. Suppressing around content or media service calls leaves the published\n  cache and search index stale until they're rebuilt.\n- **Indexing code** runs once per item indexed, and a full rebuild runs it for every\n  document and media item. With Umbraco Search, that's `IContentIndexer.GetIndexFieldsAsync`\n  and `IPropertyValueHandler.GetIndexFields`. With Examine on v17\u002Fv18, it's\n  `TransformingIndexValues` and similar events. For the Delivery API index, on any of them,\n  it's `IContentIndexHandler.GetFieldValues`. A service lookup in there is one database\n  call per item. Build fields from the content item you're handed. If you need related\n  data, read it from the published cache or a cached lookup, not a service.\n- **Startup** code runs on every app start, on every site that installs the package. Do\n  work lazily, when it's first needed. Run one-time setup through a migration, which\n  records that it ran, not a check on every boot.\n- **Volatile data doesn't belong in content nodes.** Counters, form entries, logs and\n  imported bulk data go in your own tables (`ef-core-data`). Content saves are slow by\n  design: versioning, notifications, cache updates, reindexing.\n\nSource: [Common pitfalls](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fdevelop-with-umbraco\u002Fapplication-code\u002Fcommon-pitfalls),\n[ContentService notifications](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-cms\u002Fextend-your-project\u002Fserver-side-extensions\u002Fnotifications\u002Fcontentservice-notifications),\n[Umbraco Search](https:\u002F\u002Fdocs.umbraco.com\u002Fumbraco-search).\n\n## Management API endpoints: return what the list needs\n\n- **Page anything that can grow.** A list endpoint takes `skip`\u002F`take` and returns a total.\n  Never return \"all items\" for the screen to page.\n- **List-sized models.** A list returns what its columns show; the full model is for the\n  detail endpoint.\n- **No per-item URL building in lists.** Resolving a content URL is slow next to loading\n  the item. Core moved URLs out of its own document response into a separate endpoint for\n  this reason. Return keys, and let the screen ask for URLs where it shows them.\n\nSource: CMS issue [#18910](https:\u002F\u002Fgithub.com\u002Fumbraco\u002FUmbraco-CMS\u002Fissues\u002F18910).\n\n## Backoffice extensions: don't over-fetch\n\n- **Use the paging the screen already has.** Collection views have paging built in; wire\n  them to the endpoint's `skip`\u002F`take`.\n- **Debounce search-as-you-type.** Use `debounce` from `@umbraco-cms\u002Fbackoffice\u002Futils`, so\n  a search fires when typing pauses, not on every key press.\n- **Fetch once, share it.** Two elements on one screen that need the same data read it from\n  a shared context or repository, not one request each.\n- **Don't refetch when an element reconnects.** Block editors' sorting removes and re-adds\n  elements, so `connectedCallback` runs again on every drag. Server-rendered previews and\n  other expensive fetches cache their result (for example by a hash of the value) and reuse\n  it.\n\nSource: Block Preview issue [#149](https:\u002F\u002Fgithub.com\u002Frickbutterfield\u002FBlockPreview\u002Fissues\u002F149).\n\n## *Reviewing a diff for performance*\n\n- A services-layer read (`IContentService`, `IMediaService`, `IDataTypeService`, ...) on a\n  per-request, per-property or per-item path.\n- `Descendants()`\u002F`DescendantsOrSelf()` from a root or other large node, on a per-request\n  path or without a comment saying why the subtree is small.\n- A navigation extension (`Children()`, `Ancestors()`, ...) called without the injected\n  navigation and published-status services, or the obsolete `.Children` property.\n- A converter with no `GetPropertyCacheLevel` override, or any cache level (including the\n  Delivery API one) set to `None` or `Snapshot` without a stated reason. The Delivery API\n  expansion level is the exception: flag it when it's anything but `None` or `Snapshot`.\n- A cache added with no rule for what clears it.\n- A cache key without the package prefix.\n- A request-scoped object stored in a singleton or static field.\n- Package data shown on pages or in Delivery API responses, changed with no output cache\n  eviction.\n- A database or HTTP call inside a notification handler, a content indexer, a property\n  value handler, an Examine event, or a loop over content.\n- Bulk work outside a single scope, or `Suppress()` around content or media service calls.\n- A list endpoint without paging, or with per-item URLs; a search box without a debounce;\n  an expensive fetch in `connectedCallback` with no cache.\n",{"name":5,"description":7},"main","a2f9c28bc56802b4e6db01e03972e497b30ad001","plugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-performance",1,"https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit","https:\u002F\u002Fgithub.com\u002Fmattbrailsford","https:\u002F\u002Fmattbrailsford.dev","AI Staff Engineer @umbraco ","2026-11-12 18:33:53",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add mattbrailsford\u002Fumbraco-devkit --skill umbraco-performance",{"tool":39,"command":40},"bunx","bunx skills add mattbrailsford\u002Fumbraco-devkit --skill umbraco-performance",{"tool":42,"command":43},"pnpm","pnpm dlx skills add mattbrailsford\u002Fumbraco-devkit --skill umbraco-performance","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-performance\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7CYGRPVNP8H9YNHGMZ6CP3C","user-stories","Writes, splits and refines user stories with Given\u002FWhen\u002FThen acceptance criteria in STORIES.md, feeding bdd-specs. Use when turning a feature request or a vague ask into a testable backlog entry.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fuser-stories\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7CYGJB26N83DXKMDEKY2X48","umbraco-security","What Umbraco provides for keeping a package secure, on the server and in the backoffice: Management API authorization and policies, settings that hold secrets, endpoints outside the Management API, sanitizeHTML and escapeHTML, DOMPurify rules for custom elements, and umbHttpClient instead of handling tokens in the browser. Use when writing or reviewing a Management API controller, a secret setting, a custom endpoint, a backoffice template that uses unsafeHTML, or frontend code that calls an API.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-security\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7CYG59CZN1K2KERB0SSDGSY","umbraco-package-conventions","Backend conventions for an Umbraco package: async naming, internal by default, Attempt-based results for routine failures, public-API backwards compatibility, and where extension methods live. Use when naming a method, choosing visibility, shaping a service's result, changing a public signature (including adding a dependency to a public class's constructor), or organizing extension methods. For extension mechanisms, see `umbraco-extensibility`.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-package-conventions\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7CYG0J10QH8J2GS825WTTET","umbraco-marketplace","Gets a finished package listed on the Umbraco Marketplace: the NuGet tag, the dependency Marketplace reads version support from, the v14+ compatibility gotcha, and umbraco-marketplace.json. Use when a package is ready to publish, or when reviewing its packaging.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-marketplace\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7CYFT7MSYW4GRDSQRDPG020","umbraco-extensibility","Umbraco's extension mechanisms (Composers, collection builders, notification handlers, attribute discovery) and a catalogue of backend CMS extension points: property value converters, Management API endpoints, content finders, health checks, search indexing, package migrations, background jobs, and more. Use when making a feature extensible or choosing which extension point fits. Not for property editor UI, dashboards, sections or trees, which the official Backoffice Skills plugin covers.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-extensibility\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7CYFM5BJ5SVK9SJB78VY6ZG","umbraco-env-sync","Moving an Umbraco package's own entities between environments with Umbraco Deploy or uSync: what moves as files and what moves over the wire, export shape and dependencies, restores, keeping secrets out, linking users by alias, translating stored ids, and keeping sync code current. Use when adding Deploy or uSync support, or changing an entity the package syncs. Not for deploying the site itself.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-env-sync\u002FSKILL.md",[],[]]