Skip to content

Commit eef1de8

Browse files
kvzclaude
andcommitted
Reorganize AI instructions into .ai/ directory
Move rules from .cursor/rules/ to .ai/rules/ as canonical source, with symlinks back to .cursor/rules/. Add .ai/AGENTS.md with symlinks to AGENTS.md and CLAUDE.md. Create .claude/skills and .codex/skills symlinks to .ai/skills/ for cross-tool compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 4bd6bce commit eef1de8

15 files changed

Lines changed: 136 additions & 115 deletions

.ai/AGENTS.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Transloadit Repository Guide
2+
3+
This document serves as a quick reference for agentic coding assistants working in this repository.
4+
5+
## Check your work
6+
7+
After making changes, always run `corepack yarn check`, this lints with typescript, formats code,
8+
and runs quick unit tests. Remember that this formats code and may make changes, that you are to
9+
commit if you were working on those files.
10+
11+
## When running in GitHub Actions
12+
13+
When in running in a GitHub Actions context, always commit changes to a non-`main` branch, and never
14+
forget to push. Even if there was an error, when in GHA context, commit your work to a branch and
15+
push it so we can inspect it and continue in a next run.
16+
17+
## More important rules
18+
19+
Detailed guidelines are organized in the following files, read them carefully when applicable:
20+
21+
@.ai/rules/coding-style.mdc @.ai/rules/typescript.mdc @.ai/rules/cli-scripts.mdc
22+
@.ai/rules/general.mdc @.ai/rules/repo.mdc

.ai/rules/coding-style.mdc

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
7+
Coding style:
8+
9+
- Favor `async run() {` over `run = async () => {` inside ES6 classes
10+
- Favor `if (!(err instanceof Error)) { throw new Error(`Was thrown a non-error: ${err}`) }` inside
11+
`catch` blocks to ensure the `error` is always an instance of `Error`
12+
- Favor using real paths (`../lib/schemas.ts`) over aliases (`@/app/lib/schemas`).
13+
- Favor `for (const comment of comments) {` over `comments.forEach((comment) => {`
14+
- Favor named exports over default exports, with the exception of Next.js pages
15+
- Do not wrap each function body and function call in `try`/`catch` blocks. It pollutes the code.
16+
Assume we will always have an e.g.
17+
`main().catch((err) => { console.error(err); process.exit(1) })` to catch us. I repeat: Avoid
18+
over-use of try-catch such as
19+
`try { // foo } catch (err) { console.error('error while foo'); throw err }`, assume we catch
20+
errors on a higher level and do not need the extra explananation.
21+
- If you must use try/catch, for simple cases, favor `alphalib/tryCatch.ts`
22+
(`const [err, data] = await tryCatch(promise)`) over
23+
`let data; try { data = await promise } catch (err) { }`
24+
- Before creating new files and new code, see if we can leverage existing work, maybe slighty adapt
25+
that without breaking BC, to keep things DRY.
26+
- Favor early exits, so quickly `continue`, `return false` (or `throw` if needed), over nesting
27+
everything in positive conditions, creating christmas trees.
28+
- Use Prettier with 100 char line width, single quotes for JS/TS, semi: false
29+
- Use descriptive names: PascalCase for components/types, camelCase for variables/methods/schemas
30+
- Alphabetize imports, group by source type (built-in/external/internal)
31+
- Favor US English over UK English, so `summarizeError` over `summarise Error`
32+
- Favor `.replaceAll('a', 'b)` over `.replace(/a/g, 'b')` or `.replace(new RegExp('a', 'g'), 'b')` when the only need for regeses was replacing all strings. That's usually both easier to read and more performant.
33+
- Use typographic characters: ellipsis (`…`) instead of `...`, curly quotes (`'` `"`) instead of straight quotes in user-facing text
34+
- Put API keys and secrets in `.env` files, not hardcoded in components
35+
- Check for existing hooks before creating new ones (e.g., `useUppy()` for Uppy functionality)

.ai/rules/general.mdc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
description: General
3+
globs:
4+
alwaysApply: true
5+
---
6+
General:
7+
8+
- Do not touch `.env` files!
9+
- Favor Yarn (4) over npm
10+
- Never run any dev server yourself. I have one running that auto-reloads on changes.
11+
- Avoid blocking the conversation with terminal commands. For example: A) most of my git commands run through pagers, so pipe their output to `cat` to avoid blocking the
12+
terminal. B) You can use `tail` for logs, but be smart and use `-n` instead of `-f`, or the conversation will block
13+
- Use the `gh` tool to interact with GitHub (search/view an Issue, create a PR).
14+
- All new files are to be in TypeScript. Even if someone suggests: make this new foo3 feature, model it after `foo1.js`, create: `foo3.ts`. Chances are, a `foo2.ts` already exist that you can take a look at also for inspiration.

.ai/rules/playwright.mdc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
description: Playwright e2e guidelines distilled from PR #4601 feedback
3+
globs: _src/tests/**/*.pwtest.ts,playwright.config.ts
4+
alwaysApply: false
5+
---
6+
- Prefer user-centric locators: `getByRole`/`getByText` with accessible names; avoid `page.locator('body')`, `innerText()`, or raw CSS unless there is no accessible alternative.
7+
- Make positive assertions on expected UI/text instead of looping over regexes to assert absence.
8+
- Keep tests simple: no control-flow loops or extra variables for straightforward assertions.
9+
- Navigate with relative URLs (`page.goto('/path')`) by setting `baseURL` in `playwright.config.ts`; avoid stringing environment URLs in tests.
10+
- Stub or mock external/third‑party requests (Intercom, Sentry, etc.) and any auth/login endpoints to keep tests deterministic; return minimal valid JSON when the app expects data.
11+
- Each unexpected error should surface and fail the test.

.ai/rules/pr-comments.mdc

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: false
5+
---
6+
goal: address PR comments
7+
8+
- get PR comments
9+
```bash
10+
# Find PR for current branch
11+
gh pr list --head $(git branch --show-current) | cat
12+
13+
# Get inline comments (most important)
14+
gh api repos/:owner/:repo/pulls/PR_NUMBER/comments --jq '.[] | {author: .user.login, body: .body, path: .path, line: .line}' | cat
15+
16+
# Get review comments if needed
17+
gh api repos/:owner/:repo/pulls/PR_NUMBER/reviews --jq '.[] | select(.body != "") | {author: .user.login, body: .body}' | cat
18+
```
19+
20+
- if no PR exists, abort
21+
- suggest fixes for each comment
22+
- always use `| cat`
23+
24+
25+
<!-- From https://x.com/ericzakariasson/status/1928224127942545605 -->

.ai/rules/typescript.mdc

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
description:
3+
globs:
4+
alwaysApply: true
5+
---
6+
For Typescript:
7+
8+
- Favor `contentGapItemSchema = z.object()` over `ContentGapItemSchema = z.object()`
9+
- Favor `from './PosterboyCommand.ts'` over `from './PosterboyCommand'`
10+
- Favor `return ideas.filter(isPresent)` over `ideas.filter((idea): idea is Idea => idea !== null)`
11+
- Favor using `.tsx` over `.jsx` file extensions.
12+
- Favor the `tsx` CLI over `ts-node` for running TypeScript files.
13+
- Favor `satisfies` over `as`, consider `as` a sin
14+
- Favor `unknown` over `any`, consider `any` a sin
15+
- Favor validating data with Zod over using `any` or custom type guards
16+
- We use the `rewriteRelativeImportExtensions` TS 5.7 compiler option, so for local TypeScript
17+
files, import with the `.ts` / `.tsx` extension (not js, not extensionless)
18+
- Favor defining props as an interface over inline
19+
- Favor explicit return types over inferring them as it makes typescript a lot faster in the editor
20+
on our scale

.claude/skills

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.ai/skills

.codex/skills

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../.ai/skills

.cursor/rules/coding-style.mdc

Lines changed: 0 additions & 35 deletions
This file was deleted.

.cursor/rules/coding-style.mdc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../.ai/rules/coding-style.mdc

0 commit comments

Comments
 (0)