agentleFS
siemenssiemens/element/AGENTS.md

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.

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
  1. Distinctive:

    Use strict type checking

    line 5
  2. Distinctive:

    Prefer type inference when the type is obvious

    line 6
  3. Very specific:

    Avoid the any type; use unknown when type is uncertain

    line 7
  4. Distinctive:

    Always use standalone components over NgModules

    line 11
  5. Very specific:

    Must NOT set standalone: true inside Angular decorators.

    line 12
  6. Very specific:

    Do NOT set changeDetection: ChangeDetectionStrategy.OnPush explicitly.

    line 13
  7. Distinctive:

    Use signals for state management

    line 14
  8. Very specific:

    Do NOT use the @HostBinding and @HostListener decorators.

    line 16
  9. Distinctive:

    Keep components small and focused on a single responsibility

    line 25
  10. Very specific:

    Use input() and output() functions instead of decorators

    line 26
  11. Very specific:

    Use computed() for derived state

    line 27
  12. Distinctive:

    Prefer inline templates for small components

    line 28
  13. Very specific:

    Prefer Signal Forms (@angular/forms/signals) for new forms.

    line 29
  14. Distinctive:

    When not using Signal Forms, prefer Reactive forms instead of Template-driven ones

    line 30
  15. Very specific:

    Do NOT use ngClass, use class bindings instead

    line 31
  16. Distinctive:

    When using external templates/styles, use paths relative to the component TS file.

    line 33
  17. Distinctive:

    Test through the component's public API and rendered DOM, not private methods or internal implementation details

    line 37
  18. Very specific:

    Prefer creating the component directly with TestBed.

    line 38
  19. Distinctive:

    Only introduce a test host / wrapper component when testing content projection, template composition, or integration behavior that cannot …

    line 39
  20. Distinctive:

    Keep test setup minimal. Mock only the component's direct dependencies and prefer lightweight spies or stubs over large testing modules

    line 40
  21. Distinctive:

    Prefer assertions on user-observable behavior such as rendered text, attributes, ARIA state, CSS classes that are part of the public …

    line 41
  22. Very specific:

    Prefer await fixture.whenStable() after interactions or async state changes instead of repeatedly calling fixture.detectChanges().

    line 42
  23. Distinctive:

    Keep each test focused on a single behavior with clear arrange / act / assert phases

    line 43
  24. Very specific:

    Prefer await fixture.whenStable() over repeated fixture.detectChanges() calls after interactions or async state changes

    line 48
  25. Very specific:

    Use fixture.detectChanges() deliberately for the initial render or when the change detection boundary itself is under test

    line 50
  26. Very specific:

    Do NOT chain multiple detectChanges() calls hoping to flush async work — use whenStable() instead

    line 51
  27. Very specific:

    Prefer Vitest's semantic assertion matchers over generic .toBe() with manual property access — they produce clearer failure messages and …

    line 55
  28. Very specific:

    Use toHaveLength(n) instead of accessing .length manually: expect(items).toHaveLength(3) not expect(items.length).toBe(3)

    line 56
  29. Very specific:

    Use toContain(item) instead of expect(array.includes(item)).toBe(true)

    line 57
  30. Very specific:

    Use toMatchObject(subset) to assert on a subset of properties instead of multiple individual .toBe() assertions

    line 58
  31. Very specific:

    All unit tests use Vitest.

    line 66
  32. Very specific:

    Always set CI=true when running unit tests.

    line 68
  33. Very specific:

    Only the --include CLI flag (glob filter) is supported for these commands.

    line 85
  34. Very specific:

    Do NOT use --watch, --no-watch, --watch=false, --reporter, or any other flags.

    line 86
  35. Very specific:

    Run CI=true npm run schematics:test (uses Vitest).

    line 90
  36. Very specific:

    Use ./e2e-local.sh to run e2e test.

    line 94
  37. Distinctive:

    Always check if the DEV server is already running before starting.

    line 95
  38. Distinctive:

    Use signals for local component state

    line 124
  39. Distinctive:

    Keep state transformations pure and predictable

    line 126
  40. Very specific:

    Do NOT use mutate on signals, use update or set instead

    line 127
  41. Distinctive:

    Keep templates simple and avoid complex logic

    line 131
  42. Very specific:

    Use native control flow (@if, @for, @switch) instead of *ngIf, *ngFor, *ngSwitch

    line 132
  43. Distinctive:

    Use the async pipe to handle observables

    line 133
  44. Very specific:

    Use the providedIn: 'root' option for singleton services

    line 138
  45. Very specific:

    Use the inject() function instead of constructor injection

    line 139
  46. Distinctive:

    If not online, ask to start the server.

    line 144

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

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 any type; use unknown when type is uncertain

Angular Best Practices

  • Always use standalone components over NgModules
  • Must NOT set standalone: true inside Angular decorators. It's the default in Angular v20+.
  • Do NOT set changeDetection: ChangeDetectionStrategy.OnPush explicitly. OnPush is the default in Angular v22+.
  • Use signals for state management
  • Implement lazy loading for feature routes
  • Do NOT use the @HostBinding and @HostListener decorators. Put host bindings inside the host object of the @Component or @Directive decorator 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() and output() 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, use class bindings instead
  • Do NOT use ngStyle, use style bindings 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 signal inputBinding and outputBinding bindings 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 calling fixture.detectChanges(). Use fixture.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 repeated fixture.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 — use whenStable() 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 .length manually: expect(items).toHaveLength(3) not expect(items.length).toBe(3)
  • Use toContain(item) instead of expect(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 prefixCommand
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 mutate on signals, use update or set instead

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-form

Supported 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 path
  • base — prefix prepended to each e
  • theme — light | dark
  • locale — e.g. en, de
  • isRTL — truthy for RTL
  • mode — device mode for mobile viewport
  • rfs — root font size in px
  • t — inline template override
  • framework — react | vue | js

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.