agentleFS
sorafujitanisorafujitani/skills/local-repo-finder/SKILL.md

local-repo-finder

Skill8 starsChanged 3 months agoMITView on GitHub

Quickly detect Git repository paths in local environments. Use when referencing another repository or absorbing directory layout differences across developers. Triggered by requests like "find repository", "locate repo", "repository location", "search path", "reference another repository".

  • Installs packages

The file

We split this skill into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Search for .git directories using the following command to get the repository root path.

    line 42
  2. Very specific:

    Use find if fd is not installed:

    line 98
  3. Very specific:

    Search under ~/ only (searching from / is slow).

    line 106
  4. Distinctive:

    When multiple repositories match, show the candidates and ask which one to use.

    line 107

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Local Repository Finder

A skill that quickly detects the path of a specified Git repository in local environments. Absorbs different directory structures across developers and enables shareable Workflows.

When to Use

  • Reference another repository in SlashCommands or AgentSkills
  • Reference local-specific paths from team-shared resources
  • Automate cross-repository tasks

Prerequisites

fd is preferred; fall back to find when it is missing. In a ghq-managed environment ghq list -p <name> also resolves the path.

# macOS
brew install fd

# Ubuntu/Debian
apt install fd-find

# Arch Linux
pacman -S fd

Instructions

Step 1: Identify Repository Name

Confirm the repository name the user wants to reference.

Step 2: Detect Path

Search for .git directories using the following command to get the repository root path.

fd -H "^\.git$" ~/ -t d 2>/dev/null | xargs -I {} dirname {} | grep "<REPO_NAME>$" | head -1

Replace <REPO_NAME> with the actual repository name and execute.

Step 3: Store as Variable

Save the detected path to a variable for use in subsequent operations.

REPO_ROOT="$(fd -H "^\.git$" ~/ -t d 2>/dev/null | xargs -I {} dirname {} | grep "<REPO_NAME>$" | head -1)"

Examples

Basic Usage

# Detect hogerepo repository
fd -H "^\.git$" ~/ -t d 2>/dev/null | xargs -I {} dirname {} | grep "hogerepo$" | head -1
# => /Users/username/dev/work/hogerepo

# Work with detected path
REPO_ROOT="/Users/username/dev/work/hogerepo"
cat "${REPO_ROOT}/package.json"
ls "${REPO_ROOT}/src/"

Usage in SlashCommands

## Phase 1: Repository Detection

Identify the target repository with the following command:

fd -H "^\.git$" ~/ -t d 2>/dev/null | xargs -I {} dirname {} | grep "target-repo$" | head -1

Use the detected path as `TARGET_ROOT` in subsequent operations.

## Phase 2: File Reference

- Entry point: `${TARGET_ROOT}/src/main.ts`
- Config file: `${TARGET_ROOT}/config/default.json`

Detecting Multiple Repositories

# Show all matches when multiple exist
fd -H "^\.git$" ~/ -t d 2>/dev/null | xargs -I {} dirname {} | grep "api$"

# Narrow down with more specific pattern
fd -H "^\.git$" ~/ -t d 2>/dev/null | xargs -I {} dirname {} | grep "project-a/api$" | head -1

Fallback

Use find if fd is not installed:

find ~/ -type d -name ".git" 2>/dev/null | xargs -I {} dirname {} | grep "<REPO_NAME>$" | head -1

Boundaries

  • Search under ~/ only (searching from / is slow).
  • When multiple repositories match, show the candidates and ask which one to use.

Troubleshooting

fd: command not found

# Check installation
which fd || which fdfind

# On Ubuntu, it may be named fdfind
alias fd=fdfind

Repository Not Found

# Search with partial match
fd -H "^\.git$" ~/ -t d 2>/dev/null | xargs -I {} dirname {} | grep "<PARTIAL_NAME>"

References

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.