Ensure Agents Md

adobe/skills/plugins/aem/cloud-service/skills/ensure-agents-md

作者 adobe940b8795c0df3e25de68ce3881dc90855129b215Apache-2.0197 个星标收录于 2026年10月9日更新于 2026年10月9日仓库今天更新

**Run FIRST (before any other skill or task)** when workspace root has no AGENTS.md and the repo is an AEM Cloud Service project. Creates AGENTS.md and CLAUDE.md (tailored via pom.xml). Applies on every user request until AGENTS.md exists — not only the first chat. Never overwrites existing files.

仅含说明AI & Agents
AI 生成的概览

为 AEM Cloud Service 项目根目录生成量身定制的 AGENTS.md 和 CLAUDE.md。

功能
检查工作区根目录是否已有 AGENTS.md,以及该仓库是否为 AEM Cloud Service 项目。若满足条件,则依据内置模板生成 AGENTS.md,并针对项目名称、模块列表、附加组件章节、构建命令和资源链接进行调整。若缺少 CLAUDE.md,还会创建一个引用 AGENTS.md 的 CLAUDE.md 文件。它不会覆盖已存在的文件。
适用场景
适用于在根目录尚无 AGENTS.md 的 AEM Cloud Service 仓库中开始工作时,先于调度器配置、组件创建或代码修改等任务执行。其目的是为 AI 编码代理提供项目指引。当 AGENTS.md 已存在或仓库并非 AEM Cloud Service 项目时会跳过。
运行要求
无脚本,仅包含指令。它会读取仓库根目录的 pom.xml 和模块目录,以及内置的模板和模块目录参考文件。面向 AEM as a Cloud Service 项目(Java、Maven、Dispatcher),并在工作区根目录写入文件。

Ensure AGENTS.md and CLAUDE.md (bootstrap)

Mandatory order (all cases)

Before any other work — including dispatcher, create-component, code edits, MCP, or answers — the agent MUST:

  1. Check whether AGENTS.md exists at the workspace (repository) root.
  2. If it exists → skip this skill entirely and continue with the user’s request.
  3. If it does not exist and the repo is an AEM Cloud Service project (see Gate check) → run this skill completely first (create AGENTS.md and CLAUDE.md if missing), then fulfill the user’s original request.

This applies to every user message and any intent (bugs, features, questions, dispatcher, etc.) until AGENTS.md is present. Do not defer bootstrap to “after” the main task.

It creates AGENTS.md and CLAUDE.md at the repository root so every AI coding agent (Claude Code, Cursor, etc.) gets project guidance, optionally tailored using the module catalog and add-on detection.

Gate check

  1. Look for AGENTS.md at the workspace root. If it exists → skip, move on.
  2. Verify this is an AEM Cloud Service project: root pom.xml exists and references com.adobe.aem:aem-sdk-api or aem-project-archetype or contains <modules> with typical AEM module names (core, ui.apps, dispatcher, etc.). If not an AEM project → skip.

Steps

1. Resolve project name

Check in order:

  • Root pom.xml → <name> element (preferred, usually human-readable).
  • Root pom.xml → <artifactId>, then humanize: strip leading aem-, replace - with spaces, title-case (e.g. aem-guides-wknd → WKND, my-site → My Site).
  • Directory name of the workspace.
  • Fallback: "AEM Cloud Service Project".

2. Discover modules

Read root pom.xml <modules> section. For each <module>, confirm the directory actually exists. Build a list of present modules.

3. Detect add-ons and frontend type

Scan the project for:

SignalAdd-on / variant
pom.xml depends on cif-connector or aem-core-cif-componentsCIF (Commerce)
ui.frontend/package.json contains react or @adobe/aem-react-editable-componentsReact SPA
ui.frontend/package.json contains @angular/core or @adobe/aem-angular-editable-componentsAngular SPA
ui.frontend has no clientlib.config.js and pom.xml references frontend-maven-plugin but outputs no clientlibsDecoupled frontend
pom.xml depends on aem-forms-* or forms.coreAEM Forms
Module ui.frontend.react.forms.af existsHeadless Forms
pom.xml uses precompiled-scripts-providerPrecompiled Scripts

If none of these are detected, treat as General Webpack frontend (the default archetype).

4. Generate AGENTS.md

Read the template at references/AGENTS.md.template. Apply the following adaptations:

a. Title

Replace {{PROJECT_NAME}} with the resolved project name.

b. Add-ons section

If any add-ons were detected (CIF, Forms, Headless Forms, Precompiled Scripts), insert an "Add-ons and extensions" section after the intro paragraph. Use descriptions from the references/module-catalog.md add-ons table. If none detected, omit the section entirely.

c. Modules section

Only include modules that actually exist in the project. For each module, use the matching description from the module catalog. Pay attention to:

  • ui.frontend — use the variant that matches the detected frontend type (General, React, Angular, Decoupled).
  • dispatcher — only include if the dispatcher directory exists.
  • it.tests / ui.tests — only include if they exist.
d. Build commands
  • Include frontend commands (npm run build, npm start) only if ui.frontend exists.
  • Include dispatcher validate command only if dispatcher module exists.
  • For React/Angular SPA, note that npm start requires AEM running.
e. Important resources

Always include the base resources from the template. Additionally:

  • If React or Angular SPA detected → add SPA Editor and framework-specific resources (see module catalog).
  • If CIF detected → add Commerce resources.
  • If Forms detected → add Forms resources.
  • If Decoupled frontend → add Frontend Pipeline resource.

5. Create CLAUDE.md

If CLAUDE.md does not exist at the workspace root, create it with exactly this content (so Claude/Cursor picks up project guidance):

@AGENTS.md

Do not overwrite an existing CLAUDE.md.

6. Inform the user

Briefly tell the user:

"I created AGENTS.md and CLAUDE.md in your project root with guidance tailored to your project structure. These help AI coding agents understand your project."

Then continue with the user's original request.

Reference files

FilePurpose
references/AGENTS.md.templateBase template with {{PROJECT_NAME}} placeholder and all default sections
references/module-catalog.mdModule descriptions, add-on descriptions, conditional resources — the source of truth for adapting the template

Rules

  • Never overwrite an existing AGENTS.md or CLAUDE.md. Only create when missing.
  • Never hallucinate modules. Only list modules whose directories actually exist.
  • Keep the generated AGENTS.md clean — no skill metadata, no comments about "generated by skill".
  • Project name should be human-readable (e.g. "WKND Sites Project", "My Site"), not only a raw artifactId unless that is the desired title.
  • Do not add sections that tell agents to use specific MCP servers, Cursor/Claude skills, or how to discover tools. Coding assistants pick those up from product configuration and tool metadata; if something is not discovered, fix metadata or MCP setup — do not duplicate that in AGENTS.md.
  • The resource links must point to experienceleague.adobe.com/en/docs/experience-manager-cloud-service/... (Cloud Service URLs), never to AEM 6.5 URLs.

来源与署名

来源:adobe/skills位于plugins/aem/cloud-service/skills/ensure-agents-md提交940b879

许可证: Apache-2.0

内容归原作者所有。SourceWeft 从公开仓库中收录这些内容。

举报或申请下架