Skip to content

Commit 4806f6e

Browse files
committed
Added agents.md file
1 parent 4379d10 commit 4806f6e

File tree

1 file changed

+113
-0
lines changed

1 file changed

+113
-0
lines changed

AGENTS.md

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
Instruction file for the AI agent working on the WCA competition groups web application.
2+
3+
## Project Overview
4+
5+
This is a React + TypeScript web application for viewing WCA (World Cube Association) competition groups digitally. The project uses Vite for development/build, Apollo Client for GraphQL, React Query for data fetching, and TailwindCSS/Styled Components for styling. The AI agent working on this project should understand the modular, component-driven structure and adhere to the repository’s coding and testing practices.
6+
7+
---
8+
9+
## Code Layout
10+
11+
- `src/` — Main source code.
12+
- `pages/` — Route-level components.
13+
- `components/` — Reusable React components.
14+
- `containers/` — Higher-level components that manage state and logic. These use components and are used in pages.
15+
- `hooks/` — Custom React hooks.
16+
- `providers/` — Context providers for global state management.
17+
- `lib/` — Utility functions and helpers.
18+
- `lib/api.ts` — Data fetching and API abstraction layers.
19+
- `public/` — Static assets.
20+
- `package.json` — Project scripts and dependencies.
21+
- `vite.config.ts` — Vite configuration.
22+
23+
---
24+
25+
## Setup & Dependencies
26+
27+
- **Node.js version:** Use the version compatible with Yarn 1.22+ and the dependencies in `package.json`.
28+
- **Install dependencies:**
29+
```bash
30+
yarn
31+
```
32+
- **No special environment variables** are required for development or testing by default.
33+
34+
---
35+
36+
## Building & Running
37+
38+
- **Development server:**
39+
```bash
40+
yarn dev
41+
```
42+
- **Production build:**
43+
```bash
44+
yarn build
45+
```
46+
- **Preview production build:**
47+
```bash
48+
yarn serve
49+
```
50+
51+
---
52+
53+
## Testing
54+
55+
- **Run all tests:**
56+
```bash
57+
yarn test
58+
```
59+
- **Testing libraries:** Jest and React Testing Library.
60+
- **Before committing, always run the tests** and ensure **all tests pass**. The AI agent must run the full test suite after changes.
61+
- All new features and bug fixes should include or update relevant tests.
62+
63+
---
64+
65+
## Linting & Formatting
66+
67+
- **Lint code:**
68+
```bash
69+
yarn lint
70+
```
71+
- **Type-check code:**
72+
```bash
73+
yarn check:type
74+
```
75+
- **Formatting:** Prettier is used for code formatting. ESLint is used for linting. Import sorting is handled by Prettier plugins.
76+
- The AI agent should fix any lint or type errors it introduces. (CI will fail if errors are present.)
77+
78+
---
79+
80+
## Coding Conventions
81+
82+
- **TypeScript:** All code must be type-safe. Use/extend types in `src/types` as needed.
83+
- **Styling:** Use TailwindCSS for utility-first styles; use Styled Components for component-scoped styles.
84+
- **State Management:** Use React Query for server state and Apollo Client for GraphQL APIs.
85+
- **Data Fetching:** Abstract API logic into `/lib/api.ts`.
86+
- **Routing:** Use React Router v6.
87+
- **Testing:** All new logic must have corresponding Jest/RTL tests.
88+
- **Internationalization:** Use `i18next` and `react-i18next` for translations.
89+
- **Documentation:** Update `README.md` and add comments where necessary.
90+
- **Function and variable names:** Should be clear and descriptive.
91+
- **Components:** Prefer functional components and hooks.
92+
93+
---
94+
95+
## Commit & PR Guidelines
96+
97+
- **Commits:** Use clear, descriptive commit messages. Conventional Commits format is preferred (`feat: ...`, `fix: ...`, `refactor: ...`).
98+
- **Pull Requests:** Include a summary of changes and reasoning. Reference issues if applicable (e.g., “Closes #123”).
99+
- **CI:** Tests and linting run on every PR. Ensure all checks pass before finalizing.
100+
101+
---
102+
103+
## Additional Instructions
104+
105+
- **Do not modify** files in `public/` unless the task explicitly requires it.
106+
- **Do not update dependencies** in `package.json` without approval.
107+
- **New libraries:** Prefer existing dependencies or standard approaches first.
108+
- **New files:** The agent can create new files for features or tests, but all new code should be covered by tests.
109+
- **Comments:** Add comments to explain complex logic; maintainability is valued.
110+
111+
---
112+
113+
If unsure, review the `README.md`, existing code, or add clarifying comments in your PR.

0 commit comments

Comments
 (0)