{"id":"8ccada93-44a4-49d3-8256-55e2254702c8","shortId":"YWfAGE","kind":"skill","title":"subagent-metrics-bridging","tagline":"Translate a streaming subagent run into task progress, analytics, and notifications while keeping partial results and cleanup tidy.","description":"# SKILL: Subagent Metrics Bridging\n**Domain:** metrics-bridging\n**Trigger:** Use when an async subagent loop needs to feed its token/tool-use counts, progress, and completion status back into the host task/analytics stack.\n**Source Pattern:** Distilled from reviewed async subagent lifecycle, task-progress, and analytics bridge implementations.\n\n## Core Method\nDrive the async child-agent lifecycle through one progress bridge that feeds task UI, analytics, and notifications from the same stream. As messages arrive, update visible progress, token counts, and the last-active tool so the host can show meaningful live state. When the stream finishes, finalize the result once, record analytics from that finalized snapshot, and then emit completion notifications or warnings. Heavy post-processing should happen after the task is already marked complete so diagnostics do not block the visible lifecycle.\n\n## Key Rules\n- Move the visible task status to completed or terminated before running expensive diagnostics or cleanup.\n- Derive progress, token counts, and “last tool used” from one shared tracker instead of recomputing them in multiple places.\n- Finalize the child-agent result once and use that same finalized snapshot for analytics, notifications, and partial-result handling.\n- On aborts or kills, still emit a clean closing notification so the parent task can resolve deterministically.\n- Clear agent-specific transient state after every outcome so later runs do not inherit stale progress or artifacts.\n\n## Example Application\nWhen adding a new background worker that prefetches repo data for the user, follow this pattern to link its stream to the task UI/notification system and guarantee the analytics pipeline records its token tally even if it aborts midflight.\n\n## Anti-Patterns (What NOT to do)\n- Don’t log the completion event before the agent result is finalized—duplicated token counts appear if you emit analytics prior to `finalizeAgentTool`.\n- Don’t rely on the final assistant message to always contain text; fallback logic exists inside `finalizeAgentTool` to pull the last text block, so duplicating that logic invites bugs.","tags":["subagent","metrics","bridging","cskill","agents","ychampion","agent-skills","ai-agents","cli","coding-agents","context-engineering","developer-tools"],"capabilities":["skill","source-ychampion","skill-subagent-metrics-bridging","topic-agent-skills","topic-ai-agents","topic-cli","topic-coding-agents","topic-context-engineering","topic-developer-tools","topic-mcp","topic-multi-agent","topic-terminal-ui"],"categories":["cskill-agents"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/ychampion/cskill-agents/subagent-metrics-bridging","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add ychampion/cskill-agents","source_repo":"https://github.com/ychampion/cskill-agents","install_from":"skills.sh"}},"qualityScore":"0.467","qualityRationale":"deterministic score 0.47 from registry signals: · indexed on github topic:agent-skills · 34 github stars · SKILL.md body (2,155 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-22T00:56:57.189Z","embedding":null,"createdAt":"2026-04-18T22:21:25.461Z","updatedAt":"2026-04-22T00:56:57.189Z","lastSeenAt":"2026-04-22T00:56:57.189Z","tsv":"'abort':215,289 'activ':105 'ad':253 'agent':76,197,233,306 'agent-specif':232 'alreadi':146 'alway':330 'analyt':13,66,86,124,207,280,317 'anti':292 'anti-pattern':291 'appear':313 'applic':251 'arriv':95 'artifact':249 'assist':327 'async':35,59,73 'back':48 'background':256 'block':153,343 'bridg':4,26,30,67,81 'bug':349 'child':75,196 'child-ag':74,195 'clean':221 'cleanup':21,173 'clear':231 'close':222 'complet':46,132,148,165,302 'contain':331 'core':69 'count':43,100,177,312 'data':261 'deriv':174 'determinist':230 'diagnost':150,171 'distil':56 'domain':27 'drive':71 'duplic':310,345 'emit':131,219,316 'even':286 'event':303 'everi':238 'exampl':250 'exist':335 'expens':170 'fallback':333 'feed':40,83 'final':119,127,193,204,309,326 'finalizeagenttool':320,337 'finish':118 'follow':265 'guarante':278 'handl':213 'happen':141 'heavi':136 'host':51,109 'implement':68 'inherit':245 'insid':336 'instead':186 'invit':348 'keep':17 'key':157 'kill':217 'last':104,179,341 'last-act':103 'later':241 'lifecycl':61,77,156 'link':269 'live':113 'log':300 'logic':334,347 'loop':37 'mark':147 'meaning':112 'messag':94,328 'method':70 'metric':3,25,29 'metrics-bridg':28 'midflight':290 'move':159 'multipl':191 'need':38 'new':255 'notif':15,88,133,208,223 'one':79,183 'outcom':239 'parent':226 'partial':18,211 'partial-result':210 'pattern':55,267,293 'pipelin':281 'place':192 'post':138 'post-process':137 'prefetch':259 'prior':318 'process':139 'progress':12,44,64,80,98,175,247 'pull':339 'recomput':188 'record':123,282 'reli':323 'repo':260 'resolv':229 'result':19,121,198,212,307 'review':58 'rule':158 'run':9,169,242 'share':184 'show':111 'skill':23 'skill-subagent-metrics-bridging' 'snapshot':128,205 'sourc':54 'source-ychampion' 'specif':234 'stack':53 'stale':246 'state':114,236 'status':47,163 'still':218 'stream':7,92,117,271 'subag':2,8,24,36,60 'subagent-metrics-bridg':1 'system':276 'talli':285 'task':11,63,84,144,162,227,274 'task-progress':62 'task/analytics':52 'termin':167 'text':332,342 'tidi':22 'token':99,176,284,311 'token/tool-use':42 'tool':106,180 'topic-agent-skills' 'topic-ai-agents' 'topic-cli' 'topic-coding-agents' 'topic-context-engineering' 'topic-developer-tools' 'topic-mcp' 'topic-multi-agent' 'topic-terminal-ui' 'tracker':185 'transient':235 'translat':5 'trigger':31 'ui':85 'ui/notification':275 'updat':96 'use':32,181,201 'user':264 'visibl':97,155,161 'warn':135 'worker':257","prices":[{"id":"6d12582d-3891-49a1-95c6-cfa2b834d6b4","listingId":"8ccada93-44a4-49d3-8256-55e2254702c8","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"ychampion","category":"cskill-agents","install_from":"skills.sh"},"createdAt":"2026-04-18T22:21:25.461Z"}],"sources":[{"listingId":"8ccada93-44a4-49d3-8256-55e2254702c8","source":"github","sourceId":"ychampion/cskill-agents/subagent-metrics-bridging","sourceUrl":"https://github.com/ychampion/cskill-agents/tree/main/skills/subagent-metrics-bridging","isPrimary":false,"firstSeenAt":"2026-04-18T22:21:25.461Z","lastSeenAt":"2026-04-22T00:56:57.189Z"}],"details":{"listingId":"8ccada93-44a4-49d3-8256-55e2254702c8","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"ychampion","slug":"subagent-metrics-bridging","github":{"repo":"ychampion/cskill-agents","stars":34,"topics":["agent-skills","ai-agents","cli","coding-agents","context-engineering","developer-tools","mcp","multi-agent","terminal-ui"],"license":"mit","html_url":"https://github.com/ychampion/cskill-agents","pushed_at":"2026-04-04T14:13:23Z","description":"Agent skills for coding CLIs, multi-agent runtimes, context engines, MCP extensions, and terminal tooling. Instead of using claude code's source code, give your agent skills to create your own!","skill_md_sha":"d14e25d31285db697a304491bd9e3957f83d7ca1","skill_md_path":"skills/subagent-metrics-bridging/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/ychampion/cskill-agents/tree/main/skills/subagent-metrics-bridging"},"layout":"multi","source":"github","category":"cskill-agents","frontmatter":{"name":"subagent-metrics-bridging","description":"Translate a streaming subagent run into task progress, analytics, and notifications while keeping partial results and cleanup tidy."},"skills_sh_url":"https://skills.sh/ychampion/cskill-agents/subagent-metrics-bridging"},"updatedAt":"2026-04-22T00:56:57.189Z"}}