Development guidelines and commands for the Our World in Data Grapher platform, covering code style, testing, database access, and project structure.
Expert assistant for developing the Our World in Data (OWID) Grapher platform - a monorepo for creating interactive data visualizations with React, TypeScript, and MySQL.
This is a TypeScript monorepo for the Our World In Data website, including the custom data visualization component Grapher. Built with React 19, Node 22, and MySQL 8.
```bash
yarn typecheck
yarn testLintChanged # ESLint on changed files
yarn testPrettierChanged # Prettier on changed files
yarn fixPrettierChanged # Auto-fix prettier issues
yarn test run --reporter dot
yarn test run --reporter dot path/to/test.ts # Specific test file
yarn fixPrettierChanged > /dev/null 2>&1 && yarn typecheck
```
```bash
make migrate
make dbtest
yarn query "SELECT * FROM table_name LIMIT 10"
yarn query -s "SELECT * FROM table_name"
```
Use a non-standard setup with class-based components and TC-39 stage 3 decorators:
```typescript
class Example {
observableProp: string = ""
constructor() {
makeObservable(this, {
observableProp: observable,
// Do NOT list @computed or @action properties here
})
}
@computed get derivedValue() {
return this.observableProp.toUpperCase()
}
@action updateProp(value: string) {
this.observableProp = value
}
}
```
- Site: `/site/owid.scss`
- Grapher: `/packages/@ourworldindata/grapher/src/core/grapher.scss`
**ALWAYS** read the database documentation before querying or writing migrations:
1. **Start with**: `db/docs/README.md` - overview and starting point
2. **List available tables**: `ls db/docs/` to see all `TABLE-NAME.yml` files
3. **Read table details**: Check relevant `.yml` files before constructing queries
```bash
yarn query "DESCRIBE posts"
yarn query "SELECT COUNT(*) FROM charts"
yarn query "SELECT column_name, COUNT(*) as count FROM table_name GROUP BY column_name"
yarn query -s "SELECT * FROM charts WHERE slug LIKE '%covid%' LIMIT 5"
```
For work involving the Google Docs to website pipeline, read these documentation files first:
Before creating commits, refer to `docs/agent-guidelines/commit-messages.md` for commit message guidelines.
1. **Before making changes:**
- Read relevant database documentation in `db/docs/`
- Understand existing patterns in the codebase
- Check for reusable type definitions
2. **During implementation:**
- Follow code style guidelines (double quotes, types, BEM CSS)
- Use proper MobX patterns if in Grapher/Admin
- Write unit tests for new functionality
3. **Before committing:**
- Run `yarn fixPrettierChanged > /dev/null 2>&1 && yarn typecheck`
- Fix any errors
- Follow commit message guidelines
- Ensure all tests pass
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/owid-grapher-development-assistant-a75rg8/raw