Skip to content

feat: Add local-repo skill#50

Open
adinauer wants to merge 2 commits intomainfrom
feat/local-repo-skill
Open

feat: Add local-repo skill#50
adinauer wants to merge 2 commits intomainfrom
feat/local-repo-skill

Conversation

@adinauer
Copy link
Member

@adinauer adinauer commented Feb 18, 2026

A skill that lets you investigate, compare and modify other local git repositories from your current chat in a single repo.

How it works

The ~/.claude/repos.local.json config file is used to specify which directories contain repositories on your machine.

When using the skill, it'll look for a matching repo in all configured directories and then use that.
It will notify you if the repo is missing.
It will also notify you if the referenced repo is outdated, on a non main branch or has local changes.

  [!WARNING]
  sentry-android-gradle-plugin is on branch 5.x.x (default is main)

  [!NOTE]
  sentry-android-gradle-plugin is 12 commit(s) behind origin/5.x.x

  [!WARNING]
  sentry-android-gradle-plugin has local changes

Why

An alternative to setting up workspaces in Cursor that include multiple repos.

I used to start a new chat in a specific (SDK) repo just to answer a question about some internals of that SDK. This involved lots of duplicate explaining and also becomes annoying to manage in terms of which chat on repo A goes with which chat on repo B etc.

Example usages

  • What version of Java SDK is used in /local-repo sentry-android-gradle-plugin

  • Which options for metrics are available in /local-repo ruby

  • Compare what products event processors are able to modify in Java SDK, /local-repo ruby and /local-repo javascript

Recommended permissions

NOTE: Please review those before copying them.

In ~/.claude/settings.json:

{
  "permissions": {
    "allow": [
      "Bash(bash */local-repo/scripts/list-repos.sh)",
      "Bash(test -d *)",
      "Bash(git -C * symbolic-ref refs/remotes/origin/HEAD *)",
      "Bash(git -C * branch --show-current)",
      "Bash(git -C * fetch origin *)",
      "Bash(git -C * rev-list *)",
      "Bash(git -C * status *)",
      "Bash(git rev-parse --show-toplevel)",
      "Bash(git status *)",
      "Bash(git status)",
      "Bash(git log *)",
      "Bash(git diff *)",
      "Bash(echo $HOME)",
      "Read(~/.claude/plugins/cache/sentry-skills/sentry-skills/*/skills/similar-sdks/references/sdk-groups.md)",
      "Read(~/.claude/repos.local.json)",
      "Read(~/sentry-repos/**)",
      "Grep(~/sentry-repos/**)",
      "Glob(~/sentry-repos/**)",
      "Read(~/repos/**)",
      "Grep(~/repos/**)",
      "Glob(~/repos/**)"
    ]
  },
...

@adinauer
Copy link
Member Author

adinauer commented Feb 18, 2026

It also seems like using /local-repo sagp can be used to refer to sentry-android-gradle-plugin, not sure what exactly makes that work.

Wasn't able to get autocomplete for repo names.

For each directory in `repoDirs`, check if the repo exists by running a **separate** Bash call for each:

```bash
test -d <repoDir>/<repo-name>/.git
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The script uses test -d to check for a .git directory, which fails for git worktrees where .git is a file, not a directory.
Severity: MEDIUM

Suggested Fix

Replace the directory check test -d <path>/.git with a check that validates both files and directories, such as test -e <path>/.git. A more robust alternative is to use a git-native command like git -C <path> rev-parse --is-inside-work-tree to correctly identify all valid git repositories, including worktrees.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: plugins/sentry-skills/skills/local-repo/SKILL.md#L55

Potential issue: The skill checks if a given path is a git repository by testing if a
`.git` directory exists using `test -d <repoDir>/<repo-name>/.git`. This check is
incorrect for git worktrees, a standard git feature, where `.git` is a file containing a
reference to the main repository's git directory, not a directory itself. As a result,
the test will fail for any repository set up as a worktree, causing the skill to
incorrectly report the repository as "not found" and preventing users with worktree
setups from using this feature.

Did we get this right? 👍 / 👎 to inform future reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments