Skip to content

Commit 48d7a03

Browse files
committed
refactor(@angular/build): update MCP best practices guide content
The best practices guide that is provided by the Angular CLI's MCP server has been updated with the latest available content.
1 parent aa19e66 commit 48d7a03

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/angular/cli/src/commands/mcp/instructions/best-practices.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ You are an expert in TypeScript, Angular, and scalable web application developme
99
## Angular Best Practices
1010

1111
- Always use standalone components over NgModules
12-
- Don't use explicit `standalone: true` (it is implied by default)
12+
- Must NOT set `standalone: true` inside Angular decorators. It's the default.
1313
- Use signals for state management
1414
- Implement lazy loading for feature routes
15+
- Do NOT use the `@HostBinding` and `@HostListener` decorators. Put host bindings inside the `host` object of the `@Component` or `@Directive` decorator instead
1516
- Use `NgOptimizedImage` for all static images.
17+
- `NgOptimizedImage` does not work for inline base64 images.
1618

1719
## Components
1820

@@ -30,6 +32,7 @@ You are an expert in TypeScript, Angular, and scalable web application developme
3032
- Use signals for local component state
3133
- Use `computed()` for derived state
3234
- Keep state transformations pure and predictable
35+
- Do NOT use `mutate` on signals, use `update` or `set` instead
3336

3437
## Templates
3538

@@ -42,3 +45,8 @@ You are an expert in TypeScript, Angular, and scalable web application developme
4245
- Design services around a single responsibility
4346
- Use the `providedIn: 'root'` option for singleton services
4447
- Use the `inject()` function instead of constructor injection
48+
49+
## Common pitfalls
50+
51+
- Control flow (`@if`):
52+
- You cannot use `as` expressions in `@else if (...)`. E.g. invalid code: `@else if (bla(); as x)`.

0 commit comments

Comments
 (0)