mcpField
R
repo

repo

github.com/johnlindquist開発2638 回インストール45 週間前に更新
リポジトリ

repo について

repo は、開発者やコーディングエージェント向けのコードベース分析スキルです。構造やエクスポートの索引、依存関係の分析に加え、AI 用コンテキストの作成やドキュメント生成を支援します。

主な機能

  1. 01リポジトリ構造の確認
  2. 02コードとエクスポートの索引化
  3. 03インポートと依存関係の分析
  4. 04AI 用コンテキストバンドルの生成
  5. 05README と API ドキュメントの作成支援

活用シーン

  1. 01エージェントが未知のリポジトリを把握
  2. 02AI 分析用の主要ファイルを準備
  3. 03内部・外部依存関係を確認
  4. 04リポジトリや API の文書を下書き

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/johnlindquist/claude --skill repo

インストール後、Claude Code で/repoを入力して読み込まれたか確認します。

詳細

リポジトリのコンテキスト

コードベース向けのコンテキストバンドルとマップを生成します。

構造分析

クイック構造
# Tree view (basic)
tree -L 2 -I 'node_modules|.git|dist|build'

# With file counts
tree -L 2 -I 'node_modules|.git' --dirsfirst -C

# Just directories
tree -d -L 3 -I 'node_modules|.git'
詳細な構造
#!/bin/bash
# repo-structure.sh

echo "# Repository Structure"
echo ""
echo "## Root Files"
ls -la | grep "^-" | awk '{print "- " $NF}'

echo ""
echo "## Directories"
for dir in */; do
  if [[ "$dir" != "node_modules/" && "$dir" != ".git/" ]]; then
    echo "### $dir"
    ls -la "$dir" | head -10
    echo ""
  fi
done

コードマップ

コードマップを生成
#!/bin/bash
# codemap.sh - Generate code map

echo "# Code Map"
echo ""

# Find all source files
find src -name "*.ts" -o -name "*.tsx" | while read file; do
  echo "## $file"
  echo '```typescript'

  # Extract exports
  grep -E "^export (function|const|class|interface|type)" "$file" | head -20

  echo '```'
  echo ""
done
関数インデックス
# List all exported functions
grep -rh "^export function" src/ | sort

# With file locations
grep -rn "^export function" src/ | sort
クラスインデックス
# List all classes
grep -rn "^export class" src/ | sort

# With methods
grep -rh "^export class\|^\s*\(async \)\?[a-z]\+(" src/ | head -50

コンテキストバンドル

AI 向けバンドルを作成
#!/bin/bash
# bundle-context.sh - Create context for AI

OUTPUT="CONTEXT.md"

cat > $OUTPUT << 'EOF'
# Repository Context

## Project Overview
EOF

# Add package.json summary
if [ -f package.json ]; then
  echo '```json' >> $OUTPUT
  jq '{name, description, main, scripts: .scripts | keys}' package.json >> $OUTPUT
  echo '```' >> $OUTPUT
fi

# Add key files
echo "" >> $OUTPUT
echo "## Key Files" >> $OUTPUT

for file in src/index.ts src/main.ts app.ts; do
  if [ -f "$file" ]; then
    echo "" >> $OUTPUT
    echo "### $file" >> $OUTPUT
    echo '```typescript' >> $OUTPUT
    head -100 "$file" >> $OUTPUT
    echo '```' >> $OUTPUT
  fi
done

echo "Context bundle created: $OUTPUT"
スマートパック(主要ファイルのみ)
#!/bin/bash
# smart-pack.sh - Pack only important files

# Identify key files
KEY_PATTERNS=(
  "package.json"
  "tsconfig.json"
  "src/index.ts"
  "src/main.ts"
  "README.md"
)

for pattern in "${KEY_PATTERNS[@]}"; do
  if [ -f "$pattern" ]; then
    echo "=== $pattern ==="
    cat "$pattern"
    echo ""
  fi
done

インポート分析

依存関係グラフ
# Find what imports what
grep -rh "^import.*from" src/ | \
  sed "s/.*from ['\"]//; s/['\"].*//" | \
  sort | uniq -c | sort -rn | head -20
外部依存関係
# Most used external packages
grep -rh "^import.*from ['\"]" src/ | \
  grep -v "from ['\"]\./" | \
  sed "s/.*from ['\"]//; s/['\"].*//" | \
  sort | uniq -c | sort -rn
内部モジュールグラフ
# Internal imports
grep -rh "^import.*from ['\"]\./" src/ | \
  sed "s/.*from ['\"]//; s/['\"].*//" | \
  sort | uniq -c | sort -rn

AI を活用した分析

アーキテクチャの概要
STRUCTURE=$(tree -L 2 -I 'node_modules|.git' --dirsfirst)
PACKAGE=$(cat package.json 2>/dev/null)

gemini -m pro -o text -e "" "Analyze this repository structure:

Structure:
$STRUCTURE

package.json:
$PACKAGE

Provide:
1. Architecture pattern used
2. Main entry points
3. Key modules and their purpose
4. Dependencies overview
5. Suggested improvements"
コード品質の概要
# Get sample of files
SAMPLES=$(find src -name "*.ts" | head -5 | xargs cat)

gemini -m pro -o text -e "" "Review code quality:

$SAMPLES

Assess:
1. Code organization
2. Naming conventions
3. Error handling
4. Type safety
5. Suggestions"

ドキュメント生成

README の自動生成
gemini -m pro -o text -e "" "Generate a README for this project:

package.json:
$(cat package.json)

Main file:
$(cat src/index.ts | head -100)

Include:
- Description
- Installation
- Usage
- API overview
- Contributing"
API ドキュメント
# Extract all exports
EXPORTS=$(grep -rh "^export" src/ | head -50)

gemini -m pro -o text -e "" "Generate API documentation for:

$EXPORTS

Format as markdown with:
- Function signatures
- Parameter descriptions
- Return types
- Example usage"

ベストプラクティス

  1. ノイズを除外する - node_modules、.git、build を除外します
  2. エントリーポイントに注目する - まず主要なファイルを確認します
  3. 依存関係を追跡する - インポートされているものを把握します
  4. 要約に AI を活用する - 大規模なコードベースでは情報の統合が必要です
  5. バンドルを最新の状態に保つ - 大きな変更の後に再生成します
  6. コンテキストを共有する - 他の人がすぐに理解できるようにします

コメント