The Compass Contribution Guide is available on the official doc site: https://docs.compasscalendar.com/docs/how-to-contribute/contribute
This section provides specific guidelines for AI coding agents working on Compass.
-
Read the Documentation First
-
Environment Setup
yarn install --frozen-lockfile --network-timeout 300000 cp packages/backend/.env.local.example packages/backend/.env yarn dev:web # Verify frontend works -
Understand the Codebase
- Use
yarn ai:indexto generate semantic search index - Explore
ai-tools/directory for helpful scripts - Review architecture in AGENTS.md
- Use
ALWAYS use module aliases instead of relative paths:
// ✅ Correct
import { foo } from '@compass/core'
import { bar } from '@web/common/utils'
import { baz } from '@core/types'
// ❌ Wrong
import { foo } from '../../../core/src'
import { bar } from '../../common/utils'ALWAYS use Zod for validation:
import { z } from "zod";
// Define schema
export const UserSchema = z.object({
id: z.string(),
email: z.string().email(),
name: z.string().min(1),
});
// Export type from schema
export type User = z.infer<typeof UserSchema>;
// Use for validation
export const validateUser = (data: unknown): User => UserSchema.parse(data);Write tests following user behavior patterns:
// ✅ Correct - Using semantic queries
const button = screen.getByRole('button', { name: /save/i });
await user.click(button);
// ❌ Wrong - Using implementation details
const button = container.querySelector('.save-button');
button.click();Document all backend routes with JSDoc:
/**
* Get user profile information
* @route GET /api/user/profile
* @auth Required - Supertokens session
* @returns {UserProfile} User profile data
* @throws {401} Unauthorized - Invalid or missing session
* @throws {404} Not Found - User not found
*/
.get(userController.getProfile);Always include proper error handling:
try {
const result = await apiCall();
return { success: true, data: result };
} catch (error) {
logger.error('Operation failed', { error, context });
throw new ApiError('User-friendly message', 500);
}Follow semantic branch naming:
# Format: type/action[-issue-number]
feature/add-calendar-sync
bug/fix-auth-timeout
docs/update-api-docs
refactor/simplify-event-handlerUse conventional commit format:
# Format: type(scope): description
feat(web): add calendar event creation modal
fix(backend): resolve authentication timeout issue
docs(readme): update installation instructions
refactor(core): simplify date utility functions
test(web): add unit tests for login componentCommit Types:
feat- New featuresfix- Bug fixesdocs- Documentation changesstyle- Code style changes (formatting, semicolons)refactor- Code refactoringtest- Adding or updating testschore- Maintenance tasks, dependency updates
Scope Examples:
web- Frontend/React changesbackend- Server/API changescore- Shared utilities/typesscripts- CLI tools and build scriptsconfig- Configuration files
-
Run Type Checking
yarn type-check
-
Run Tests
yarn test:core yarn test:web yarn test:backend
-
Check Code Health
yarn audit:code-health
-
Format Code
yarn prettier . --write -
Generate Documentation (if you added/modified APIs)
yarn docs:generate
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix (non-breaking change fixing an issue)
- [ ] New feature (non-breaking change adding functionality)
- [ ] Breaking change (fix or feature causing existing functionality to change)
- [ ] Documentation update
## Testing
- [ ] Unit tests pass (`yarn test:core`, `yarn test:web`, `yarn test:backend`)
- [ ] E2E tests pass (if applicable)
- [ ] Manual testing completed
## Checklist
- [ ] Code follows project style guidelines
- [ ] Self-review completed
- [ ] Comments added for complex logic
- [ ] Documentation updated
- [ ] No new warnings introduced
- [ ] Tests added/updated as needed- Don't use barrel files (
index.ts) - Use named exports directly - Don't use raw Tailwind colors - Use semantic theme colors (
bg-bg-primarynotbg-blue-300) - Don't test login without backend - Frontend tests should work standalone
- Don't modify unrelated code - Keep changes surgical and focused
- Don't skip type checking - Always run
yarn type-checkbefore submitting - Don't ignore linter warnings - Fix all warnings in your code
- Don't use relative imports - Always use module aliases
The ai-tools/ directory contains helper scripts:
generate-api-docs.ts- Extract and document all API endpointsextract-types.ts- Generate type documentationcode-health-audit.ts- Analyze code quality metricssemantic-index.ts- Build search index for code navigationtest-harness.ts- Template for automated testing workflows
Run any tool with:
yarn ts-node ai-tools/<script-name>.ts- OpenAI Harness Engineering: https://openai.com/index/harness-engineering/
- Loop Methodology: https://ghuntley.com/loop/
- Testing Library: Best practices for user-centric testing
- Zod Documentation: Type-safe validation patterns
For issues or questions:
- Check existing GitHub issues
- Review AGENTS.md and docs
- Join GitHub Discussions
- Create a new issue with detailed context