Guidance for AI coding agents (Copilot, Cursor, Aider, Claude, etc.) working in this repository. Human readers are welcome, but this file is written for tools.
This repo hosts Stream’s React Chat SDK. It provides UI component.
Agents should prioritize backwards compatibility, API stability, and high test coverage when changing code.
- Language: React (Typescript)
- Primary runtime: Node (use the version in .nvmrc via nvm use)
- Package manager: Yarn 4 (Berry). The binary lives at
.yarn/releases/yarn-4.14.1.cjsand is activated viayarnPathin.yarnrc.yml. Any globally installedyarn(e.g. classic 1.x) acts only as a launcher — no Corepack required. - Workspaces: Yarn workspaces monorepo. The published SDK lives at the repo root (
stream-chat-react);examples/*are private workspaces consuming the SDK viaworkspace:^. - Testing: Unit/integration: Vitest (+ React Testing Library).
- CI: GitHub Actions (assume PR validation on build + tests + lint)
- Lint/format: ESLint + Prettier (configs in repo root)
- Styles: Import Stream styles and override via CSS layers as described in README (don’t edit compiled CSS)
- Release discipline: Conventional Commits + automated release tooling (see commitlint/semantic-release configs).
- src/ — Components, hooks, contexts, styles, and utilities (library source).
- scripts/ - Scripts run during the build process
- examples/ — Example apps as private Yarn workspaces. Currently
examples/tutorialandexamples/vite. - developers/ — Dev notes & scripts.
Use the closest folder’s patterns and conventions when editing.
Root configs:
- .gitignore
- .lintstagedrc.fix.json
- .lintstagedrc.json
- .nvmrc
- .prettierignore
- .prettierrc
- .releaserc.json
- codecov.yml
- commitlint.config.mjs
- eslint.config.mjs,
- i18next.config.ts
- tsconfig.json
Respect any repo-specific rules. Do not suppress rules broadly; justify and scope exceptions.
- Install dependencies (root + all workspaces): yarn install
- Build: yarn build
- Typecheck: yarn types
- Lint: yarn lint
- Fix lint issues: yarn lint-fix
- Unit tests: yarn test
- Run an example: yarn start:tutorial or yarn start:vite
- Build all examples: yarn examples:build
- Make sure the eslint and prettier configurations are followed. Run before committing:
yarn lint-fix
- Never commit directly to main, always create a feature branch.
- Never commit unless explicitly requested.
- Keep PRs small and focused; include tests.
- Follow the project’s “zero warnings” policy—fix new warnings and avoid introducing any.
- For UI changes, attach comparison screenshots (before/after) where feasible.
- Ensure public API changes include docs.
- Follow the @.github/pull_request_template.md when opening PRs.
Add/extend tests in the matching module’s __tests__/ folder.
Cover:
- React components
- React hooks
- Utility functions
- Use fakes/mocks from the test helpers provided by the repo when possible.
- When altering public API, update inline docs and any affected guide pages in the docs site where this repo is the source of truth.
- Keep sample/snippet code compilable.
- Never commit API keys or customer data.
- Example code must use obvious placeholders (e.g., YOUR_STREAM_KEY).
- If you add scripts, ensure they fail closed on missing env vars.
- Mirror existing patterns in the nearest module.
- Prefer additive changes; avoid breaking public APIs.
- Ask maintainers (CODEOWNERS) through PR mentions for modules you touch.
Quick agent checklist (per commit)
- Build the src
- Run all tests and ensure green
- Run lint commands
- Update docs if public API changed
- Add/adjust tests
- No new warnings
End of machine guidance. Edit this file to refine agent behavior over time; keep human-facing details in README.md and docs.