Check Angular code.
- 01const doctor = scan('angular.json');
- 02doctor.rules = 81; // six families
- 03if (hostBindings) throw 'prefer-host-bindings';
- 04doctor.score = 81;
- 05write('angular-doctor-report.md');
- 06// fix order: migrations → style guide → the rest
- 07repeat(doctor.scan).on('--scope changed');
Angular Doctor scans your Angular or Nx workspace, scores it from 0 to 100, and writes a report you can fix from.
A real scan of the sample workspace.
npx @abiramcodes/angular-doctor@latest20.19+
Node.js
The package requires this runtime or newer.
15+
Angular
Angular 17+ gets every check. 15 and 16 run in compat mode.
4
Scopes
full, changed, files, and contextual.
1.5
Per file
An error costs 1.5 in each file. A warning costs 0.75 once. A note costs nothing.
Six families, one meter.
81 built-in checks in six categories. Each family is a kind of Angular habit the scan looks for.
correctness
14Does the code do what it says? Control flow, subscriptions, strict mode, templates.
prefer-take-until-destroyedtypescript-strictstrict-templatesperformance
14Angular's runtime budget. Change detection, images, zone.js, routing.
missing-for-trackzone-jsprefer-ng-optimized-imagemaintainability
34The style guide, enforced. Naming, file sets, host bindings, lifecycle, signals.
one-concept-per-fileprefer-host-bindingsprefer-signal-formssecurity
5Secrets and injection. Client code, env files, innerHTML, target="_blank".
client-secretenv-fileinner-htmlaccessibility
4Keyboard and screen reader. Alt text, labels, focus order, click handlers.
img-altcontrol-missing-labelclick-without-keyboardhygiene
10Dead weight and drift. Unused imports and exports, file naming, project layout.
unused-exportfile-hyphen-caseproject-layout
The report is the prescription.
When anything is found, the scan writes angular-doctor-report.md — a self-contained brief for you or your agent.
When a scan finds something, it writes a self-contained Markdown report: the score, official migrations, a fix order, and every finding with its location and, where the rule provides one, a suggested fix.
The report is written for you or your agent. Re-run with --verbose --scope changed after edits and it covers only what changed.
Error
angular-doctor/prefer-host-bindings
src/app/style-violations/host-slider.ts:8
@HostListener is backwards-compatible. Use the host option instead.
before
@HostListener('keydown', ['$event'])
updateValue(event: KeyboardEvent) {}suggested fix
host: {
'(keydown)': 'updateValue($event)',
}# Angular Doctor report
> Self-contained findings for coding agents. Re-run `npx @abiramcodes/angular-doctor@latest --verbose` after fixes.
## Summary
- **Health score:** 81/100
- **Errors:** 9
- **Warnings:** 15
- **Infos:** 5
- **Project:** angular-doctor (angular-cli)
- **Angular:** 22.2.0
- **Scan duration:** 299ms
### angular-doctor/prefer-host-bindings (error) — 1 occurrence
- **Message:** @HostListener is backwards-compatible. Use the host option instead.
- **Suggested fix:** Move the binding into the host object of @Component or @Directive.
- **Locations:**
- `src/app/style-violations/host-slider.ts:8:3`Start with one command.
Every command accepts --colors default, pastel, or velvet. The full flag reference lives in the docs.
Read the command referencenpx @abiramcodes/angular-doctor@latest --verbose --scope changedScan what git shows as changed. The command to run after an edit.
npx @abiramcodes/angular-doctor@latest --category securityPrint one category. The score is still the full scan.
npx @abiramcodes/angular-doctor@latest --jsonPrint one JSON object for another tool to read.
npx @abiramcodes/angular-doctor@latest rules listList the built-in checks grouped by category.
npx @abiramcodes/angular-doctor@latest installCopy the agent skill into your project.
Run it where the code lands.
Write a GitHub Actions workflow that scans pushes to main and every pull request. Add --scope changed to report local working-tree changes, or --json to feed another job.
Set up CInpx @abiramcodes/angular-doctor@latest ci installRun it on your workspace.
Scan the directory you are in.
npx @abiramcodes/angular-doctor@latest