Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Work with multiple repositories in Cursor: multi-root workspaces, monorepo patterns, selective indexing, and cross-project context. Triggers on "cursor multi repo", "cursor multiple projects", "cursor monorepo", "cursor workspace", "multi-root workspace".
.claude/skills/jeremylongshore-cursor-multi-repo/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 44% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 8% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 32% | 0% |
| case-16 | ✗→✓ | ▲ Improved | 233% | 0% |
| case-17 | ✗→✓ | ▲ Improved | 20% | 0% |
Configure multi-root workspaces so Cursor sees only repositories and files needed for the task, preserving repository ownership and context boundaries.
| Condition | Safe response | |---|---| | Unrelated repository appears in context | Remove the root, start a new chat, and verify indexing scope. | | Rules conflict across roots | Apply the most restrictive relevant rule and resolve the conflict through repository owners. | | Memory/indexing becomes slow | Close inactive roots rather than disabling ignore or security controls. |
To change an API contract and its client, open only those two repositories, attach the contract file explicitly, and create separate reviewed commits. Close the client root when the cross-repo validation is complete.
Work with multiple repositories and monorepo structures in Cursor. Covers multi-root workspaces, selective indexing, cross-project context, and rule inheritance patterns.
Open multiple project roots in a single Cursor window:
File > Open Folder > select project AFile > Add Folder to Workspace... > select project BFile > Save Workspace As... > mywork.code-workspacejson// mywork.code-workspace { "folders": [ { "path": "/home/dev/api-service" }, { "path": "/home/dev/web-frontend" }, { "path": "/home/dev/shared-lib" } ], "settings": { "editor.tabSize": 2, "files.exclude": { "**/node_modules": true, "**/dist": true } } }
Open workspace: cursor mywork.code-workspace or double-click the file.
@Codebase searches across all open roots@Files paths include the root name: @api-service/src/routes/users.tsbashcursor /path/to/monorepo
Pros: @Codebase searches everything, cross-package references work naturally Cons: Slow indexing on large monorepos, lots of irrelevant search results
bash# Open just the package you're working on cursor /path/to/monorepo/packages/api
Pros: Fast indexing, focused search results Cons: No automatic cross-package context
bash# Open the monorepo root but exclude what you don't need cursor /path/to/monorepo
gitignore# .cursorignore at monorepo root # Only index packages you're actively working on # Exclude everything in packages/ packages/*/ # Except the ones you want indexed: !packages/api/ !packages/shared/ # Always exclude node_modules/ dist/ build/ .turbo/
This indexes only packages/api/ and packages/shared/, keeping search focused.
In a multi-root workspace, use the root folder name as prefix:
@api-service/src/types/user.ts @web-frontend/src/hooks/useAuth.ts
The User type in the API doesn't match the frontend hook.
Show me the differences and suggest how to share the type.Use project rules to guide cross-project imports:
yaml# .cursor/rules/monorepo-imports.mdc (in monorepo root) --- description: "Monorepo import conventions" globs: "" alwaysApply: true --- # Import Rules - Shared types: import from @myorg/shared (never relative paths across packages) - Shared UI: import from @myorg/ui - Never import directly from another app package (apps/api → apps/web is forbidden) - Each package declares its own dependencies in package.json
monorepo/
├── .cursor/rules/
│ ├── global.mdc # alwaysApply: true (applies everywhere)
│ └── security.mdc # alwaysApply: true
├── packages/
│ ├── api/
│ │ └── .cursor/rules/
│ │ └── api-patterns.mdc # Scoped to api/ files
│ ├── web/
│ │ └── .cursor/rules/
│ │ └── react-patterns.mdc # Scoped to web/ files
│ └── shared/Behavior:
In a multi-root workspace, each root has its own .cursor/rules/:
# Workspace contains:
api-service/
.cursor/rules/express-patterns.mdc # Only applies to api-service files
web-frontend/
.cursor/rules/react-patterns.mdc # Only applies to web-frontend filesRules do NOT cross workspace roots. Each project's rules are independent.
bashcursor packages/api/ # Only indexes packages/api/ # Fast, focused, no cross-package noise
gitignore# .cursorignore at monorepo root packages/*/ !packages/api/ !packages/shared/ !packages/config/
gitignore# .cursorignore node_modules/ dist/ build/ .turbo/ .next/ coverage/ *.lock *.min.js **/*.test.ts # Optional: exclude tests from indexing **/fixtures/ # Test fixtures **/migrations/ # Database migrations (reference via @Files)
Each open workspace root consumes memory for indexing. Minimize open roots:
# Instead of opening 5 repos:
cursor repo1/ repo2/ repo3/ repo4/ repo5/ # Heavy
# Open only what you need:
cursor repo1/ # Light
# Add repo2/ only when needed via File > Add Folder1. Use .cursorignore aggressively
2. Open specific packages, not the root
3. Close workspace folders you're not actively editing
4. Start new chats when switching between packages
5. Use @Files for cross-package references instead of @Codebase.cursor/rules/ should be reviewed in PRs like any other configuration change.| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-12 | pass→pass | 4,942 | 2,945 | -40% | 1 | 1 | 0% | 918 | 2,123 | +131% | 0 | 0 | — |
case-01 | fail→pass | 11,515 | 7,812 | -32% | 1 | 1 | 0% | 2,140 | 3,073 | +44% | 0 | 0 | — |
case-02 | fail→pass | 14,632 | 15,316 | +5% | 1 | 1 | 0% | 2,603 | 2,823 | +8% | 0 | 0 | — |
case-03 | pass→pass | 7,450 | 4,492 | -40% | 1 | 1 | 0% | 1,456 | 2,402 | +65% | 0 | 0 | — |
case-04 | pass→pass | 12,934 | 10,111 | -22% | 1 | 1 | 0% | 2,329 | 3,592 | +54% | 0 | 0 | — |
case-05 | pass→pass | 11,538 | 8,865 | -23% | 1 | 1 | 0% | 1,390 | 2,483 | +79% | 0 | 0 | — |
case-06 | pass→pass | 14,946 | 13,077 | -13% | 1 | 1 | 0% | 1,914 | 3,005 | +57% | 0 | 0 | — |
case-13 | fail→pass | 11,785 | 6,354 | -46% | 1 | 1 | 0% | 1,966 | 2,601 | +32% | 0 | 0 | — |
case-07 | pass→pass | 13,404 | 9,423 | -30% | 1 | 1 | 0% | 2,326 | 3,369 | +45% | 0 | 0 | — |
case-08 | pass→pass | 5,810 | 1,889 | -67% | 1 | 1 | 0% | 1,048 | 1,957 | +87% | 0 | 0 | — |
case-09 | pass→pass | 8,821 | 4,949 | -44% | 1 | 1 | 0% | 1,478 | 2,409 | +63% | 0 | 0 | — |
case-10 | pass→pass | 9,931 | 7,448 | -25% | 1 | 1 | 0% | 1,782 | 2,934 | +65% | 0 | 0 | — |
case-11 | pass→pass | 7,688 | 6,318 | -18% | 1 | 1 | 0% | 1,446 | 2,780 | +92% | 0 | 0 | — |
case-14 | pass→pass | 10,194 | 5,894 | -42% | 1 | 1 | 0% | 1,589 | 2,569 | +62% | 0 | 0 | — |
case-15 | pass→pass | 8,475 | 3,739 | -56% | 1 | 1 | 0% | 1,587 | 2,309 | +45% | 0 | 0 | — |
case-16 | fail→pass | 4,125 | 4,926 | +19% | 1 | 1 | 0% | 731 | 2,435 | +233% | 0 | 0 | — |
case-17 | fail→pass | 10,245 | 3,614 | -65% | 1 | 1 | 0% | 1,889 | 2,272 | +20% | 0 | 0 | — |
case-18 | pass→pass | 4,720 | 2,175 | -54% | 1 | 1 | 0% | 948 | 2,028 | +114% | 0 | 0 | — |
case-19 | pass→pass | 12,719 | 8,566 | -33% | 1 | 1 | 0% | 2,071 | 3,114 | +50% | 0 | 0 | — |
case-20 | pass→pass | 8,666 | 4,471 | -48% | 1 | 1 | 0% | 1,592 | 2,467 | +55% | 0 | 0 | — |
case-21 | pass→pass | 7,155 | 3,512 | -51% | 1 | 1 | 0% | 1,255 | 2,284 | +82% | 0 | 0 | — |
case-22 | pass→pass | 5,733 | 4,690 | -18% | 1 | 1 | 0% | 994 | 2,390 | +140% | 0 | 0 | — |
case-23 | pass→pass | 3,595 | 4,577 | +27% | 1 | 1 | 0% | 670 | 2,466 | +268% | 0 | 0 | — |
case-24 | pass→pass | 3,491 | 3,073 | -12% | 1 | 1 | 0% | 621 | 2,190 | +253% | 0 | 0 | — |
case-25 | pass→pass | 3,104 | 2,486 | -20% | 1 | 1 | 0% | 567 | 2,118 | +274% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 25 cases were attempted. The headline lift of +20 percentage points is the difference between those two pass rates over the 25 comparable cases.
The publisher has shipped newer versions since this run, so these numbers describe v1, not the version currently listed.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.