Skip to main content

Agent Skills

Coding agents default to whatever testing patterns are most common on the internet: beforeEach + let, fixture.whenStable(), fixture.componentInstance, vi.mock(), and brittle spy objects.

The angular-testing skill encodes the Pragmatic Angular Testing approach from this cookbook so your coding agents write, fix, and review Angular tests the right way from the start.

Installationโ€‹

Install just the angular-testing skill:

npx skills add marmicode/skills --skill angular-testing

Or install the full Marmicode Skills collection (which also includes the Charted Coding test-first approach):

npx skills add marmicode/skills

What It Teaches Your Agentโ€‹

The skill keeps your agent aligned with the principles and recipes in this cookbook:

  • The Widest Narrow Test: uses real child components, real services, and real stores by default, replacing only slow, complex, or non-deterministic boundaries (Beyond Unit vs. Integration).
  • Fakes over Mocks: fakes adapters you own (e.g. HTTP repositories) instead of vi.mock(), vi.spyOn(...).mockReturnValue(), or mocking third-party libraries (Fake It Till You Mock It & How to Cook a Fake).
  • Through the DOM, without the Fixture: mounts components with Angular bindings (inputBinding, outputBinding, twoWayBinding), ignores the returned fixture, and interacts through accessible locators (page.getByRole, page.getByLabelText) with retrying assertions (Vitest Browser Mode).
  • Readable Test Design: composable setup functions (mountX(), createX()) instead of beforeEach + let, object mothers for test data, literal expectations, and zero conditionals or loops.
  • Signals, Routing, and Time: dedicated reference guides for services, signals, resources, router/guards, and Vitest fake timers (Controlling Time in Tests).

How to Use Itโ€‹

Once installed, the skill activates automatically whenever you ask your agent to:

  • Write new tests for components, services, signals, guards, routing, or timer-based behavior.
  • Fix slow or flaky tests or replace mocks and spies with fakes.
  • Review existing tests: the skill includes a prioritized review rubric that flags false confidence, implementation coupling, synchronization hacks (detectChanges, whenStable, TestBed.tick), and test design issues.
tip

For the full SKILL.md, reference guides, and complete passing example specs, check out the marmicode/skills repository on GitHub.

Want to master the principles behind the skill yourself? See how this fits into a Full Pragmatic Angular Testing Strategy โ€” with hands-on exercises and an AI tutor that nudges you forward, one hint at a time.

Pragmatic Angular Testing Course
Younes Jaaidi

๐Ÿ”” Want me to notify you when I drop new recipes?

~1 email per month. Unsubscribe anytime.

Pragmatic Angular Testing

๐Ÿ’ฐ 120โ‚ฌ

Stop rewriting tests every time you refactor.