github-ai-features-2025 について
コードやリポジトリを管理するチーム向けに、GitHub の開発ワークフローとセキュリティ機能を解説するスキルです。トランクベース開発、シークレット保護、コードスキャン、依存関係レビュー、自動化エージェントを扱います。
主な機能
- 01トランクベース開発の実践
- 02AI によるシークレット検出
- 03CodeQL スキャンと Copilot Autofix
- 04不具合修正や PR 作成のエージェント
- 05依存関係変更のレビュー
活用シーン
- 01短期間のブランチ運用の計画
- 02プッシュ前のリポジトリ内シークレット検出
- 03コードのセキュリティ問題の確認
- 04Issue に応じた修正と PR 作成の自動化
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ josiahsiegel/ claude-plugin-marketplace --skill github-ai-features-2025インストール後、Claude Code で/github-ai-features-2025を入力して読み込まれたか確認します。
詳細
🚨 重要なガイドライン
Windows のファイルパス要件
必須:Windows ではファイルパスに常にバックスラッシュを使用してください
Windows で Edit または Write ツールを使用する場合、ファイルパスにはスラッシュ(/)ではなく、バックスラッシュ(\)を必ず使用してください。
例:
- ❌ 誤り:
D:/repos/project/file.tsx - ✅ 正しい:
D:\repos\project\file.tsx
これは次の項目に適用されます:
- Edit ツールの file_path パラメーター
- Write ツールの file_path パラメーター
- Windows システムでのすべてのファイル操作
ドキュメント作成のガイドライン
ユーザーから明示的に依頼されない限り、新しいドキュメントファイルを作成しないでください。
- 優先事項:新しいドキュメントを作成するのではなく、既存の README.md ファイルを更新してください
- リポジトリの整理:ユーザーから依頼がない限り、リポジトリのルートは README.md のみとし、整理された状態を保ってください
- スタイル:ドキュメントは簡潔で、直接的かつ専門的な内容にしてください。AI 生成のような文体は避けてください
- ユーザーの希望:ユーザーからドキュメント作成を明確に依頼された場合に限り、追加の .md ファイルを作成してください
GitHub AI 機能 2025
トランクベース開発(TBD)
大手テクノロジー企業(Google:開発者 35,000 人以上)が採用する最新のワークフローです。
原則
- 短命なブランチ: 最長でも数時間から 1 日
- 小規模で頻繁なコミット: マージの競合を減らします
- 継続的インテグレーション: メインブランチは常にデプロイ可能な状態にします
- フィーチャーフラグ: 未完成の機能を非表示にします
実装
# Create task branch from main
git checkout main
git pull origin main
git checkout -b task/add-login-button
# Make small changes
git add src/components/LoginButton.tsx
git commit -m "feat: add login button component"
# Push and create PR (same day)
git push origin task/add-login-button
gh pr create --title "Add login button" --body "Implements login UI"
# Merge within hours, delete branch
gh pr merge --squash --delete-branch
メリット
- マージの競合を削減(75% 減)
- フィードバックサイクルの短縮
- コードレビューの簡素化(変更が小規模)
- メインブランチを常にリリース可能な状態に維持
- CI/CD パイプラインの簡素化
GitHub Secret Protection(AI を活用)
リポジトリに登録される前に、AI がシークレットを検出します。
プッシュ保護
# Attempt to commit secret
git add config.py
git commit -m "Add config"
git push
# GitHub AI detects secret:
"""
⛔ Push blocked by secret scanning
Found: AWS Access Key
Pattern: AKIA[0-9A-Z]{16}
File: config.py:12
Options:
1. Remove secret and try again
2. Mark as false positive (requires justification)
3. Request review from admin
"""
# Fix: Use environment variables
# config.py
import os
aws_key = os.environ.get('AWS_ACCESS_KEY')
git add config.py
git commit -m "Use env vars for secrets"
git push # ✅ Success
対応するシークレットの種類(AI による強化)
- AWS 認証情報
- Azure サービスプリンシパル
- Google Cloud キー
- GitHub トークン
- データベース接続文字列
- API キー(OpenAI、Stripe など)
- 秘密鍵(SSH、TLS)
- OAuth トークン
- カスタムパターン(正規表現ベース)
GitHub コードセキュリティ
CodeQL コードスキャン
AI を活用した静的解析です。
# .github/workflows/codeql.yml
name: "CodeQL"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
analyze:
runs-on: ubuntu-latest
permissions:
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: javascript, python, java
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
検出対象:
- SQL インジェクション
- XSS の脆弱性
- パストラバーサル
- コマンドインジェクション
- 安全でないデシリアライゼーション
- 認証の回避
- ロジックエラー
Copilot Autofix
AI がセキュリティの脆弱性を自動的に修正します。
# Vulnerable code detected by CodeQL
def get_user(user_id):
query = f"SELECT * FROM users WHERE id = {user_id}" # ❌ SQL injection
return db.execute(query)
# Copilot Autofix suggests:
def get_user(user_id):
query = "SELECT * FROM users WHERE id = ?"
return db.execute(query, (user_id,)) # ✅ Parameterized query
# One-click to apply fix
GitHub エージェント(自動化ワークフロー)
バグ修正と PR 作成を自動化する AI エージェントです。
バグ修正エージェント
# .github/workflows/ai-bugfix.yml
name: AI Bug Fixer
on:
issues:
types: [labeled]
jobs:
autofix:
if: contains(github.event.issue.labels.*.name, 'bug')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Analyze Bug
uses: github/ai-agent@v1
with:
task: 'analyze-bug'
issue-number: ${{ github.event.issue.number }}
- name: Generate Fix
uses: github/ai-agent@v1
with:
task: 'generate-fix'
create-pr: true
pr-title: "Fix: ${{ github.event.issue.title }}"
PR の自動生成
# GitHub Agent creates PR automatically
# When issue is labeled "enhancement":
# 1. Analyzes issue description
# 2. Generates implementation code
# 3. Creates tests
# 4. Opens PR with explanation
# Example: Issue #42 "Add dark mode toggle"
# Agent creates PR with:
# - DarkModeToggle.tsx component
# - ThemeContext.tsx provider
# - Tests for theme switching
# - Documentation update
依存関係のレビュー(AI による強化)
AI が PR の依存関係の変更を分析します。
# .github/workflows/dependency-review.yml
name: Dependency Review
on: [pull_request]
permissions:
contents: read
jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Dependency Review
uses: actions/dependency-review-action@v3
with:
fail-on-severity: high
fail-on-scopes: runtime
AI による分析結果:
- 新しい依存関係に既知の脆弱性があるか
- ライセンスコンプライアンス上の問題
- 更新による破壊的変更
- より安全な代替パッケージ
- 依存関係の最新度スコア
トランクベース開発のワークフロー
日々のワークフロー
# Morning: Sync with main
git checkout main
git pull origin main
# Create task branch
git checkout -b task/user-profile-api
# Work in small iterations (2-4 hours)
# First iteration: API endpoint
git add src/api/profile.ts
git commit -m "feat: add profile API endpoint"
git push origin task/user-profile-api
gh pr create --title "Add user profile API" --draft
# Continue work: Add tests
git add tests/profile.test.ts
git commit -m "test: add profile API tests"
git push
# Mark ready for review
gh pr ready
# Get review (should happen within hours)
# Merge same day
gh pr merge --squash --delete-branch
# Next task: Start fresh from main
git checkout main
git pull origin main
git checkout -b task/profile-ui
小規模で頻繁なコミットのパターン
# ❌ Bad: Large infrequent commit
git add .
git commit -m "Add complete user profile feature with API, UI, tests, docs"
# 50 files changed, 2000 lines
# ✅ Good: Small frequent commits
git add src/api/profile.ts
git commit -m "feat: add profile API endpoint"
git push
git add src/components/ProfileCard.tsx
git commit -m "feat: add profile card component"
git push
git add tests/profile.test.ts
git commit -m "test: add profile tests"
git push
git add docs/profile.md
git commit -m "docs: document profile API"
git push
# Each commit: 1-3 files, 50-200 lines
# Easier reviews, faster merges, less conflicts
セキュリティのベストプラクティス(2025)
- シークレットスキャンを有効にする:
# Repository Settings → Security → Secret scanning
# Enable: Push protection + AI detection
- CodeQL を設定する:
# Add .github/workflows/codeql.yml
# Enable for all languages in project
- Copilot Autofix を使用する:
# Review security alerts weekly
# Apply Copilot-suggested fixes
# Test before merging
- トランクベース開発を導入する:
# Branch lifespan: <1 day
# Commit frequency: Every 2-4 hours
# Main branch: Always deployable
- GitHub エージェントを活用する:
# Automate: Bug triage, PR creation, dependency updates
# Review: All AI-generated code before merging
リソース
コメント
Markdown 対応