contribute-skill

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

contribute-skill

contribute-skill

現在のプロジェクトから知見を収集し、TBSten/skills リポジトリに skill として登録する PR を自動作成する。
Collect insights from the current project and automatically create a PR to register them as a skill in the TBSten/skills repository.

前提条件チェック

Prerequisite Check

スキル起動時にまず以下を確認する。失敗した場合は対処方法を案内して中断する。
  1. git --version
    で git の存在を確認
  2. gh auth status
    で gh CLI の認証状態を確認
First verify the following items when the skill starts. If the check fails, guide the user on the solution and abort the process.
  1. Confirm git is installed via
    git --version
  2. Confirm gh CLI authentication status via
    gh auth status

Step 1: 起動時の確認

Step 1: Confirmation on Startup

ARGUMENTS からユーザーが収集したい知見の説明を受け取る。以下を確認する。 ユーザーの指示から明確に読み取れる項目は確認を省略してよい。
  1. skill 名 — kebab-case で命名。知見の内容から適切な名前を提案する
  2. 収集対象 — どの知見をスキル化するか。具体的なファイルパスやセクションを特定する
  3. スキルの対象ユーザー — どのようなプロジェクト・状況で使われるスキルか
  4. リポジトリ — デフォルトは
    TBSten/skills
    。fork を使う場合はユーザーに確認する
Receive the description of the insights the user wants to collect from ARGUMENTS. Confirm the following items. You can skip confirmation for items that can be clearly read from the user's instructions.
  1. skill name — Name in kebab-case. Propose an appropriate name based on the content of the insights
  2. Collection target — Which insights to turn into a skill. Specify concrete file paths or sections
  3. Target users of the skill — What kind of projects/scenarios the skill is intended for
  4. Repository — Defaults to
    TBSten/skills
    . Confirm with the user if a fork is used

Step 2: 知見の収集と整理

Step 2: Insight Collection and Organization

ユーザーが指定した収集対象を読み取る。
Read the collection targets specified by the user.

収集の効率化

Collection Efficiency Improvement

収集対象が多い場合、Agent tool を活用して並列に収集する:
  1. コアファイルの読み取り (Glob でファイル一覧取得 → 並列 Read)
  2. 利用箇所の調査 (Grep で呼び出し元を検索 → 並列 Read)
  3. テストコードの調査 (並列 Agent)
独立したファイル読み取りは必ず並列で実行すること。
主なソース:
  • CLAUDE.md の特定セクション
  • .claude/rules/
    内のルールファイル
  • .claude/skills/
    内の既存スキル
  • コードベース内のパターンやユーティリティ
  • 実際の利用箇所 — Grep 等で対象コードの呼び出し元を調査し、利用パターン(ViewModel での使い方、UI での使い方、テストでの使い方等)を収集する
  • テストコード — 対象コードのテストを検索 (
    *Test.kt
    ,
    *Spec.kt
    ,
    *.test.ts
    等)
  • ユーザーの説明そのもの
When there are many collection targets, use Agent tools for parallel collection:
  1. Read core files (Get file list via Glob → Parallel Read)
  2. Investigate usage locations (Search for callers via Grep → Parallel Read)
  3. Investigate test code (Parallel Agent)
Always execute independent file reads in parallel.
Main sources:
  • Specific sections of CLAUDE.md
  • Rule files in
    .claude/rules/
  • Existing skills in
    .claude/skills/
  • Patterns and utilities in the codebase
  • Actual usage locations — Investigate callers of the target code via Grep etc., collect usage patterns (usage in ViewModel, usage in UI, usage in tests, etc.)
  • Test code — Search for tests of the target code (
    *Test.kt
    ,
    *Spec.kt
    ,
    *.test.ts
    , etc.)
  • The user's own description

テストコードの扱い

Handling of Test Code

テストが見つかった場合、以下の基準で同梱方針を判断する:
  • example/test/ に同梱: テストの書き方自体がスキルの一部である場合(テストパターンがスキルの価値の一つ)
  • references/ に記載: テストパターンを参考情報として提供する場合
  • 同梱しない: テストがプロジェクト固有のフレームワークに強く依存する場合
同梱する場合は Step 3.5 と同様にプロジェクト固有の依存を除去する。
読み取った知見を以下の形式で整理し、ユーザーに提示する:
  • スキルの目的 — 1〜2文で何を実現するか
  • トリガー条件 — どのような発話・状況で発動すべきか (5個以上リストアップ)
  • 手順・ワークフロー — 具体的な実行ステップの箇条書き
  • 利用パターン — 実プロジェクトでの使い方を 3 つ以上リストアップ
  • 同梱リソース — サンプルコードやテンプレート等。不要であれば「なし」と明記
  • 対象プロジェクトの前提 — 言語、フレームワーク、ディレクトリ構成等の前提条件
ユーザーの承認を得てから次のステップに進む。
If tests are found, determine the inclusion policy based on the following criteria:
  • Include in example/test/: When the way of writing tests itself is part of the skill (test patterns are one of the values of the skill)
  • List in references/: When test patterns are provided as reference information
  • Do not include: When tests are strongly dependent on project-specific frameworks
If included, remove project-specific dependencies in the same way as Step 3.5.
Organize the collected insights into the following format and present them to the user:
  • Skill purpose — What it achieves in 1-2 sentences
  • Trigger conditions — What utterances/scenarios it should be activated in (list 5 or more)
  • Procedures/Workflow — Bullet points of specific execution steps
  • Usage patterns — List 3 or more usage examples in real projects
  • Included resources — Sample code, templates, etc. Specify "None" if not needed
  • Target project prerequisites — Prerequisites such as language, framework, directory structure, etc.
Proceed to the next step after obtaining user approval.

Step 3: ワークディレクトリの準備と add-skill.md の読み込み

Step 3: Work Directory Preparation and add-skill.md Loading

  1. ワークディレクトリを準備する:
bash
rm -rf /tmp/contribute-skill
git clone --depth 1 https://github.com/<repo>.git /tmp/contribute-skill
<repo>
は Step 1 で確認したリポジトリ (デフォルト:
TBSten/skills
)。
  1. clone したリポジトリ内のスキル作成ガイドを読み込む:
/tmp/contribute-skill/.claude/skills/add-skill.md
add-skill.md を読み込んだ後、以下のように統合する:
  • add-skill.md の Step 1 (確認事項): contribute-skill の Step 1-2 で既に完了。スキップする
  • add-skill.md の Step 2 (SKILL.md 作成): フォーマット・構成ルールに従う。内容は contribute-skill の Step 2 で整理した知見を使う
  • add-skill.md の Step 3-5 (リソース配置・ドキュメント・README): そのまま従う
ガイドが見つからない場合は、以下の「フォールバック」セクションに従う。
  1. Prepare the work directory:
bash
rm -rf /tmp/contribute-skill
git clone --depth 1 https://github.com/<repo>.git /tmp/contribute-skill
<repo>
is the repository confirmed in Step 1 (default:
TBSten/skills
).
  1. Load the skill creation guide in the cloned repository:
/tmp/contribute-skill/.claude/skills/add-skill.md
After loading add-skill.md, integrate as follows:
  • Step 1 of add-skill.md (Confirmation items): Already completed in Steps 1-2 of contribute-skill. Skip
  • Step 2 of add-skill.md (Create SKILL.md): Follow the format/structure rules. Use the insights organized in Step 2 of contribute-skill for content
  • Steps 3-5 of add-skill.md (Resource placement / Documentation / README): Follow as is
If the guide is not found, follow the "Fallback" section below.

Step 3.5: コードの汎用化

Step 3.5: Code Generalization

example にコードを配置する前に以下を確認・実行する:
  1. プロジェクト固有の import を検出: example 対象ファイルの import を全走査し、スキルの example パッケージ外への依存をリストアップ
  2. 依存の分類と対処:
    • 標準ライブラリ (
      kotlin.*
      ,
      kotlinx.*
      ) → そのまま
    • フレームワーク標準 (
      androidx.*
      ,
      react
      等) → そのまま
    • プロジェクト固有ユーティリティ → 標準的な代替に置換、または example に同梱
    • プロジェクト固有アノテーション → 削除
  3. パッケージ名の抽象化:
    com.example.<skill-name-without-hyphens>
    に統一 (add-skill.md のパッケージ名規約に準拠)
  4. 置換結果をユーザーに提示: 何を何に置換したかの一覧を示し、承認を得る
Verify and execute the following before placing code in example:
  1. Detect project-specific imports: Scan all imports of example target files, list dependencies outside the skill's example package
  2. Dependency classification and handling:
    • Standard libraries (
      kotlin.*
      ,
      kotlinx.*
      ) → Keep as is
    • Framework standard libraries (
      androidx.*
      ,
      react
      , etc.) → Keep as is
    • Project-specific utilities → Replace with standard alternatives, or include in example
    • Project-specific annotations → Delete
  3. Package name abstraction: Unify to
    com.example.<skill-name-without-hyphens>
    (comply with package name conventions in add-skill.md)
  4. Present replacement results to the user: Show a list of what was replaced with what, obtain approval

Step 4: スキルファイルの作成

Step 4: Create Skill Files

clone した
/tmp/contribute-skill/
内で、add-skill.md の手順に従い以下を作成する。 Step 2 で整理した知見をもとに、SKILL.md の各セクションを埋めていく。
  1. skills/<skill-name>/SKILL.md
    — frontmatter (name, description) + 手順書
  2. 必要に応じて
    references/
    ,
    example/
    ,
    assets/
    内のリソース
  3. skills/<skill-name>.md
    — 詳細ドキュメント (英語)
  4. skills/<skill-name>.ja.md
    — 詳細ドキュメント (日本語)
  5. README.md
    README.ja.md
    の Available Skills テーブルに行を追加
In the cloned
/tmp/contribute-skill/
directory, create the following items following the steps in add-skill.md. Fill in each section of SKILL.md based on the insights organized in Step 2.
  1. skills/<skill-name>/SKILL.md
    — frontmatter (name, description) + procedure manual
  2. Resources in
    references/
    ,
    example/
    ,
    assets/
    as needed
  3. skills/<skill-name>.md
    — Detailed documentation (English)
  4. skills/<skill-name>.ja.md
    — Detailed documentation (Japanese)
  5. Add a row to the Available Skills table in
    README.md
    and
    README.ja.md

レビューの提示方法

Review Presentation Method

作成ファイル数に応じて提示方法を変える:
  • 5 ファイル以下: 全ファイルの内容を提示
  • 6 ファイル以上: 以下を提示
    1. ファイル一覧と各ファイルの概要 (1行)
    2. SKILL.md の全内容 (最重要ファイル)
    3. 特に注意が必要なファイルをピックアップして内容を提示
    4. 「他のファイルも確認しますか?」とユーザーに確認
フィードバックがあれば修正してから次に進む。
Change the presentation method according to the number of created files:
  • 5 files or less: Present the content of all files
  • 6 files or more: Present the following
    1. File list and summary of each file (1 line)
    2. Full content of SKILL.md (most important file)
    3. Pick up files that require special attention and present their content
    4. Ask the user: "Would you like to check other files as well?"
Make corrections if there is feedback before proceeding to the next step.

プロジェクト固有情報の除外チェック

Exclusion Check for Project-Specific Information

スキルは公開リポジトリに登録されるため、作成したファイルに以下が含まれていないか細心の注意を払う:
  • プロジェクト固有のファイルパス、URL、ドメイン名
  • 社内システムやサービスの名前
  • 認証情報、トークン、API キー
  • 個人名、メールアドレス、チーム名
  • 社内ドキュメントへのリンク
  • その他、公開すべきでない情報
知見を汎用化する際に具体例が必要な場合は、プレースホルダー (
<project-name>
,
<your-package>
等) に置き換える。 チェック結果をユーザーに報告し、問題がないことを確認してから次に進む。
Since the skill will be registered in a public repository, pay close attention to ensure that the created files do not contain the following:
  • Project-specific file paths, URLs, domain names
  • Names of internal systems and services
  • Authentication information, tokens, API keys
  • Personal names, email addresses, team names
  • Links to internal documents
  • Other information that should not be disclosed
If specific examples are needed when generalizing insights, replace them with placeholders (
<project-name>
,
<your-package>
, etc.). Report the check results to the user, confirm there are no issues before proceeding.

Step 4.5: セルフレビュー

Step 4.5: Self-Review

PR 作成前に以下を確認する:
  1. 必要なファイルが揃っているか — 以下のファイルが存在することを確認する:
    • ./skills/<skill-name>.ja.md
      が存在すること
    • ./skills/<skill-name>.md
      が存在すること
    • ./skills/<skill-name>/SKILL.md
      が存在すること
    • SKILL.md 内で参照しているすべてのファイルが
      ./skills/<skill-name>/
      配下に存在すること
    • README.md
      README.ja.md
      の Available Skills テーブルに新しいスキルのエントリが追加されていること
  2. SKILL.md の word count が 5,000 words 以下か
    wc -w
    で確認。超える場合は詳細を references/ に分離する
  3. SKILL.md と references/ に情報重複がないか — SKILL.md には概要・手順のみ、詳細コード例は references/ に分離
  4. example/ 内の import が整合しているか
    grep -r "^import"
    でプロジェクト固有依存が残っていないか確認
  5. README テーブルが既存行と同じフォーマットか — HTML タグ、改行、code block の書き方を既存行と比較
問題が見つかった場合は修正してからユーザーに報告する。
Verify the following before creating the PR:
  1. All required files are present — Confirm the following files exist:
    • ./skills/<skill-name>.ja.md
      exists
    • ./skills/<skill-name>.md
      exists
    • ./skills/<skill-name>/SKILL.md
      exists
    • All files referenced in SKILL.md exist under
      ./skills/<skill-name>/
    • A new skill entry has been added to the Available Skills table in
      README.md
      and
      README.ja.md
  2. SKILL.md word count is 5,000 words or less — Check with
    wc -w
    . If exceeded, separate detailed content into references/
  3. No duplicate information between SKILL.md and references/ — SKILL.md only contains overview/procedures, detailed code examples are separated into references/
  4. Imports in example/ are consistent — Check for remaining project-specific dependencies via
    grep -r "^import"
  5. README table has the same format as existing rows — Compare HTML tags, line breaks, code block writing style with existing rows
If issues are found, fix them before reporting to the user.

Step 5: PR の作成

Step 5: Create PR

以下の内容をユーザーに提示し、push と PR 作成の許可を明示的に得てから実行する:
  • push 先リポジトリとブランチ名
  • コミットに含まれるファイル一覧
  • プロジェクト固有情報が含まれていないことの最終確認
許可を得たら、以下を実行する:
bash
cd /tmp/contribute-skill
git checkout -b add-skill/<skill-name>
git add skills/<skill-name>/ README.md README.ja.md
git commit -m "add <skill-name> skill"
git push -u origin add-skill/<skill-name>
PR を作成する:
bash
gh pr create \
  --repo <repo> \
  --head add-skill/<skill-name> \
  --title "Add <skill-name> skill" \
  --body "## Summary
- <Step 2 で整理したスキルの目的>
Present the following content to the user, and execute only after explicitly obtaining permission to push and create the PR:
  • Target repository and branch name for push
  • List of files included in the commit
  • Final confirmation that no project-specific information is included
After obtaining permission, execute the following:
bash
cd /tmp/contribute-skill
git checkout -b add-skill/<skill-name>
git add skills/<skill-name>/ README.md README.ja.md
git commit -m "add <skill-name> skill"
git push -u origin add-skill/<skill-name>
Create the PR:
bash
gh pr create \
  --repo <repo> \
  --head add-skill/<skill-name> \
  --title "Add <skill-name> skill" \
  --body "## Summary
- <Skill purpose organized in Step 2>

Files

Files

  • skills/<skill-name>/SKILL.md
  • <その他の追加ファイル一覧>
  • skills/<skill-name>/SKILL.md
  • <List of other added files>

Test plan

Test plan

  • npx skills add <repo> --skill <skill-name> でインストールできること
  • スキルのトリガーフレーズで正しく発動すること "

作成された PR の URL をユーザーに報告する。
  • Can be installed via npx skills add <repo> --skill <skill-name>
  • Can be triggered correctly with the skill's trigger phrases "

Report the created PR URL to the user.

エラー時の対応

Error Handling

  • gh auth status
    失敗 →
    gh auth login
    を案内
  • clone 失敗 → ネットワーク接続の確認を案内
  • push 失敗 → リポジトリへの write 権限を確認するよう案内。fork の利用を提案
  • PR 作成失敗で同名ブランチが既存 → ブランチ名にサフィックス (
    -v2
    等) を付与して再試行
  • gh auth status
    failed → Guide the user to run
    gh auth login
  • Clone failed → Guide the user to check network connection
  • Push failed → Guide the user to check write permission to the repository. Suggest using a fork
  • PR creation failed due to existing branch with the same name → Retry with a suffix (
    -v2
    etc.) added to the branch name

フォールバック

Fallback

add-skill.md が clone 先に存在しない場合、以下の最低限の構成で作成する:
  1. skills/<skill-name>/SKILL.md
    に YAML frontmatter (name, description) + 手順を記述
  2. skills/<skill-name>.md
    /
    <skill-name>.ja.md
    に概要・使い方・前提条件を記述
  3. README のテーブルは手動で更新するようユーザーに案内する
If add-skill.md does not exist in the cloned repository, create with the following minimum configuration:
  1. Describe YAML frontmatter (name, description) + procedures in
    skills/<skill-name>/SKILL.md
  2. Describe overview/usage/prerequisites in
    skills/<skill-name>.md
    /
    <skill-name>.ja.md
  3. Guide the user to manually update the README table