Skip to content

Commit 1fe50a7

Browse files
committed
fix: update AGENTS.md to specify that this is a template
1 parent 2a558b5 commit 1fe50a7

File tree

1 file changed

+48
-7
lines changed

1 file changed

+48
-7
lines changed

AGENTS.md

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,41 @@
22

33
This file provides guidance to AI coding agents when working with code in this repository.
44

5+
## IMPORTANT: This is a Template Repository
6+
7+
**You MUST read this section carefully before making any changes.**
8+
9+
### Determining Context: Template vs Application
10+
11+
Check the current working directory name:
12+
13+
- **If directory is `fullstack-monorepo-template`**: You are working on the template itself. Keep all demo content and examples intact.
14+
- **If directory is anything else**: You are working on an application built from this template. You MUST clean up template artifacts before implementing features.
15+
16+
### When Working on an Application (NOT the template)
17+
18+
Before implementing any features, you MUST:
19+
20+
1. **Delete demo/example content**:
21+
- `packages/web/src/routes/demo/` - All demo routes
22+
- `packages/web/src/data/` - Demo data files
23+
- `packages/web/src/routes/rpc/` - Example RPC route files (but keep the pattern in mind)
24+
- Any other placeholder or example code
25+
26+
2. **Remove template styling**:
27+
- Do NOT use TanStack-specific theming, logos, or branding
28+
- Replace placeholder styles with application-specific styling
29+
- Remove TanStack logo files from `packages/web/public/` if not needed
30+
- **Keep TanStack Router DevTools** - The development debugging tools are useful and should remain
31+
32+
3. **Update package names** in `package.json` files from `@fullstack-monorepo-template/*` to match the application name
33+
34+
4. **Update service binding names** in `wrangler.jsonc` files to match the application name (replace `fullstack-monorepo-template-worker`)
35+
36+
### When Working on the Template Itself
37+
38+
Keep all demo content intact as it serves as reference examples for users of the template.
39+
540
## Monorepo Architecture
641

742
This is a pnpm workspace monorepo with two packages:
@@ -42,17 +77,21 @@ import type { WorkerRpc } from '../worker/src/rpc';
4277

4378
This creates a **direct TypeScript dependency** between packages. The monorepo structure enables this cross-package type sharing.
4479

45-
### TanStack Start Server Context
80+
### Calling Worker RPC Methods
4681

47-
In TanStack Start server functions/loaders, access the RPC binding via:
82+
**CORRECT way to access Worker RPC** in TanStack Start server functions:
4883

4984
```typescript
50-
import { getServerContext } from '@tanstack/react-start/server';
85+
import { getWorkerRpc } from '@/lib/rpc';
5186

52-
const { WORKER_RPC } = getServerContext().cloudflare.env;
53-
const result = await WORKER_RPC.sayHello('World');
87+
const workerRpc = getWorkerRpc();
88+
const result = await workerRpc.sayHello('World');
5489
```
5590

91+
**DO NOT use** `getServerContext().cloudflare.env` - this is incorrect. Always use the `getWorkerRpc()` helper from `@/lib/rpc.ts`.
92+
93+
See `packages/web/src/routes/rpc/` for complete examples of proper RPC usage patterns.
94+
5695
## Commands
5796

5897
### Development
@@ -134,8 +173,10 @@ export class WorkerRpc extends WorkerEntrypoint {
134173
3. **Call from web package** in any server function:
135174

136175
```typescript
137-
const { WORKER_RPC } = getServerContext().cloudflare.env;
138-
const result = await WORKER_RPC.myNewMethod('value');
176+
import { getWorkerRpc } from '@/lib/rpc';
177+
178+
const workerRpc = getWorkerRpc();
179+
const result = await workerRpc.myNewMethod('value');
139180
```
140181

141182
4. **Optional**: Add helper function in `packages/web/src/lib/worker-rpc.ts` for convenience

0 commit comments

Comments
 (0)