This file contains important guidelines and preferences for AI agents working on this project. Following these guidelines will help maintain code quality, consistency, and project standards.
This is Apsara Design System - a React component library built with:
- TypeScript for type safety
- CSS Modules for styling
- Vitest for testing
- pnpm for package management
- Biome for code formatting and linting
- Monorepo structure with documentation site
packages/raystack/ # Main component library
├── components/ # React components
├── hooks/ # Custom hooks
├── icons/ # Icon components
├── styles/ # Global styles
├── types/ # Type definitions
└── test-utils.tsx # Testing utilities
apps/www/ # Documentation site
├── src/content/docs/ # Component documentation
└── src/components/playground/ # Demo examples
- NO
anyTYPES - Use specific types,unknown, or generics - NO direct npm/yarn - Always use
pnpm - NO ignored linting errors - Fix all issues properly
- NO outdated documentation - Keep docs in sync with code
- NO CSS-in-JS or inline styles - Use CSS Modules only
- NO Tailwind CSS - Use CSS Modules for all styling
- Always use
pnpm- Never usenpmoryarn - Installing dependencies:
pnpm add <package>orpnpm add -D <package> - Running scripts:
pnpm run <script>orpnpm <script>
- Never use
anytype - This is a strict rule - Use specific types, interfaces, or union types instead
- Prefer
unknownoveranywhen type is genuinely unknown - Use generic types
<T>for reusable components/functions - Always provide explicit return types for functions
- Use CSS Modules exclusively for component styling
- File naming:
component-name.module.css - Import:
import styles from './component-name.module.css' - Usage:
className={styles.className} - Follow accessibility standards (ARIA labels, keyboard navigation)
- Ensure responsive design works across different screen sizes
- Use semantic HTML elements appropriately
- Use Vitest for all tests (migrated from Jest)
- Write comprehensive tests for utilities and components
- Use proper TypeScript types in tests (never use
any) - Import from
vitestnotjest - Test file pattern:
__tests__/component.test.tsx
When adding/updating components:
- Component docs: Update
apps/www/src/content/docs/components/ - Demo examples: Update
apps/www/src/components/playground/ - Props documentation: Keep API docs in sync with implementation
Required for:
- New components or hooks
- API/props changes
- New styling variants
- Behavior modifications
- Analyze existing patterns before implementing new features
- Run
pnpm formatafter making changes - Write tests using Vitest for new utilities/components
- Update documentation when changing component APIs
- Start with minimal viable implementation then enhance
- Test early and often during development
- Be transparent about limitations or uncertainties
- Ask for clarification when requirements are ambiguous
- Explain your reasoning for architectural decisions
- Provide detailed error messages with context
- Include relevant code snippets when reporting issues
Before completing any task:
- Code follows TypeScript best practices (no
any) - Styling uses CSS Modules correctly
- Tests are written and passing
- Documentation is updated
- Code is formatted with
pnpm format - Follows existing project patterns
- No linting errors remain
- Accessibility considerations addressed
- Error states and edge cases handled
When finishing a task:
- Summarize what was implemented - Key features and changes
- Note any limitations - What wasn't implemented or edge cases
- Provide usage examples - How to use the new functionality
- Suggest next steps - Potential improvements or related tasks
- Confirm all requirements met - Review against original request
Following these guidelines ensures high-quality, maintainable code that aligns with project standards and team expectations.