mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-28 21:52:55 +08:00
- Refreshed all 241 library rules with current best practices - Updated Exa search results for all libraries with 2025 content - Fixed --regenerate-all flag logic to properly process all libraries - Removed duplicate astro entry in rules.json (merged tags) - Added missing docker.mdc and vim.mdc files - All rules now include modern patterns and anti-patterns - Updated with framework-specific recommendations for 2025 Technical improvements: - Fixed retry_failed_only logic in generate_mdc_files.py - Improved progress tracking for regeneration scenarios - Ensured proper handling of --refresh-exa flag
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
---
|
|
description: Definitive guidelines for building robust, performant, and maintainable apollo-graphql applications using modern best practices and tooling.
|
|
globs: **/*.{js,jsx}
|
|
---
|
|
# apollo-graphql Best Practices
|
|
|
|
This guide outlines our definitive best practices for developing with Apollo GraphQL, covering both server-side (Apollo Server 5) and client-side (Apollo Client) implementations. Adhering to these rules ensures consistency, performance, and maintainability across our GraphQL ecosystem.
|
|
|
|
## 1. Schema Design and Organization
|
|
|
|
Your GraphQL schema is the contract. Design it meticulously, document it thoroughly, and organize it logically.
|
|
|
|
### 1.1 Schema-First Development with SDL
|
|
|
|
Always start by defining your schema using Schema Definition Language (SDL). This forces clear API design before implementation.
|
|
|
|
❌ BAD
|
|
```javascript
|
|
// Implicit schema definition through resolvers
|
|
const resolvers = {
|
|
Query: {
|
|
users: () => [{ id: '1', name: 'Alice' }],
|
|
},
|
|
};
|
|
// Schema is inferred or built programmatically, harder to review
|
|
```
|
|
|
|
✅ GOOD
|
|
```graphql
|
|
# schema/user.graphql
|
|
"""Represents a user in the system."""
|
|
type User {
|
|
id: ID!
|
|
name: String!
|
|
email: String
|
|
}
|
|
|
|
type Query {
|
|
"""Fetches a list of all users."""
|
|
users: [User!]!
|
|
"""Fetches a single user by their ID."""
|
|
user(id: ID |