angular-material-20

A set of coding rules for Angular applications that use Angular Material, Google's component library. It focuses on Material 3 themes, component imports, SCSS styling, accessibility, maintainability, and correct APIs.

In plain words
What is it for?
Use it when building or reviewing Angular Material components, themes, SCSS, imports, accessibility, performance, or scalable application structure.
Why use it?
It reduces common Angular Material mistakes, such as using the wrong import style or configuring themes with unsuitable CSS.

Cursor rule for Cursor

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add rules/angular-material-dev/angular-material-ai-rules/angular-material-20
Clone the repo
git clone --depth 1 https://github.com/Angular-Material-Dev/angular-material-ai-rules

Made for: Cursor.

Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 2,383 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.02383
Opus 5 $0.00000 $0.01192
Sonnet 5 $0.00000 $0.00477
Haiku 4.5 $0.00000 $0.00238

Measured yesterday against content hash dcb897a9c4ab, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

angular-material-20 scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/angular-material-20.mdc · 353 lines

How it starts

The opening of the file, as written. The whole thing — 353 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Angular Material 20 Best Practices

This project adheres to modern Angular Material best practices, emphasizing maintainability, performance, accessibility, scalability and correct usage of APIs.

Core Principles

SCSS vs CSS

  • Prefer SCSS for styling, especially when theme customization is required. Angular Material has APIs written in SCSS.
  • Use CSS only when you need to use theme styles generated by mat.theme mixin. Modifications or customizations for Angular Material theming are not possible with CSS.

Component & Directive Imports

Always import components and directives from @angular/material package. Avoid importing modules.

Good:

import { MatButton } from '@angular/material/button';
import { MatIcon } from '@angular/material/icon';
import { MatCard, MatCardContent } from '@angular/material/card';

Bad:

import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatCardModule } from '@angular/material/card';

Theming Configuration

Always use mat.theme mixin to configure the theme. Avoid using mat.define-theme, mat.define-light-theme, mat.define-dark-theme functions and mat.core mixin.

Basic Theme Configuration

The mat.theme mixin takes a map with the following properties:

  • color: Single color palette or a map of color palettes
  • typography: Single typography or a map of typography properties
  • density: Integer from 0 to -5 (0 = default spacing, -5 = most dense)

Simple Theme Example

@use '@angular/material' as mat;

html {
  color-scheme: light dark;
  @include mat.theme(
    (
      color: mat.$violet-palette,
      typography: Roboto,
      density: 0,
    )
  );
}

Advanced Theme with Multiple Color Palettes

@use '@angular/material' as mat;

html {
  color-scheme: light dark;
  @include mat.theme(
    (
      color: (
        primary: mat.$violet-palette,
        tertiary: mat.$orange-palette,
      ),
      typography: (
        plain-family: Roboto,
        brand-family: Open Sans,
        bold-weight: 900,
        medium-weight: 500,
        regular-weight: 300,
      ),
      density: 0,
    )
  );
}

Read the full file on GitHub · 353 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 353 lines · 2,383 tokens per session scan A dcb897a9c4ab

Subscribe to this mod's changes

angular-material-20 is a cursor rule published in the GitHub repository Angular-Material-Dev/angular-material-ai-rules (13 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 2,383 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.