Angular › Angular Schematics & Custom Builders
What is an Angular schematic and how does it relate to the ng generate command?
BeginnerAnswer
A schematic is a template based code generator that the Angular CLI uses to create new files, such as components and services, following consistent naming and structure rules. Every time you run a command like ng generate component, you are actually running a built in schematic behind the scenes.
ng generate component user-profile
// This runs the built in @schematics/angular component schematic
// which creates the .ts, .html, and .spec.ts files following Angular conventionsReal-world example A team relies on the built in component schematic every time they add a new feature, ensuring every component in their codebase follows the exact same consistent file naming and folder structure automatically.