<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/building-installation-schematics-with-ng-add-apgki5sdi" -->

---
title: Building Installation Schematics with ng add | daily.dev
description: Part 3 of a six-part series on Angular Schematics walks through building an ng add installation schematic that automates a library's first-time setup. It...
canonical: https://daily.dev/posts/building-installation-schematics-with-ng-add-apgki5sdi
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Building Installation Schematics with ng add | daily.dev
og:description: Part 3 of a six-part series on Angular Schematics walks through building an ng add installation schematic that automates a library's first-time setup. It...
og:url: https://daily.dev/posts/building-installation-schematics-with-ng-add-apgki5sdi
og:image: https://api.daily.dev/og/posts/ApGKI5sDi.png
og:image:alt: Building Installation Schematics with ng add
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Building Installation Schematics with ng add

**[Angular.love](https://daily.dev/sources/angularlove)** · 12 min read · 0 upvotes · 0 comments

## Summary

Part 3 of a six-part series on Angular Schematics walks through building an ng add installation schematic that automates a library's first-time setup. It covers how ng add differs from ng generate, registering the reserved 'ng-add' entry point in collection.json, and a full walkthrough of composing Rules to add peer dependencies to package.json, schedule NodePackageInstallTask, update angular.json styles array, and inject a global style import via chain(). Includes guidance on idempotency guards, local testing with npm pack and --dry-run, and why ng add has become an expected installation pattern for serious Angular libraries like Angular Material, NgRx, and PrimeNG.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://angular.love/angular-schematics-deep-dive-part-3-building-installation-schematics-with-ng-add>

## Questions this post answers

### How do I create an ng add schematic for my Angular library?

Register a schematic named exactly 'ng-add' in your library's collection.json, pointing to a factory function. The CLI looks for this reserved key specifically. Compose Rules with chain() to add peer dependencies to package.json, schedule a NodePackageInstallTask, update angular.json's styles array, and prepend a global style import, ensuring dependency writes happen before the install task runs.

_daily.dev surfaces practical schematic patterns for developers packaging Angular libraries for easy installs._

### Does the Angular CLI install a package before or after running its ng add schematic?

The CLI installs the package first, before executing the ng-add factory function. This means by the time the schematic runs, the package already exists in node_modules and its package.json, version info, and shipped assets are all accessible to the schematic logic, unlike ng generate which requires the package to already be installed.

_Understanding CLI installation order helps teams building Angular libraries avoid setup bugs, a topic worth tracking on daily.dev._

### How do I test an ng add schematic locally before publishing?

Pack the library into a tarball with npm pack after building it, then run ng add ./path/to/package.tgz in a test Angular workspace, or install it locally with npm install and run ng add separately. Always preview changes first with the --dry-run flag, since ng add schematics typically touch multiple files like package.json, angular.json, and global stylesheets.

_Developers refining library release workflows can keep tabs on Angular tooling practices via daily.dev._

## Similar posts on daily.dev

- [Getting Started with the Angular CLI: Beginner-friendly Guide](https://daily.dev/posts/getting-started-with-the-angular-cli-beginner-friendly-guide-cyib5ntmn) · Angular.love · 0 upvotes · 0 comments
- [Angular 00: Introduction to Angular 22](https://daily.dev/posts/angular-00-introduction-to-angular-22-xtjsurcuc) · Medium · 3 upvotes · 0 comments
- [Ng-News 26/01: Ng-Poland Outtakes - Keynote and Q&A](https://daily.dev/posts/ng-news-26-01-ng-poland-outtakes---keynote-and-q-a-rhtqe5mte) · This is Angular · 2 upvotes · 0 comments
- [Angular's Official Agent Skills Helps AI Coding Tools Write Modern Angular](https://daily.dev/posts/angular-s-official-agent-skills-helps-ai-coding-tools-write-modern-angular-43lqh4gde) · InfoQ · 13 upvotes · 1 comments
- [Why are we talking about architecture again?](https://daily.dev/posts/why-are-we-talking-about-architecture-again--qeiyintcw) · ITNEXT · 19 upvotes · 3 comments

---

Tags: [#typescript](https://daily.dev/tags/typescript), [#angular](https://daily.dev/tags/angular)

[View this post on daily.dev](https://daily.dev/posts/building-installation-schematics-with-ng-add-apgki5sdi)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Building Installation Schematics with ng add","url":"https://daily.dev/posts/building-installation-schematics-with-ng-add-apgki5sdi","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/building-installation-schematics-with-ng-add-apgki5sdi"},"datePublished":"2026-09-20T07:44:26.980Z","dateModified":"2026-09-20T07:48:31.604Z","description":"Part 3 of a six-part series on Angular Schematics walks through building an ng add installation schematic that automates a library's first-time setup. It...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/9ec5e0e4e3d1b8ce6671a2a7bcbe0315?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/9ec5e0e4e3d1b8ce6671a2a7bcbe0315?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Angular.love","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"Angular.love","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/b638946cd9c74bf6a260e4e6a40212d7","url":"https://daily.dev/sources/angularlove"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/building-installation-schematics-with-ng-add-apgki5sdi","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"typescript,angular","timeRequired":"PT12M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Angular.love","item":"https://daily.dev/sources/angularlove"},{"@type":"ListItem","position":3,"name":"Building Installation Schematics with ng add"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/building-installation-schematics-with-ng-add-apgki5sdi#faq","mainEntity":[{"@type":"Question","name":"How do I create an ng add schematic for my Angular library?","acceptedAnswer":{"@type":"Answer","text":"Register a schematic named exactly 'ng-add' in your library's collection.json, pointing to a factory function. The CLI looks for this reserved key specifically. Compose Rules with chain() to add peer dependencies to package.json, schedule a NodePackageInstallTask, update angular.json's styles array, and prepend a global style import, ensuring dependency writes happen before the install task runs. daily.dev surfaces practical schematic patterns for developers packaging Angular libraries for easy installs."}},{"@type":"Question","name":"Does the Angular CLI install a package before or after running its ng add schematic?","acceptedAnswer":{"@type":"Answer","text":"The CLI installs the package first, before executing the ng-add factory function. This means by the time the schematic runs, the package already exists in node_modules and its package.json, version info, and shipped assets are all accessible to the schematic logic, unlike ng generate which requires the package to already be installed. Understanding CLI installation order helps teams building Angular libraries avoid setup bugs, a topic worth tracking on daily.dev."}},{"@type":"Question","name":"How do I test an ng add schematic locally before publishing?","acceptedAnswer":{"@type":"Answer","text":"Pack the library into a tarball with npm pack after building it, then run ng add ./path/to/package.tgz in a test Angular workspace, or install it locally with npm install and run ng add separately. Always preview changes first with the --dry-run flag, since ng add schematics typically touch multiple files like package.json, angular.json, and global stylesheets. Developers refining library release workflows can keep tabs on Angular tooling practices via daily.dev."}}]}
```

