Standardize Early
Establish rules and patterns before the codebase grows
AI-powered development tools reach their full potential when entire teams use them cohesively. This guide covers strategies for deploying Cursor across teams, maintaining consistency, and maximizing collective productivity.
Create a centralized repository for team-wide Cursor configuration:
#!/bin/bash# sync-rules.sh - Distribute rules to all team projects
REPOS=( "frontend-app" "backend-api" "mobile-app" "admin-dashboard")
for repo in "${REPOS[@]}"; do echo "Syncing rules to $repo..."
# Clone or update repo if [ -d "../$repo" ]; then cd "../$repo" && git pull else git clone "git@github.com:company/$repo.git" "../$repo" fi
# Sync rules based on project type ./scripts/sync-project-rules.sh "$repo"
# Commit changes cd "../$repo" git add .cursor/ git commit -m "chore: Update Cursor rules from team config" git pushdone
{ "mcpServers": { "company-docs": { "command": "npx", "args": ["@company/docs-mcp"], "version": "2.1.0", "env": { "DOCS_URL": "${COMPANY_DOCS_URL}", "API_KEY": "${DOCS_API_KEY}" } }, "jira-integration": { "command": "npx", "args": ["@atlassian/jira-mcp"], "version": "1.5.0", "config": { "instance": "company.atlassian.net", "project": "${JIRA_PROJECT}" } }, "design-system": { "command": "node", "args": ["./mcp/design-system-server.js"], "localPath": true } }}
// Shared project memoriesclass ProjectMemoryManager { async syncMemories() { // Collect approved memories from all developers const memories = await this.collectTeamMemories();
// Deduplicate and validate const validated = await this.validateMemories(memories);
// Create consolidated memory file const consolidated = { version: "1.0", updated: new Date().toISOString(), memories: validated, contributors: this.getContributors(memories) };
// Distribute to team await this.distributeMemories(consolidated); }
private async validateMemories(memories: Memory[]) { // Remove conflicts const deduped = this.deduplicateMemories(memories);
// Ensure accuracy const verified = await this.verifyAgainstCode(deduped);
// Categorize by confidence return this.categorizeByConfidence(verified); }}
# Team Knowledge Base
## Architecture Decisions
### Decision: Microservices Communication- **Date**: 2024-03-15- **Decided by**: Architecture Team- **Context**: Need reliable inter-service communication- **Decision**: Use gRPC for internal, REST for external- **Consequences**: - All services must implement gRPC interfaces - Shared protobuf definitions in central repo - REST adapters for public APIs
### Decision: State Management- **Date**: 2024-04-20- **Decided by**: Frontend Team- **Context**: Complex state across multiple views- **Decision**: Zustand for client, React Query for server- **Rationale**: Simple API, good DevEx, proper separation
## Learned Patterns
### Pattern: Optimistic Updates```typescript// Always follow this pattern for mutationsconst mutation = useMutation({ mutationFn: updateUser, onMutate: async (newData) => { // Cancel in-flight queries await queryClient.cancelQueries(['user', id]);
// Snapshot previous value const previousUser = queryClient.getQueryData(['user', id]);
// Optimistically update queryClient.setQueryData(['user', id], newData);
// Return context for rollback return { previousUser }; }, onError: (err, newData, context) => { // Rollback on error queryClient.setQueryData(['user', id], context.previousUser); }, onSettled: () => { // Refetch regardless queryClient.invalidateQueries(['user', id]); }});
// Integrate Cursor insights into code reviewclass CursorReviewAssistant { async enhanceCodeReview(pr: PullRequest) { const enhancements = { aiSuggestions: await this.getAISuggestions(pr), ruleViolations: await this.checkRuleCompliance(pr), performanceImpact: await this.analyzePerformance(pr), securityIssues: await this.runSecurityScan(pr), testCoverage: await this.assessTestCoverage(pr), };
// Generate review comment const comment = this.formatReviewComment(enhancements);
// Post to PR await github.createReviewComment({ pull_number: pr.number, body: comment, event: 'COMMENT', }); }
private formatReviewComment(enhancements: ReviewEnhancements): string { return `## Cursor AI Review Assistant
### Rule Compliance${this.formatRuleViolations(enhancements.ruleViolations)}
### AI Suggestions${this.formatSuggestions(enhancements.aiSuggestions)}
### Performance Analysis${this.formatPerformance(enhancements.performanceImpact)}
### Security Scan${this.formatSecurity(enhancements.securityIssues)}
### Test Coverage${this.formatCoverage(enhancements.testCoverage)} `; }}
Setting Up Team Background Agents
# Configure Slack integration for Background Agentscursor slack setup --enable-agents
# Link to workspace with agent permissionscursor slack link --workspace=company.slack.com --allow-agents
# Configure agent channels and permissionscursor slack configure \ --channel=#dev-team \ --agent-channel=#cursor-agents \ --max-concurrent=5 \ --budget-limit=100
Team Workflow Examples
# In Slack channel #dev-team@Cursor implement the user dashboard from Figma design- Use our design system components- Make it responsive- Add loading states- Include error handling- Write tests
The agent will:
Using Slack Commands
Background Agents are triggered directly in Slack by mentioning @Cursor. Here are example commands:
# Fix a bug@Cursor fix bug #456 in the payment processing module- Check the error logs for root cause- Add proper error handling- Write regression tests- Create a PR with the fix
# Review a PR@Cursor review PR #123- Check for code quality issues- Verify test coverage- Look for security vulnerabilities- Suggest improvements
# Implement a feature@Cursor implement user dashboard from issue #234- Follow our design system- Make it responsive- Add loading states- Include error handling- Write comprehensive tests
Advanced Slack Options:
# Target specific repository@Cursor [repo=company/frontend] implement dark mode toggle
# Set branch name@Cursor [branch=feature/oauth] add Google OAuth integration
# Multiple agents for parallel work@Cursor implement authentication module@Cursor implement payment processing@Cursor create admin dashboard
Access and manage all team Background Agents from any device:
export function TeamAgentDashboard() { const [agents, setAgents] = useState<Agent[]>([]); const [teamMetrics, setTeamMetrics] = useState<TeamMetrics>();
useEffect(() => { // Connect to real-time agent updates const ws = new WebSocket('wss://cursor.com/agent/ws');
ws.on('agent:started', (agent) => { setAgents(prev => [...prev, agent]); });
ws.on('agent:progress', (update) => { setAgents(prev => prev.map(a => a.id === update.agentId ? { ...a, ...update } : a )); });
ws.on('agent:completed', (result) => { // Update metrics updateTeamMetrics(result); }); }, []);
return ( <Dashboard> <MetricsPanel> <Metric label="Active Agents" value={agents.filter(a => a.status === 'running').length} /> <Metric label="Tasks Completed Today" value={teamMetrics?.completedToday} /> <Metric label="Average Time" value={teamMetrics?.avgCompletionTime} /> <Metric label="Cost Today" value={`$${teamMetrics?.costToday}`} /> </MetricsPanel>
<AgentGrid> {agents.map(agent => ( <AgentCard key={agent.id}> <AgentHeader> <User>{agent.triggeredBy}</User> <Status>{agent.status}</Status> </AgentHeader> <Task>{agent.task}</Task> <Progress value={agent.progress} /> <Actions> <Button onClick={() => takeOver(agent)}>Take Over</Button> <Button onClick={() => viewDetails(agent)}>View Details</Button> </Actions> </AgentCard> ))} </AgentGrid> </Dashboard> );}
Access Background Agents from mobile devices via the web interface:
Mobile Web Access
Mobile Slack Integration
# From Slack mobile app@Cursor implement the feature from issue #345- I'm commuting but need this started- Follow our mobile-first approach- Ping me when PR is ready
Best Practices for Mobile
Parallel Team Development
Sprint Task Distribution via Slack:
# In your sprint planning channel@Cursor implement user authentication (Task SPRINT-101)@Cursor create payment processing module (Task SPRINT-102)@Cursor build admin dashboard (Task SPRINT-103)@Cursor add email notifications (Task SPRINT-104)
Each agent will:
Monitoring Multiple Agents:
Code Review Automation
Setting Up Automated Reviews:
Create a GitHub Action that posts to Slack when PRs are opened:
name: Request Cursor Review
on: pull_request: types: [opened, synchronize]
jobs: request-review: runs-on: ubuntu-latest steps: - name: Post to Slack for Cursor Review uses: slackapi/slack-github-action@v1.24.0 with: channel-id: 'cursor-reviews' slack-message: | @Cursor review PR ${{ github.event.pull_request.html_url }} - Check code quality and patterns - Verify test coverage - Run security scan - Analyze performance impact - Ensure documentation is complete
The Background Agent will analyze the PR and post its findings as a comment.
Team Knowledge Sharing
class TeamKnowledgeSync { async syncTeamMemories() { // Collect memories from all team members const teamMemories = await this.collectTeamMemories();
// Merge and deduplicate const mergedMemories = this.mergeMemories(teamMemories);
// Create shared memory file await fs.writeFile('.cursor/team-memories.md', this.formatMemories(mergedMemories));
// Notify team await this.notifyTeam({ message: 'Team memories synchronized', newPatterns: mergedMemories.filter((m) => m.isNew).length, totalMemories: mergedMemories.length, }); }}
// Cursor + Live Share integrationclass CollaborativeSession { async startPairProgramming(sessionConfig: SessionConfig) { // Start VS Code Live Share const session = await vscode.liveshare.share();
// Create shared Cursor configuration const cursorConfig = { // Shared rules for the session rulesPath: '.cursor/team-rules', // Shared context files contextFiles: ['CLAUDE.md', 'docs/architecture.md'], // Model preferences model: 'claude-4-sonnet', };
// Save config for all participants await fs.writeFileSync( '.cursor/collaborative-session.json', JSON.stringify(cursorConfig, null, 2) );
// Set up real-time sync session.onDidChangeParticipants((participants) => { // Notify participants to reload Cursor config this.notifyConfigUpdate(participants); });
return { sessionUrl: session.url, accessCode: session.accessCode, instructions: 'All participants should open Cursor with the shared config', }; }}
#!/bin/bashecho "Welcome to the team! Setting up your Cursor environment..."
# 1. Install Cursorif ! command -v cursor &> /dev/null; then echo "Installing Cursor..." brew install --cask cursorfi
# 2. Clone team configgit clone git@github.com:company/cursor-team-config.git ~/.cursor-team
# 3. Set up authenticationecho "Setting up SSO..."cursor auth login --sso --domain=company.com
# 4. Install team MCP serversecho "Installing team MCP servers..."cd ~/.cursor-team && npm install
# 5. Sync rulesecho "Syncing team rules..."./scripts/sync-rules.sh --user
# 6. Configure workspaceecho "Setting up workspace..."cursor config set --team-defaults
# 7. Run verificationecho "Verifying setup..."./scripts/verify-setup.sh
echo "Setup complete! You're ready to start coding with the team."
// Real-time team performance metricsclass TeamMetricsDashboard { metrics = { productivity: { codeGenerated: new MetricCollector('lines_generated'), tasksCompleted: new MetricCollector('tasks_completed'), bugsFixed: new MetricCollector('bugs_fixed'), testsWritten: new MetricCollector('tests_written'), }, efficiency: { timeToComplete: new MetricCollector('task_duration'), aiAcceptanceRate: new MetricCollector('ai_acceptance'), refactorSuccess: new MetricCollector('refactor_success'), reviewTurnaround: new MetricCollector('review_time'), }, quality: { bugRate: new MetricCollector('bugs_per_kloc'), testCoverage: new MetricCollector('coverage_percent'), codeComplexity: new MetricCollector('complexity_score'), ruleCompliance: new MetricCollector('rule_adherence'), }, };
async generateTeamReport(): Promise<TeamReport> { const period = { start: lastWeek(), end: now() };
return { summary: await this.calculateSummary(period), trends: await this.analyzeTrends(period), recommendations: await this.generateRecommendations(), individualMetrics: await this.getIndividualStats(period), }; }}
// Team-wide resource allocation{ "cursor.team.resources": { "tokenAllocation": { "method": "dynamic", "baseAllocation": 100000, "bonusPool": 500000, "allocationRules": { "priority": "task-based", "weights": { "feature-development": 0.4, "bug-fixes": 0.3, "refactoring": 0.2, "documentation": 0.1 } } }, "modelAccess": { "default": "claude-4-sonnet", "elevated": { "criteria": "complexity > 8 || priority === 'critical'", "model": "claude-4.1-opus" } } }}
// Automated conflict resolutionclass RuleConflictResolver { async resolveConflicts(conflicts: RuleConflict[]) { for (const conflict of conflicts) { const resolution = await this.determineResolution(conflict);
switch (resolution.type) { case 'merge': await this.mergeRules(conflict.rules); break;
case 'prioritize': await this.prioritizeRule(resolution.winner); break;
case 'escalate': await this.escalateToTeam(conflict); break; } } }
private async determineResolution(conflict: RuleConflict) { // Check if rules can be merged if (this.areMergeable(conflict.rules)) { return { type: 'merge' }; }
// Check priority levels const priorities = conflict.rules.map((r) => r.priority); if (Math.max(...priorities) > Math.min(...priorities)) { return { type: 'prioritize', winner: conflict.rules.find((r) => r.priority === Math.max(...priorities)), }; }
// Escalate to team return { type: 'escalate' }; }}
// AI-assisted merge conflict resolutionclass MergeConflictAssistant { async resolveMergeConflict(conflictFile: string) { // Create a structured prompt for Cursor const mergePrompt = ` Analyze this merge conflict and suggest the best resolution: 1. Understand the intent of both changes 2. Preserve functionality from both branches 3. Explain your reasoning 4. Provide alternative solutions if applicable
Use @Git to see the conflict markers and history Use @Files to understand the broader context `;
// Open conflict file in Cursor await execAsync(`cursor "${conflictFile}"`);
// Guide for manual resolution return { instructions: [ '1. Open the conflict file in Cursor', '2. Use Agent mode (Ctrl+I) with the merge prompt', '3. Review suggested resolution', '4. Apply changes using the Apply button', '5. Test the resolved code before committing', ], prompt: mergePrompt, tips: [ 'Use @Git to understand change history', 'Check @Recent Changes for context', 'Run tests after resolution', ], }; }}
Standardize Early
Establish rules and patterns before the codebase grows
Document Decisions
Capture architectural decisions and patterns in shared rules
Regular Sync
Schedule weekly rule reviews and updates
Monitor Usage
Track AI usage patterns to optimize team workflows
## AI-Enhanced Daily Standup
### Yesterday
- Completed: [Cursor Summary of Commits]- AI Assistance: 85% acceptance rate- Blockers Resolved: Authentication bug via Agent mode
### Today
- Plan: Implement user dashboard- Approach: TDD with Cursor test generation- Dependencies: Need design tokens from Figma MCP
### Blockers
- Waiting on API documentation- Cursor suggesting deprecated patterns - need rule update
## AI-Assisted Code Review Checklist- [ ] Cursor rule compliance verified- [ ] AI suggestions reviewed and applied- [ ] Test coverage meets standards- [ ] Performance impact analyzed- [ ] Security scan passed- [ ] Documentation updated
### AI Insights- Suggested optimizations: 3 applied, 1 rejected- Pattern violations: None- Complexity score: 4.2 (acceptable)
2-5 Developers
6-20 Developers
20-50 Developers
50+ Developers
Metric | Target | Measurement |
---|---|---|
AI Acceptance Rate | >80% | Accepted suggestions / Total suggestions |
Time to Feature | -40% | Average feature completion time |
Bug Introduction Rate | -60% | Bugs per 1000 lines of code |
Code Review Time | -50% | Average PR review duration |
Onboarding Time | -70% | Time to first production commit |
Remember: Team collaboration with AI is about amplifying collective intelligence. When done right, the team becomes more than the sum of its parts.