Communitygithub.com

コードツアー

CodeTour形式の`.tour`ファイルを作成します。ファイルや行をアンカーにした、ペルソナ別のステップバイステップのウォークスルーを生成し、オンボーディング、アーキテクチャ説明、PRレビュー、RCA(根本原因分析)などに活用します。

コードツアー とは?

このスキルは、コードベースのウォークスルーのためのCodeTour `.tour`ファイル(JSON形式)を作成します。ファイルや行の範囲をアンカーとして、実際のコードに直接リンクしたガイド付きツアーを生成でき、オンボーディング、アーキテクチャ解説、PRレビュー、障害解析(RCA)など、様々なユースケースに対応します。 大きな特徴は、**ペルソナ(読者の役割)に基づいた適切なツアー**を作成できる点です。新規参加者向けには9〜13ステップの詳細なツアーを、クイックツアーには5〜8ステップと簡潔に、アーキテクチャ説明には14〜18ステップの深い内容を自動的に推奨します。各ステップの説明はSMIG(状況、仕組み、含意、見落としがちな点)のフレームワークに従い、単なるファイルリストではなく**ストーリー性のあるナビゲーション**を提供します。 このスキルはVS CodeやCursorなどのCodeTour拡張機能をサポートするエディタ上で動作し、ツアーファイルは`.tours/`ディレクトリに保存されます。重要なのは、`ref`フィールド(gitブランチやコミット指定)の適切な設定で、特にPRツアーでは、新規追加ファイルがベースブランチに存在しない問題を回避するためにブランチを正しく指定する必要があります。 類似の「コードベースオンボーディング」スキルと異なり、こちらは**再利用可能なアーティファクト**として具体的なファイル・行指定を含むツアーを生成する点が特徴です。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/ECC/tree/main/skills/code-tour

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

コードツアー は何をしますか?

コードベースのウォークスルー用に、実際のファイルと行範囲に直接ジャンプできる CodeTour .tour ファイルを作成します。ツアーファイルは .tours/ に配置し、CodeTour 形式に従います。アドホックな Markdown メモではありません。

良いツアーは、特定の読者のためのナラティブです:

  • 何を見ているのか
  • それがなぜ重要なのか
  • 次にどのパスをたどるべきか

.tour JSON ファイルのみを作成します。このスキルの一部としてソースコードを変更してはいけません。

使用すべきタイミング

以下の場合にこのスキルを使用します:

  • ユーザーがコードツアー、オンボーディングツアー、アーキテクチャウォークスルー、PRツアーを依頼したとき
  • ユーザーが「Xの仕組みを説明して」と依頼し、再利用可能なガイド付き成果物を求めているとき
  • ユーザーが新しいエンジニアやレビューア向けのランプアップパスを求めているとき
  • タスクがフラットな要約よりもガイド付きのシーケンスで表現する方が適しているとき

例:

  • 新しいメンテナーをオンボーディングする
  • あるサービスやパッケージのアーキテクチャツアー
  • 変更ファイルにアンカーを張った PR レビューウォークスルー
  • 障害パスを示す RCA ツアー
  • 信頼境界と重要なチェックを示すセキュリティレビューツアー

使用すべきでないタイミング

コードツアーを使わない場合代わりに使用するもの
チャットでの一回限りの説明で十分な場合直接回答する
ユーザーが .tour 成果物ではなく散文のドキュメントを求めている場合documentation-lookup またはリポジトリのドキュメント編集
タスクが実装やリファクタリングの場合実装作業を行う
ツアー成果物なしで広範なコードベースオンボーディングを行う場合codebase-onboarding

ワークフロー

1. 発見

何かを書く前にリポジトリを探索します:

  • README とパッケージ/アプリのエントリポイント
  • フォルダ構造
  • 関連する設定ファイル
  • ツアーが PR に焦点を当てている場合は、変更されたファイル

コードの構造を理解する前にステップを書き始めてはいけません。

2. 読者を推測する

リクエストからペルソナと深さを決定します。

リクエストの形状ペルソナ推奨ステップ数
「オンボーディング」「新規メンバー」new-joiner9-13 ステップ
「クイックツアー」「感触を確かめたい」vibecoder5-8 ステップ
「アーキテクチャ」architect14-18 ステップ
「このPRのツアー」pr-reviewer7-11 ステップ
「なぜ壊れたのか」rca-investigator7-11 ステップ
「セキュリティレビュー」security-reviewer7-11 ステップ
「この機能の仕組みを説明して」feature-explainer7-11 ステップ
「このパスをデバッグして」bug-fixer7-11 ステップ

3. アンカーを読み、検証する

すべてのファイルパスと行アンカーは実際に存在する必要があります:

  • ファイルが存在することを確認する
  • 行番号が範囲内であることを確認する
  • 選択範囲を使用する場合は、正確なブロックを確認する
  • ファイルが変動しやすい場合は、パターンベースのアンカーを推奨する

行番号を推測してはいけません。

4. .tour を書く

以下の場所に書き込みます:

.tours/<persona>-<focus>.tour

パスは決定論的で読みやすいものに保ちます。

5. 検証する

終了する前に:

  • 参照されているすべてのパスが存在すること
  • すべての行または選択範囲が有効であること
  • 最初のステップが実際のファイルまたはディレクトリにアンカーされていること
  • ref がツアーが参照するすべてのファイルを実際に持つブランチまたはコミットを指していること(下記参照)
  • ツアーがファイルを列挙するのではなく、一貫性のあるストーリーを語っていること

ref フィールド

ref はツアーを git ブランチまたはコミットに紐付けます。見た目以上に重要です:ref が読者がチェックアウトしているブランチと異なる場合、CodeTour は各ステップのファイルをディスク上のファイルではなく、そのリビジョンの git から開きます。そのリビジョンにファイルが存在しない場合、ステップは開かれません——読者は「エディタを開けませんでした。ファイルが見つかりませんでした」というメッセージを目にすることになります。実際にはファイルはすぐそこにあるにもかかわらずです。ツアーとそのコメントは表示されるため、本当の原因を見逃しがちです。

ツアーの種類に応じて ref を選びます:

ツアーの種類ref の設定値
PR ツアーPR ブランチ — ベースブランチにしてはいけません
オンボーディング / アーキテクチャ読者がいるであろうブランチ(多くの場合 main)、または省略する
不明な場合ref を省略し、CodeTour がディスクから直接ファイルを読み込むようにする

PR のケースはよくある落とし穴です:PR は通常新しいファイルを追加し、新しいファイルはベースブランチにはまだ存在しません。ref をベース(例:develop)に設定すると、新しいファイルのすべてのステップが開けなくなります。

終了する前に、各ステップのファイルが選択した ref に実際に存在することを確認します。

ステップの種類

コンテンツ

控えめに、通常はクロージングステップのみに使用します:

{ "title": "次のステップ", "description": "これでリクエストパスをエンドツーエンドで追跡できます。" }

最初のステップをコンテンツのみにしてはいけません。

ディレクトリ

読者をモジュールに誘導するために使用します:

{ "directory": "src/services", "title": "サービス層", "description": "コアのオーケストレーションロジックはここにあります。" }

ファイル + 行

これがデフォルトのステップタイプです:

{ "file": "src/auth/middleware.ts", "line": 42, "title": "認証ゲート", "description": "すべての保護されたリクエストは最初にここを通過します。" }

選択範囲

ファイル全体よりも特定のコードブロックが重要な場合に使用します:

{
  "file": "src/core/pipeline.ts",
  "selection": {
    "start": { "line": 15, "character": 0 },
    "end": { "line": 34, "character": 0 }
  },
  "title": "リクエストパイプライン",
  "description": "このブロックは、検証、認証、および下流の実行を結びつけます。"
}

パターン

正確な行が変動する可能性がある場合に使用します:

{ "file": "src/app.ts", "pattern": "export default class App", "title": "アプリケーションエントリ" }

URI

PR、Issue、ドキュメントなどに便利な場合に使用します:

{ "uri": "https://github.com/org/repo/pull/456", "title": "このPR" }

記述ルール:SMIG

各説明は以下に答える必要があります:

  • 状況 (Situation):読者が何を見ているか
  • 仕組み (Mechanism):どのように動作するか
  • 含意 (Implication):このペルソナにとってなぜ重要か
  • 見落としがちな点 (Gotcha):賢い読者が見逃しそうなこと

説明はコンパクトで具体的に、実際のコードに基づいて記述します。

ナラティブの形

タスクが明確に別の形を必要としない限り、この流れを使用します:

  1. オリエンテーション
  2. モジュールマップ
  3. コア実行パス
  4. エッジケースまたは見落としがちな点
  5. クロージング / 次のアクション

ツアーは、目録ではなく、パスのように感じられるべきです。

例

{
  "$schema": "https://aka.ms/codetour-schema",
  "title": "API サービスツアー",
  "description": "決済サービスのリクエストパスのウォークスルー。",
  "ref": "main",
  "steps": [
    {
      "directory": "src",
      "title": "ソースルート",
      "description": "サービスのすべてのランタイムコードはここから始まります。"
    },
    {
      "file": "src/server.ts",
      "line": 12,
      "title": "エントリポイント",
      "description": "サーバーはここで起動し、任意のルートに到達する前にミドルウェアを配線します。"
    },
    {
      "file": "src/routes/payments.ts",
      "line": 8,
      "title": "決済ルート",
      "description": "すべての決済リクエストは、サービスロジックに到達する前にこのルーターを通過します。"
    },
    {
      "title": "次のステップ",
      "description": "これで、主要なアンカーを使用して任意の決済リクエストをエンドツーエンドで追跡できます。"
    }
  ]
}

アンチパターン

アンチパターン修正方法
フラットなファイルリストステップ間の依存関係を持つストーリーを語る
一般的な説明具体的なコードパスやパターンを名指しする
推測によるアンカーすべてのファイルと行を最初に検証する
クイックツアーにしてステップが多すぎる積極的に削減する
最初のステップがコンテンツのみ最初のステップを実際のファイルまたはディレクトリにアンカーする
ペルソナの不一致一般的なエンジニアではなく、実際の読者に向けて書く

ベストプラクティス

  • ステップ数はリポジトリのサイズとペルソナの深さに比例させる
  • オリエンテーションにはディレクトリステップを、実質的な内容にはファイルステップを使用する
  • PR ツアーの場合は、変更されたファイルを最初にカバーする
  • モノレポの場合は、すべてをツアーするのではなく、関連するパッケージにスコープを絞る
  • まとめではなく、読者が次に何ができるようになったかを示して締めくくる

関連スキル

  • codebase-onboarding
  • coding-standards
  • council
  • 公式アップストリーム形式:microsoft/codetour

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/content-engine

Create platform-native content systems for X, LinkedIn, TikTok, YouTube, newsletters, and repurposed multi-platform campaigns. Use when the user wants social posts, threads, scripts, content calendars, or one source asset adapted cleanly across platforms.

affaan-m/ECC

Multi-platform content distribution across X, LinkedIn, Threads, and Bluesky. Adapts content per platform using content-engine patterns. Never posts identical content cross-platform. Use when the user wants to distribute content across social platforms.

affaan-m/fal-ai-media

Unified media generation via fal.ai MCP — image, video, and audio. Covers text-to-image (Nano Banana), text/image-to-video (Seedance, Kling, Veo 3), text-to-speech (CSM-1B), and video-to-audio (ThinkSound). Use when the user wants to generate images, videos, or audio with AI.

affaan-m/manim-video

日本語翻訳:このファイルは manim-video 用の日本語翻訳が必要です

affaan-m/remotion-video-creation

Remotion のベストプラクティス - React で動画を作成する。3D、アニメーション、音声、字幕、チャート、トランジションなどをカバーするドメイン固有の29のルール。

affaan-m/video-editing

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

agent-self-evaluation

Use after completing any non-trivial task. The agent self-rates its output on 5 axes — accuracy, completeness, clarity, actionability, conciseness — with concrete evidence per criterion. Produces a structured 1-5 scorecard with specific improvement suggestions.

agent-sort

Build an evidence-backed ECC install plan for a specific repo by sorting skills, commands, rules, hooks, and extras into DAILY vs LIBRARY buckets using parallel repo-aware review passes. Use when ECC should be trimmed to what a project actually needs instead of loading the full bundle.

ai-first-engineering

Engineering operating model for teams where AI agents generate a large share of implementation output. Use when setting team process, review gates, or ownership rules for a codebase largely written by agents.

ai-regression-testing

Regression testing strategies for AI-assisted development. Sandbox-mode API testing without database dependencies, automated bug-check workflows, and patterns to catch AI blind spots where the same model writes and reviews code. Use when adding regression coverage to AI-assisted code, or when the same model both wrote and reviewed a change.

android-clean-architecture

Clean Architecture patterns for Android and Kotlin Multiplatform projects — module structure, dependency rules, UseCases, Repositories, and data layer patterns. Use when structuring modules, layers, or data flow in an Android or KMP project.

angular-developer

Generates Angular code and provides architectural guidance. Trigger when creating projects, components, or services, or for best practices on reactivity (signals, linkedSignal, resource), forms, dependency injection, routing, SSR, accessibility (ARIA), animations, styling (component styles, Tailwind CSS), testing, or CLI tooling.

関連スキル