If you're still manually unsubscribing from observables in Angular or using the old ngOnDestroy pattern, this skill pushes you toward DestroyRef and takeUntilDestroyed, which became the recommended approach in Angular 16+. It covers the standard component cleanup pattern and also shows how to handle it in services, which is less obvious but equally important. The examples are minimal but hit the key scenarios. Honestly, this is one of those patterns that should just become muscle memory once you see it, and having Claude automatically reach for it when dealing with subscriptions saves you from memory leaks and outdated patterns.

skills.sh installs
182
GitHub stars
7
last updated
Aug 21, 2026

Install

$ npx -y skills add oguzhan18/angular-ecosystem-skills --skill angular-destroyref --agent claude-code

Installs into .claude/skills of the current project.

Files

Angular DestroyRef

Version: Angular 16+ (2025) Tags: DestroyRef, Cleanup, takeUntilDestroyed

References: DestroyRef

Best Practices

  • Use takeUntilDestroyed
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';

@Component({})
export class MyComponent {
  private destroyRef = inject(DestroyRef);
  
  ngOnInit() {
    this.data$.pipe(
      takeUntilDestroyed(this.destroyRef)
    ).subscribe();
  }
}
  • Use in service
@Injectable({ providedIn: 'root' })
export class DataService {
  private destroyRef = inject(DestroyRef);
  
  getData() {
    return this.http.get('/api/data').pipe(
      takeUntilDestroyed(this.destroyRef)
    );
  }
}

Sponsors

Details

Repository
github.com/oguzhan18/angular-ecosystem-skills
Category
Frontend Development
First seen
Jun 3, 2026

More from oguzhan18/angular-ecosystem-skills

All 45
1nexu-io avatarhtml-ppt-xhs-postnexu-io/open-design小红书 / Instagram 风 9 页 3:4 竖版图文(810×1080)— 暖色 pastel、虚线 sticker 卡片、底部页码点点。用于发小红书图文、Instagram carousel、品牌种草内容。181skills.sh installs
2oguzhan18 avatarangular-resolversoguzhan18/angular-ecosystem-skillsALWAYS use when working with Angular Route Resolvers, data pre-fetching, or loading data before route activation.179skills.sh installs
3oguzhan18 avatarangular-deferrableoguzhan18/angular-ecosystem-skillsALWAYS use when working with Angular Deferrable Views, @defer, lazy loading components, or deferred loading in Angular.178skills.sh installs
4oguzhan18 avatarangular-resourceoguzhan18/angular-ecosystem-skillsALWAYS use when working with Angular Resource, Angular 19 resource API, or new async data loading with signals.178skills.sh installs
5oguzhan18 avatarangular-directivesoguzhan18/angular-ecosystem-skillsALWAYS use when working with Angular Directives, custom directives, attribute directives, structural directives, or directive composition in Angular application176skills.sh installs
6sickn33 avatarreact-flow-architectsickn33/antigravity-awesome-skillsreact flow architect176skills.sh installs