CLAUDE.md
core-web/CLAUDE.mdCLAUDE.md
Quality
100/100
Scores the file, not the repository.Length
975 words
24 headings · 5 code blocksRepository
950
— · pushed 1 days agoLast changed
3 days ago
First indexed 3 days ago.1# CLAUDE.md23This file provides guidance to Claude Code when working with code in this repository.45## Overview67DotCMS Core-Web monorepo — Angular + Nx. Uses **pnpm** as package manager. Nx is not installed globally — always use `pnpm nx`.89### MCP Servers1011Configured in `/.mcp.json`. Use these instead of guessing:1213- **`angular-cli`** — Angular best practices, documentation search, code examples. Use before writing Angular code.14- **`primeng`** — PrimeNG component API, props, events, examples. Use when building UI.15- **`chrome-devtools`** — Browser automation, screenshots, network debugging, performance tracing.1617## Essential Commands1819```bash20pnpm nx serve dotcms-ui # Dev server (proxies /api/* to port 8080)21pnpm nx build dotcms-ui # Build22pnpm nx test {project} # Test specific project23pnpm nx test {project} --testPathPattern= # Test specific file24pnpm nx lint {project} # Lint25pnpm nx affected:test # Test only changed projects26pnpm run test:dotcms # Test all27pnpm run lint:dotcms # Lint all28```2930## Architecture3132### Where Code Goes3334```35apps/dotcms-ui/ # Main admin UI application36libs/portlets/ # Feature portlets (new portlets go HERE)37libs/ui/ # Shared UI components (multi-portlet)38libs/data-access/ # Shared services (multi-portlet)39libs/dotcms-models/ # TypeScript interfaces and types40libs/edit-content/ # Content editing library41libs/block-editor/ # TipTap rich text editor42libs/sdk/ # External SDKs (client, react, angular)43```4445### Code Placement Rules4647```48Is this component/service used by multiple portlets?49├─ NO → libs/portlets/{feature}/50└─ YES → Is it domain-agnostic?51 ├─ YES (UI) → libs/ui/52 ├─ YES (Service) → libs/data-access/53 └─ NO → libs/portlets/shared/ or refactor54```5556## Angular Rules (REQUIRED)5758### Modern Syntax — Always Use5960```typescript61// Control flow62@if (condition()) { <content /> } // NOT *ngIf63@for (item of items(); track item.id) { } // NOT *ngFor6465// Inputs/Outputs66data = input<string>(); // NOT @Input()67onChange = output<string>(); // NOT @Output()6869// Testing selectors70<button data-testid="submit-btn">Submit</button>71spectator.query('[data-testid="submit-btn"]');72spectator.setInput('prop', value); // ALWAYS use setInput73```7475### Component Conventions7677- **Prefix**: All components use `dot-` prefix78- **Standalone**: All new components must be standalone79- **State**: Use NgRx signals (`@ngrx/signals`) for state management80- **Styling**: Tailwind CSS + PrimeNG theme (PrimeFlex deprecated/removed — use Tailwind utilities instead)81- **Testing**: Jest + Spectator, use `data-testid` for selectors82- **Dialogs**: All dialogs must have `closable: true` and `closeOnEscape: true` to allow closing via X button and ESC key8384### Form Markup8586Always wrap form fields with this structure for consistent styling:8788```html89<form class="form">90 <div class="field">91 <label for="name">Name</label>92 <input pInputText id="name" />93 </div>94 <div class="field">95 <label for="site">Site</label>96 <p-select id="site" [options]="sites()" />97 </div>98</form>99```100101## Portlet Development102103New portlets go in `libs/portlets/`. For full patterns, architecture, testing, and Nx generator setup:104105> **See [`libs/portlets/CLAUDE.md`](libs/portlets/CLAUDE.md)** — the complete portlet development guide with `dot-tags` as canonical reference.106107## Testing (Jest + Spectator)108109### Config110111- Use `dot-content-drive` portlet as reference for test config112- `tsconfig.spec.json` tsconfig.spec.json must have "isolatedModules": true in compilerOptions113- `tsconfig.json` — do NOT add `"strict": true` or `"module": "preserve"`114- `tsconfig.spec.json` — keep minimal (only `module`, `target`, `types`)115- Import `mockProvider` from `@openng/spectator/jest` (not `@openng/spectator`)116117### SignalStore Tests118119- Use `createServiceFactory` from Spectator120- Call `spectator.flushEffects()` in `beforeEach` to trigger the `withHooks` `onInit` effect121- Mock services with `mockProvider(Service, { method: jest.fn().mockReturnValue(of(...)) })`122- Test error paths: mock service to `throwError(() => error)`, assert `httpErrorManager.handle` was called123- For `jest.mock()` of utilities: place the mock **before** the import124125### Component Tests (with Mocked Store)126127- Use `createComponentFactory` from Spectator128- Store goes in `componentProviders` (component-level injection), not `providers`129- Mock all signal getters as `jest.fn().mockReturnValue(...)` and all methods as `jest.fn()`130- PrimeNG button clicks: `spectator.query(byTestId('btn'))?.querySelector('button')` then `spectator.click(el)`131132### Dialog Tests133134- Mock `DialogService.open` to return `{ onClose: new Subject() }`, then emit a value and complete the subject135- Two `describe` blocks for create/edit dialog: one with `DynamicDialogConfig.data: {}`, one with `data: { item }`136- Test that dialogs are configured with `closable: true` and `closeOnEscape: true`137138### DotSiteComponent Mocking139140- Use `jest.mock('@dotcms/ui', ...)` with a stub implementing `ControlValueAccessor`141- Add `CUSTOM_ELEMENTS_SCHEMA` when mocking complex child components142143### Debounce / Timer Tests144145- Use `jest.useFakeTimers()` in `beforeEach`, `jest.useRealTimers()` in `afterEach`146- Advance with `jest.advanceTimersByTime(300)` to trigger debounced actions147148## Backend Integration149150- Dev proxy: `proxy-dev.conf.mjs` routes `/api/*` to port 8080151- API services: `libs/data-access/` via `DotHttpService`152- OpenAPI spec: Use `http://localhost:8080/api/openapi.json` (local dev instance), fallback to `https://demo.dotcms.com/api/openapi.json`. Fetch this to understand available endpoints, request/response schemas, and parameters before building API integrations.153154## For Backend/Java Development155156See **[../CLAUDE.md](../CLAUDE.md)** for Java, Maven, REST API, and Git workflow standards.157158<!-- nx configuration start-->159<!-- Leave the start & end comments to automatically receive updates. -->160161## General Guidelines for working with Nx162163- For navigating/exploring the workspace, invoke the `nx-workspace` skill first - it has patterns for querying projects, targets, and dependencies164- When running tasks (for example build, lint, test, e2e, etc.), always prefer running the task through `nx` (i.e. `nx run`, `nx run-many`, `nx affected`) instead of using the underlying tooling directly165- Prefix nx commands with the workspace's package manager (e.g., `pnpm nx build`, `npm exec nx test`) - avoids using globally installed CLI166- You have access to the Nx MCP server and its tools, use them to help the user167- For Nx plugin best practices, check `node_modules/@nx/<plugin>/PLUGIN.md`. Not all plugins have this file - proceed without it if unavailable.168- NEVER guess CLI flags - always check nx_docs or `--help` first when unsure169170## Scaffolding & Generators171172- For scaffolding tasks (creating apps, libs, project structure, setup), ALWAYS invoke the `nx-generate` skill FIRST before exploring or calling MCP tools173174## When to use nx_docs175176- USE for: advanced config options, unfamiliar flags, migration guides, plugin configuration, edge cases177- DON'T USE for: basic generator syntax (`nx g @nx/react:app`), standard commands, things you already know178- The `nx-generate` skill handles generator discovery internally - don't call nx_docs just to look up generator syntax179180<!-- nx configuration end-->181
Also in dotCMS/core
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| dotCMS/core.cursor/rules/doc-updates.mdc · 950 | Cursor rules | docs | 30/100 | 3 days ago | |
| dotCMS/core.cursor/rules/dotcms-guide.mdc · 950 | Cursor rules | archdo-notdocs | 69/100 | 3 days ago | |
| dotCMS/core.cursor/rules/e2e-rules.mdc · 950 | Cursor rules | setupteststylearch+5 | 89/100 | 3 days ago | |
| dotCMS/core.cursor/rules/frontend-context.mdc · 950 | Cursor rules | teststyledocs | 78/100 | 3 days ago | |
| dotCMS/core.cursor/rules/java-context.mdc · 950 | Cursor rules | buildstyle | 44/100 | 3 days ago | |
| dotCMS/core.cursor/rules/test-context.mdc · 950 | Cursor rules | testtesting-strategy | 54/100 | 3 days ago | |
| dotCMS/core.github/copilot-instructions.md · 950 | Copilot instructions | setupbuildtestlint-format+11 | 84/100 | 3 days ago | |
| dotCMS/core.github/instructions/frontend.instructions.md · 950 | Copilot instructions | testlint-formatstylearch+3 | 69/100 | 3 days ago | |
| dotCMS/coreCLAUDE.md · 950 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | 3 days ago | |
| dotCMS/corecore-web/AGENTS.md · 950 | AGENTS.md | style | 63/100 | 3 days ago | |
| dotCMS/corecore-web/apps/dotcms-ui-e2e/AGENTS.md · 950 | AGENTS.md | setupstylearchtesting-strategy+2 | 78/100 | 3 days ago | |
| dotCMS/corecore-web/apps/dotcms-ui/AGENTS.md · 950 | AGENTS.md | buildteststyledependencies+3 | 94/100 | 3 days ago | |
| dotCMS/corecore-web/apps/mcp-server/CLAUDE.md · 950 | CLAUDE.md | setupbuildtestlint-format+5 | 89/100 | 3 days ago | |
| dotCMS/corecore-web/libs/block-editor/CLAUDE.md · 950 | CLAUDE.md | archdo-not | 69/100 | 3 days ago | |
| dotCMS/corecore-web/libs/new-block-editor/CLAUDE.md · 950 | CLAUDE.md | lint-formatstyledo-notagent-behaviour | 61/100 | 3 days ago | |
| dotCMS/corecore-web/libs/portlets/CLAUDE.md · 950 | CLAUDE.md | setupteststyleui+1 | 77/100 | 3 days ago | |
| dotCMS/corecore-web/libs/portlets/edit-ema/portlet/src/lib/store/CLAUDE.md · 950 | CLAUDE.md | teststylearchtypes+2 | 65/100 | 3 days ago | |
| dotCMS/corecore-web/libs/sdk/client/CLAUDE.md · 950 | CLAUDE.md | setupbuildtestlint-format+9 | 97/100 | 3 days ago | |
| dotCMS/corecore-web/libs/sdk/react/CLAUDE.md · 950 | CLAUDE.md | setupbuildtestlint-format+9 | 97/100 | 3 days ago | |
| dotCMS/coredotCMS/src/main/java/com/dotcms/rest/CLAUDE.md · 950 | CLAUDE.md | typesdatabaseapido-not+1 | 57/100 | 3 days ago |
Diff against .cursor/rules/doc-updates.mdc Diff against .cursor/rules/dotcms-guide.mdc Diff against .cursor/rules/e2e-rules.mdc Diff against .cursor/rules/frontend-context.mdc Diff against .cursor/rules/java-context.mdc Diff against .cursor/rules/test-context.mdc Diff against .github/copilot-instructions.md Diff against .github/instructions/frontend.instructions.md Diff against CLAUDE.md Diff against core-web/AGENTS.md Diff against core-web/apps/dotcms-ui-e2e/AGENTS.md Diff against core-web/apps/dotcms-ui/AGENTS.md Diff against core-web/apps/mcp-server/CLAUDE.md Diff against core-web/libs/block-editor/CLAUDE.md Diff against core-web/libs/new-block-editor/CLAUDE.md Diff against core-web/libs/portlets/CLAUDE.md Diff against core-web/libs/portlets/edit-ema/portlet/src/lib/store/CLAUDE.md Diff against core-web/libs/sdk/client/CLAUDE.md Diff against core-web/libs/sdk/react/CLAUDE.md Diff against dotCMS/src/main/java/com/dotcms/rest/CLAUDE.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| bagisto/bagistoCLAUDE.md · 28k | CLAUDE.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| microsoft/playwrightCLAUDE.md · 94k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| filamentphp/filamentCLAUDE.md · 32k | CLAUDE.md | buildtestlint-formatstyle+7 | 100/100 | 3 days ago | |
| nimbalyst/nimbalystpackages/android/CLAUDE.md · 1.4k | CLAUDE.md | setupbuildstylearch+2 | 100/100 | 3 days ago | |
| Adit-Jain-srm/NightmareNetCLAUDE.md · 45 | CLAUDE.md | buildtestlint-formatstyle+6 | 100/100 | 3 days ago | |
| dotCMS/coreCLAUDE.md · 950 | CLAUDE.md | setupbuildteststyle+7 | 99/100 | 3 days ago | |
| dotCMS/corecore-web/libs/sdk/react/CLAUDE.md · 950 | CLAUDE.md | setupbuildtestlint-format+9 | 97/100 | 3 days ago | |
| skillrecordings/egghead-nextCLAUDE.md · 1.4k | CLAUDE.md | setupbuildtestlint-format+8 | 97/100 | 3 days ago |
