From 0757e8ce4149694fe40fee05f21a568bf878fd91 Mon Sep 17 00:00:00 2001 From: watanabe-kohei-jp <283722319+watanabe-kohei-jp@users.noreply.github.com> Date: Thu, 21 May 2026 15:40:02 +0900 Subject: [PATCH 1/4] docs(seo): sync lectures 02/03 to sitemap/llms.txt/README and fix og:url MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 既存講義 02-setup / 03-claude-md を SEO・GEO 系メタデータに同期し、 02/03 の og:url が旧 GitHub Pages URL を指していた誤りを修正する。 Co-Authored-By: Claude Opus 4.7 (1M context) --- 02-setup/index.html | 2 +- 03-claude-md/index.html | 2 +- README.md | 4 ++++ index.html | 8 ++++++++ llms.txt | 2 ++ sitemap.xml | 14 +++++++++++++- 6 files changed, 29 insertions(+), 3 deletions(-) diff --git a/02-setup/index.html b/02-setup/index.html index ee4d5b9..8838259 100644 --- a/02-setup/index.html +++ b/02-setup/index.html @@ -8,7 +8,7 @@ - + diff --git a/03-claude-md/index.html b/03-claude-md/index.html index e333c3f..e250d00 100644 --- a/03-claude-md/index.html +++ b/03-claude-md/index.html @@ -8,7 +8,7 @@ - + diff --git a/README.md b/README.md index 0e797c8..9e3b63c 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,8 @@ AI コーディング(Claude Code 等)を中心に、散在しがちな情 |---|---|---| | [`00-about/`](./00-about/index.html) | この資料の歩き方(Read me) | 9 枚 | | [`01-claude-code-intro/`](./01-claude-code-intro/index.html) | Claude Code 入門 | 12 枚 | +| [`02-setup/`](./02-setup/index.html) | Claude Code 環境構築 | 12 枚 | +| [`03-claude-md/`](./03-claude-md/index.html) | CLAUDE.md でプロジェクトを記憶させる | 12 枚 | 各章は単体の HTML として完結しているので、ブラウザで開けばそのまま読めます。 @@ -41,6 +43,8 @@ AI コーディング(Claude Code 等)を中心に、散在しがちな情 ``` https://co-lect.github.io/lectures/00-about/ https://co-lect.github.io/lectures/01-claude-code-intro/ +https://co-lect.github.io/lectures/02-setup/ +https://co-lect.github.io/lectures/03-claude-md/ ``` ### 方法 2: クローンしてローカルで開く diff --git a/index.html b/index.html index e690a72..2c78496 100644 --- a/index.html +++ b/index.html @@ -110,6 +110,14 @@

講義

01 — なぜ今、Claude Code を学ぶのか
AI コーディングの全体像、ツールの正体、人の立ち位置の変化(12 枚)
+
  • + 02 — Claude Code 環境構築 +
    プランの選択からインストール・認証・初起動まで(12 枚)
    +
  • +
  • + 03 — CLAUDE.md でプロジェクトを記憶させる +
    毎回の説明をゼロにする CLAUDE.md の書き方・置き場所・効果的な 3 パターン(12 枚)
    +
  • 鮮度について

    diff --git a/llms.txt b/llms.txt index ceed783..215c3fd 100644 --- a/llms.txt +++ b/llms.txt @@ -8,6 +8,8 @@ - [00 Read me](https://co-lect.github.io/lectures/00-about/): 教材シリーズの設計思想と歩き方。1 年で陳腐化する世界で資料をどう作るか(9 枚) - [01 なぜ今、Claude Code を学ぶのか](https://co-lect.github.io/lectures/01-claude-code-intro/): AI コーディングの全体像、ツールの正体、人の立ち位置の変化(12 枚) +- [02 Claude Code 環境構築](https://co-lect.github.io/lectures/02-setup/): プランの選択からインストール・認証・初起動まで(12 枚) +- [03 CLAUDE.md でプロジェクトを記憶させる](https://co-lect.github.io/lectures/03-claude-md/): 毎回の説明をゼロにする CLAUDE.md の書き方・置き場所・効果的な 3 パターン(12 枚) ## メタ diff --git a/sitemap.xml b/sitemap.xml index 7b89909..939eb4b 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,7 +2,7 @@ https://co-lect.github.io/lectures/ - 2026-05-17 + 2026-05-20 monthly 1.0 @@ -18,4 +18,16 @@ monthly 0.8 + + https://co-lect.github.io/lectures/02-setup/ + 2026-05-20 + monthly + 0.8 + + + https://co-lect.github.io/lectures/03-claude-md/ + 2026-05-20 + monthly + 0.8 + From 7e0ea93ac51f0c94e83d6ff6e0325833512c8477 Mon Sep 17 00:00:00 2001 From: watanabe-kohei-jp <283722319+watanabe-kohei-jp@users.noreply.github.com> Date: Fri, 22 May 2026 15:12:54 +0900 Subject: [PATCH 2/4] feat(automation): auto-sync listings from NN-slug/index.html MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit NN-slug/index.html を真実源として sitemap.xml / llms.txt / index.html / README.md の講義一覧ブロックを自動生成する仕組みを追加。 - scripts/sync_listings.py: / <meta description> / <section> 数を 抽出して各 listing ファイルのマーカー間を再生成する - sync-listings-check.yml: PR で --check を強制 - sync-listings-bot.yml: main へのマージ後 --write して bot コミット - 4 ファイルにマーカー埋め込み、現状の listing を再生成済み - CONTRIBUTING.md / CLAUDE.md / _template/index.html に運用ノート追記 PR #31 で手動同期した同期漏れの再発防止。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --- .github/workflows/sync-listings-bot.yml | 44 ++++ .github/workflows/sync-listings-check.yml | 27 ++ CLAUDE.md | 6 + CONTRIBUTING.md | 21 +- README.md | 10 +- _template/index.html | 3 + index.html | 11 +- llms.txt | 11 +- scripts/README.md | 63 +++++ scripts/sync_listings.py | 287 ++++++++++++++++++++++ sitemap.xml | 7 +- 11 files changed, 477 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/sync-listings-bot.yml create mode 100644 .github/workflows/sync-listings-check.yml create mode 100644 scripts/README.md create mode 100644 scripts/sync_listings.py diff --git a/.github/workflows/sync-listings-bot.yml b/.github/workflows/sync-listings-bot.yml new file mode 100644 index 0000000..85fe6e9 --- /dev/null +++ b/.github/workflows/sync-listings-bot.yml @@ -0,0 +1,44 @@ +name: Listings Sync Bot + +# main への push 後に同期ブロックを再生成し、差分があれば +# github-actions[bot] が main に直接 commit する。PR 段階のチェック +# (sync-listings-check.yml) を通過していれば通常は no-op で終わる。 +# +# ループ防止: bot 自身の push では走らせない。 + +on: + push: + branches: [main] + +permissions: + contents: write + +jobs: + sync: + if: github.actor != 'github-actions[bot]' + name: Auto-commit listing sync + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Run sync_listings --write + run: python3 scripts/sync_listings.py --write + + - name: Commit if changed + run: | + if [[ -z "$(git status --porcelain)" ]]; then + echo "No changes — listings already in sync." + exit 0 + fi + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add -A + git commit -m "chore(listings): auto-sync $(date +%F)" + git push diff --git a/.github/workflows/sync-listings-check.yml b/.github/workflows/sync-listings-check.yml new file mode 100644 index 0000000..80ffc08 --- /dev/null +++ b/.github/workflows/sync-listings-check.yml @@ -0,0 +1,27 @@ +name: Listings Sync Check + +# PR 用の verify-only。NN-slug/index.html の追加・変更があった際に +# sitemap.xml / llms.txt / index.html / README.md の自動生成ブロックが +# 同期されていなければ fail させる。 +# ローカルでの修正コマンド: python3 scripts/sync_listings.py --write +# +# 詳細: scripts/README.md + +on: + pull_request: + +jobs: + check: + name: Verify auto-generated listing blocks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Run sync_listings --check + run: python3 scripts/sync_listings.py --check diff --git a/CLAUDE.md b/CLAUDE.md index 0f7cc45..f571bf6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -49,6 +49,12 @@ - AI 周辺は移り変わりが激しい。古くなったら直す、ではなく、**最初から "更新される前提" で設計** - HTML × Git × PR ベースの運用は、その変化への対応手段 +### 5. 講義一覧は自動同期する(手で更新しない) +- 新しい講義 `NN-slug/index.html` を追加するだけで、`sitemap.xml` / `llms.txt` / ルート `index.html` / `README.md` の講義一覧ブロックが自動同期される +- 真実源は各 `NN-slug/index.html` の `<title>` と `<meta name="description">` +- 同期スクリプト: `python3 scripts/sync_listings.py --write`(PR では `--check` が CI 強制) +- 詳細: [`scripts/README.md`](./scripts/README.md) + --- ## 期待する効果(長期) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 469fa35..7a0d7d6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -100,7 +100,26 @@ commit に `Co-Authored-By: Name <email>` trailer を付けると、GitHub の C ### CI - **Prompt Injection Guard** が HTML/CSS/JS の追加行を自動スキャン -- 失敗時は job summary に検出箇所が表示される +- **Listings Sync Check** が `sitemap.xml` / `llms.txt` / `index.html` / `README.md` の講義一覧ブロックを検証 +- 失敗時は job summary に検出箇所・修正コマンドが表示される + +### 新しい Lecture を追加するとき + +`sitemap.xml` / `llms.txt` / `index.html`(ルート)/ `README.md` の講義一覧は **自動同期** されます。`NN-slug/index.html` の `<title>` と `<meta name="description">` から自動生成されるので、これらのファイルを手で編集する必要はありません。 + +```bash +# 講義ディレクトリを作って書く +cp -r _template NN-slug +# ... NN-slug/index.html を編集 ... + +# 4 つの listing ファイルを同期 +python3 scripts/sync_listings.py --write + +# 確認用 +python3 scripts/sync_listings.py --check +``` + +PR で同期し忘れた場合は CI(`sync-listings-check.yml`)が落とします。詳細は [`scripts/README.md`](./scripts/README.md)。 ### 大きな変更の場合 diff --git a/README.md b/README.md index 9e3b63c..9b8f0dd 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,13 @@ AI コーディング(Claude Code 等)を中心に、散在しがちな情 | 章 | 内容 | スライド | |---|---|---| -| [`00-about/`](./00-about/index.html) | この資料の歩き方(Read me) | 9 枚 | -| [`01-claude-code-intro/`](./01-claude-code-intro/index.html) | Claude Code 入門 | 12 枚 | +<!-- Auto-generated by scripts/sync_listings.py. Do not edit by hand. --> +<!-- listings:auto:lectures-table:start --> +| [`00-about/`](./00-about/index.html) | Read me | 9 枚 | +| [`01-claude-code-intro/`](./01-claude-code-intro/index.html) | なぜ今、Claude Code を学ぶのか | 12 枚 | | [`02-setup/`](./02-setup/index.html) | Claude Code 環境構築 | 12 枚 | | [`03-claude-md/`](./03-claude-md/index.html) | CLAUDE.md でプロジェクトを記憶させる | 12 枚 | +<!-- listings:auto:lectures-table:end --> 各章は単体の HTML として完結しているので、ブラウザで開けばそのまま読めます。 @@ -41,10 +44,13 @@ AI コーディング(Claude Code 等)を中心に、散在しがちな情 ### 方法 1: 公開サイト(GitHub Pages) ``` +<!-- Auto-generated by scripts/sync_listings.py. Do not edit by hand. --> +<!-- listings:auto:lectures-urls:start --> https://co-lect.github.io/lectures/00-about/ https://co-lect.github.io/lectures/01-claude-code-intro/ https://co-lect.github.io/lectures/02-setup/ https://co-lect.github.io/lectures/03-claude-md/ +<!-- listings:auto:lectures-urls:end --> ``` ### 方法 2: クローンしてローカルで開く diff --git a/_template/index.html b/_template/index.html index 3863b1d..3e32081 100644 --- a/_template/index.html +++ b/_template/index.html @@ -2,6 +2,9 @@ <html lang="ja"> <head> <meta charset="UTF-8"> +<!-- 注意: <title> と <meta name="description"> はルートの sitemap.xml / llms.txt / + index.html / README.md の講義一覧に自動転記されます(scripts/sync_listings.py)。 + listing にそのまま載る前提で、短く・的確に書いてください。 --> <title>{{ 講義タイトル }} — Lectures diff --git a/index.html b/index.html index 2c78496..36141ac 100644 --- a/index.html +++ b/index.html @@ -102,22 +102,25 @@

    Lectures

    講義

    鮮度について

    diff --git a/llms.txt b/llms.txt index 215c3fd..e78321a 100644 --- a/llms.txt +++ b/llms.txt @@ -6,10 +6,13 @@ ## 講義 -- [00 Read me](https://co-lect.github.io/lectures/00-about/): 教材シリーズの設計思想と歩き方。1 年で陳腐化する世界で資料をどう作るか(9 枚) -- [01 なぜ今、Claude Code を学ぶのか](https://co-lect.github.io/lectures/01-claude-code-intro/): AI コーディングの全体像、ツールの正体、人の立ち位置の変化(12 枚) -- [02 Claude Code 環境構築](https://co-lect.github.io/lectures/02-setup/): プランの選択からインストール・認証・初起動まで(12 枚) -- [03 CLAUDE.md でプロジェクトを記憶させる](https://co-lect.github.io/lectures/03-claude-md/): 毎回の説明をゼロにする CLAUDE.md の書き方・置き場所・効果的な 3 パターン(12 枚) + + +- [00 Read me](https://co-lect.github.io/lectures/00-about/): Lectures シリーズの歩き方 — 1 年で陳腐化する世界で、AI と共同編集する資料はどう作るべきか。教材全体の設計思想を 9 枚で示す Read me。 +- [01 なぜ今、Claude Code を学ぶのか](https://co-lect.github.io/lectures/01-claude-code-intro/): なぜ今 Claude Code を学ぶのか — AI コーディングの全体像、ツールの正体、人の立ち位置の変化を 12 枚で概観する HTML スライド教材。 +- [02 Claude Code 環境構築](https://co-lect.github.io/lectures/02-setup/): Claude Code を動かすまでの手順を 12 枚で解説。プランの選択からインストール・認証・初起動まで。 +- [03 CLAUDE.md でプロジェクトを記憶させる](https://co-lect.github.io/lectures/03-claude-md/): 毎回の説明をゼロにする CLAUDE.md の使い方。書き方・置き場所・効果的な3パターンを12枚で解説。 + ## メタ diff --git a/scripts/README.md b/scripts/README.md new file mode 100644 index 0000000..cb372e1 --- /dev/null +++ b/scripts/README.md @@ -0,0 +1,63 @@ +# scripts/ + +リポジトリ運用のためのユーティリティスクリプト。 + +--- + +## `sync_listings.py` — 講義一覧の自動同期 + +`NN-slug/index.html` を真実源(source of truth)として、以下の自動生成ブロックを同期する: + +| ファイル | 同期される場所 | +|---|---| +| `sitemap.xml` | ` ... :end -->` — 講義 URL の `` ブロック | +| `llms.txt` | 同上 — 「## 講義」の箇条書き | +| `index.html`(ルート) | 同上 — `