Skip to content

Commit f341d4f

Browse files
authored
Refactor Agents.md to remove outdated content
Removed outdated examples and sections related to providers, hooks, and core directories. Updated development practices and TypeScript requirements.
1 parent 43db439 commit f341d4f

File tree

1 file changed

+12
-46
lines changed

1 file changed

+12
-46
lines changed

.claude/Agents.md

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -17,44 +17,12 @@ React-admin is a comprehensive frontend framework for building B2B and admin app
1717

1818
### Provider Pattern
1919

20-
React-admin uses adapters called "providers" for external integrations:
21-
22-
```typescript
23-
// Data Provider - abstracts API calls
24-
dataProvider.getList('posts', {
25-
pagination: { page: 1, perPage: 5 },
26-
sort: { field: 'title', order: 'ASC' },
27-
filter: { author_id: 12 }
28-
})
29-
30-
// Auth Provider - handles authentication
31-
authProvider.checkAuth()
32-
authProvider.login({ username, password })
33-
authProvider.getPermissions()
34-
35-
// i18n Provider - manages translations
36-
i18nProvider.translate('ra.action.save')
37-
```
20+
React-admin uses adapters called "providers" for external integrations.
3821

3922
### Hook-Based API
4023

4124
All functionality exposed through hooks following React patterns:
4225

43-
```typescript
44-
// Data hooks
45-
const { data, isLoading } = useGetList('posts', {
46-
pagination: { page: 1, perPage: 10 }
47-
});
48-
49-
// State management hooks
50-
const [filters, setFilters] = useFilterState();
51-
const [page, setPage] = usePaginationState();
52-
53-
// Auth hooks
54-
const { permissions } = usePermissions();
55-
const canAccess = useCanAccess({ resource: 'posts', action: 'edit' });
56-
```
57-
5826
### Headless Core
5927

6028
The `ra-core` package contains all logic without UI. UI components are in separate packages like `ra-ui-materialui`. This allows:
@@ -97,15 +65,6 @@ react-admin/
9765
└── scripts/ # Build scripts
9866
```
9967

100-
### Key ra-core Directories
101-
102-
- `src/auth/` - Authentication and authorization (54 files)
103-
- `src/controller/` - CRUD controllers and state management
104-
- `src/dataProvider/` - Data fetching and caching logic (70 files)
105-
- `src/form/` - Form handling (31 files)
106-
- `src/routing/` - Navigation and routing (26 files)
107-
- `src/i18n/` - Internationalization (30 files)
108-
10968
### Package Dependencies
11069

11170
- **Core**: React 18.3+, TypeScript 5.8+, lodash 4.17+, inflection 3.0+
@@ -117,12 +76,13 @@ react-admin/
11776

11877
## Development Practices
11978

79+
**Search for similar functions** before creating a new one. React-admin is a rich framework that already has many building blocks.
80+
12081
### TypeScript Requirements
12182

12283
- **Strict mode enabled** - no implicit any
12384
- **Complete type exports** - all public APIs must be typed
12485
- **Generic types** for flexibility in data providers and resources
125-
- **JSDoc comments** for better IDE support
12686

12787
```typescript
12888
// GOOD - Properly typed with generics
@@ -156,11 +116,17 @@ export const MyField = ({ source, ...props }) => {
156116
```
157117
158118
### File Organization
119+
159120
- **Feature-based structure** within packages (not type-based)
121+
- **One file per component** except for components that can't be used in standalone (e.g. `DataTable.Col`)
160122
- **Co-location** - Tests (`.spec.tsx`) and stories (`.stories.tsx`) next to components
161123
- **Index exports** - Each directory has an index.ts exporting public API
162124
- **Flat structure** within features - avoid unnecessary nesting
163125
126+
### JSDoc
127+
128+
Every hook or component must have basic usage described in JSDoc, including a non-trivial example. No need to document all options - IDEs display TypeScript types for that.
129+
164130
### Documentation
165131
166132
Every new feature or API change must be documented. The documentation consists of Markdown files located in the `/docs/` directory and built with Jekyll, one file per component or hook.
@@ -210,8 +176,7 @@ make prettier # Format code
210176
feat: Add support for custom row actions in Datagrid
211177
docs: Clarify dataProvider response format
212178
```
213-
214-
4. **Documentation**: Update relevant docs for API changes
179+
4. Use Pull Request Description Template
215180
216181
### Common Make Commands
217182
```bash
@@ -241,6 +206,7 @@ make run-demo # Run demo application
241206
- Test with screen readers
242207
243208
### Browser Support
209+
244210
- Modern browsers only (Chrome, Firefox, Safari, Edge)
245211
- No IE11 support
246212
- ES5 compilation target for compatibility
@@ -298,4 +264,4 @@ Kept minimal to critical user paths due to maintenance overhead.
298264
make lint # ESLint checks
299265
make prettier # Prettier formatting
300266
make build # TypeScript type checking
301-
```
267+
```

0 commit comments

Comments
 (0)