wp-calypso Agent Skills & AI Rules

GitHub

The JavaScript and API powered WordPress.com

12,646 stars TypeScript TypeScript 1 file ยท ~119,724 tokens #es2015#es6#es6-javascript#javascript#nodejs#react#redux#wordpress
RAW Rules
5 Discovered Rules โ€ข ~2,932 Estimated Tokens
Quick:
Loading skill content...

AI Agent Protocol & Instructions

AGENTS.md root-instruction ~1,904 tokens
Raw
# AGENTS.md

## Confidentiality

CRITICAL: This is a **public repository**. Never put an internal link or hostname in a PR description, review comment, commit message, code comment, or any other public-facing text: no wordpress.com URLs (internal sites and P2s), no Slack, Linear, HackerOne, private GitHub repository, or GitHub Enterprise URLs, and no other internal tool URLs. Use shortlinks instead: `PCYsg-hS-p2` for a P2 post, `p<message>-slack-<channel>` for a Slack message (`p<message>/<thread>-slack-<channel>` for a reply in a thread), and the bare issue key (`LIN-123`) for Linear.

## Repository layout

- client/ โ€” main application clients, deployed as single-page React apps.
- packages/ โ€” shared libraries across clients.
- apps/ โ€” standalone mini-apps, deployed separately.

## Clients

- **Calypso** โ€” the classic WordPress.com hosting dashboard, sharing data using Redux and split via Webpack section chunks.
  - client/my-sites โ€” per-site management; deprecated in favor of the Dashboard client
  - client/my-sites/checkout โ€” checkout flow
  - client/me/purchases โ€” redirects to the Dashboard billing screens, plus purchase helpers shared by other sections
  - client/landing/stepper โ€” onboarding/signup flows (site creation, domain purchase, migration wizards)
  - client/reader โ€” WordPress.com Reader: feed streams, discover, conversations, likes, lists, following management
  - Shared infra: client/components, client/state, client/lib, client/layout
- **Jetpack Cloud** (client/jetpack-cloud) โ€” reuses Calypso shared infra (client/state, client/components).
- **A8C for Agencies** (client/a8c-for-agencies) โ€” reuses Calypso shared infra.
- **Dashboard** (client/dashboard) โ€” the new multi-site dashboard. Self-contained: does not reuse Calypso client code. Has its own components, data fetching (TanStack Query), and routing (TanStack Router).
  - client/dashboard/me/billing-purchases โ€” billing & purchase management

## Packages

- **Agents Manager** (`packages/agents-manager`) โ€” shared component library for WordPress.com's unified AI agent experience, running in Calypso, the Dashboard, Simple and Atomic sites, the WooCommerce AI admin and Reader Chat. Also deployed via `apps/agents-manager/` to `widgets.wp.com`. See its `AGENTS.md` for architecture and conventions.
- **AI UI Renderer** (`packages/ai-ui-renderer`) โ€” reusable A2UI v1.0 catalog and rendering primitives built with WordPress components. Agents Manager consumes it; conversation handling and MCP transport stay in consumers.
- **Agenttic** (`packages/agenttic-client`, `packages/agenttic-ui`) โ€” AI agent chat client library and UI components. Also published to npm for consumers outside this repo. โš ๏ธ Still on its pre-migration package layout (vite-built, ESM-only, flat `dist/`, no `calypso:src`); normalizing it is a future goal, but the published artifact shape is a contract with external consumers โ€” read the Development and Releasing sections in `packages/agenttic-client/README.md` before restructuring or publishing.
- **Help Center** (`packages/help-center`) โ€” shared component library for WordPress.com support. Also deployed via `apps/help-center/` to `widgets.wp.com`.
- **Image Studio** (`packages/image-studio`) โ€” AI-powered image editing and generation. When adding Image Studio entry points, read [packages/image-studio/AGENTS.md](packages/image-studio/AGENTS.md).
- **Calypso Products** (`packages/calypso-products`) โ€” โš ๏ธ **Avoid.** Deprecated/frozen: a bloated client-side duplicate of product data the backend already owns. Don't add to it; prefer backend-driven data (e.g. `@automattic/api-queries`). See `packages/calypso-products/AGENTS.md`.

## Apps

- **Agents Manager** (`apps/agents-manager`) โ€” build/deploy layer that bundles `packages/agents-manager` into webpack entry points served from `widgets.wp.com`.
- **Help Center** (`apps/help-center`) โ€” build/deploy layer that bundles `packages/help-center` into webpack entry points served from `widgets.wp.com`.
- **Survicate** (`apps/survicate`) โ€” build/deploy layer that bundles `packages/survicate` into the single script wp-admin loads from `widgets.wp.com`. No logic of its own.

## Development

> **Note**: The Calypso dev server uses the `PORT` environment variable (check repo-root `.env`) and falls back to port `3000`. Do not create or modify `.env` unless explicitly asked.

```bash
# Setup
yarn install

# Build and start the dev server
yarn start

# Build and start the dev server for the Dashboard client only.
yarn start-dashboard
```

If `yarn start` fails with `Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory`, increase the Node heap size by running `NODE_OPTIONS=--max-old-space-size=8192 yarn start`. For other errors, run `yarn calypso-doctor` to diagnose and fix common environment issues.

## Testing instructions

> **Note**: E2E tests require a local Calypso development instance to be running.

```bash
# JavaScript tests
yarn test                                       # Run unit tests for client, packages, server, and build-tools
yarn test-build-tools                           # Run unit tests for build-tools
yarn test-client                                # Run unit tests for client
yarn test-integration                           # Run integration tests
yarn test-apps                                  # Run apps unit tests
yarn test-packages                              # Run packages unit tests
yarn test-server                                # Run server unit tests
yarn test-server:coverage                       # Run server unit tests with coverage info

yarn test-client:watch                          # Run unit tests for client in watch mode
yarn test-client <path_to_test_directory>       # Run client unit tests from a specific directory
yarn test-client --testNamePattern="<TestName>" # Run a specific client unit test

# E2E tests - refer to: test/e2e/AGENTS.md

# Code Quality
yarn lint             # Lint everything
yarn lint:css         # Lint CSS
yarn lint:js          # Lint JavaScript
yarn reformat-files   # Fix formatting with Prettier
yarn typecheck-client # Type-check client
```

## Conventions

- Do NOT add any verbose code comments that narrate what the change does or why it was made (e.g. `// Added this to fix X`, `// Changed from Y to Z`, restating the code in prose). Such explanation belongs in the PR description, not the source. Only keep comments that a future reader genuinely needs โ€” non-obvious rationale, gotchas, links to context โ€” and match the comment density and style of the surrounding code.

## Pre-PR checks

Before pushing a branch or running `gh pr create`, run the type-check that CI will run. PRs touching `client/` may fail the `type_check_client` CI check after opening, so verify locally first:

```bash
yarn               # Install dependencies first if you haven't already
yarn typecheck-client
```

If it fails, fix the type errors at the source โ€” do not silence them with `// @ts-expect-error`, `// @ts-ignore`, or `as any` unless you can justify it in the PR description. Other CI type-checks worth running when relevant: `yarn typecheck-packages`, `yarn typecheck-apps`.

## Creating Pull Requests

- Create PRs as draft. Follow the template in .github/PULL_REQUEST_TEMPLATE.md.
- Branch naming (see `docs/git-workflow.md`): branch off `trunk` and prefix with `add/` (new feature), `update/` (iterating on existing), `fix/` (fixing something broken), or `try/` (experiment). Use a **single slash only** โ€” multiple slashes break Calypso Live testing. Do NOT use Linear's autogenerated `gitBranchName` (e.g. `dotcom-17900-โ€ฆ`); it has no prefix and violates this convention. For the Signup accepts-props initiative, follow the established pattern `add/stepper-<step>-accepts-props` (e.g. `add/stepper-user-step-accepts-props`, `add/stepper-unified-plans-accepts-props`).
- In the PR description:
  - Use Linear issue IDs (e.g., `LIN-123`) instead of full Linear URLs.
  - Avoid mentioning people's names.
  - Include all checklist items from .github/PULL_REQUEST_TEMPLATE.md. Only mark items as completed (`[x]`) if they actually apply; leave inapplicable items unchecked (`[ ]`).