スキル一覧に戻る
chkim-su

hook-sdk-integration

by chkim-su

1🍴 0📅 2026年1月16日
GitHubで見るManusで実行

SKILL.md


name: hook-sdk-integration description: LLM invocation patterns from hooks via SDK. Use when you need background agents, CLI calls, or cost optimization. allowed-tools: ["Read", "Grep", "Glob"]

Hook SDK Integration

Patterns for invoking LLM calls from hooks using u-llm-sdk/claude-only-sdk.

IMPORTANT: SDK Detailed Guide

Load when implementing SDK:

Skill("forge-editor:llm-sdk-guide")

This skill covers SDK call pattern interfaces. llm-sdk-guide covers SDK detailed APIs and types.

Quick Start

# Background agent pattern (non-blocking)
(python3 sdk-agent.py "$INPUT" &)
echo '{"status": "started"}'
exit 0

Key Findings (Verified: 2025-12-30)

ItemResult
SDK callsPossible from hooks
Latency~30s (CLI session initialization)
BackgroundNon-blocking execution possible (0.01s return)
CostIncluded in subscription (no additional API cost)

Architecture

Hook (bash) → Background (&) → SDK (Python) → CLI → Subscription usage
     │                                                    │
     └─── Immediate return (0.01s) ───────────────────────┘

Pattern Selection

SituationPatternReason
Need fast evaluationtype: "prompt"In-session execution, fast
Need isolationDirect CLI callSeparate MCP config possible
Complex logicSDK + BackgroundType-safe, non-blocking
Cost reductionLocal LLM (ollama)Free, privacy

SDK Configuration (Python)

from u_llm_sdk import LLM, LLMConfig
from llm_types import Provider, ModelTier, AutoApproval

config = LLMConfig(
    provider=Provider.CLAUDE,
    tier=ModelTier.LOW,
    auto_approval=AutoApproval.FULL,
    timeout=60.0,
)

async with LLM(config) as llm:
    result = await llm.run("Your prompt")

Cost Structure

MethodCost
type: "prompt"Included in subscription
Claude CLIIncluded in subscription
SDK via CLIIncluded in subscription
Direct APIPer-token billing

References

スコア

総合スコア

60/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です