with one click
template-sync
// テンプレート同期スキル。yellow-seed/template の更新を他のリポジトリに反映。Use when: テンプレート更新の反映、template同期、既存リポジトリへの変更適用を依頼された時。
// テンプレート同期スキル。yellow-seed/template の更新を他のリポジトリに反映。Use when: テンプレート更新の反映、template同期、既存リポジトリへの変更適用を依頼された時。
[HINT] Download the complete skill directory including SKILL.md and all related files
| name | template-sync |
| description | テンプレート同期スキル。yellow-seed/template の更新を他のリポジトリに反映。Use when: テンプレート更新の反映、template同期、既存リポジトリへの変更適用を依頼された時。 |
yellow-seed/template の更新内容を、このテンプレートを基に作成された他のリポジトリに反映するためのスキルです。
このスキルは、具体的なファイルパスではなく、ファイルの性質や役割に基づいた分類を使用します。これにより、将来追加されるファイルやディレクトリにも自動的に対応できます。
.github/ 配下)対象パターン:
.github/**/*
同期戦略:
.github/workflows/: 新規ファイルは追加、既存ファイルは構造比較後に更新提案.github/ISSUE_TEMPLATE/: 新規テンプレートを追加.github/PULL_REQUEST_TEMPLATE.md: 新規追加または内容比較.github/actions/: 新規カスタムアクションを追加.github/configs/, .agents/skills/: 将来追加される任意のディレクトリに自動対応対象パターン:
# 既知のAIエージェント設定ディレクトリ
.claude/**/*
.codex/**/*
.agents/**/*
.cursor/**/*
.aider/**/*
.codeium/**/*
.copilot/**/*
自動検出ロジック: テンプレート側でドット始まりの新しいディレクトリを検出した場合、以下の条件でAIエージェント設定と判定:
.{claude,codex,agents,cursor,aider,codeium,copilot} のパターンに一致skills/, prompts/, config/, hooks/ などのサブディレクトリを含む同期戦略:
settings.json などの設定ファイルは差分比較して更新提案.agents/skills へのシンボリックリンクを優先し、
シンボリックリンクが使えない環境では
.claude/hooks/skills-setup.sh などの同期スクリプト利用を提案対象パターン:
# エディタ・フォーマッタ設定
.editorconfig
.prettierrc*
.eslintrc*
.markdownlint*
.shellcheckrc
# CI/CD設定
.codecov.yml
.renovate.json
.dependabot/**/*
同期戦略:
scripts/ 配下)対象パターン:
scripts/**/*
同期戦略:
scripts/ へ切り出し、参照先の更新も提案対象パターン:
.gitignore
.gitattributes
.gitmodules
同期戦略:
.githooks/ 配下)対象パターン:
.githooks/**/*
同期戦略:
.githooks/ のディレクトリ構造はテンプレートに合わせて同期対象パターン:
README.md
AGENTS.md
AGENTS.md
CONTRIBUTING.md
同期戦略:
README.md: バッジセクション(先頭の <!-- ... --> コメントで囲まれた範囲)を同期AGENTS.md, AGENTS.md: セクション構造をテンプレートに合わせてリファクタリング提案| 同期タイプ | 対象ファイル | 動作 |
|---|---|---|
| 完全同期 | .github/workflows/ (新規), .github/ISSUE_TEMPLATE/, .github/actions/ | テンプレートから完全コピー |
| 構造同期 | README.md, AGENTS.md, AGENTS.md, .github/workflows/ (既存) | 構造をテンプレートに合わせる |
| マージ同期 | .gitignore, .gitattributes | 既存内容を保持しつつ新規内容を追加 |
| 値同期 | .codecov.yml, .renovate.json, .editorconfig | テンプレート値を基準に |
| 選択的同期 | README.md (バッジセクションのみ) | 特定セクションのみを置換 |
| 差分同期 | scripts/, .githooks/ | 差分を確認して更新提案 |
| スキップ | プロジェクト固有ファイル (package.json, Cargo.toml, pyproject.toml など) | 同期対象外 |
テンプレートのお手本構造を維持し、AIエージェントが理解しやすいドキュメントを保つことで、skillsへの適切な委譲精度を向上させます。
# 見出し構造を抽出
grep "^#" template/README.md > /tmp/template_structure.txt
grep "^#" target/README.md > /tmp/target_structure.txt
diff -u /tmp/target_structure.txt /tmp/template_structure.txt
README.md:
AGENTS.md:
構造比較結果から、ターゲットリポジトリのドキュメント構造をテンプレートに合わせるための提案を生成します。
- ## セットアップ
- ## 使い方
+ ## インストール方法
+ ### 前提条件
+ ### 手順
+ ## 使い方
→ 提案: セクション「セットアップ」を「インストール方法」に統合し、
「前提条件」「手順」のサブセクションに再編成
テンプレートの整理されたワークフロー構造は、適切なCI/CDのベストプラクティスを反映しています。トリガー条件、ジョブの分離、依存関係、ステップ順序などの構造パターンは、技術スタックに依存せず共通化できます。
同期する要素:
| 要素 | 同期方法 | 理由 |
|---|---|---|
| トリガー条件 | テンプレート値を採用 | CI/CD戦略の統一 |
| ブランチ条件 | テンプレート値を採用 | branches: [main] |
| パス条件 | テンプレート値を採用 | paths-ignore: ['**.md'] でCI最適化 |
| ジョブ分離 | 構造パターンを採用 | lint → test → coverage の分離 |
| 依存関係 | 構造パターンを採用 | needs: lint |
| ステップ順序 | 構造パターンを採用 | checkout → setup → action |
同期しない要素:
| 要素 | 理由 |
|---|---|
| 具体的なコマンド | 技術スタック依存(npm test vs pytest vs cargo test) |
| 環境変数値 | プロジェクト固有(NODE_VERSION, PYTHON_VERSION など) |
on:
push:
branches: [main]
paths-ignore: ["**.md", "docs/**"]
pull_request:
branches: [main]
paths-ignore: ["**.md", "docs/**"]
workflow_dispatch: # 手動実行を許可
パターンA: 基本CI(lint → test)
jobs:
lint:
steps: [checkout, setup-tools, run-linter]
test:
needs: lint
steps: [checkout, setup-env, run-tests]
パターンB: カバレッジ付きCI(lint → test → coverage)
jobs:
lint:
steps: [checkout, setup-tools, run-linter]
test:
needs: lint
steps: [checkout, setup-env, run-tests]
coverage:
needs: test
steps: [checkout, setup-coverage, generate, upload]
# ci-macos.yml 構造リファクタリング提案
## 1. トリガー条件の修正
現在: `on: [push, pull_request]`
修正後: テンプレート推奨条件(branches指定、paths-ignore、workflow_dispatch追加)
## 2. ジョブ構成の修正
現在: test ジョブのみ(lint と test が混在)
修正後: lint と test を分離、依存関係を明示(`test: needs: lint`)
## 3. ステップ順序の整理
各ジョブで checkout → setup → action の順序を維持
.codecov.yml, .renovate.json, .editorconfig, .prettierrc など
codecov.yml の例:
# テンプレート基準値
coverage:
status:
project:
default:
target: 80% # ← この値を基準に
threshold: 5% # ← この値を基準に
適用方法:
renovate.json の例:
{
"extends": ["config:base"],
"schedule": ["after 10pm every weekday"],
"automerge": true
}
適用方法:
テンプレート側でワークフローを追加した場合、対応するバッジもターゲットリポジトリのREADMEに反映します。
<!-- ... -->)で囲まれたバッジセクションを識別<!-- CI/CD & Code Quality -->
[](...)
[](...)
<!-- /CI/CD & Code Quality -->
yellow-seed/template → yellow-seed/{target-repo})# ディレクトリツリー比較
git ls-tree -r --name-only template/main | grep -E "^\.(github|Codex|codex)/" | sort > /tmp/template_structure.txt
git ls-tree -r --name-only HEAD | grep -E "^\.(github|Codex|codex)/" | sort > /tmp/target_structure.txt
diff /tmp/template_structure.txt /tmp/target_structure.txt
# テンプレートの設定ファイルを検出
find template -maxdepth 1 -type f \( -name ".*rc" -o -name ".*ignore" -o -name ".*yml" -o -name ".*json" \) | sort
# ドット始まりのディレクトリを検出
find template -maxdepth 1 -type d -name ".*" | while read dir; do
# skills/, hooks/, config/, prompts/ のいずれかを含むか確認
if find "$dir" -maxdepth 1 -type d \( -name "skills" -o -name "hooks" -o -name "config" -o -name "prompts" \) | grep -q .; then
echo "AIエージェント設定ディレクトリを検出: $dir"
fi
done
# yellow-seed/template のURL(デフォルト)
TEMPLATE_REPO="https://github.com/yellow-seed/template.git"
# yellow-seed/template の最新情報を取得
git ls-remote --heads $TEMPLATE_REPO
分析項目:
.githooks/ の構造と運用有無.claude/ .codex/ .agents/ のトップレベル構造(設定ファイルとsymlink)scripts/ の有無と利用箇所(Dockerfileなど)分析方法:
# 言語検出
ls package.json pyproject.toml Cargo.toml go.mod Gemfile pom.xml build.gradle 2>/dev/null
# 既存のskills確認
ls -la .agents/skills/ 2>/dev/null
# AIエージェント設定の構造確認
ls -la .claude .codex .agents 2>/dev/null
# 既存の.github/設定確認(全体)
ls -la .github/ 2>/dev/null
find .github/ -type f 2>/dev/null
# 既存のドキュメント確認
ls AGENTS.md AGENTS.md README.md 2>/dev/null
# セットアップスクリプト確認
ls -la scripts 2>/dev/null
# yellow-seed/template をリモートとして追加(一時的)
git remote add template $TEMPLATE_REPO 2>/dev/null || true
git fetch template main
# 差分を確認
git diff HEAD template/main --name-only
# 特定ディレクトリの差分を詳細確認
git diff HEAD template/main -- .claude/
git diff HEAD template/main -- .codex/
git diff HEAD template/main -- .agents/skills/
git diff HEAD template/main -- .github/
git diff HEAD template/main -- .githooks/
git diff HEAD template/main -- scripts/
git diff HEAD template/main -- AGENTS.md
git diff HEAD template/main -- README.md
自動適用可能な変更:
.agents/skills/内の新規skillファイル.github/配下の全ての新規ファイル・ディレクトリ
.github/workflows/内の新規ワークフローファイル.github/ISSUE_TEMPLATE/内の新規テンプレート.agents/skills/, .github/configs/等、将来追加される新規ディレクトリscripts/ 内の新規スクリプト確認が必要な変更:
.gitignore, .editorconfig等)AGENTS.md, AGENTS.md)適用しない変更:
# 例: Node.jsプロジェクトの場合
if [ -f "package.json" ]; then
# Node.js関連のworkflowsのみ適用
# Python関連のworkflowsはスキップ
fi
戦略:
例: AGENTS.mdの統合:
# 現在のAGENTS.md
## プロジェクト概要
[既存の内容]
# yellow-seed/template からの新規セクション
## 開発環境のセットアップ
### Codex での GitHub CLI (gh) のセットアップ
[新規内容を追加]
競合が発生する場合:
# yellow-seed/template の .github/workflows/new-workflow.yml を追加
git show template/main:.github/workflows/new-workflow.yml > .github/workflows/new-workflow.yml
# yellow-seed/template の .agents/skills/ を追加する例
mkdir -p .agents/skills
git archive --remote=$TEMPLATE_REPO HEAD:.agents/skills/ | tar -x -C .agents/skills/
# yellow-seed/template の .agents/skills/new-skill/SKILL.md を追加
git show template/main:.agents/skills/new-skill/SKILL.md > .agents/skills/new-skill/SKILL.md
# ドキュメントの部分更新例(セクション追加)
# 手動でセクションを追加、または既存内容を保持してマージ
# 変更内容を確認
git status
git diff
# 変更をコミット
git add .
git commit -m "chore: sync updates from yellow-seed/template
Applied changes:
- Added new skill: xxx
- Added new workflow: yyy
- Updated AGENTS.md with new sections
Source: yellow-seed/template@<commit-hash>"
# 一時的に追加したリモートを削除
git remote remove template
**検出された変更**:
- `.agents/skills/template-sync/SKILL.md` (新規スキル)
- `.github/workflows/shell-linting.yml` (新規ワークフロー)
- `.codex/` (新規AIエージェント設定ディレクトリ、自動検出)
**自動検出の流れ**:
1. ドット始まりのディレクトリ `.codex/` を検出
2. サブディレクトリ `skills/`, `config/` を確認
3. AIエージェント設定と判定
**適用戦略**:
- パターンベースで自動的に追加対象と判定
- 新規ファイル・ディレクトリをそのままコピー
**実行**:
1. 新規ディレクトリを作成
2. yellow-seed/template からファイルをコピー
3. 動作確認
4. コミット: `git commit -m "chore: add new files and directories from template"`
**検出された変更**:
- yellow-seed/template の `.gitignore`: 複数の新規エントリ
**現在の.gitignore**:
node_modules/ .env dist/
**yellow-seed/template の .gitignore**:
node_modules/ .env dist/
.vscode/ .idea/
.DS_Store Thumbs.db
.claude/settings.local.json
**適用戦略**:
- 新規セクション(IDE, OS, Codex)を追加
- 既存エントリは保持
**実行**:
1. `.gitignore`に新規セクションを追加
2. 既存の内容は変更しない
3. コミット: `git commit -m "chore: update .gitignore from yellow-seed/template"`
**検出された変更**:
- `AGENTS.md`: 構造の整理と新規セクション追加
- `README.md`: バッジセクションの更新
**AGENTS.md 構造比較結果**:
```diff
# 現在のターゲットリポジトリ
## プロジェクト概要
## 使い方
## セットアップ手順
# yellow-seed/template の推奨構造
## プロジェクト概要
## 技術スタック
## ディレクトリ構造
## 開発環境のセットアップ
## コーディング規約
## コミットメッセージ規約
## コミット粒度
## テスト戦略
## Pull Request 作成
## デプロイメント
## その他の重要な情報
```
README.md バッジセクション:
<!-- CI/CD & Code Quality --> で囲まれた範囲を同期yellow-seed/template → yellow-seed/target-repo)適用戦略:
実行:
git commit -m "docs: restructure documents to match template"
### シナリオ4: ワークフロー構造の同期(構造同期)
```markdown
**検出された変更**:
- `.github/workflows/ci.yml`: 構造パターンの改善
**構造比較結果**:
```diff
# 現在のターゲットリポジトリ
on: [push, pull_request]
jobs:
test:
steps: [checkout, setup, lint, test]
# yellow-seed/template の推奨構造
on:
push:
branches: [main]
paths-ignore: ['**.md', 'docs/**']
pull_request:
branches: [main]
paths-ignore: ['**.md', 'docs/**']
workflow_dispatch:
jobs:
lint:
steps: [checkout, setup-tools, run-linter]
test:
needs: lint
steps: [checkout, setup-env, run-tests]
適用戦略:
実行:
git commit -m "ci: refactor workflow structure to match template"
### シナリオ5: 設定ファイル値の基準化(値同期)
```markdown
**検出された変更**:
- `.codecov.yml`: カバレッジ目標値の更新
- `.renovate.json`: スケジュール設定の更新
**codecov.yml 値比較結果**:
```diff
# 現在のターゲットリポジトリ
coverage:
status:
project:
default:
target: 70%
threshold: 10%
# yellow-seed/template の基準値
coverage:
status:
project:
default:
target: 80%
threshold: 5%
適用戦略:
実行:
git commit -m "chore: align config values with template standards"
## 同期時のチェックリスト
- [ ] yellow-seed/template の最新情報を取得した
- [ ] 現在のリポジトリの設定を分析した
- [ ] 差分を確認し、適用すべき変更を選択した
- [ ] プロジェクト固有の設定を保持する戦略を確認した
- [ ] 新規ファイルの追加を実行した
- [ ] 既存ファイルの更新(必要な場合)をユーザーと確認した
- [ ] 変更内容をコミットした
- [ ] 一時的なリモートをクリーンアップした
- [ ] 適用後の動作確認を行った
## 注意事項
1. **バックアップの推奨**: 同期前にブランチを作成することを推奨
```bash
git checkout -b sync-from-template
段階的な適用: 一度に全ての変更を適用せず、段階的に適用することを推奨
テストの実施: 適用後、必ずCI/CDやローカルテストを実施
ドキュメントの確認: READMEやAGENTS.mdの内容がプロジェクトに適合しているか確認
カスタマイズの尊重: プロジェクト固有のカスタマイズは常に尊重
解決策:
# SSHキーの確認
ssh -T git@github.com
# HTTPSでアクセスを試す
TEMPLATE_REPO="https://github.com/yellow-seed/template.git"
解決策:
解決策:
chore: タイプを使用このskillは以下の最小限のセットアップで動作します:
TEMPLATE_REPO(オプション、デフォルト: yellow-seed/template)使用方法:
# AI Agentに依頼するだけ
"yellow-seed/template の最新の変更を同期してください"
AI Agentが自動的に:
yellow-seed/templatemainhttps://github.com/yellow-seed/template.git別のテンプレートを使用する場合は、以下のように指定:
TEMPLATE_REPO="https://github.com/your-org/your-template.git"