element
AGENTS.md83 starsChanged 15 days agoMITView on GitHub
You are an expert in TypeScript, Angular, and scalable web application development. You write functional, maintainable, performant, and accessible code following Angular and TypeScript best practices.
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 31,774 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository5 other files it gives its agents.
- gh-stackSkill
- git-githubSkill
- playwright-cliSkill
- reviewSkill
- elementSkill
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
46 rules. About 0 are common, 19 are distinctive, and 27 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈19
Distinctive · estimate
This author's own choices. Worth a look.
27
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 5
Use strict type checking
- Distinctive: line 6
Prefer type inference when the type is obvious
- Very specific: line 7
Avoid the any type; use unknown when type is uncertain
- Distinctive: line 11
Always use standalone components over NgModules
- Very specific: line 12
Must NOT set standalone: true inside Angular decorators.
- Very specific: line 13
Do NOT set changeDetection: ChangeDetectionStrategy.OnPush explicitly.
- Distinctive: line 14
Use signals for state management
- Very specific: line 16
Do NOT use the @HostBinding and @HostListener decorators.
- Distinctive: line 25
Keep components small and focused on a single responsibility
- Very specific: line 26
Use input() and output() functions instead of decorators
- Very specific: line 27
Use computed() for derived state
- Distinctive: line 28
Prefer inline templates for small components
- Very specific: line 29
Prefer Signal Forms (@angular/forms/signals) for new forms.
- Distinctive: line 30
When not using Signal Forms, prefer Reactive forms instead of Template-driven ones
- Very specific: line 31
Do NOT use ngClass, use class bindings instead
- Distinctive: line 33
When using external templates/styles, use paths relative to the component TS file.
- Distinctive: line 37
Test through the component's public API and rendered DOM, not private methods or internal implementation details
- Very specific: line 38
Prefer creating the component directly with TestBed.
- Distinctive: line 39
Only introduce a test host / wrapper component when testing content projection, template composition, or integration behavior that cannot …
- Distinctive: line 40
Keep test setup minimal. Mock only the component's direct dependencies and prefer lightweight spies or stubs over large testing modules
- Distinctive: line 41
Prefer assertions on user-observable behavior such as rendered text, attributes, ARIA state, CSS classes that are part of the public …
- Very specific: line 42
Prefer await fixture.whenStable() after interactions or async state changes instead of repeatedly calling fixture.detectChanges().
- Distinctive: line 43
Keep each test focused on a single behavior with clear arrange / act / assert phases
- Very specific: line 48
Prefer await fixture.whenStable() over repeated fixture.detectChanges() calls after interactions or async state changes
- Very specific: line 50
Use fixture.detectChanges() deliberately for the initial render or when the change detection boundary itself is under test
- Very specific: line 51
Do NOT chain multiple detectChanges() calls hoping to flush async work — use whenStable() instead
- Very specific: line 55
Prefer Vitest's semantic assertion matchers over generic .toBe() with manual property access — they produce clearer failure messages and …
- Very specific: line 56
Use toHaveLength(n) instead of accessing .length manually: expect(items).toHaveLength(3) not expect(items.length).toBe(3)
- Very specific: line 57
Use toContain(item) instead of expect(array.includes(item)).toBe(true)
- Very specific: line 58
Use toMatchObject(subset) to assert on a subset of properties instead of multiple individual .toBe() assertions
- Very specific: line 66
All unit tests use Vitest.
- Very specific: line 68
Always set CI=true when running unit tests.
- Very specific: line 85
Only the --include CLI flag (glob filter) is supported for these commands.
- Very specific: line 86
Do NOT use --watch, --no-watch, --watch=false, --reporter, or any other flags.
- Very specific: line 90
Run CI=true npm run schematics:test (uses Vitest).
- Very specific: line 94
Use ./e2e-local.sh to run e2e test.
- Distinctive: line 95
Always check if the DEV server is already running before starting.
- Distinctive: line 124
Use signals for local component state
- Distinctive: line 126
Keep state transformations pure and predictable
- Very specific: line 127
Do NOT use mutate on signals, use update or set instead
- Distinctive: line 131
Keep templates simple and avoid complex logic
- Very specific: line 132
Use native control flow (@if, @for, @switch) instead of *ngIf, *ngFor, *ngSwitch
- Distinctive: line 133
Use the async pipe to handle observables
- Very specific: line 138
Use the providedIn: 'root' option for singleton services
- Very specific: line 139
Use the inject() function instead of constructor injection
- Distinctive: line 144
If not online, ask to start the server.
≈ “Common” is an estimate: at least 1 in 5 of the 40,246 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are an expert in TypeScript, Angular, and scalable web application development. You write functional, maintainable, performant, and accessible code following Angular and TypeScript best practices.
TypeScript Best Practices
- Use strict type checking
- Prefer type inference when the type is obvious
- Avoid the
anytype; useunknownwhen type is uncertain
Angular Best Practices
- Always use standalone components over NgModules
- Must NOT set
standalone: trueinside Angular decorators. It's the default in Angular v20+. - Do NOT set
changeDetection: ChangeDetectionStrategy.OnPushexplicitly.OnPushis the default in Angular v22+. - Use signals for state management
- Implement lazy loading for feature routes
- Do NOT use the
@HostBindingand@HostListenerdecorators. Put host bindings inside thehostobject of the@Componentor@Directivedecorator instead
Accessibility Requirements
- It MUST pass all AXE checks.
- It MUST follow all WCAG AA minimums, including focus management, color contrast, and ARIA attributes.
Components
- Keep components small and focused on a single responsibility
- Use
input()andoutput()functions instead of decorators - Use
computed()for derived state - Prefer inline templates for small components
- Prefer Signal Forms (
@angular/forms/signals) for new forms. They are stable in Angular v22+ and provide signal-based state, type-safe field access, and schema-based validation - When not using Signal Forms, prefer Reactive forms instead of Template-driven ones
- Do NOT use
ngClass, useclassbindings instead - Do NOT use
ngStyle, usestylebindings instead - When using external templates/styles, use paths relative to the component TS file.
Component Testing
- Test through the component's public API and rendered DOM, not private methods or internal implementation details
- Prefer creating the component directly with
TestBed. Use signalinputBindingandoutputBindingbindings instead of test host / wrapper components when wiring inputs and outputs - Only introduce a test host / wrapper component when testing content projection, template composition, or integration behavior that cannot be expressed through direct bindings
- Keep test setup minimal. Mock only the component's direct dependencies and prefer lightweight spies or stubs over large testing modules
- Prefer assertions on user-observable behavior such as rendered text, attributes, ARIA state, CSS classes that are part of the public contract, and emitted outputs
- Prefer
await fixture.whenStable()after interactions or async state changes instead of repeatedly callingfixture.detectChanges(). Usefixture.detectChanges()deliberately for the initial render or when the change detection boundary itself is under test - Keep each test focused on a single behavior with clear arrange / act / assert phases
- Cover happy paths, boundary conditions, and regression-prone branches. Avoid broad snapshot-style assertions that do not explain the intended behavior
Async Test Stabilization
- Prefer
await fixture.whenStable()over repeatedfixture.detectChanges()calls after interactions or async state changes whenStable()waits for pending microtasks, timers, and zone activity to settle, producing more reliable tests than manually pumping change detection- Use
fixture.detectChanges()deliberately for the initial render or when the change detection boundary itself is under test - Do NOT chain multiple
detectChanges()calls hoping to flush async work — usewhenStable()instead
Test Assertions
- Prefer Vitest's semantic assertion matchers over generic
.toBe()with manual property access — they produce clearer failure messages and more readable tests - Use
toHaveLength(n)instead of accessing.lengthmanually:expect(items).toHaveLength(3)notexpect(items.length).toBe(3) - Use
toContain(item)instead ofexpect(array.includes(item)).toBe(true) - Use
toMatchObject(subset)to assert on a subset of properties instead of multiple individual.toBe()assertions
Running Tests
Infer the correct test command from the file path being edited. After implementation changes, run the matching unit test command to verify.
Unit Tests
All unit tests use Vitest. Do NOT use npx ng test or Karma/Jasmine commands.
Always set CI=true when running unit tests. This disables watch mode so tests run once and configures browser tests to run headlessly.
| File path prefix | Command |
projects/element-ng/ | CI=true pnpm lib:test |
projects/charts-ng/ | CI=true pnpm charts:test |
projects/native-charts-ng/ | CI=true pnpm native-charts:test |
projects/maps-ng/ | CI=true pnpm maps:test |
projects/dashboards-ng/ | CI=true pnpm dashboards:test |
projects/element-translate-ng/ | CI=true pnpm translate:test |
To run a specific test file, use --include:
CI=true pnpm lib:test --include='**/component-name/component-name.component.spec.ts'Only the --include CLI flag (glob filter) is supported for these commands.
Do NOT use --watch, --no-watch, --watch=false, --reporter, or any other flags. Use CI=true instead of watch flags.
Schematics Tests
Run CI=true npm run schematics:test (uses Vitest). Config: projects/element-ng/vitest.config.schematics.ts.
E2E Tests
Use ./e2e-local.sh to run e2e test. If you run a specific test always include the '--project=...' in addition.
Always check if the DEV server is already running before starting.
# 1. Start the dev server, port 4200
pnpm start -- --allowed-hosts true --host 0.0.0.0
# 2. Only if running dashboards test:
pnpm dashboards-demo:build-and-run-all # webpack, port 4201
pnpm dashboards-demo:build-and-run-all:esm # ESM, port 4204
# 3. Run e2e tests
./e2e-local.sh # run all
./e2e-local.sh run '--project=element-examples/*' # examples project
./e2e-local.sh run '--project=dashboards-demo/*' # dashboards-webpack project
./e2e-local.sh run '--project=dashboards-demo-esm/*' # dashboards-esm project
./e2e-local.sh vrt # visual regression only
./e2e-local.sh a11y # accessibility only
# Update snapshots
./e2e-local.sh update # changed snapshots
./e2e-local.sh update-all # all snapshots
./e2e-local.sh update <test-file-name> # specific test (glob supported)
# Run specific static tests
./e2e-local.sh run static --grep 'buttons/buttons|badges/badges'State Management
- Use signals for local component state
- Use
computed()for derived state - Keep state transformations pure and predictable
- Do NOT use
mutateon signals, useupdateorsetinstead
Templates
- Keep templates simple and avoid complex logic
- Use native control flow (
@if,@for,@switch) instead of*ngIf,*ngFor,*ngSwitch - Use the async pipe to handle observables
Services
- Design services around a single responsibility
- Use the
providedIn: 'root'option for singleton services - Use the
inject()function instead of constructor injection
Live-Preview Navigation (localhost:4200)
The live-preview demo app runs on http://localhost:4200/.
If not online, ask to start the server. Do not run it yourself.
Load examples using this URL schema:
http://localhost:4200/#/viewer/preview?e=<relative-example-path><relative-example-path> is resolved against examplesBaseUrl (app/examples/, see src/app/app.config.ts:132) and omits the file extension.
Example for si-form:
http://localhost:4200/#/viewer/preview?e=si-form/si-reactive-formSupported query params (see projects/live-preview/components/si-example-viewer/si-example-viewer.component.ts)
Unless specifically requested, only use the example path.
e— example pathbase— prefix prepended to eachetheme—light|darklocale— e.g.en,deisRTL— truthy for RTLmode— device mode for mobile viewportrfs— root font size in pxt— inline template overrideframework—react|vue|js
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

