Skip to content

Commit 5e7d48e

Browse files
authored
chore(rules): update documentation structure and add new context files (#34428)
- Enhanced CLAUDE.md with clearer guidance on project rules and documentation updates. - Introduced new rule files for documentation maintenance, frontend context, Java context, and testing context. - Removed outdated documentation files to streamline the rules directory. - Updated README.md to reflect the new structure and provide an index for easy navigation. This update improves clarity and accessibility of project rules and documentation practices.
1 parent 4756d89 commit 5e7d48e

21 files changed

+1692
-2265
lines changed

.cursor/rules/README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Cursor Project Rules
2+
3+
Project rules live in `.cursor/rules/`. Cursor applies them according to the rule type.
4+
5+
## Rule types (frontmatter)
6+
7+
| Type in Cursor | Frontmatter | When it applies |
8+
|----------------|-------------|-----------------|
9+
| **Always Apply** | `alwaysApply: true` | On every chat |
10+
| **Apply to Specific Files** | `globs: ["..."]` + `alwaysApply: false` | When the open file/context matches the pattern |
11+
| **Apply Intelligently** | `description: "..."` + `alwaysApply: false` | When the Agent deems the description relevant |
12+
| **Apply Manually** | No alwaysApply/globs | Only if you mention the rule with @ (e.g. `@doc-updates`) |
13+
14+
## Current rules
15+
16+
- **dotcms-guide.mdc** – Always Apply. Navigation and critical reminders.
17+
- **frontend-context.mdc** – Globs: `core-web/**/*.{ts,tsx,html,scss,css}`. Nx monorepo, Angular, SDK, docs/frontend index.
18+
- **java-context.mdc** – Globs: `**/*.java`, `**/pom.xml`, `dotCMS/src/**/*`. Config, Logger, Maven.
19+
- **test-context.mdc** – Globs: `**/*.spec.ts`, `**/*Test.java`, etc. Spectator, data-testid.
20+
- **doc-updates.mdc** – Globs: `**/*.md`, `docs/**/*`. Where to update docs, DRY.
21+
22+
## Best practices (Cursor docs)
23+
24+
- Keep rules **short** (< 500 lines; ideally ~50 for reminders).
25+
- **One concern** per rule; split if they grow.
26+
- **Descriptions** that are clear and keyword-rich for Apply Intelligently.
27+
- Use **`.mdc`** (not `.md`) so Cursor interprets `description`, `globs`, `alwaysApply` correctly.
28+
- Put long details in **`/docs/`** and reference with `@docs/...` instead of copying into the rule.

.cursor/rules/doc-updates.mdc

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
description: "Where to update documentation. Use when editing docs/, CLAUDE.md, .md/.mdc files, or when adding patterns that should be documented."
3+
globs: ["**/*.md", "**/*.mdc", "CLAUDE.md", "docs/**/*"]
4+
alwaysApply: false
5+
---
6+
7+
# Documentation Updates
8+
9+
## Single source of truth
10+
- **CLAUDE.md** – navigation and quick reference only.
11+
- **`/docs/`** – full patterns by domain (backend, frontend, testing, etc.).
12+
- **`.cursor/rules/`** – short reminders and globs; link to `/docs/`, don’t duplicate.
13+
14+
## Where to update
15+
- **Java/Config/REST/DB** → `docs/backend/*.md`
16+
- **Angular/tests/styles** → `docs/frontend/*.md`
17+
- **Build/CI/Docker** → `docs/core/`, `docs/backend/MAVEN_BUILD_SYSTEM.md`, `docs/infrastructure/`
18+
- **Testing** → `docs/frontend/TESTING_FRONTEND.md`, `docs/testing/*.md`
19+
20+
## When editing code
21+
- New Config usage → document in CONFIGURATION_PATTERNS.md.
22+
- New REST/API pattern → REST_API_PATTERNS.md.
23+
- New Angular/testing pattern → ANGULAR_STANDARDS.md or TESTING_FRONTEND.md.
24+
- Keep rules under ~50 lines; put details in `/docs/` and reference with `@docs/...`.
25+
26+
## Quality
27+
- Use ✅/❌ examples. Cross-reference instead of duplicating. Same patterns for Claude and Cursor.

.cursor/rules/documentation-maintenance.md

Lines changed: 0 additions & 176 deletions
This file was deleted.

.cursor/rules/dotcms-guide.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

.cursor/rules/dotcms-guide.mdc

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
description: dotCMS project navigation and critical reminders. Apply to every chat.
3+
alwaysApply: true
4+
---
5+
6+
# dotCMS Development Guide
7+
8+
## Primary Reference
9+
**CLAUDE.md** – main roadmap and quick patterns for both Claude and Cursor.
10+
11+
## Project Structure
12+
13+
```
14+
core/
15+
├── dotCMS/ # Main backend Java code
16+
│ └── src/main/java/com/ # Java source files
17+
├── core-web/ # Frontend (Angular/Nx monorepo)
18+
│ ├── apps/dotcms-ui/ # Main admin UI
19+
│ └── libs/ # Shared libraries and SDKs
20+
├── dotcms-integration/ # Integration tests
21+
├── dotcms-postman/ # Postman API tests
22+
├── bom/application/pom.xml # Dependency versions (ADD versions here)
23+
├── parent/pom.xml # Plugin management
24+
└── .github/workflows/ # CI/CD pipelines
25+
```
26+
27+
## Domain-Specific Rules (loaded by file pattern or relevance)
28+
- **Java / pom.xml**: `java-context.mdc` – Config, Logger, Maven, REST
29+
- **Frontend / core-web (Nx)**: `frontend-context.mdc` – Angular, SDK, Nx commands, links to docs/frontend
30+
- **Tests (*.spec.ts, *Test.java)**: `test-context.mdc` – Spectator, data-testid
31+
- **Docs (docs/, *.md)**: `doc-updates.mdc` – where to update, DRY
32+
33+
## Critical Reminders
34+
- **Java**: Config/Logger only; never System.out or System.getProperty
35+
- **Maven**: Versions only in `bom/application/pom.xml`
36+
- **Angular**: @if/@for, input()/output(), spectator.setInput(), data-testid
37+
- **Security**: No secrets in code; validate input
38+
39+
## Documentation
40+
- Update `/docs/` when you find gaps; keep rules short; single source of truth.
41+
- See `doc-updates.mdc` when editing docs or CLAUDE.md.

.cursor/rules/frontend-context.mdc

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
description: "Nx monorepo frontend (core-web): Angular, TypeScript, SDK Angular/React. Use when editing apps, libs, or SDK in core-web."
3+
globs: ["core-web/**/*.ts", "core-web/**/*.tsx", "core-web/**/*.html", "core-web/**/*.scss", "core-web/**/*.css"]
4+
alwaysApply: false
5+
---
6+
7+
# Frontend Context (core-web)
8+
9+
**Nx monorepo** in `core-web/`: TypeScript, Angular apps/libs, and SDK for **Angular** and **React**. Full standards live in **`docs/frontend/`**. Index: **`@docs/frontend/README.md`** — load it for the full doc list and when to use each; then load the specific doc you need.
10+
11+
## Stack
12+
- **Angular**: standalone, signals, `inject()`, `input()`/`output()`, `@if`/`@for`, OnPush, PrimeNG/PrimeFlex.
13+
- **SDK**: `sdk-angular`, `sdk-react`, `sdk-client`, `sdk-types`, etc.
14+
- **Apps**: `dotcms-ui`, `content-drive-ui`, `edit-ema-ui`, portlets, libs.
15+
16+
## Nx commands (repo root or `core-web`)
17+
```bash
18+
cd core-web && yarn nx show projects
19+
cd core-web && yarn nx run dotcms-ui:serve
20+
cd core-web && yarn nx run <project>:test
21+
cd core-web && yarn nx run <project>:test -t MyComponent
22+
cd core-web && yarn nx affected -t build --exclude='tag:skip:build'
23+
cd core-web && yarn nx affected -t lint --exclude='tag:skip:lint'
24+
cd core-web && yarn nx affected -t test --exclude='tag:skip:test'
25+
```
26+
27+
## When to load which doc (`@docs/frontend/...`)
28+
29+
| If you are… | Load |
30+
|-------------|------|
31+
| Writing or refactoring components, templates, or Angular patterns | `@docs/frontend/ANGULAR_STANDARDS.md` |
32+
| Defining component structure, inputs/outputs, file layout | `@docs/frontend/COMPONENT_ARCHITECTURE.md` |
33+
| Adding or changing feature state (stores, async) | `@docs/frontend/STATE_MANAGEMENT.md` |
34+
| Writing or updating styles, BEM, PrimeFlex | `@docs/frontend/STYLING_STANDARDS.md` |
35+
| Writing or fixing tests (Spectator, Jest, data-testid) | `@docs/frontend/TESTING_FRONTEND.md` |
36+
| Using TypeScript (strict, inference, `unknown`, `as const`, `#` private) | `@docs/frontend/TYPESCRIPT_STANDARDS.md` |
37+
38+
**Reference in chat**: e.g. `@docs/frontend/ANGULAR_STANDARDS.md` or `@docs/frontend/TESTING_FRONTEND.md` so the right doc is included in context.
39+
40+
## Quick reminders (details in docs)
41+
- **Angular**: `$` prefix for signals, `$` suffix for observables; no `standalone: true`; OnPush; `[class.x]` / `[style.x]` (no ngClass/ngStyle); host in `host: {}`.
42+
- **State**: Prefer NgRx Signal Store; avoid manual signal soup in components. See `@docs/frontend/STATE_MANAGEMENT.md`.
43+
- **Testing**: Spectator + Jest/Vitest; `byTestId()`, `spectator.setInput()`, `spectator.detectChanges()`, `spectator.click()`; never set component inputs directly. See `@docs/frontend/TESTING_FRONTEND.md`.
44+
- **TypeScript**: Strict types, no `any` (use `unknown`), `as const` instead of enums, `#` for private. See `@docs/frontend/TYPESCRIPT_STANDARDS.md`.
45+
46+
## Nx
47+
For workspace/graph/config: Nx MCP tools or `yarn nx show projects`; see `core-web/AGENTS.md`.

0 commit comments

Comments
 (0)