This file provides configuration and guidance for AI agents working with the BigDesign component library.
- Glob: Fast file pattern matching for finding components, tests, and documentation
- Grep: Powerful regex search using grep for code patterns and implementations
- Read: File content analysis with support for TypeScript, React, and test files
- Edit: Precise string replacements in existing files
- MultiEdit: Batch edits across multiple locations in a single file
- Write: Create new files when absolutely necessary (prefer editing existing files)
- Bash: Execute build, test, lint, and development commands
- TodoWrite: Track multi-step tasks and ensure completion
When working with components, follow this established pattern:
packages/big-design/src/components/ComponentName/
├── ComponentName.tsx # Main component implementation
├── styled.tsx # Styled components and styling
├── index.ts # Public exports
├── spec.tsx # Jest tests
├── __snapshots__/ # Jest snapshots
└── SubComponent/ # Sub-components (if any)
├── SubComponent.tsx
├── styled.tsx
└── index.ts
Always run from repository root:
# Setup (required before development)
pnpm install
pnpm run build:icons
# Development
pnpm run start # Start docs with live reload
# Testing
pnpm run test # Run all tests
pnpm -F @bigcommerce/big-design run test # Package-specific tests
pnpm run test --update-snapshot # Update snapshots
# Code Quality
pnpm run lint # Lint all packages
pnpm run typecheck # Type check all packages- Use strict typing with proper interfaces
- Extend base HTML element props when appropriate
- All styling in
styled.tsxfiles - Use theme tokens from
@bigcommerce/big-design-theme - Implement responsive design patterns
- Support logical margin/padding system props (not directional)
- Do not forward
classNameandstyleprops unless explicitly instructed by a human
- Jest tests with React Testing Library in
spec.tsx - Test component rendering, interactions, and accessibility
- Snapshot tests for styled components (may need updates after style changes) but only 1-2 per spec file
- Use
jest-styled-componentsfor style assertions
- Add usage examples in component documentation
- Update docs site examples when adding or changing features
- Full test suite:
pnpm run test - Package-specific:
pnpm -F @bigcommerce/big-design run test - Watch mode:
pnpm run test:watch - Coverage:
pnpm run ci:test
When styled components change:
- Navigate to package:
cd packages/big-design - Update snapshots:
pnpm run test --update-snapshot - Review snapshot changes carefully before committing
- Group related tests using
describeblocks but only for related functionality - Test both positive and negative scenarios
- Include accessibility tests with appropriate ARIA attributes
- Mock external dependencies appropriately
Always run before committing:
pnpm run lint # ESLint + Prettier
pnpm run typecheck # TypeScript compilation- Make changes to components/tests
- Run
pnpm run build:iconsif icon changes - Run
pnpm run lintand fix any issues - Run
pnpm run typecheckand resolve type errors - Run
pnpm run testand ensure all tests pass - Generate a changeset using
pnpm changesetwhile following the prompts to the best of your ability - Update snapshots if needed
- Commit changes
- Monorepo with workspace dependencies using
workspace:^protocol - Turborepo handles build orchestration and caching
- Package build outputs go to
dist/directories - Icons must be built before other packages
Resolve dependency ordering via Turbo
- Icons not found: Run
pnpm run build:icons - Type errors: Ensure all packages are built in correct order
- Stale cache: Clear with
turbo cleanif needed
- Start with
pnpm run start - Documentation lives in
packages/docs/ - Uses Next.js with live code examples
- Component examples are interactive and editable
- Include live code examples using the docs component system
- Document all props with descriptions and examples following existing patterns
- Include accessibility guidelines and best practices
- Use TodoWrite tool for multi-step component development
- Break down complex tasks (new components, major refactors)
- Track progress through build, test, and documentation phases
- Understand existing patterns: Read similar components first
- Check dependencies: Examine imports and package.json files
- Follow conventions: Match existing code style and patterns
- Test thoroughly: Run full test suite after changes
- Build errors: Check TypeScript types and imports
- Test failures: Review snapshots and component behavior
- Lint errors: Follow established code formatting rules
- Type errors: Ensure proper prop interfaces and theme usage
- Prefer editing existing files over creating new ones
- Follow naming conventions established in the codebase
- Use MultiEdit for multiple changes in the same file
- Read files first to understand context before editing
- All styling uses
@bigcommerce/big-design-theme - Use theme tokens for colors, spacing, typography
- Icons are SVG components in
@bigcommerce/big-design-icons - Build icons before other packages:
pnpm run build:icons - Icons are used throughout components for consistency
- All interactive components must be keyboard accessible
- Include proper ARIA attributes and roles
- Test with screen readers when possible
- Follow WCAG 2.2 AA guidelines
- Modern browsers (Chrome, Firefox, Safari, Edge)
- React 18 and styled-components 5.x
- TypeScript strict mode enabled
- Check TypeScript errors first
- Ensure icons are built:
pnpm run build:icons - Clear cache:
turbo clean - Rebuild:
pnpm run build
- Check if snapshots need updating
- Verify component changes don't break existing behavior
- Run tests in isolation to identify specific failures
- Update snapshots carefully after reviewing changes
- All packages must build successfully
- Tests must pass completely
- Documentation must build without errors