Skip to content
Skills Library
Programming · Building & coding

general-deprecate-api

/general-deprecate-api

Deprecate a public API (class, method, property, type, constant, or context token) following the 2-major-version rule. Use when removing or replacing any publicly exported symbol that external consumers may depend on — includes exports from package index.ts files, global components, extension type aliases, and manifest schemas.

Repository
umbraco-cms ↗
Licence
MIT
Last repository change
27.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 27.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

Deprecate a public API (class, method, property, type, constant, or context token) following the 2-major-version rule. Use when removing or replacing any publicly exported symbol that external consumers may depend on — includes exports from package index.ts files, global components, extension type aliases, and manifest schemas.

Original author description

Deprecate a public API (class, method, property, type, constant, or context token) following the 2-major-version rule. Use when removing or replacing any publicly exported symbol that external consumers may depend on — includes exports from package index.ts files, global components, extension type aliases, and manifest schemas.

How it works

  1. What you need from the user
  2. The 2-Major-Version Rule
  3. Both mechanisms are required
  4. Step 1: Add the replacement API
  5. Step 2: Add JSDoc @deprecated tag
  6. Step 3: Add UmbDeprecation runtime warning
  7. Step 4: Delegate old to new
  8. Step 5: Update internal callers
  9. What counts as a breaking change
  10. Checklist
Original SKILL.md headings · 154 lines, 604 words
SKILL.md preview
---
name: general-deprecate-api
description: Deprecate a public API (class, method, property, type, constant, or context token) following the 2-major-version rule. Use when removing or replacing any publicly exported symbol that external consumers may depend on — includes exports from package index.ts files, global components, extension type aliases, and manifest schemas.
allowed-tools: Read, Write, Edit, Grep, Glob
---

# Deprecate API

Deprecate a public API following Umbraco's breaking changes policy.

## What you need from the user

1. **What to deprecate** — The class, method, property, type, or constant
2. **The replacement** — What consumers should use instead
3. **Current major version** — Read from `version.json` at the repository root

## The 2-Major-Version Rule

> Deprecated in **vN** -> earliest removal in **vN+2**.
>
> Example: deprecated in v17 -> scheduled for removal in v19.

Read `version.json` to determine the current major version and calculate the removal version.

## Both mechanisms are required

Every deprecation **must** use both:

1. **JSDoc `@deprecated` tag** — for IDE warnings and documentation
2. **`UmbDeprecation` runtime warning** — for console output at runtime

## Step 1: Add the replacement API

Introduce the new API alongside the old one. The old API should delegate to the new implementation internally.

```typescript
// New method (the replacement)
requestSummary() {
	// Real implementation here
}
```

## Step 2: Add JSDoc `@deprecated` tag

Include: what was deprecated, when, the replacement, and when it will be removed.

```typescript
/**
 * @deprecated Deprecated since v17. Use `requestSummary()` instead. Will be removed in v19.
 */
getSummary() {
	return this.requestSummary();
}
```

For types and interfaces:

```typescript
/**
 * @deprecated Deprecated since v17. Use `UmbNewInterface` instead. Scheduled for removal in Umbraco 19.
 */
export interface UmbOldInterface {
	// ...
}
```

## Step 3: Add `UmbDeprecation` runtime warning

```typescript
import { UmbDeprecation } from '@umbraco-cms/backoffice/utils';

/**
 * @deprecated Deprecated since v17. Use `requestSummary()` instead. Will be removed in v19.
 */
getSummary() {
	new UmbDeprecation({
		deprecated: 'UmbMyContext.getSummary()',
		removeInVersion: '19.0.0',
		solution: 'Use requestSummary() instead.',
	}).warn();

	return this.requestSummary();
}
```

### Placement by symbol type

| Symbol | Where to place `UmbDeprecation` |
|--------|-------------------------------|
| Method | Inside the method body |
| Class | In the `constructor` |
| Property getter | Inside the getter |
| Constant | At module level (executes on import) |

### For deprecated classes

```typescript
/**
 * @deprecated Deprecated since v17. Use `UmbNewRepository` instead. Will be removed in v19.
 */
export class UmbOldRepository extends UmbControllerBase {
	constructor(host: UmbControllerHost) {
		super(host);

		new UmbDeprecation({
			deprecated: 'UmbOldRepository is deprecated.',
			removeInVersion: '19.0.0',
			solution: 'Use UmbNewRepository instead.',
		}).warn();
	}
}
```

## Step 4: Delegate old to new

The deprecated API must keep working. Delegate to the replacement internally:

```typescript
/**
 * @deprecated Deprecated since v17. Use `getContentTypeUnique()` instead. Will be removed in v19.
 */
getContentTypeId(): string | undefined {
	new UmbDeprecation({
		deprecated: 'UmbMemberWorkspaceContext.getContentTypeId()',
		removeInVersion: '19.0.0',
		solution: 'Use getContentTypeUnique() instead.',
	}).warn();

	return this.getContentTypeUnique();
}
```

## Step 5: Update internal callers

All internal code must use the new API. No code within the repository should call the deprecated member.

## What counts as a breaking change

Any of the following to a **publicly exported** symbol:

- Removing/renaming an exported class, function, type, constant, or context token
- Removing/renaming a public method or property
- Changing a public method signature (required params, return type)
- Removing/renaming a subpath export from `package.json`
- Changing an extension type alias or manifest schema
- Removing/renaming a global component's tag name

**Not breaking**: Internal code (unexported classes, private methods) can be changed freely without deprecation.

## Checklist

- [ ] Replacement API introduced and working
- [ ] `@deprecated` JSDoc tag added with: since version, replacement, removal version
- [ ] `UmbDeprecation` runtime warning added with `deprecated`, `removeInVersion`, `solution`
- [ ] Deprecated code delegates to the replacement (still works)
- [ ] All internal callers updated to use the new API
- [ ] Removal version follows the 2-major-version rule (current + 2)
- [ ] Compiles: `npm run compile`

Versions

The database has no other skills named general-deprecate-api.

Database snapshot: 13.11.2026 · package version 2ff42d1c054e (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100deprecate-cds-api
    Deprecates a CDS component, hook, or other exported symbol with consistent JSDoc, version tags, and docsite metadata across every public export path (web, mobile, common, visualization), not only the original package. Use whenever the user asks to deprecate a CDS component or…
  • 100deprecate-api
    Mark a Polygraphy function, class, module, or alias as deprecated so it warns at runtime and is scheduled for removal. Use when asked to deprecate an API, replace one API with another while keeping backwards compatibility, or add a deprecation warning.
  • 100deprecate-api
    Reference for how deprecation of public Remotion APIs is represented in TypeScript source and documentation. Use when adding, reviewing, or discussing a deprecation of a function, component, hook, type, prop, option, or other public API that remains available.
  • 100api-design
    Use when designing or reviewing a public API, exported function signature, module boundary, exported type/interface, or any contract other code depends on
  • 100deprecate-integration
    Sunsets (soft-deprecates) a shipped Aspire hosting integration: marks its public API [Obsolete], adds a README warning banner, hides the package from `aspire add`, removes integration-specific automation, suppresses the resulting warnings in first-party consumers, and ships one…
  • 100deprecate
    Use when something has to be removed or retired, a feature, endpoint, table column, config key, feature flag, package or whole service; migrating consumers off an old API or version; code that looks dead but might not be. Symptoms: \"can we delete this?\", \"is anything still…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.