Index of every page on this site: llms.txt
All skills
abiramcodes avatar

/angular-developer

@5863679
by Abiramabiramcodes/ng-point9 stars
Run it yourself

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), queries and content projection, forms, dependency injection, routing, server and hybrid rendering (SSR, prerendering, hydration), accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, naming conventions, or CLI tooling.

  • 45 files
  • 180.7 KB
  • MIT
  • Updated 2 days ago
  • GitHub
Use this Skill: https://skilld.dev/gh/abiramcodes/ng-point/angular-developer

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencescomponents.md

≈1.4k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Components

Angular components are the fundamental building blocks of an application. Each component consists of a TypeScript class with behaviors, an HTML template, and a CSS selector.

Component Definition

Use the @Component decorator to define a component's metadata.

@Component({
  selector: 'app-profile',
  template: `
    <img src="profile.jpg" alt="Profile photo" />
    <button (click)="save()">Save</button>
  `,
  styles: `
    img {
      border-radius: 50%;
    }
  `,
})
export class Profile {
  save() {
    /* ... */
  }
}

Metadata Options

  • selector: The CSS selector that identifies this component in templates.
  • template: Inline HTML template (preferred for small templates).
  • templateUrl: Path to an external HTML file.
  • styles: Inline CSS styles.
  • styleUrl / styleUrls: Path(s) to external CSS file(s).
  • imports: Lists the components, directives, or pipes used in this component's template.

Using Components

To use a component, add it to the imports array of the consuming component and use its selector in the template.

@Component({
  selector: 'app-root',
  imports: [Profile],
  template: `<app-profile />`,
})
export class App {}

Self-Closing Tags

Angular supports self-closing tags for custom components.

Rule: Always use self-closing tags when a component does not contain projected content or child nodes:

<!-- Preferred: concise and modern -->
<app-profile />
<app-user-card [user]="currentUser()" />
<router-outlet />

<!-- Avoid: redundant closing tags for empty elements -->
<app-profile></app-profile>
<app-user-card [user]="currentUser()"></app-user-card>
<router-outlet></router-outlet>

Template Control Flow

Angular uses built-in blocks for conditional rendering and loops.

Conditional Rendering (@if)

Use @if to conditionally show content. You can include @else if and @else blocks.

@if (user.isAdmin) {
<admin-dashboard />
} @else if (user.isModerator) {
<mod-dashboard />
} @else {
<standard-dashboard />
}

Result aliasing: Save the result of the expression for reuse.

@if (user.settings(); as settings) {
<p>Theme: {{ settings.theme }}</p>
}

Loops (@for)

The @for block iterates over collections. The track expression is required for performance and DOM reuse.

<ul>
  @for (item of items(); track item.id; let i = $index, total = $count) {
  <li>{{ i + 1 }}/{{ total }}: {{ item.name }}</li>
  } @empty {
  <li>No items to display.</li>
  }
</ul>

Implicit Variables: $index, $count, $first, $last, $even, $odd.

Avoiding expensive work in templates

Template expressions are re-evaluated every time the component's template is checked, so avoid doing expensive work in them (e.g. building or filtering arrays, sorting, heavy formatting). Calling a cheap method is fine; the concern is expensive work repeated on every change detection cycle. A method that returns a new array or object also hands @for a new collection on every run.

Reading a signal (count(), items()) is fine, and so is a trivial lookup. For anything expensive, derive the value once:

  • computed() for values derived from signals.
  • A pure pipe for formatting a value (see pipes.md).
  • A child component when each item needs its own derived state.

Switching Content (@switch)

The @switch block renders content based on a value. It uses strict equality (===) and has no fallthrough.

@switch (status()) { @case ('loading') { <app-spinner /> } @case ('error') { <app-error-msg /> }
@case ('success') { <app-data-grid /> } @default {
<p>Unknown status</p>
} }

Multiple Cases: Stack consecutive @case statements with no content between them to share one block across several matches.

@switch (status()) {
  @case ('paused')
  @case ('cancelled') {
    <span>Not running</span>
  }
  @default {
    <span>Running</span>
  }
}

Exhaustive Type Checking: Use @default never; to ensure all cases of a union type are handled.

@switch (state) { @case ('on') { ... } @case ('off') { ... } @default never; // Errors if a new
state like 'standby' is added }

Arrow Functions in Template Expressions

Template expressions support arrow functions with an expression body, such as inline array callbacks:

<button (click)="count.update((c) => c + 1)">Increment</button>

For derived values such as a filtered list, use a computed signal in the component instead.

Arrow functions must have an expression body, such as (c) => c + 1. In event bindings, call the method directly, (click)="save()", because an arrow function like (click)="() => save()" is never invoked.

Arrow functions with a block body (() => { ... }) are not supported. A pipe cannot be used inside an arrow function's body, but an arrow function can be passed as an argument to a pipe.

Core Concepts

  • Host Element: The DOM element that matches the component's selector.
  • View: The DOM rendered by the component's template inside the host element.
  • Standalone: By default, components are standalone (since Angular 19, standalone: true is default). For older versions, standalone: true must be explicit or the component must be part of an NgModule.
  • Component Tree: Angular applications are structured as a tree of components, where each component can host child components.
  • Component Naming: Do not add suffixes the Component suffix for Component classes (e.g., AppComponent) unless the project has been configured to use that naming configuration.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No third-party reports yet.

Signed by skilld at 5863679. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 10 hours ago.

Activeupdated 2 days ago
Other metadata
metadata
{
  "author": "Copyright 2026 Google LLC",
  "version": "1.0",
  "internal": true
}

README badge

README badge for abiramcodes/ng-point/angular-developer