Angular Stack Conventions

VerifiedSafe

Angular frontend conventions, patterns, and test infrastructure for components, services, RxJS, CLI, and more.

Sby Skills Guide Bot
DevelopmentIntermediate
7/22/2026
Claude Code
#angular#typescript#jasmine#component-harness#frontend-testing

Recommended for

Automated summary

This skill supplies Angular conventions (components, services, RxJS, forms, routing, dependency injection) together with the matching testing strategy built on Jasmine, Component Harnesses and HttpTestingController.

Strengths

  • Lays out a graduated testing strategy per component type (presentational, container, form-heavy, visual)
  • Provides concrete examples pairing Component Harnesses with HttpTestingController
  • Covers CLI commands (ng build, ng test --watch=false) and Playwright E2E/visual tests
  • Addresses custom validators as a separate unit-test case

Limitations

  • The content is almost entirely test-focused: component, routing, form and DI conventions appear only in the description without further detail
  • Assumes a working Jasmine + Playwright setup and does not cover installation or configuration
  • Gives no guidance on the target Angular version (standalone components, new control-flow blocks)
When to use it

Reach for it when writing or changing Angular code and you want tests to follow the team's conventions (harnesses, HttpTestingController, Playwright).

When not to use it

Avoid it for other frontend frameworks, or for Angular projects that do not already have Jasmine/Playwright test infrastructure in place.

Security analysis

Safe
Quality score90/100

This skill is purely educational documentation describing Angular testing conventions and patterns. It contains code snippets and build/test commands (ng build, ng test) but no destructive, exfiltrating, or obfuscated actions. It even includes security best practices such as avoiding bypassSecurityTrust and using HttpClient's built-in XSRF protection. No meaningful execution risk.

No concerns found

How this analysis is made

Examples

Integration test for a container component
Write a Jasmine integration test for DashboardComponent using a Component Harness and HttpTestingController, asserting it loads stats from the service.
Test a reactive form
Add integration tests for ProfileFormComponent: one for successful submission and one showing the validation error for an invalid email.
Visual regression test
Create a Playwright visual regression test that screenshots the dashboard sidebar against a baseline.

name: stack-angular description: Angular frontend conventions, patterns, and test infrastructure. Use when working with Angular components, services, modules, RxJS, Angular CLI, ng commands, Jasmine tests, Component Harnesses, HttpTestingController, Angular routing, Angular forms, Angular pipes, or Angular dependency injection. user-invocable: false

Integration Tests

// Use Component Harnesses + HttpTestingController
describe('OrderListComponent', () => {
  it('should display orders after loading', async () => {
    const harness = await TestbedHarnessEnvironment.harnessForFixture(
      fixture, OrderListComponentHarness
    );
    await harness.clickRefresh();
    const items = await harness.getOrderItems();
    expect(items.length).toBeGreaterThan(0);
  });
});

Frameworks

  • Jasmine for tests
  • Component Harnesses for component testing
  • HttpTestingController for service integration

Build & Test Commands

ng build
ng test --watch=false

Test Patterns by Component Classification

Presentational Components

Skip standalone tests — covered by parent component integration tests. Exception: if the component has 3+ conditional branches (e.g., *ngIf / @if chains), write a focused component test.

Smart/Container Components

// Component Harness + HttpTestingController for smart components
describe('DashboardComponent', () => {
  it('should load and display stats from service', async () => {
    const harness = await TestbedHarnessEnvironment.harnessForFixture(
      fixture, DashboardComponentHarness
    );
    const req = httpTestingController.expectOne('/api/stats');
    req.flush(mockStats);
    const cards = await harness.getStatCards();
    expect(cards.length).toBe(mockStats.length);
  });
});

Form-heavy Components

// Integration test for reactive form submission
describe('ProfileFormComponent', () => {
  it('should submit valid form data', async () => {
    const harness = await TestbedHarnessEnvironment.harnessForFixture(
      fixture, ProfileFormComponentHarness
    );
    await harness.fillName('Jane Doe');
    await harness.fillEmail('jane@example.com');
    await harness.clickSubmit();
    const req = httpTestingController.expectOne('/api/profile');
    expect(req.request.body.name).toBe('Jane Doe');
  });

  it('should show validation error for invalid email', async () => {
    const harness = await TestbedHarnessEnvironment.harnessForFixture(
      fixture, ProfileFormComponentHarness
    );
    await harness.fillEmail('not-an-email');
    await harness.clickSubmit();
    const error = await harness.getEmailError();
    expect(error).toBeTruthy();
  });
});

Unit test custom validators separately only when they have complex rules:

describe('passwordStrengthValidator', () => {
  it('should reject passwords without special characters', () => {
    const control = new FormControl('weakpassword');
    const result = passwordStrengthValidator(control);
    expect(result?.['passwordStrength']).toBeTruthy();
  });
});

Critical User Journey (E2E)

// Playwright Test — E2E for auth flow (runs in CI)
import { test, expect } from '@playwright/test';

test('login flow', async ({ page }) => {
  await page.goto('/login');
  await page.fill('[data-testid="email"]', 'user@example.com');
  await page.fill('[data-testid="password"]', 'securepassword');
  await page.click('[data-testid="login-button"]');
  await expect(page).toHaveURL('/dashboard');
  await expect(page.locator('[data-testid="welcome-message"]')).toBeVisible();
});

Visual/Layout Components

Write Playwright visual regression tests — these run in CI and catch regressions automatically:

// Playwright visual regression test (runs in CI)
test('sidebar matches visual baseline', async ({ page }) => {
  await page.goto('/dashboard');
  await expect(page.locator('[data-testid="sidebar"]')).toHaveScreenshot('sidebar.png');
});

For interactive spot-checks during development, use Playwright CLI (playwright-cli snapshot, playwright-cli screenshot). Neither replaces Playwright Test — see the testing skill's "Browser Testing Tools" section.

Data Display Components

// Integration test for data table with transformation
describe('OrderTableComponent', () => {
  it('should display formatted order data', async () => {
    const harness = await TestbedHarnessEnvironment.harnessForFixture(
      fixture, OrderTableComponentHarness
    );
    const req = httpTestingController.expectOne('/api/orders');
    req.flush([{ amount: 1500, date: '2024-01-15' }]);
    const rows = await harness.getRows();
    expect(rows.length).toBe(1);
    const amount = await rows[0].getAmount();
    expect(amount).toContain('$15.00');
  });
});

Security

  • Trust Angular's built-in XSS protection — do not bypass with bypassSecurityTrust* unless absolutely necessary and reviewed
  • Use HttpClient which includes XSRF protection by default
  • Sanitize user input displayed via [innerHTML] using DomSanitizer

Read the project's applicable agent guidance (AGENTS.md for Codex, CLAUDE.md for Claude Code) and relevant docs/<topic>.md files for project-specific Angular conventions when they exist.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/angular-stack-conventions-mrwakg78/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/angular-stack-conventions-mrwakg78' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/angular-stack-conventions-mrwakg78/download' --output '.skill-downloads/angular-stack-conventions-mrwakg78/SKILL.md.part' && mv '.skill-downloads/angular-stack-conventions-mrwakg78/SKILL.md.part' '.skill-downloads/angular-stack-conventions-mrwakg78/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/angular-stack-conventions-mrwakg78/SKILL.md' && test -s '.skill-downloads/angular-stack-conventions-mrwakg78/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/stack-angular' && cp -R '.skill-downloads/angular-stack-conventions-mrwakg78' '.claude/skills/stack-angular'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/angular-stack-conventions-mrwakg78'

openskills read 'angular-stack-conventions-mrwakg78'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/angular-stack-conventions-mrwakg78/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills