Install any skill in seconds. Free to start, no credit card required.
Get Started Free →majiayu000/cc-harness-patterns
Harness Engineering 設計模式 — 基於 Claude Code 原始碼逆向分析的 12 條可遷移原則。
Passed 21 of 22 test cases with the skill, and 14 of 22 without it.
and 10 more in the full report
8 fixed13 passed either way0 still failing1 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 8 test cases the skill fixed. Same model, same prompt, with and without the skill.
When spinning up background sub-agents for specialized tasks like summary generation or deep research, how should context sessions be instantiated to maximize prompt cache hits?
| Checked | Without skill | With skill |
|---|---|---|
| The response instantiates sub-agents as forked agents that inherit the parent session prompt cache. | Missed | Passed |
The instructions your model reads when the skill loads.
Harness = Tools + Knowledge + Observation + Action Interfaces + Permissions
基於 Claude Code v2.1.88(92,500 行 TypeScript)逆向分析。
Claude Code 的 agent loop 用 async generator 實作:
async function* queryModel(...): AsyncGenerator<StreamEvent | AssistantMessage> {
// yield 每個 stream event,呼叫端按需消費
}
核心循環:queryModel() → 檢查 stop_reason → tool_use 時呼叫 runTools() → 結果回注 messages → 再次 queryModel()
stop_reason 分支:end_turn(結束)、tool_use(執行工具)、max_tokens(context 滿了,觸發 compaction)
function isConcurrencySafe(input): boolean {
// 工具自己聲明是否可並行
}
partitionToolCalls() 把一批工具呼叫分成可並行組和必須串行組Schema Validation → Custom validateInput() → Input Sanitization
→ PreToolUse Hooks → Permission Resolution → Execution → PostToolUse Hooks
test cases passed, vs 14 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.