-
Notifications
You must be signed in to change notification settings - Fork 580
add AGENTS.md with AEM Edge Delivery project guidelines/instructions #532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
shsteimer
wants to merge
13
commits into
main
Choose a base branch
from
agents-md
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3ca39db
add AGENTS.md for AEM Edge Delivery project guidelines and setup inst…
shsteimer ae2d62c
Update AGENTS.md
shsteimer 7cb0444
Update cleanup-on-create.yaml
shsteimer b3d7908
Update AGENTS.md
shsteimer 5553c1e
chore(.gitignore): track CLAUDE.md and AGENTS.md files explicitly
trieloff ec67cde
Merge pull request #535 from adobe/terragon/add-claude-agents-to-giti…
shsteimer 9dae226
Apply suggestions from code review
shsteimer 83aa9db
Update AGENTS.md
shsteimer 4e0601e
Update AGENTS.md
shsteimer beb8868
Update AGENTS.md
shsteimer 8239f7a
Apply suggestion from @shsteimer
shsteimer 6240cec
Apply suggestion from @shsteimer
shsteimer dd12ed2
Update AGENTS.md
shsteimer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,201 @@ | ||
| # AGENTS.md | ||
|
|
||
| This is the AEM Edge Delivery boilerplate project - a starter template for AEM Edge Delivery Services projects. This file provides guidance for AI coding agents working on this project. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| This is a boilerplate project for Adobe AEM Edge Delivery Services that serves as the foundation for all AEM Edge Delivery projects. It provides the basic structure, blocks, and configuration needed to get started quickly. | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| **Key Technologies:** | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - AEM Edge Delivery Services | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Vanilla JavaScript (ES6+) | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - CSS3 with modern features | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - HTML5 semantic markup | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Node.js tooling | ||
|
|
||
| ## Setup Commands | ||
|
|
||
| - Install dependencies: `npm install` | ||
| - Start local development: `aem up` (requires AEM CLI) | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Install the AEM CLI globally by running `npm install -g @adobe/aem-cli` | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Run linting: `npm run lint` | ||
| - Fix linting issues: `npm run lint:fix` | ||
|
|
||
| ## Project Structure | ||
|
|
||
| ``` | ||
| ├── blocks/ # Reusable content blocks | ||
| └── {blockName}/ - Individual block directory | ||
| ├── {blockName}.js # Block's JavaScript | ||
| └── {blockName}.css # Block's styles | ||
| ├── styles/ # Global styles and CSS | ||
| ├── styles.css # Minimal global styling and layout for your website required for LCP | ||
| └── lazy-styles.css # Additional global styling and layout for below the fold/post LCP content | ||
| ├── scripts/ # JavaScript libraries and utilities | ||
| ├── aem.js # Core AEM Library for Edge Delivery page decoration logic | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ├── scripts.js # Global JavaScript utilities, main entry point for page decoration | ||
| └── delayed.js # Delayed functionality such as martech loading | ||
| ├── fonts/ # Web fonts | ||
| ├── icons/ # SVG icons | ||
| ├── head.html # Global HTML head content | ||
| └── 404.html # Custom 404 page | ||
| ``` | ||
|
|
||
| ## Code Style Guidelines | ||
|
|
||
| ### JavaScript | ||
| - Use ES6+ features (arrow functions, destructuring, etc.) | ||
| - Follow Airbnb ESLint rules (already configured) | ||
| - Always include `.js` file extensions in imports | ||
| - Use Unix line endings (LF) | ||
|
|
||
| ### CSS | ||
| - Follow Stylelint standard configuration | ||
| - Use modern CSS features (CSS Grid, Flexbox, CSS Custom Properties) | ||
| - Maintain responsive design principles | ||
| - Declare styles mobile first, use media queries for tablet and desktop specific styles | ||
| - Use 600px/900px/1200px as breakpoints | ||
|
|
||
| ### HTML | ||
| - Use semantic HTML5 elements | ||
| - Ensure accessibility standards (ARIA labels, proper heading hierarchy) | ||
| - Follow AEM markup conventions for blocks and sections | ||
|
|
||
| ## Key Concepts | ||
|
|
||
| ### Content | ||
|
|
||
| CMS authored content is a key part of every AEM Website. The content of a page is broken into sections. Sections can have default content (text, headings, links, etc.) as well as content in blocks. | ||
|
|
||
shsteimer marked this conversation as resolved.
Show resolved
Hide resolved
shsteimer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ### Blocks | ||
|
|
||
| Blocks are the re-usable building blocks of AEM. Blocks add styling and functionality to content. Each block has an initial content structure it expects, and transforms the html in the block using DOM APIs to render a final structure. | ||
|
|
||
| The initial content sturcture is important because it impacts how the author will create the content and how you will write your code to decorate it. In some sense, you can think of this structure as the contract for your block between the author and the developer. You should decide on this initial structure before writing any code, and be careful when making changes to code that makes assumptions about that structure as it could break existing pages. | ||
|
|
||
| The block javascript should export a default function which is called to perform the block decoration: | ||
|
|
||
| ``` | ||
| /** | ||
| * loads and decorates the block | ||
| * @param {Element} block The block element | ||
| */ | ||
| export default async function decorate(block) { | ||
| // 1. Load dependencies | ||
| // 2. Extract configuration, if applicable | ||
| // 3. Transform DOM | ||
| // 4. Add event listeners | ||
| // 5. Set loaded status | ||
| } | ||
| ``` | ||
|
|
||
shsteimer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ### Auto-Blocking | ||
|
|
||
| Auto-blocking is the process of creating blocks that aren't explicitly authored into the page based on patterns in the content. See the `buildAutoBlocks` function in scripts.js. | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Three-Phase Page Loading | ||
|
|
||
| Pages are progressively loaded in three phases to maximize performance. This process begins when `loadPage` from scripts.js is called. | ||
|
|
||
| * Eager - load only what is required to get to LCP. This generally includes decorating the overall page content to create sections, blocks, buttons, etc. and loading the first section of the page. | ||
| * Lazy - load all other page content, including the header and footer. | ||
| * Delayed - load things that can be safely loaded later here and incur a performance penalty when loaded earlier | ||
|
|
||
| ## Development Workflow | ||
|
|
||
| ### Local Development | ||
| 1. Run `aem up` to start the AEM Proxy server | ||
| 2. Open `http://localhost:3000` in your browser | ||
| 3. Make changes to files - they will auto-reload | ||
| 4. Use browser dev tools to test responsive design | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Block Development | ||
| - Each block in the `blocks/` directory should be self-contained and re-useable | ||
| - Include CSS and JS files for each block | ||
| - Follow the naming convention: `blockname.css`, `blockname.js` | ||
| - Blocks should be responsive and accessible by default | ||
|
|
||
| ### Styling | ||
| - Global styles go in `styles/styles.css` | ||
| - Font definitions in `styles/fonts.css` | ||
| - Lazy-loaded styles in `styles/lazy-styles.css` | ||
| - Block-specific styles in their respective directories | ||
|
|
||
| ## Testing & Quality Assurance | ||
|
|
||
| ### Linting | ||
| - JavaScript: ESLint with Airbnb base configuration | ||
| - CSS: Stylelint with standard configuration | ||
| - Run `npm run lint` before committing | ||
| - Use `npm run lint:fix` to automatically fix issues | ||
|
|
||
| ### Performance | ||
| - Follow AEM Edge Delivery performance best practices | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Optimize images and assets | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Use lazy loading for non-critical resources | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Minimize JavaScript bundle size | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ### Accessibility | ||
| - Ensure proper heading hierarchy | ||
| - Include alt text for images | ||
| - Test with screen readers | ||
| - Follow WCAG 2.1 AA guidelines | ||
|
|
||
| ## Deployment | ||
|
|
||
| ### Environments | ||
shsteimer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - **Production Preview**: `https://main--{repo}--{owner}.aem.page/` | ||
| - **Production Live**: `https://main--{repo}--{owner}.aem.live/` | ||
| - **Feature Preview**: `https://{branch}--{repo}--{owner}.aem.page/` | ||
|
|
||
| ### Publishing Process | ||
| 1. Push changes to a feature branch | ||
| 2. AEM Code Sync automatically processes changes making them available on feature preview environment for that branch | ||
| 3. Open a pull request to merge changes to main | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 4. Merge the PR | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| 5. AEM Code Sync updates the main branch for production | ||
|
|
||
| ## Common Tasks | ||
|
|
||
| ### Adding New Blocks | ||
| 1. Create a new directory in `blocks/` | ||
| 2. Add `blockname.css` and `blockname.js` files | ||
| 3. Update documentation if needed | ||
| 4. Test in local development environment | ||
|
|
||
| ### Modifying Existing Blocks | ||
| 1. Make changes to the specific block files | ||
| 2. Test locally with `aem up` | ||
| 3. Ensure responsive behavior across devices | ||
| 4. Run linting before committing | ||
|
|
||
| ### Global Style Changes | ||
| 1. Modify files in the `styles/` directory | ||
| 2. Test across different blocks and pages | ||
| 3. Ensure changes don't break existing layouts | ||
| 4. Consider impact on performance, especially CLS | ||
|
|
||
| ## Troubleshooting | ||
|
|
||
| ### Getting Help | ||
| - Check [AEM Edge Delivery documentation](https://www.aem.live/docs/) | ||
| - Review [Developer Tutorial](https://www.aem.live/developer/tutorial) | ||
| - Consult [The Anatomy of a Project](https://www.aem.live/developer/anatomy-of-a-project) | ||
| - Consider the rules in [David's Model](https://www.aem.live/docs/davidsmodel) | ||
|
|
||
shsteimer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ## Security Considerations | ||
|
|
||
| - Never commit sensitive information (API keys, passwords) | ||
| - Use environment variables for configuration | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - Follow Adobe security guidelines | ||
| - Regularly update dependencies | ||
| - Use the .hlxignore file to prevent filed from being served | ||
|
|
||
| ## Contributing | ||
|
|
||
| - Follow the existing code style and patterns | ||
| - Test changes locally before committing | ||
| - Run a PSI check on your branch and fix performance issues before raising a PR | ||
| - Ensure all linting passes | ||
| - Update documentation for significant changes | ||
| - Follow the project's Code of Conduct | ||
shsteimer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.