diff --git a/.agents/skills/angular-developer/SKILL.md b/.agents/skills/angular-developer/SKILL.md index f332e3e08..6ab0e3d77 100644 --- a/.agents/skills/angular-developer/SKILL.md +++ b/.agents/skills/angular-developer/SKILL.md @@ -1,6 +1,6 @@ --- name: angular-developer -description: Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling. +description: Generates Angular code and provides architectural guidance. Trigger when creating projects, components, services, or HTTP communication, or for best practices on reactivity (signals, linkedSignal, resource, httpResource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling. license: MIT metadata: author: Copyright 2026 Google LLC @@ -17,7 +17,7 @@ metadata: ## Creating New Projects -If no guidelines are provided by the user, here are same default rules to follow when creating a new Angular project: +If no guidelines are provided by the user, here are some default rules to follow when creating a new Angular project: 1. Use the latest stable version of Angular unless the user specifies otherwise. 2. Use Signals Forms for form management in new projects (available in Angular v21 and newer) [Find out more](references/signal-forms.md). @@ -61,12 +61,18 @@ When managing state and data reactivity, use Angular Signals and consult the fol - **Async Reactivity (`resource`)**: Fetching asynchronous data directly into signal state. Read [resource.md](references/resource.md) - **Side Effects (`effect`)**: Logging, third-party DOM manipulation (`afterRenderEffect`), and when NOT to use effects. Read [effects.md](references/effects.md) +## HTTP Communication + +When communicating with backend services, use Angular HTTP APIs and consult the following reference: + +- **HTTP Client and Resources**: `provideHttpClient`, `HttpClient`, interceptors, and `httpResource`. Read [http-client.md](references/http-client.md) + ## Forms In most cases for new apps, **prefer signal forms**. When making a forms decision, analyze the project and consider the following guidelines: -- if the application is using v21 or newer and this is a new form, **prefer signal forms**. - -For older applications or when working with existing forms, use the appropriate form type that matches the applications current form strategy. +- If the application is using v21 or newer and this is a new form, **prefer signal forms**. +- For older applications or when working with existing forms, use the appropriate form type that matches the applications current form strategy. - **Signal Forms**: Use signals for form state management. Read [signal-forms.md](references/signal-forms.md) - **Template-driven forms**: Use for simple forms. Read [template-driven-forms.md](references/template-driven-forms.md) @@ -82,6 +88,12 @@ When implementing dependency injection in Angular, follow these guidelines: - **Injection Context**: Where `inject()` is allowed, `runInInjectionContext`, and `assertInInjectionContext`. Read [injection-context.md](references/injection-context.md) - **Hierarchical Injectors**: The `EnvironmentInjector` vs `ElementInjector`, resolution rules, modifiers (`optional`, `skipSelf`), and `providers` vs `viewProviders`. Read [hierarchical-injectors.md](references/hierarchical-injectors.md) +## Pipes + +When formatting values in templates, creating custom pipes, or reusing pipe-like logic in TypeScript, consult the following reference. Prefer pipes in templates; outside templates, avoid injecting pipe classes just to call `transform()`. + +- **Pipes**: Built-in pipe imports, custom pipe naming and implementation, pure vs impure pipes, and TypeScript reuse patterns using standalone formatting functions or extracted plain functions. Read [pipes.md](references/pipes.md) + ## Angular Aria When building accessible custom components for any of the following patterns: Accordion, Listbox, Combobox, Menu, Tabs, Toolbar, Tree, Grid, consult the following reference: @@ -119,7 +131,7 @@ When writing or updating tests, consult the following references based on the ta - **Fundamentals**: Best practices for unit testing (Vitest), async patterns, and `TestBed`. Read [testing-fundamentals.md](references/testing-fundamentals.md) - **Component Harnesses**: Standard patterns for robust component interaction. Read [component-harnesses.md](references/component-harnesses.md) - **Router Testing**: Using `RouterTestingHarness` for reliable navigation tests. Read [router-testing.md](references/router-testing.md) -- **End-to-End (E2E) Testing**: Best practices for E2E tests with Cypress. Read [e2e-testing.md](references/e2e-testing.md) +- **End-to-End (E2E) Testing**: Setting up and running E2E tests. Read [e2e-testing.md](references/e2e-testing.md) ## Tooling @@ -128,3 +140,4 @@ When working with Angular tooling, consult the following references: - **Angular CLI**: Creating applications, generating code (components, routes, services), serving, and building. Read [cli.md](references/cli.md) - **Code Modernization**: Automatically refactoring to modern standards using migrations. Read [migrations.md](references/migrations.md) - **Angular MCP Server**: Available tools, configuration, and experimental features. Read [mcp.md](references/mcp.md) +- **Environment Configuration**: Strategies for build-time and runtime configuration. Read [environment-configuration.md](references/environment-configuration.md) diff --git a/.agents/skills/angular-developer/references/angular-animations.md b/.agents/skills/angular-developer/references/angular-animations.md index c96c4d9c6..4abc961a6 100644 --- a/.agents/skills/angular-developer/references/angular-animations.md +++ b/.agents/skills/angular-developer/references/angular-animations.md @@ -155,6 +155,6 @@ import {trigger, state, style, animate, transition} from '@angular/animations'; template: `
...
`, }) export class OpenClose { - isOpen = signal(true); + protected readonly isOpen = signal(true); } ``` diff --git a/.agents/skills/angular-developer/references/angular-aria.md b/.agents/skills/angular-developer/references/angular-aria.md index 2dd0cf451..4241a2576 100644 --- a/.agents/skills/angular-developer/references/angular-aria.md +++ b/.agents/skills/angular-developer/references/angular-aria.md @@ -44,11 +44,11 @@ export class App { ```html
- -
+

Lazy loaded content here.

@@ -98,7 +98,7 @@ export class App { ```html -
    +
    • Apple
    • Banana
    @@ -126,37 +126,69 @@ Target `[aria-selected="true"]` for selected state and `:focus-visible` or `[dat ## 3. Combobox, Select, and Multiselect -These patterns combine `ngCombobox` with a popup containing an `ngListbox`. +These patterns combine the `ngCombobox` directive (applied directly to the trigger/combobox element) with a popup containing an `ngListbox` widget. -- **Combobox**: Text input + popup (used for Autocomplete). -- **Select**: Readonly Combobox + single-select Listbox. -- **Multiselect**: Readonly Combobox + multi-select Listbox. - -**Usage:** The Combobox is a low-level primitive directive that synchronizes a text input with a popup, serving as the foundational logic for autocomplete, select, and multiselect patterns. Use it specifically for building custom filtering, unique selection requirements, or specialized input-to-popup coordination that deviates from standard, documented components. +- **Combobox (Autocomplete)**: Applied to an `` element. Ideal when typing filters the list. +- **Select**: Applied to a focusable wrapper like a `
    ` or ` - - -