- GitHub Issue/PR のコメントで
/codeまたは🤖を書くと、devcontainer 内で Claude Code を実行 - 自動的にブランチ checkout、main merge、conflict 解決、コミット&プッシュ
- 実装は約 350 行のシェルスクリプト + 200 行のシステムプロンプト
- 技術スタック非依存で、どんなプロジェクトでも再利用可能
最近、私たちはコマンドラインツール「Claude Code」をリリースしました。これはエージェント的コーディングを可能にするツールで、Anthropic のエンジニアや研究者が Claude をよりネイティブにコーディングワークフローに組み込めるよう設計された研究プロジェクトです。
Claude Code は意図的にロー レベルかつアンオピニオンテッド(特定のワークフローを強制しない)に作られており、モデルへのほぼ生のアクセスを提供します。このデザイン哲学により、柔軟でカスタマイズ可能、スクリプト化が容易、かつ安全なパワーツールとなっています。しかしその柔軟さゆえ、エージェント的コーディングツールに不慣れなエンジニアには学習コストがかかります──少なくとも、自身のベストプラクティスを確立するまでは。
この記事では、Anthropic の内部チームやさまざまなコードベース/言語/環境で Claude Code を使っている外部エンジニアにとって効果的だった一般的なパターンを紹介します。ここに挙げた内容は不変でも普遍的でもありません。あくまで出発点としてご参考にしていただき、ぜひ試行錯誤しながら最適な方法を見つけてください。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ; このファイルを `~/.claude/claude-sandbox.sb` に設定したあと、 | |
| ; alias c="sandbox-exec -f ~/.claude/claude-sandbox.sb -D PWD="`pwd`" -D HOME="$HOME" claude " | |
| ; このaliasを~/.zshrcに書き込んで、`. ~/.zshrc`で読み直します。 | |
| ; dangerousな人は下記のように。 | |
| ; alias c="sandbox-exec -f ~/.claude/claude-sandbox.sb -D PWD="`pwd`" -D HOME="$HOME" claude --dangerously-skip-permissions " | |
| ; これで `c`だけで安全にClaude Code CLIが実行できます。 | |
| (version 1) | |
| ; based |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Get list of running containers with images containing "vsc-" | |
| containers=$(docker ps --format "{{.ID}}:{{.Image}}:{{.Names}}" | grep "vsc-") | |
| if [ -z "$containers" ]; then | |
| echo "No devcontainer (vsc-*) containers are running." | |
| exit 1 | |
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # <xbar.title>Docker Manager</xbar.title> | |
| # <xbar.version>v2.4</xbar.version> | |
| # <xbar.author>Yuichiro Masui</xbar.author> | |
| # <xbar.author.github>masuidrive</xbar.author.github> | |
| # <xbar.desc>Manage Docker containers: start, stop, and open services in browser. Manage Colima.</xbar.desc> | |
| # <xbar.dependencies>docker,colima</xbar.dependencies> | |
| # 管理するコンテナのリストを定義 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ''' | |
| # Transcription to JSONL Converter | |
| ## 概要 | |
| LibriSpeechデータセットの転写ファイル(.trans.txt)を処理し、構造化されたJSONLファイルに変換します。また、必要に応じて関連する本文をProject Gutenbergからダウンロードします。 | |
| ## 主な機能 | |
| 1. 転写ファイル(.trans.txt)の読み込みと処理 | |
| 2. 章情報(CHAPTERS.txt)と話者情報(SPEAKERS.txt)の統合 | |
| 3. 本文ファイルの存在確認と必要に応じたダウンロード |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| # M5Unified Touch Circles Documentation | |
| ## 概要 | |
| このプログラムは、M5Unifiedデバイス上でタッチ操作を検出し、視覚的フィードバックを提供すると同時に、I2C経由で外部デバイスにマウス操作をシミュレートします。 | |
| 一般的なUSBやシリアルのプロトコルではなく、専用のI2Cプロトコルを話します。 | |
| ## 主要機能 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <M5Atom.h> | |
| #include <Wire.h> | |
| // 高位4ビット(0-F)の5x3パターン | |
| const uint8_t hexPatternsHigh[16][5] = { | |
| // 0 | |
| {0b111, 0b101, 0b101, 0b101, 0b111}, | |
| // 1 | |
| {0b010, 0b110, 0b010, 0b010, 0b111}, | |
| // 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import torch | |
| import torch.nn.functional as F | |
| from pytorch_metric_learning.utils import common_functions as c_f | |
| from pytorch_metric_learning.losses.large_margin_softmax_loss import LargeMarginSoftmaxLoss | |
| class MagFaceLoss(LargeMarginSoftmaxLoss): | |
| """ | |
| Implementation of MagFace: https://arxiv.org/pdf/1801.07698.pdf (extension to ArcFace) | |
| """ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <ogg/ogg.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <stdint.h> | |
| #include <string.h> | |
| // get_opus_raw関数のプロトタイプ | |
| // この関数は外部で定義され、Opusエンコードされたraw binaryを提供します。 | |
| int16_t get_opus_raw(uint8_t *buffer); |
NewerOlder