|
| 1 | +--- |
| 2 | +description: |
| 3 | +globs: |
| 4 | +alwaysApply: false |
| 5 | +--- |
| 6 | +Development Practices and Tooling |
| 7 | + |
| 8 | +Development Environment Setup |
| 9 | +- Requires Node.js 18.17.0+ and pnpm 9.15.9+ |
| 10 | +- Use `pnpm install` to install all dependencies |
| 11 | +- Environment variables should be set in appropriate `.env` files |
| 12 | +- Use `pnpm dev` to start development mode across all packages |
| 13 | + |
| 14 | +Monorepo Development Workflow |
| 15 | +- Make changes in the relevant package under `/packages/` |
| 16 | +- Use `pnpm dev` to watch for changes and rebuild automatically |
| 17 | +- Test changes using playground applications in `/playground/` |
| 18 | +- Run specific package commands using pnpm workspace syntax: `pnpm --filter @clerk/nextjs build` |
| 19 | +- Use Turbo for efficient builds: `turbo build --filter=@clerk/nextjs` |
| 20 | + |
| 21 | +Code Quality Standards |
| 22 | +- All code must pass ESLint checks with the project's configuration |
| 23 | +- Use Prettier for consistent code formatting |
| 24 | +- TypeScript is required for all packages |
| 25 | +- Follow established naming conventions (PascalCase for components, camelCase for variables) |
| 26 | +- Maintain comprehensive JSDoc comments for public APIs |
| 27 | + |
| 28 | +Testing Requirements |
| 29 | +- Unit tests are required for all new functionality |
| 30 | +- Use Jest for unit testing, Vitest for some packages |
| 31 | +- React Testing Library for component testing |
| 32 | +- Integration tests using Playwright for E2E scenarios |
| 33 | +- Test files should be co-located with source files or in `__tests__` directories |
| 34 | +- Maintain test coverage above established thresholds |
| 35 | + |
| 36 | +Package Development Guidelines |
| 37 | +- Each package should have a clear single responsibility |
| 38 | +- Follow semantic versioning for all packages |
| 39 | +- Use Changesets for version management and changelogs |
| 40 | +- Packages should export TypeScript types alongside runtime code |
| 41 | +- Use tsup for building packages with proper ESM/CJS dual publishing |
| 42 | + |
| 43 | +Framework Integration Patterns |
| 44 | +- Framework packages should provide idiomatic APIs for their respective frameworks |
| 45 | +- Maintain consistency in naming and patterns across framework integrations |
| 46 | +- Provide both high-level components and low-level utilities |
| 47 | +- Ensure SSR/SSG compatibility where applicable |
| 48 | +- Follow framework-specific best practices and conventions |
| 49 | + |
| 50 | +API Design Principles |
| 51 | +- Design APIs to be intuitive and self-documenting |
| 52 | +- Provide sensible defaults to minimize configuration |
| 53 | +- Support both imperative and declarative usage patterns |
| 54 | +- Maintain backward compatibility when possible |
| 55 | +- Use progressive enhancement for advanced features |
| 56 | + |
| 57 | +Build and Bundle Optimization |
| 58 | +- Use tree-shaking friendly exports |
| 59 | +- Minimize bundle sizes through careful dependency management |
| 60 | +- Use dynamic imports for optional features |
| 61 | +- Monitor bundle sizes with bundlewatch |
| 62 | +- Optimize for both development and production builds |
| 63 | + |
| 64 | +Documentation Standards |
| 65 | +- All public APIs must be documented with JSDoc |
| 66 | +- Provide usage examples in documentation |
| 67 | +- Maintain up-to-date README files for each package |
| 68 | +- Use TypeDoc for generating API documentation |
| 69 | +- Include migration guides for breaking changes |
| 70 | + |
| 71 | +Error Handling Patterns |
| 72 | +- Use proper TypeScript error types |
| 73 | +- Provide meaningful error messages to developers |
| 74 | +- Include error recovery suggestions where applicable |
| 75 | +- Log errors appropriately for debugging |
| 76 | +- Use error boundaries in React components |
| 77 | + |
| 78 | +Performance Considerations |
| 79 | +- Lazy load components and features when possible |
| 80 | +- Implement proper caching strategies |
| 81 | +- Minimize re-renders in React components |
| 82 | +- Use efficient data structures and algorithms |
| 83 | +- Profile and optimize critical paths |
| 84 | + |
| 85 | +Security Guidelines |
| 86 | +- Never commit sensitive keys or credentials |
| 87 | +- Use environment variables for configuration |
| 88 | +- Validate all inputs and sanitize outputs |
| 89 | +- Follow OWASP security best practices |
| 90 | +- Regular security audits of dependencies |
| 91 | + |
| 92 | +Debugging and Development Tools |
| 93 | +- Use browser dev tools for client-side debugging |
| 94 | +- Implement proper logging with different levels |
| 95 | +- Use Clerk's development dashboard for testing |
| 96 | +- Leverage source maps for debugging built code |
| 97 | +- Use performance profiling tools when needed |
| 98 | + |
| 99 | +Integration Testing Approach |
| 100 | +- Each framework integration has its own test suite |
| 101 | +- Use real Clerk instances for integration tests |
| 102 | +- Test authentication flows end-to-end |
| 103 | +- Verify proper error handling and edge cases |
| 104 | +- Test across different browsers and environments |
| 105 | + |
| 106 | +Release Process |
| 107 | +- Use Changesets for managing releases |
| 108 | +- Follow semantic versioning strictly |
| 109 | +- Coordinate releases across dependent packages |
| 110 | +- Test releases in staging environments |
| 111 | +- Maintain detailed changelogs |
| 112 | + |
| 113 | +Local Development Tips |
| 114 | +- Use playground applications to test changes quickly |
| 115 | +- Set up multiple test environments for different scenarios |
| 116 | +- Use Verdaccio for local npm registry testing |
| 117 | +- Leverage hot reloading for faster development cycles |
| 118 | +- Use proper IDE setup with TypeScript support |
| 119 | + |
| 120 | +Contribution Guidelines |
| 121 | +- Follow the established PR template |
| 122 | +- Include tests for all new features |
| 123 | +- Update documentation for API changes |
| 124 | +- Ensure all CI checks pass before merging |
| 125 | +- Get proper code review from team members |
| 126 | + |
| 127 | +Package Maintenance |
| 128 | +- Regularly update dependencies |
| 129 | +- Monitor for security vulnerabilities |
| 130 | +- Deprecate features properly with migration paths |
| 131 | +- Maintain compatibility matrices for supported versions |
| 132 | +- Archive packages that are no longer maintained |
0 commit comments