Skip to content

Commit eea37b4

Browse files
committed
chore: update rules
1 parent 11e6de8 commit eea37b4

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

.copilot-rules.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,58 @@
2424
- `plugins/` - WordPress plugins
2525
- `site/` - Project website
2626

27+
## Development Philosophy
28+
29+
### Simplicity Over Complexity
30+
31+
- Start with the simplest solution that works, then add complexity only when absolutely necessary
32+
- If you find yourself building complex abstractions, step back and ask if a simpler approach exists
33+
- Prefer explicit, obvious code over "magic" that hides implementation details
34+
- Question whether template registries, complex HOCs, or automated systems are actually needed
35+
36+
### Headless-First Design
37+
38+
- Don't take over entire systems (routing, rendering, etc.) - provide utilities that developers can compose
39+
- Give developers control over their implementation rather than imposing opinionated frameworks
40+
- If it feels like "magic," it's probably too opinionated for a headless system
41+
- Provide core utilities and let developers implement their own data fetching and routing logic
42+
43+
### Reuse Before Reimplementing
44+
45+
- Check if functionality already exists in shared packages before writing new code
46+
- When improving shared functionality, update the shared package rather than working around it
47+
- Don't duplicate logic across framework-specific implementations
48+
- Use existing functions like `getTemplate` instead of reimplementing the same logic
49+
50+
## Technical Implementation Guidelines
51+
52+
### Environment Variables
53+
54+
- Use semantic names (`WORDPRESS_URL`) over technical ones (`GRAPHQL_ENDPOINT`)
55+
- Let packages handle technical details (like appending `/index.php?graphql`)
56+
- Default to WordPress conventions (prefer `/index.php?graphql` over `/graphql`)
57+
58+
### Framework Organization
59+
60+
- Keep framework-agnostic utilities at main package level
61+
- Put framework-specific code under subpaths (`/pages`, `/app`, etc.)
62+
- Each framework handles its own specific needs (paths, imports, etc.) in its own layer
63+
- Example: Astro needs file paths, Next.js only needs template IDs
64+
65+
### Dynamic Imports Structure
66+
67+
- Use `next/dynamic` in template index files, not in page components
68+
- Keep loading states and code splitting organized at the template level
69+
- Import the configured templates directly in pages
70+
- Structure: `wp-templates/index.js` exports dynamic components, pages import and use them
71+
72+
### Backward Compatibility
73+
74+
- Don't add complexity for unreleased versions
75+
- Clean up deprecated patterns before they become public API
76+
- Focus on the best API design rather than supporting every iteration
77+
- Remove fallbacks for functionality that was never released
78+
2779
## Code Standards
2880

2981
### TypeScript/JavaScript

0 commit comments

Comments
 (0)