Skip to content

chore: add AGENTS.md and conventions#4387

Open
amanabiy wants to merge 10 commits intomainfrom
dev-v3-amanabiy-ai-instructions
Open

chore: add AGENTS.md and conventions#4387
amanabiy wants to merge 10 commits intomainfrom
dev-v3-amanabiy-ai-instructions

Conversation

@amanabiy
Copy link
Copy Markdown
Member

@amanabiy amanabiy commented Mar 26, 2026

Description

Adds AGENTS.md as a top-level entry point for AI coding agents working in this repo, along with supporting documentation in docs/.

Key changes:

  • AGENTS.md — setup, build, and run instructions tailored for agents, with pointers into docs/ for deeper guidance.
  • docs/CLOUDSCAPE_COMPONENTS_GUIDE.md — central index for component conventions, styling, testing, and internals. Designed to be reusable across related repos.
  • Additional docs linked from the guide covering code style, styling patterns, test authoring, and component API conventions.

I have other repositories reusing the CLOUDSCAPE_COMPONENTS_GUIDE.md for example take a look at this PR for chat-components repository.

Related links, issue #, if available: X2NaAdxtpFej rcDoAlynI8Zj

How has this been tested?

  • Verified locally that with considering all the feedbacks from the team, and running against our of predefined tests.
Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@amanabiy amanabiy requested a review from a team as a code owner March 26, 2026 16:59
@amanabiy amanabiy requested review from ernst-dev and removed request for a team March 26, 2026 16:59
@amanabiy amanabiy force-pushed the dev-v3-amanabiy-ai-instructions branch from 9365e0d to 92871de Compare March 26, 2026 17:00
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.45%. Comparing base (c8acad4) to head (1d29949).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4387   +/-   ##
=======================================
  Coverage   97.44%   97.45%           
=======================================
  Files         906      909    +3     
  Lines       26561    26637   +76     
  Branches     9582     9614   +32     
=======================================
+ Hits        25882    25958   +76     
  Misses        673      673           
  Partials        6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@amanabiy amanabiy force-pushed the dev-v3-amanabiy-ai-instructions branch from 2daa3b6 to 17d9487 Compare March 27, 2026 08:33

This project uses `@cloudscape-design/documenter` to generate API docs from JSDoc comments in component interface files (`src/<component>/interfaces.ts`).

## Special Tags
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also have @awsuiSystem


- Props interface: `${ComponentName}Props`, namespace sub-types under it (e.g. `${ComponentName}Props.Variant`)
- Union types must be type aliases (no inline unions)
- Array types must use `ReadonlyArray<T>`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it still? I think our updated documenter can actually handle readonly T[] - could we check it?

- Props interface: `${ComponentName}Props`, namespace sub-types under it (e.g. `${ComponentName}Props.Variant`)
- Union types must be type aliases (no inline unions)
- Array types must use `ReadonlyArray<T>`
- Cast string props to string at runtime if rendered in JSX — React accepts JSX content there
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this line mean?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is part of our v3-development convention. It said. If you declared property as a string type, but then you also use it in JSX content (for example: <div>{option.label}</div>), you need to add additional cast to string in runtime, because React would accept JSX content there which allows customers to provide unsupported content.. I will remove it since it's confusing.

@@ -0,0 +1,7 @@
# Dev Pages

Dev and test pages live in `pages/<component-name>/`. They are used for local development, integration tests, and visual regression tests.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we say "dev and test pages" - instead of just "test pages" or "demo pages"? We sometimes add a -test suffix to pages used in integ tests, but that rule is not always followed.

Dev and test pages live in `pages/<component-name>/`. They are used for local development, integration tests, and visual regression tests.

## Rules
- For visual regression content, either use `SimplePage` (handles heading, screenshot area, i18n, and layout) or wrap content in `ScreenshotArea`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The mention of visual regression testing can be confusing. In this repo we don't run VR tests in GitHub - only in the internal pipeline.

│ ├── generated - generated code from style-dictionary
│ └── styles - base styles and SCSS-mixins
├── lib - build output
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is it necessary to describe the build output structure?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It helps with understanding the project structure and debugging build issues. This section was originally part of our CONTRIBUTING.md. I just moved it here for better organization.


## Test Types

- **Build-tool tests** — test the build-tools code in a NodeJS context.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to mention build-tool tests? We have a few of those, and those are touches very seldom.

At the same time, we can mention the a11y tests here. We have a util to run a11y checks in unit tests, and there are separate scripts to run a11y tests on the test pages.

When component APIs change, you may need to update test snapshots. Use the `-u` flag to update snapshots:

```
TZ=UTC npx jest -u snapshot -c jest.unit.config.js src/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All snapshot tests are grouped inside global unit and integ folders, which means:

  1. There is no need to run all unit tests to update snapshots
  2. When design tokens are touched - one must run integ tests to update snapshots

Also, it is essential to mention that the project must be built with the full build (npm run build) before updating snapshots - so that documenter docs are generated.

TZ=UTC npx jest -u snapshot -c jest.unit.config.js src/
```

## Visual Regression Tests
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have these in the components repo atm.

@@ -0,0 +1,28 @@
# Writing Tests
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider describing test utils separately from testing, either as part of component conventions or in a separate section? While we use test utils for internal testing - the main purpose of test utils is different - they are part of our contract.

At the same time, I don't think we should have separate running tests and writing tests guide, as there is a lot of similar info - I recommend combining the two.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separating the test-utils makes sense to me. I will move it the component conventions.

The reason I kept them separate is that the writing tests guide is meant to be shared across repositories, while the running tests part is repo-specific. for example here through the CLOUDSCAPE_COMPONENTS_GUIDE.md. Therefore I think it's better if we keep it separate for now.

npm install
```

## Building
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are useful instructions. Should we have them in our general docs somewhere? I think the agents.md should ideally only give references to other docs.

@amanabiy amanabiy changed the title feat: add AGENTS.md and conventions chore: add AGENTS.md and conventions Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants