Skip to content

Commit 8ed862a

Browse files
committed
Refactored agent.md and skills
1 parent 6830a95 commit 8ed862a

File tree

14 files changed

+270
-344
lines changed

14 files changed

+270
-344
lines changed

.cursor/rules/README.md

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,5 @@
1-
# Cursor Rules – Contentstack Utils (Java)
1+
# Cursor (optional)
22

3-
This directory contains Cursor AI rules for **contentstack-utils-java**. Rules give persistent context so the AI follows project conventions and Contentstack RTE / embedded-item patterns.
3+
**Cursor** users: start at **[AGENTS.md](../../AGENTS.md)**. All conventions live in **`skills/*/SKILL.md`**.
44

5-
## How rules are applied
6-
7-
- **File-specific rules** use the `globs` frontmatter: they apply when you open or edit files matching that pattern.
8-
- **Always-on rules** use `alwaysApply: true`: they are included in every conversation in this project.
9-
10-
## Rule index
11-
12-
| File | Applies when | Purpose |
13-
|------|--------------|---------|
14-
| **dev-workflow.md** | (Reference only; no glob) | Development workflow: branches, running tests, PR expectations, optional TDD. |
15-
| **java.mdc** | Editing any `**/*.java` file | Java 17 standards: naming, package layout under `com.contentstack.utils`, JSON/Jsoup, Javadoc, dependencies. |
16-
| **contentstack-utils-java.mdc** | Editing `src/main/java/**/*.java` | Utils-specific patterns: `Utils` / `GQL`, RTE and embedded JSON, `DefaultOption` / callbacks; alignment with entry JSON shapes (no HTTP client in this module). |
17-
| **testing.mdc** | Editing `src/test/**/*.java` | Testing patterns: JUnit 4, fixtures, JaCoCo, Surefire (including `testFailureIgnore`). |
18-
| **code-review.mdc** | Always | PR / review checklist: API stability, error handling, backward compatibility, dependencies and security (e.g. SCA), tests. |
19-
20-
## Related
21-
22-
- **AGENTS.md** (repo root) – Main entry point for AI agents: project overview, entry points, commands, pointers to rules and skills.
23-
- **skills/** – Reusable skill docs (`contentstack-utils-java`, `testing`, `code-review`, `framework`) for deeper guidance on specific tasks.
5+
This folder only points contributors to **`AGENTS.md`** so editor-specific config does not duplicate the canonical docs.

.cursor/rules/code-review.mdc

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

.cursor/rules/contentstack-utils-java.mdc

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

.cursor/rules/dev-workflow.md

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

.cursor/rules/java.mdc

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

.cursor/rules/testing.mdc

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

AGENTS.md

Lines changed: 39 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,53 @@
11
# Contentstack Utils (Java) – Agent guide
22

3-
This document is the main entry point for AI agents working in **contentstack-utils-java**. Repo: [contentstack-utils-java](https://github.com/contentstack/contentstack-utils-java).
3+
**Universal entry point** for contributors and AI agents. Detailed conventions live in **`skills/*/SKILL.md`**.
44

5-
## Project
5+
## What this repo is
66

7-
- **Name:** Contentstack Utils (Java) — Maven artifact `com.contentstack.sdk:utils`.
8-
- **Purpose:** Library for **rendering Rich Text Editor (RTE) content and embedded items** from Contentstack entry JSON (REST/CDA-style with `_embedded_items`) and GraphQL-shaped responses. It does **not** perform HTTP calls or manage API keys; use it with the [Contentstack Java Delivery SDK](https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/java) after fetching entries.
7+
| Field | Detail |
8+
|--------|--------|
9+
| **Name:** | [contentstack-utils-java](https://github.com/contentstack/contentstack-utils-java) — Maven `com.contentstack.sdk:utils` |
10+
| **Purpose:** | Library for rendering **Rich Text Editor (RTE)** content and **embedded items** from Contentstack entry JSON (REST/CDA-style with `_embedded_items`) and GraphQL-shaped responses. Consumed by the [Contentstack Java Delivery SDK](https://www.contentstack.com/docs/developers/sdks/content-delivery-sdk/java) and apps that already hold entry JSON. |
11+
| **Out of scope (if any):** | **No HTTP client** in this package: no stack API calls, tokens, or `includeEmbeddedItems()` — those belong to the Delivery SDK or your app. Optional **`sample/`** wires the SDK + Utils for manual testing only. |
912

10-
## Tech stack
13+
## Tech stack (at a glance)
1114

12-
- **Language:** Java **17** (`maven-compiler-plugin` `<release>17</release>` in `pom.xml`).
13-
- **Build:** Maven.
14-
- **Testing:** JUnit 4, Maven Surefire, JaCoCo (see `pom.xml`; Surefire uses `testFailureIgnore`).
15-
- **JSON / HTML:** `org.json`, Jsoup, `commons-text`; `javax.validation` API; `spring-web` is a compile dependency (not a public HTTP client surface for this module).
15+
| Area | Details |
16+
|------|---------|
17+
| **Language** | Java **17**`maven-compiler-plugin` `<release>17</release>` in root `pom.xml` (legacy `1.8` properties in `pom.xml` are not authoritative). |
18+
| **Build** | **Maven** — root `pom.xml`; optional module `sample/pom.xml`. |
19+
| **Tests** | **JUnit 4**, Maven **Surefire** (`src/test/java/com/contentstack/utils/**/*.java`). Surefire **`testFailureIgnore`** is `true` — check `target/surefire-reports/`. |
20+
| **Lint / coverage** | No Checkstyle/Spotless in repo — match existing style. **JaCoCo** (`target/site/jacoco/` after `mvn test`). |
21+
| **Other** | JSON: `org.json`, `json-simple` (provided). HTML: **Jsoup**. `spring-web` compile dependency — not a public REST client API for this module. **Snyk** on PRs (`.github/workflows/sca-scan.yml`). |
1622

17-
## Main entry points
23+
## Commands (quick reference)
1824

19-
- **`Contentstack.stack(...)`** — Not in this repo; provided by the Java SDK (see root `README.md`).
20-
- **`com.contentstack.utils.Utils`**`render`, `renderContent`, `jsonToHTML`, variant helpers, etc.
21-
- **`com.contentstack.utils.GQL`** — GraphQL entry `jsonToHTML`.
22-
- **`com.contentstack.utils.render.DefaultOption`** / **`interfaces.Option`** — custom RTE/embedded rendering.
23-
- **Paths:** `src/main/java/com/contentstack/utils/` (production), `src/test/java/com/contentstack/utils/` (tests). Optional **`sample/`** demonstrates Delivery SDK + Utils together.
25+
| Command type | Command |
26+
|--------------|---------|
27+
| **Build** | `mvn clean compile` |
28+
| **Test** | `mvn clean test` |
29+
| **Lint** | *(none configured — rely on IDE and code review)* |
2430

25-
## Commands
31+
| Optional | Command / location |
32+
|----------|---------------------|
33+
| Single test class | `mvn test -Dtest=UtilTests` |
34+
| Javadoc | `mvn javadoc:javadoc` |
35+
| Sample (after `mvn install` with skips if needed) | `mvn -f sample/pom.xml compile` |
36+
| **CI** | Java **17** publish: `.github/workflows/maven-publish.yml` · SCA: `.github/workflows/sca-scan.yml` · branch rules: `.github/workflows/check-branch.yml` |
2637

27-
- **Build and test:** `mvn clean test`
28-
- **Compile only:** `mvn clean compile`
29-
- **Single test class:** `mvn test -Dtest=UtilTests`
30-
- **Javadoc (optional):** `mvn javadoc:javadoc`
38+
## Where the documentation lives: skills
3139

32-
CI uses Java **17** (`.github/workflows/maven-publish.yml`). **Snyk** runs on PRs (`.github/workflows/sca-scan.yml`).
40+
| Skill | Path | What it covers |
41+
|-------|------|----------------|
42+
| **Development workflow** | [`skills/dev-workflow/SKILL.md`](skills/dev-workflow/SKILL.md) | Branches, CI, build/test commands, PR expectations, optional TDD. |
43+
| **Java (language & layout)** | [`skills/java/SKILL.md`](skills/java/SKILL.md) | Java 17, `com.contentstack.utils` packages, naming, JSON/Jsoup, dependencies. |
44+
| **Contentstack Utils API** | [`skills/contentstack-utils-java/SKILL.md`](skills/contentstack-utils-java/SKILL.md) | Public API: `Utils`, `GQL`, `DefaultOption`, JSON contracts, RTE/embedded boundaries. |
45+
| **Testing** | [`skills/testing/SKILL.md`](skills/testing/SKILL.md) | JUnit 4, fixtures, Surefire/JaCoCo, offline tests vs `sample/`. |
46+
| **Code review** | [`skills/code-review/SKILL.md`](skills/code-review/SKILL.md) | PR checklist, optional Blocker/Major/Minor. |
47+
| **Framework (build & tooling)** | [`skills/framework/SKILL.md`](skills/framework/SKILL.md) | Maven plugins, publishing, GPG, Central, `sample/` dependency hygiene. |
3348

34-
## Rules and skills
49+
An index with **when to use** hints is in [`skills/README.md`](skills/README.md).
3550

36-
### `.cursor/rules/`
51+
## Using Cursor (optional)
3752

38-
| Resource | Role |
39-
|----------|------|
40-
| **README.md** | Index of all rules and when they apply |
41-
| **dev-workflow.md** | Branches, tests, PRs, optional TDD |
42-
| **java.mdc** | Applies to `**/*.java`: Java 17, `com.contentstack.utils`, JSON/Jsoup |
43-
| **contentstack-utils-java.mdc** | Applies to `src/main/java/**/*.java`: Utils/GQL, RTE, embedded JSON |
44-
| **testing.mdc** | Applies to `src/test/**/*.java`: JUnit 4, fixtures, JaCoCo |
45-
| **code-review.mdc** | Always applied: PR checklist |
46-
47-
### `skills/`
48-
49-
| Skill | Use when |
50-
|-------|----------|
51-
| **contentstack-utils-java** | Changing RTE, embedded items, `Utils` / `GQL`, `DefaultOption`, callbacks |
52-
| **testing** | Adding or refactoring tests and fixtures |
53-
| **code-review** | Reviewing PRs or pre-merge self-review |
54-
| **framework** | Editing `pom.xml`, plugins, publishing, or `sample/` dependency management |
55-
56-
See **`skills/README.md`** for details. For editor-wide Cursor user skills (if configured), this repo’s project skills live only under **`./skills/`**.
57-
58-
## Official documentation
59-
60-
- [Contentstack Developers](https://www.contentstack.com/docs/)
61-
- [Content Delivery API](https://www.contentstack.com/docs/apis/content-delivery-api/)
62-
- Root **`README.md`** — Maven coordinates and embedded-items examples
53+
If you use **Cursor**, [`.cursor/rules/README.md`](.cursor/rules/README.md) only points to **`AGENTS.md`** — same docs as everyone else.

0 commit comments

Comments
 (0)