# Angular Schematics

> ALWAYS use when working with Angular Schematics, custom generators, code generation, or building CLI tools in Angular.

- Skill: `oguzhan18/angular-schematics` (Agent Skill, multi-file: 5 files)
- Install (CLI): `npx skillmds@latest add oguzhan18/angular-schematics`
- Raw SKILL.md: https://api.skillmd.com/api/skills/oguzhan18/angular-schematics/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: oguzhan18 (https://skillmd.com/u/oguzhan18)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/oguzhan18/angular-schematics

---


# Angular Schematics

**Version:** Angular 21 (2025)
**Tags:** Schematics, Generators, CLI, Code Generation

**References:** [Schematics Guide](https://angular.io/guide/schematics) • [@schematics/angular](https://github.com/angular/angular/tree/main/packages/schematics/angular)

## Best Practices

- Create schematic

```bash
npm install -g @angular-devkit/schematics-cli
schematics schematics .:my-schematic
```

- Create rule

```ts
import { Rule, SchematicContext, Tree } from '@angular-devkit/schematics';

export function myScheme(options: any): Rule {
  return (tree: Tree, context: SchematicContext) => {
    tree.create(options.path + '/file.ts', 'content');
    return tree;
  };
}
```

- Use templates

```ts
import { apply, url, template } from '@angular-devkit/schematics';

export function myScheme(options: any): Rule {
  const templateSource = apply(url('./files'), [
    template({ ...options }),
    move(options.path)
  ]);
  return chain([mergeWith(templateSource)]);
}
```

