Skip to content

Commit a731417

Browse files
committed
refactor: agents instructions
1 parent 54169df commit a731417

File tree

3 files changed

+9
-91
lines changed

3 files changed

+9
-91
lines changed

.github/workflows/claude.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,15 @@ jobs:
2929
actions: read # Required for Claude to read CI results on PRs
3030
steps:
3131
- name: Checkout repository
32-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5
32+
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
3333
with:
3434
fetch-depth: 1
35-
3635
- name: Run Claude Code
3736
id: claude
38-
uses: anthropics/claude-code-action@8a1c4371755898f67cd97006ba7c97702d5fc4bf # v1
37+
uses: anthropics/claude-code-action@ac1a3207f3f00b4a37e2f3a6f0935733c7c64651 # v1.0
3938
with:
4039
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
4140

42-
# This is an optional setting that allows Claude to read CI results on PRs
43-
additional_permissions: |
44-
actions: read
45-
4641
# Optional: Give a custom prompt to Claude. If this is not specified, Claude will perform the instructions specified in the comment that tagged it.
4742
prompt: |
4843
Review this PR following the guidelines in CLAUDE.md.

AGENTS.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ This document provides essential context for AI coding assistants (Claude, GitHu
66

77
**IMPORTANT**: Before making any code changes, read:
88

9-
1. `.cursor/rules/*.mdc` - Comprehensive coding guidelines
10-
2. This file - Project overview and key patterns
9+
1. This file (AGENTS.md) - Project overview and key patterns
10+
2. `CLAUDE.md` - Detailed guidelines for AI assistants
1111
3. `README.md` - Setup and deployment instructions
1212

1313
## Project Summary
@@ -68,7 +68,6 @@ src/
6868
├── generated/ # hey-api output (DO NOT EDIT)
6969
└── hooks/ # Custom React hooks
7070
71-
.cursor/rules/ # Coding guidelines (READ FIRST)
7271
dev-auth/ # Development OIDC mock
7372
helm/ # Kubernetes deployment
7473
scripts/ # Build scripts
@@ -429,7 +428,7 @@ function isData(value: unknown): value is Data {
429428

430429
### Documentation
431430

432-
- **Workspace Rules**: `.cursor/rules/*.mdc` (MUST READ)
431+
- **Project Guides**: AGENTS.md, CLAUDE.md, copilot-instructions.md (MUST READ)
433432
- **Next.js**: https://nextjs.org/docs
434433
- **Better Auth**: https://www.better-auth.com
435434
- **hey-api**: https://heyapi.vercel.app
@@ -478,4 +477,4 @@ This is an **open-source** project. Write code that:
478477

479478
---
480479

481-
**Remember**: Simple, readable code is better than clever code. When in doubt, check the workspace rules (`.cursor/rules/*.mdc`) and existing codebase patterns.
480+
**Remember**: Simple, readable code is better than clever code. When in doubt, check the project documentation (AGENTS.md, CLAUDE.md) and existing codebase patterns.

CLAUDE.md

Lines changed: 3 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,11 @@ pnpm generate-client # Fetch swagger.json and regenerate
119119
pnpm generate-client:nofetch # Regenerate without fetching
120120
```
121121

122-
123122
## Critical Rules
124123

125124
### DO ✅
126125

127-
1. **Read workspace rules first** - `.cursor/rules/*.mdc` contains all guidelines
126+
1. **Read project documentation first** - Check AGENTS.md and CLAUDE.md for all guidelines
128127
2. **Use Server Components by default** - Mark Client Components explicitly
129128
3. **Use hey-api hooks exclusively** - No manual fetch in components
130129
4. **Use async/await** - Never `.then()` chains
@@ -283,7 +282,7 @@ git push origin v0.x.x
283282

284283
1. **Ask questions** - If requirements are unclear, ask before implementing
285284
2. **Check existing code** - Look for similar patterns in the codebase
286-
3. **Read the rules** - All guidelines are in `.cursor/rules/*.mdc`
285+
3. **Read the documentation** - All guidelines are in AGENTS.md, CLAUDE.md, and copilot-instructions.md
287286
4. **Incremental changes** - Small, focused changes are better than large refactors
288287
5. **Test your changes** - Run linter, type-check, and tests
289288
6. **Explain reasoning** - Use JSDoc to explain why, not what
@@ -309,7 +308,7 @@ git push origin v0.x.x
309308

310309
## References
311310

312-
- **Workspace Rules**: `.cursor/rules/*.mdc` (READ FIRST)
311+
- **Project Documentation**: AGENTS.md, CLAUDE.md, copilot-instructions.md (READ FIRST)
313312
- **Next.js Docs**: https://nextjs.org/docs
314313
- **React Docs**: https://react.dev
315314
- **Better Auth**: https://www.better-auth.com
@@ -329,78 +328,3 @@ For questions or issues:
329328
---
330329

331330
**Remember**: This is an open-source project. Write clean, maintainable code that others can understand and contribute to. When in doubt, favor simplicity over cleverness.
332-
## Next.js App Router Essentials
333-
334-
**CRITICAL**: This is Next.js 16 with App Router (not Pages Router). Consult [Next.js Documentation](https://nextjs.org/docs) before suggesting code.
335-
336-
### Core Concepts
337-
338-
**File-System Routing** - Routes are defined by folder structure, not code:
339-
```
340-
app/
341-
├── page.tsx # Route
342-
├── layout.tsx # Shared UI (persists across navigation)
343-
├── loading.tsx # Loading UI (auto-Suspense)
344-
├── error.tsx # Error boundary
345-
└── [param]/ # Dynamic segment
346-
└── page.tsx
347-
```
348-
349-
**Server Components (default)** - Run only on server:
350-
-**CAN**: async/await, fetch data, access backend resources, environment variables
351-
-**CANNOT**: hooks (useState, useEffect), event handlers, browser APIs, React Query hooks
352-
353-
```typescript
354-
// ✅ Server Component - async data fetching
355-
async function ServerPage() {
356-
const response = await fetch('https://api.example.com/data', {
357-
next: { revalidate: 3600 } // Cache 1 hour
358-
});
359-
const data = await response.json();
360-
return <div>{data.title}</div>;
361-
}
362-
```
363-
364-
**Client Components** (`'use client'`) - Run in browser:
365-
-**CAN**: hooks, event handlers, browser APIs, hey-api React Query hooks
366-
-**CANNOT**: direct backend access
367-
368-
```typescript
369-
"use client";
370-
371-
import { useState } from "react";
372-
import { useGetApiV0Servers } from "@/generated/client/@tanstack/react-query.gen";
373-
374-
function ClientComponent() {
375-
const [isOpen, setIsOpen] = useState(false);
376-
const { data, isLoading } = useGetApiV0Servers(); // hey-api hook
377-
378-
return <button onClick={() => setIsOpen(!isOpen)}>Toggle</button>;
379-
}
380-
```
381-
382-
**Server Actions** (`'use server'`) - For mutations:
383-
```typescript
384-
"use server";
385-
386-
import { revalidatePath } from "next/cache";
387-
388-
export async function createServer(formData: FormData) {
389-
await db.server.create({ data: formData });
390-
revalidatePath("/servers"); // Revalidate cache
391-
return { success: true };
392-
}
393-
```
394-
395-
**Caching & Revalidation**:
396-
- Time-based: `next: { revalidate: 3600 }`
397-
- Tag-based: `next: { tags: ['servers'] }`
398-
- On-demand: `revalidatePath('/servers')`, `revalidateTag('servers')`
399-
- Opt-out: `cache: 'no-store'`
400-
401-
**For detailed patterns, examples, and advanced features**:
402-
- [Next.js Official Docs](https://nextjs.org/docs/app) - Comprehensive guide
403-
- `AGENTS.md` in this repo - Quick reference with code examples
404-
- `.cursor/rules/nextjs.mdc` - Best practices and common patterns
405-
406-

0 commit comments

Comments
 (0)