依存関係の取り違えを検出する観測。lockfile固定、クリーンビルド、統合スモークで再現性を担保。Use when: 依存追加/更新、CI設定、ローカルでは動く問題、新環境セットアップ、バージョン差異の疑い。
This skill inherits all available tools. When active, it can use any tool Claude has access to.
references/ci-templates.md生成コードは「見たことあるAPIっぽいもの」を書きがちで、依存取り違えは頻出。 このスキルは"works on my machine"を潰し、依存の再現性を確保する。
lockfile が存在し、かつCIで固定が破られたら即failするか確認。
言語別lockfile:
| 言語 | lockfile |
|---|---|
| Node.js | package-lock.json / yarn.lock / pnpm-lock.yaml |
| Python | poetry.lock / Pipfile.lock / requirements.txt (pip-compile) |
| Go | go.sum |
| Rust | Cargo.lock |
| Ruby | Gemfile.lock |
キャッシュに頼らないビルドを実行:
# Node.js
rm -rf node_modules && npm ci
# Python (poetry)
rm -rf .venv && poetry install
# Go
go clean -cache && go build ./...
# Rust
cargo clean && cargo build
どのバージョンが入っているかを出力:
# Node.js
npm ls --all
# Python
pip list --format=freeze
# Go
go list -m all
# Rust
cargo tree
"本物の依存"で最小経路だけ叩く:
# 例: DB接続→1クエリのスモークテスト
def test_database_smoke():
conn = get_db_connection()
result = conn.execute("SELECT 1").fetchone()
assert result[0] == 1
起動時に依存バージョンと設定をログ出力(トラブルシュートの生命線):
{
"event": "app_started",
"runtime": "python 3.11.5",
"dependencies": {
"sqlalchemy": "2.0.23",
"pydantic": "2.5.2"
}
}
詳細は references/ci-templates.md を参照。
name: Dependency Check
on: [push, pull_request]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check lockfile exists
run: |
if [ ! -f package-lock.json ]; then
echo "❌ package-lock.json not found"
exit 1
fi
- name: Clean install (fail on lockfile mismatch)
run: npm ci
- name: Smoke test
run: npm run test:smoke
// tests/smoke.test.ts
describe('Integration Smoke', () => {
it('connects to database', async () => {
const db = await createConnection();
const result = await db.query('SELECT 1 as value');
expect(result[0].value).toBe(1);
await db.close();
});
it('external API is reachable', async () => {
const response = await fetch(process.env.API_ENDPOINT + '/health');
expect(response.ok).toBe(true);
});
});