{"id":"a3212539-ceb4-44e2-ac10-79b0ba8d136a","shortId":"Zp6C62","kind":"skill","title":"analyze-knowledge","tagline":">-","description":"# Analyze Knowledge\n\nAnalyze git history to surface code expertise, suggest reviewers, and assess knowledge concentration risk.\n\n## 1. Determine Mode and Scope\n\nAuto-detect from user intent:\n\n| Mode | Triggers | Default scope |\n|---|---|---|\n| **Reviewer** | \"who should review\", \"find reviewers\", \"suggest reviewers\" | Changed files: `git diff --name-only $(git merge-base HEAD main)..HEAD` |\n| **Distribution** | \"who knows\", \"lottery factor\", \"bus factor\", \"knowledge spread\", \"expertise\" | User-specified directory, or repo root |\n\nIf scope is ambiguous, ask. Accept:\n- Explicit paths or globs\n- A PR number (extract changed files via `gh pr diff --name-only`)\n- A directory\n- \"whole repo\" (default for distribution mode)\n\nExclude generated files: check for `// Code generated` or `DO NOT EDIT` headers.\n\n## 2. Normalize Authors\n\n```bash\n# Check for .mailmap\nif [ -f .mailmap ]; then\n  MAILMAP_FLAG=\"--use-mailmap\"\nelse\n  MAILMAP_FLAG=\"\"\nfi\n```\n\n- Pass `$MAILMAP_FLAG` to all git commands.\n- If no `.mailmap`, group by author name (not email) to merge multiple addresses.\n- Filter bots: exclude authors matching `[bot]`, `dependabot`, `renovate`, `github-actions`, or emails containing `noreply@github.com` with non-human names.\n\n## 2.5. Fan out for broad scope\n\nWhen scope is large, delegate per-area data collection to subagents so main context never sees raw blame/log output for hundreds of files. Aligns with `parallelize-subagents` (delegate when output would flood main context) and `delegate-investigation` (read-only history work belongs in `Explore`).\n\n| Trigger | Strategy |\n|---|---|\n| Distribution mode, \"whole repo\" or >20 directories in scope | One `Explore` subagent per top-level directory; each runs its tiered collection and returns the per-area summary only. |\n| Reviewer mode, >20 changed files | Batch files in groups of ~10; one `Explore` subagent per batch returning per-file expert lists. |\n| Tier 3 line-level on >5 files | One `Explore` subagent per file (blame output is voluminous). |\n| Anything smaller | Run inline. Don't spin up a subagent for one `git shortlog`. |\n\nEach subagent prompt follows `subagent-prompt-contract`:\n\n- **Goal:** \"Return top-N authors per file in <area>, with weighted contribution scores\"\n- **Inline context:** paths, `$MAILMAP_FLAG` state, the recency weighting table from step 4, the `git` command(s) to run\n- **Output shape:** Markdown table only, ≤30 lines\n- **Constraints:** read-only (`Explore` enforces this); do not spawn further subagents\n- **Model:** `haiku` (per `subagent-model-routing`) — mechanical aggregation; output is bounded and requires no architectural reasoning\n- **Return:** prefix the summary with `Status: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT`\n\nParent merges per-area returns into the final table in step 5.\n\n## 3. Collect Data (Tiered)\n\n### Tier 1: Commit counts (always run, fast)\n\n```bash\ngit shortlog -sne --no-merges $MAILMAP_FLAG -- <paths> | head -20\n```\n\nUse this for a quick overview. Sufficient when the user just wants a rough sense.\n\n### Tier 2: File-level changes (default)\n\n```bash\ngit log --no-merges --since=\"2 years ago\" $MAILMAP_FLAG \\\n  --format='COMMIT:%H|%an|%aI' --numstat -- <paths>\n```\n\nParse with jq pipelines from [reference.md](reference.md). This produces per-author, per-file change counts with timestamps for recency weighting.\n\nFor large repos or broad scope, add `--since=\"1 year ago\"` to keep it fast.\n\n### Tier 3: Line-level blame (opt-in, small file sets only)\n\nOnly use when:\n- User explicitly asks for deep/line-level analysis\n- Scope is ≤15 files\n\n```bash\ngit blame --porcelain $MAILMAP_FLAG <file> | \\\n  awk '/^author /{print}' | sort | uniq -c | sort -rn\n```\n\nFor >5 files, fan out per step 2.5 (one `Explore` subagent per file). For ≤5 files, parallelize inline with `xargs -P4`.\n\n## 4. Analyze\n\n### Recency Weighting\n\nWeight contributions by age:\n\n| Age | Weight |\n|---|---|\n| < 6 months | 1.0 |\n| 6–12 months | 0.7 |\n| 12–24 months | 0.4 |\n| > 24 months | 0.1 |\n\n### Reviewer Mode\n\n1. For each file in scope, compute weighted contribution score per author\n2. Aggregate across all files: an author touching many of the changed files scores higher\n3. Exclude the PR author (current `git config user.name`) from suggestions\n4. Rank by score, present top 3–5\n5. For each reviewer, list the directories/files where they have the most expertise\n\n### Distribution Mode\n\n1. Group files by directory (auto-detect depth: <20 files → no grouping, 20–200 → 1 level, 200+ → 2 levels)\n2. Per area, compute:\n   - **Top experts**: authors ranked by weighted contribution\n   - **Lottery factor**: count of authors contributing ≥10% of weighted changes\n   - **Concentration**: percentage of changes from the top contributor\n3. Flag risk levels:\n   - **HIGH**: lottery factor = 1 (single expert)\n   - **MEDIUM**: lottery factor = 2\n   - **LOW**: lottery factor ≥ 3\n\n## 5. Present Results\n\nOutput directly to terminal. No file output.\n\n### Reviewer Mode\n\n```\n## Suggested Reviewers (<N> files from <source>)\n\n| Rank | Reviewer       | Score | Key areas                   | Last active  |\n|------|----------------|-------|-----------------------------|--------------|\n| 1    | Alice Smith    | 0.82  | internal/auth/, pkg/tokens/ | 2 weeks ago  |\n| 2    | Bob Jones      | 0.65  | internal/auth/              | 1 month ago  |\n| 3    | Carol Lee      | 0.41  | pkg/tokens/, cmd/server/    | 3 months ago |\n```\n\n### Distribution Mode\n\n```\n## Knowledge Distribution: <scope>\n\n| Area                 | Top experts                       | Lottery factor | Risk   |\n|----------------------|-----------------------------------|----------------|--------|\n| internal/auth/oauth/ | Alice (0.9)                       | 1              | HIGH   |\n| internal/auth/jwt/   | Alice (0.6), Bob (0.5)            | 2              | MEDIUM |\n| internal/auth/rbac/  | Bob (0.4), Carol (0.3), Dan (0.3) | 3              | LOW    |\n\n### Concentration Warnings\n\n- **internal/auth/oauth/**: single expert; Alice authored 94% of recent changes\n- **internal/auth/jwt/**: two experts with significant overlap\n```\n\n## Edge Cases\n\n- **Squash-imported repo**: if total unique authors < 3 or median commits/author < 2, warn that history may not be representative\n- **Monorepo with many contributors**: use tier 2 scoped to paths + time window; never run tier 3 on broad scope\n- **No changes in scope** (reviewer mode): fall back to directory-level analysis of the files' parent directories\n\n## Guidelines\n\n- Use `jq` for all JSON/pipeline processing (see [reference.md](reference.md) for templates)\n- Present findings conversationally: tables for data, plain text for warnings and recommendations\n- When suggesting reviewers, mention *why* each person is suggested (which files/areas they know)\n- For distribution analysis, lead with the highest-risk areas\n- Per `~/.claude/rules/probe-not-assume.md`: confirm via tool/command before recommending; do not infer.","tags":["analyze","knowledge","skill","issue","paultyng","agent-skills","ai-tools","claude-code","cursor","dotfiles"],"capabilities":["skill","source-paultyng","skill-analyze-knowledge","topic-agent-skills","topic-ai-tools","topic-claude-code","topic-cursor","topic-dotfiles"],"categories":["skill-issue"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/paultyng/skill-issue/analyze-knowledge","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add paultyng/skill-issue","source_repo":"https://github.com/paultyng/skill-issue","install_from":"skills.sh"}},"qualityScore":"0.454","qualityRationale":"deterministic score 0.45 from registry signals: · indexed on github topic:agent-skills · 8 github stars · SKILL.md body (6,951 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-05-18T19:08:59.916Z","embedding":null,"createdAt":"2026-05-18T13:21:24.433Z","updatedAt":"2026-05-18T19:08:59.916Z","lastSeenAt":"2026-05-18T19:08:59.916Z","tsv":"'-20':439 '/.claude/rules/probe-not-assume.md':936 '0.1':601 '0.3':807,809 '0.4':598,805 '0.41':775 '0.5':800 '0.6':798 '0.65':767 '0.7':594 '0.82':758 '0.9':793 '1':20,423,510,604,665,680,721,755,769,794 '1.0':590 '10':273,702 '12':592,595 '15':541 '2':117,456,469,616,683,685,727,761,764,801,843,857 '2.5':177,564 '20':238,265,674,678 '200':679,682 '24':596,599 '3':286,418,518,631,648,714,731,772,778,810,839,866 '30':361 '4':349,578,642 '5':291,417,558,571,649,650,732 '6':588,591 '94':819 'accept':79 'across':618 'action':167 'activ':754 'add':508 'address':156 'age':585,586 'aggreg':383,617 'ago':471,512,763,771,780 'ai':478 'alic':756,792,797,817 'align':207 'alway':426 'ambigu':77 'analysi':538,882,927 'analyz':2,4,6,579 'analyze-knowledg':1 'anyth':302 'architectur':390 'area':190,260,409,687,752,785,934 'ask':78,535 'assess':16 'author':119,149,160,329,491,550,615,622,635,691,700,818,838 'auto':26,671 'auto-detect':25,670 'awk':549 'back':877 'base':53 'bash':120,429,462,543 'batch':268,278 'belong':228 'blame':298,522,545 'blame/log':201 'block':402 'bob':765,799,804 'bot':158,162 'bound':386 'broad':181,506,868 'bus':62 'c':554 'carol':773,806 'case':830 'chang':43,88,266,460,495,627,705,709,822,871 'check':108,121 'cmd/server':777 'code':11,110 'collect':192,254,419 'command':143,352 'commit':424,475 'commits/author':842 'comput':610,688 'concentr':18,706,812 'concern':401 'config':638 'confirm':937 'constraint':363 'contain':170 'context':197,218,338,404 'contract':323 'contribut':335,583,612,695,701 'contributor':713,854 'convers':902 'count':425,496,698 'current':636 'dan':808 'data':191,420,905 'deep/line-level':537 'default':33,101,461 'deleg':187,212,221 'delegate-investig':220 'dependabot':163 'depth':673 'detect':27,672 'determin':21 'diff':46,93 'direct':736 'directori':70,98,239,249,669,880,887 'directories/files':656 'directory-level':879 'distribut':57,103,233,663,781,784,926 'done':398,399 'edg':829 'edit':115 'els':133 'email':152,169 'enforc':368 'exclud':105,159,632 'expert':283,690,723,787,816,825 'expertis':12,66,662 'explicit':80,534 'explor':230,243,275,294,367,566 'extract':87 'f':125 'factor':61,63,697,720,726,730,789 'fall':876 'fan':178,560 'fast':428,516 'fi':136 'file':44,89,107,206,267,269,282,292,297,331,458,494,527,542,559,569,572,607,620,628,667,675,740,746,885 'file-level':457 'files/areas':922 'filter':157 'final':413 'find':39,901 'flag':129,135,139,341,437,473,548,715 'flood':216 'follow':319 'format':474 'generat':106,111 'gh':91 'git':7,45,50,142,314,351,430,463,544,637 'github':166 'github-act':165 'glob':83 'goal':324 'group':147,271,666,677 'guidelin':888 'h':476 'haiku':376 'head':54,56,438 'header':116 'high':718,795 'higher':630 'highest':932 'highest-risk':931 'histori':8,226,846 'human':175 'hundr':204 'import':833 'infer':944 'inlin':305,337,574 'intent':30 'internal/auth':759,768 'internal/auth/jwt':796,823 'internal/auth/oauth':791,814 'internal/auth/rbac':803 'investig':222 'jone':766 'jq':482,890 'json/pipeline':893 'keep':514 'key':751 'know':59,924 'knowledg':3,5,17,64,783 'larg':186,503 'last':753 'lead':928 'lee':774 'level':248,289,459,521,681,684,717,881 'line':288,362,520 'line-level':287,519 'list':284,654 'log':464 'lotteri':60,696,719,725,729,788 'low':728,811 'mailmap':123,126,128,132,134,138,146,340,436,472,547 'main':55,196,217 'mani':624,853 'markdown':358 'match':161 'may':847 'mechan':382 'median':841 'medium':724,802 'mention':915 'merg':52,154,406,435,467 'merge-bas':51 'mode':22,31,104,234,264,603,664,743,782,875 'model':375,380 'monorepo':851 'month':589,593,597,600,770,779 'multipl':155 'n':328 'name':48,95,150,176 'name-on':47,94 'need':403 'never':198,863 'no-merg':433,465 'non':174 'non-human':173 'noreply@github.com':171 'normal':118 'number':86 'numstat':479 'one':242,274,293,313,565 'opt':524 'opt-in':523 'output':202,214,299,356,384,735,741 'overlap':828 'overview':445 'p4':577 'parallel':210,573 'parallelize-subag':209 'parent':405,886 'pars':480 'pass':137 'path':81,339,860 'per':189,245,259,277,281,296,330,377,408,490,493,562,568,614,686,935 'per-area':188,258,407 'per-author':489 'per-fil':280,492 'percentag':707 'person':918 'pipelin':483 'pkg/tokens':760,776 'plain':906 'porcelain':546 'pr':85,92,634 'prefix':393 'present':646,733,900 'print':551 'process':894 'produc':488 'prompt':318,322 'quick':444 'rank':643,692,748 'raw':200 'read':224,365 'read-on':223,364 'reason':391 'recenc':344,500,580 'recent':821 'recommend':911,941 'reference.md':485,486,896,897 'renov':164 'repo':72,100,236,504,834 'repres':850 'requir':388 'result':734 'return':256,279,325,392,410 'review':14,35,38,40,42,263,602,653,742,745,749,874,914 'risk':19,716,790,933 'rn':556 'root':73 'rough':453 'rout':381 'run':251,304,355,427,864 'scope':24,34,75,182,184,241,507,539,609,858,869,873 'score':336,613,629,645,750 'see':199,895 'sens':454 'set':528 'shape':357 'shortlog':315,431 'signific':827 'sinc':468,509 'singl':722,815 'skill' 'skill-analyze-knowledge' 'small':526 'smaller':303 'smith':757 'sne':432 'sort':552,555 'source-paultyng' 'spawn':372 'specifi':69 'spin':308 'spread':65 'squash':832 'squash-import':831 'state':342 'status':397 'step':348,416,563 'strategi':232 'subag':194,211,244,276,295,311,317,321,374,379,567 'subagent-model-rout':378 'subagent-prompt-contract':320 'suffici':446 'suggest':13,41,641,744,913,920 'summari':261,395 'surfac':10 'tabl':346,359,414,903 'templat':899 'termin':738 'text':907 'tier':253,285,421,422,455,517,856,865 'time':861 'timestamp':498 'tool/command':939 'top':247,327,647,689,712,786 'top-level':246 'top-n':326 'topic-agent-skills' 'topic-ai-tools' 'topic-claude-code' 'topic-cursor' 'topic-dotfiles' 'total':836 'touch':623 'trigger':32,231 'two':824 'uniq':553 'uniqu':837 'use':131,440,531,855,889 'use-mailmap':130 'user':29,68,449,533 'user-specifi':67 'user.name':639 'via':90,938 'volumin':301 'want':451 'warn':813,844,909 'week':762 'weight':334,345,501,581,582,587,611,694,704 'whole':99,235 'window':862 'work':227 'would':215 'xarg':576 'year':470,511","prices":[{"id":"d42c21e6-f6d9-4fe4-a38a-588a0ba37cd3","listingId":"a3212539-ceb4-44e2-ac10-79b0ba8d136a","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"paultyng","category":"skill-issue","install_from":"skills.sh"},"createdAt":"2026-05-18T13:21:24.433Z"}],"sources":[{"listingId":"a3212539-ceb4-44e2-ac10-79b0ba8d136a","source":"github","sourceId":"paultyng/skill-issue/analyze-knowledge","sourceUrl":"https://github.com/paultyng/skill-issue/tree/main/skills/analyze-knowledge","isPrimary":false,"firstSeenAt":"2026-05-18T13:21:24.433Z","lastSeenAt":"2026-05-18T19:08:59.916Z"}],"details":{"listingId":"a3212539-ceb4-44e2-ac10-79b0ba8d136a","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"paultyng","slug":"analyze-knowledge","github":{"repo":"paultyng/skill-issue","stars":8,"topics":["agent-skills","ai-tools","claude-code","cursor","dotfiles"],"license":"mit","html_url":"https://github.com/paultyng/skill-issue","pushed_at":"2026-05-18T18:26:54Z","description":"Personal Claude Code / Cursor agent skills, rules, and config","skill_md_sha":"b948c890c1ee21db44c35c715171f18742d71ae2","skill_md_path":"skills/analyze-knowledge/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/paultyng/skill-issue/tree/main/skills/analyze-knowledge"},"layout":"multi","source":"github","category":"skill-issue","frontmatter":{"name":"analyze-knowledge","description":">-"},"skills_sh_url":"https://skills.sh/paultyng/skill-issue/analyze-knowledge"},"updatedAt":"2026-05-18T19:08:59.916Z"}}