7.4 KiB
source, confidence, namespace, last_synced, alwaysApply
| source | confidence | namespace | last_synced | alwaysApply |
|---|---|---|---|---|
| ~/DuckDuckGo/apple-browsers.git/main/.cursor/rules/general.mdc | 0.9 | work | 2026-04-28 | true |
DuckDuckGo Browser Development Rules Overview
Project Context
This is the DuckDuckGo browser for iOS and macOS, built with privacy-first principles, modern Swift patterns, and cross-platform architecture.
Key Directories:
iOS/- iOS browser app (UIKit + SwiftUI hybrid)macOS/- macOS browser app (AppKit + SwiftUI hybrid)SharedPackages/- Cross-platform Swift packages
Architecture Summary
- Pattern: MVVM + Coordinators + Dependency Injection
- UI: SwiftUI preferred, UIKit/AppKit for legacy
- Storage: Core Data + GRDB + Keychain for sensitive data
- Design: DesignResourcesKit for colors/icons (MANDATORY)
- Testing: >80% coverage required
Available Rules (.cursor/rules/)
Development rules are stored in .cursor/rules/.
You MUST list all the available rules and you MUST consult the appropriate rule file before starting any work!
Core (Always Apply)
anti-patterns.mdc- What NOT to do; use with ViewModels, testing, WebView workcode-style.mdc- Swift style guideprivacy-security.mdc- Privacy requirements; use with network calls, analytics, credentialsimport-hygiene.mdc- Import management and SwiftUI preview scopinglogging-guidelines.mdc- Logger usage (never print())
Architecture & Patterns
architecture.mdc- MVVM, DI patterns; use for new ViewModelsproject-structure.mdc- Directory layoutbrowserserviceskit-integration.mdc- BSK integration; use for cross-platform codeshared-packages.mdc- Cross-platform packages; use for cross-platform codesubscription-architecture.mdc- Privacy Pro subscription
Feature Development
feature-flags.mdc+feature-flags-addition.mdc- Feature flagsabn-experiment-framework.mdc- A/B testinguser-defaults-storage.mdc- UserDefaults, @UserDefaultsWrapper; use for settings/preferences
UI Development
swiftui-style.mdc- SwiftUI + DesignResourcesKit; use for new ViewModels, UI workswiftui-advanced.mdc- Advanced SwiftUI patternsdesign-system-designresourceskit.mdc- Colors, typography, icons (MANDATORY)webkit-browser.mdc- WebView patterns
Platform-Specific
ios-architecture.mdc- iOS AppDependencyProvider, MainCoordinator, UIKitios-tracker-blocking-implementation.mdc- iOS content blockingmacos-window-management.mdc- macOS windowsmacos-system-integration.mdc- macOS system servicesmacos-singletons-removal.mdc- Removing singletons from macOS
Feature-Specific
duckplayer.mdc+duckplayer-userscript-integration.mdc- DuckPlayersecurevault-guidelines.mdc- Credentials/vault storageapp-lifecycle-state-machine.mdc- App state managementnetwork-quality-*.mdc(4 files) - Network quality assessment
Testing & Quality
testing.mdc- Testing patterns, xcodebuild commandsui-testing.mdc- UI testing for macOS browsermaestro-device-selection.mdc- Maestro test device configperformance-optimization.mdc- Performance; use with network calls
Workflow & Process
development-commands.mdc- Build commandspull-request.mdc+branch-naming-conventions.mdc- PRs and git workflowanalytics-patterns.mdc- Pixel analytics
Quick Start Checklist
Before Writing Any Code:
- ✅ Read
privacy-security.mdc- Privacy is non-negotiable - ✅ Check platform rules (
ios-architecture.mdcormacos-system-integration.mdc) - ✅ Review
anti-patterns.mdc- Avoid common mistakes - ✅ REMEMBER: NEVER commit, push, or run tests without explicit user permission or unless explicitly asked to
For UI Development:
- ✅ Use
swiftui-style.mdcfor SwiftUI components - ✅ MUST use DesignResourcesKit colors:
Color(designSystemColor: .textPrimary) - ✅ MUST use DesignResourcesKit icons:
DesignSystemImages.Glyphs.Size16.add
For New Features:
- ✅ Follow
architecture.mdcfor MVVM + DI patterns - ✅ Use AppDependencyProvider (iOS) or equivalent (macOS)
- ✅ Write tests per
testing.mdcrequirements
Critical Don'ts (from anti-patterns.mdc)
- ❌ NEVER commit, push changes, create or delete branches on git or trigger github actions without EXPLICIT user permission
- ❌ NEVER run tests without EXPLICIT user permission or if user explicitly asked to in their prompt
- ❌ NEVER use
.sharedsingletons - use dependency injection instead - ❌ NEVER hardcode colors/icons (use DesignResourcesKit)
- ❌ NEVER update UI without @MainActor
- ❌ NEVER ignore privacy implications
- ❌ NEVER force unwrap without justification
- ❌ NEVER use
print()statements - use appropriate Logger extensions instead
Logging Guidelines
NEVER use print() in production code. ALWAYS use appropriate Logger extensions:
Example: See logging-guidelines.swift
Available Logger categories:
Logger.general- General app functionalityLogger.network- Network requests and responsesLogger.ui- UI updates and user interactionsLogger.tests- Test-specific logging (importos.login tests)
Benefits of Logger extensions:
- Structured logging with categories and levels
- Better performance than print() statements
- Automatic log collection and filtering
- Integration with system logging infrastructure
Dependency Injection Pattern (iOS)
Example: See dependency-injection-pattern.swift
Design System Usage (MANDATORY)
Example: See design-system-usage.swift
Code Review Checklist
- Privacy implications assessed (
privacy-security.mdc) - Design system properly used (
design-system-designresourceskit.mdc) - Architecture patterns followed (platform-specific rules)
- Anti-patterns avoided (
anti-patterns.mdc) - Tests written and passing (
testing.mdc) - Performance considered (
performance-optimization.mdc) - PR template followed (
pull-request.mdc)
Git & Testing Workflow Rules
🚨 MANDATORY: Never Auto-Execute Commands
NEVER commit, push, or run tests without EXPLICIT user permission.
Git Workflow:
- Make file changes as requested
- STOP before any
git add,git commit, orgit pushcommands - ASK the user: "Should I commit/push these changes?"
- WAIT for explicit permission (e.g., "yes", "commit it", "push it", "go ahead")
- Only then execute git commands
Testing Workflow:
- Write or modify code as requested
- STOP before running any tests (
swift test,npm test,xcodebuild test, etc.) - ASK the user: "Should I run the tests?"
- WAIT for explicit permission (e.g., "yes", "run tests", "test it")
- Only then execute test commands
What NOT to Do:
Example: See git-workflow-wrong.sh
What TO Do:
Example: See git-workflow-correct.sh
These rules have NO exceptions. Always ask before executing git or test commands.
Communication Style
- Keep responses concise and focused on the task
- Avoid enthusiastic language like "Perfect!", "You are absolutely right!", "Excellent!"
- Keep work summaries brief - focus on what was changed, not how great it is
- Let the code quality speak for itself rather than using excessive praise
This overview ensures you understand the project context and know which specific rules to consult for your development task.