{"id":"b4074208-acee-45f7-9705-4eb5bb1b8a75","shortId":"9jyN36","kind":"skill","title":"discover-patterns","tagline":">-","description":"# Discover Patterns\n\nAnalyze a codebase to discover and document its implicit architectural and implementation patterns.\n\n## Workflow\n\n### 1. Scope and explore\n\n- Confirm scope with the user: full codebase (default), specific packages/directories, or specific concern.\n- Explore the scoped code using parallel explore subagents. Read source files, test files, config files, and build files.\n- Classify files by type: `has_go`, `has_proto`, `has_ts`, `has_infra`, etc.\n\n### 2. Identify candidate patterns (Opus)\n\nLaunch up to 4 concurrent subagents (`subagent_type=\"generalPurpose\"`, `model: opus` per `subagent-model-routing` — architecture-level pattern recognition requires deep reasoning across the codebase), each covering a group of pattern categories from the taxonomy. Each subagent reads all relevant files and **identifies candidate patterns** with a signature the counting stage can apply mechanically.\n\n| Subagent | Categories | Requires |\n|---|---|---|\n| Structure & Layering | STRUCT | Any source files |\n| Error Handling & Observability | ERR, OBS | Any source files |\n| Config & DI | CFG, DI | Any source files |\n| Testing | TEST | Any source + test files |\n| Transport | XPORT | HTTP/gRPC code present |\n\nEach subagent receives:\n- The scoped file list for its relevant file types\n- Reference: [reference-pattern-taxonomy.md](reference-pattern-taxonomy.md) for what to look for\n\nFor each candidate pattern, record:\n- **Name**: short descriptive name\n- **Description**: what the pattern is and how it works\n- **Search signature**: a concrete way to find further occurrences. A grep regex, file glob, AST predicate (e.g. \"calls to `context.Background()` outside `main.go`\"), or symbol pattern. Must be specific enough that the counting stage applies it mechanically.\n- **Seed exemplars**: 1-2 file:line references the discovery subagent already saw\n\nThis stage does NOT compute confidence or gather exhaustive exemplars. Step 2.5 handles that.\n\n### 2.5. Count occurrences per pattern (Haiku fan-out)\n\nFor each candidate pattern from step 2, spawn an `Explore` subagent (`model: haiku` per `subagent-model-routing` — applying a known signature is mechanical). Run up to 4 concurrently; if more than 4 patterns, launch the first 4 and the rest after one completes.\n\nEach subagent receives (per `subagent-prompt-contract`):\n- **Goal**: apply the search signature to the scoped file list. Return match count, total relevant files, additional exemplars, counter-examples.\n- **Inline context**: pattern name + description + search signature + the scoped file list (paste; do not re-derive scope).\n- **Output shape**: structured per-pattern record (counts + 2-3 exemplars + up to 3 counter-examples), ≤80 words.\n- **Constraints**: read-only; no further subagents.\n- **Return**: prefixed with `Status: DONE | DONE_WITH_CONCERNS | BLOCKED | NEEDS_CONTEXT`.\n\nParent computes confidence from the returned counts:\n- **ESTABLISHED**: matches in >80% of relevant files\n- **EMERGING**: 50-80%\n- **INCONSISTENT**: <50% but ≥3 matches\n\nDrop patterns with fewer than 3 total matches (anecdotal, not a pattern).\n\n### 3. Consolidate\n\nMerge per-pattern records from step 2.5 (confidence, exemplars, counter-examples) with the descriptions from step 2. Deduplicate overlapping patterns (e.g. a DI pattern that also appears as a testing pattern). Resolve confidence levels across the merged dataset.\n\n### 4. Write output\n\nIf `REVIEW_DIR` was provided by the review-all orchestrator, use it. Otherwise, resolve it:\n\n```sh\nREVIEW_DATE=$(date +%Y-%m-%d)\nREVIEW_DIR=\"reviews/${REVIEW_DATE}\"\nif [ -d \"$REVIEW_DIR\" ]; then REVIEW_DIR=\"reviews/${REVIEW_DATE}-$(date +%H%M)\"; fi\nmkdir -p \"$REVIEW_DIR\"\n```\n\nWrite to `${REVIEW_DIR}/PATTERNS.md`. Present the report to the user.\n\n## Output Template\n\n```markdown\n# Codebase Patterns\n\n> Discovered on YYYY-MM-DD. Scope: [full codebase | specific paths].\n\n## STRUCT — Structure & Layering\n\n### [Pattern Name]\n**Confidence:** ESTABLISHED\n**Description:** Brief description of the pattern.\n**Exemplars:**\n- `path/to/file.go:42` — explanation\n- `path/to/other.go:15` — explanation\n\n### [Pattern Name]\n**Confidence:** INCONSISTENT\n**Description:** Brief description.\n**Exemplars:**\n- `path/to/file.go:10` — majority approach\n**Counter-examples:**\n- `path/to/outlier.go:25` — deviates because...\n\n## ERR — Error Handling\n...\n\n## OBS — Observability\n...\n\n## CFG — Configuration\n...\n\n## DI — Dependency Injection\n...\n\n## TEST — Testing\n...\n\n## XPORT — Transport\n...\n```\n\n## Guidelines\n\n- Focus on patterns that are actionable; skip trivially obvious things (e.g., \"files end with `.go`\").\n- A pattern requires at least 3 exemplars to be reported. Fewer is anecdotal, not a pattern.\n- When confidence is INCONSISTENT, note which approach is more common and which is the outlier.\n- Keep the output concise: 2-3 exemplars per pattern, not exhaustive file lists.\n- For detailed discovery heuristics per category, see [reference-pattern-taxonomy.md](reference-pattern-taxonomy.md).\n- Per `~/.claude/rules/probe-not-assume.md`: confirm via tool/command before recommending; do not infer.","tags":["discover","patterns","skill","issue","paultyng","agent-skills","ai-tools","claude-code","cursor","dotfiles"],"capabilities":["skill","source-paultyng","skill-discover-patterns","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/discover-patterns","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 (5,101 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:09:00.794Z","embedding":null,"createdAt":"2026-05-18T13:21:25.691Z","updatedAt":"2026-05-18T19:09:00.794Z","lastSeenAt":"2026-05-18T19:09:00.794Z","tsv":"'-2':241 '-3':373,658 '-80':417 '/.claude/rules/probe-not-assume.md':676 '/patterns.md':530 '1':20,240 '10':582 '15':571 '2':68,279,372,455,657 '2.5':261,264,444 '25':589 '3':377,421,428,435,627 '4':76,300,305,310,477 '42':568 '50':416,419 '80':381,411 'across':97,473 'action':612 'addit':341 'alreadi':248 'also':464 'analyz':6 'anecdot':431,634 'appear':465 'appli':127,235,291,326 'approach':584,644 'architectur':15,90 'architecture-level':89 'ast':216 'block':398 'brief':561,578 'build':53 'call':219 'candid':70,118,186,275 'categori':106,130,671 'cfg':148,597 'classifi':55 'code':40,162 'codebas':8,30,99,540,550 'common':647 'complet':316 'comput':254,402 'concern':36,397 'concis':656 'concret':205 'concurr':77,301 'confid':255,403,445,471,558,575,639 'config':50,146 'configur':598 'confirm':24,677 'consolid':436 'constraint':383 'context':347,400 'context.background':221 'contract':324 'count':124,233,265,337,371,407 'counter':344,379,448,586 'counter-exampl':343,378,447,585 'cover':101 'd':502,509 'dataset':476 'date':498,499,507,517,518 'dd':547 'dedupl':456 'deep':95 'default':31 'depend':600 'deriv':362 'descript':191,193,350,452,560,562,577,579 'detail':667 'deviat':590 'di':147,149,461,599 'dir':482,504,511,514,525,529 'discov':2,4,10,542 'discover-pattern':1 'discoveri':246,668 'document':12 'done':394,395 'drop':423 'e.g':218,459,617 'emerg':415 'end':619 'enough':230 'err':141,592 'error':138,593 'establish':408,559 'etc':67 'exampl':345,380,449,587 'exemplar':239,259,342,374,446,566,580,628,659 'exhaust':258,663 'explan':569,572 'explor':23,37,43,282 'fan':271 'fan-out':270 'fewer':426,632 'fi':521 'file':47,49,51,54,56,115,137,145,152,158,169,174,214,242,333,340,355,414,618,664 'find':208 'first':309 'focus':607 'full':29,549 'gather':257 'generalpurpos':81 'glob':215 'go':60,621 'goal':325 'grep':212 'group':103 'guidelin':606 'h':519 'haiku':269,285 'handl':139,262,594 'heurist':669 'http/grpc':161 'identifi':69,117 'implement':17 'implicit':14 'inconsist':418,576,641 'infer':684 'infra':66 'inject':601 'inlin':346 'keep':653 'known':293 'launch':73,307 'layer':133,555 'least':626 'level':91,472 'line':243 'list':170,334,356,665 'look':182 'm':501,520 'main.go':223 'major':583 'markdown':539 'match':336,409,422,430 'mechan':128,237,296 'merg':437,475 'mkdir':522 'mm':546 'model':82,87,284,289 'must':227 'name':189,192,349,557,574 'need':399 'note':642 'ob':142,595 'observ':140,596 'obvious':615 'occurr':210,266 'one':315 'opus':72,83 'orchestr':490 'otherwis':493 'outlier':652 'output':364,479,537,655 'outsid':222 'overlap':457 'p':523 'packages/directories':33 'parallel':42 'parent':401 'past':357 'path':552 'path/to/file.go':567,581 'path/to/other.go':570 'path/to/outlier.go':588 'pattern':3,5,18,71,92,105,119,187,196,226,268,276,306,348,369,424,434,440,458,462,469,541,556,565,573,609,623,637,661 'per':84,267,286,320,368,439,660,670,675 'per-pattern':367,438 'predic':217 'prefix':391 'present':163,531 'prompt':323 'proto':62 'provid':484 're':361 're-der':360 'read':45,112,385 'read-on':384 'reason':96 'receiv':166,319 'recognit':93 'recommend':681 'record':188,370,441 'refer':176,244 'reference-pattern-taxonomy.md':177,178,673,674 'regex':213 'relev':114,173,339,413 'report':533,631 'requir':94,131,624 'resolv':470,494 'rest':313 'return':335,390,406 'review':481,488,497,503,505,506,510,513,515,516,524,528 'review-al':487 'rout':88,290 'run':297 'saw':249 'scope':21,25,39,168,332,354,363,548 'search':202,328,351 'see':672 'seed':238 'sh':496 'shape':365 'short':190 'signatur':122,203,294,329,352 'skill' 'skill-discover-patterns' 'skip':613 'sourc':46,136,144,151,156 'source-paultyng' 'spawn':280 'specif':32,35,229,551 'stage':125,234,251 'status':393 'step':260,278,443,454 'struct':134,553 'structur':132,366,554 'subag':44,78,79,86,111,129,165,247,283,288,318,322,389 'subagent-model-rout':85,287 'subagent-prompt-contract':321 'symbol':225 'taxonomi':109 'templat':538 'test':48,153,154,157,468,602,603 'thing':616 'tool/command':679 'topic-agent-skills' 'topic-ai-tools' 'topic-claude-code' 'topic-cursor' 'topic-dotfiles' 'total':338,429 'transport':159,605 'trivial':614 'ts':64 'type':58,80,175 'use':41,491 'user':28,536 'via':678 'way':206 'word':382 'work':201 'workflow':19 'write':478,526 'xport':160,604 'y':500 'yyyi':545 'yyyy-mm-dd':544","prices":[{"id":"43d09692-a104-4183-b7a8-e3749501341c","listingId":"b4074208-acee-45f7-9705-4eb5bb1b8a75","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:25.691Z"}],"sources":[{"listingId":"b4074208-acee-45f7-9705-4eb5bb1b8a75","source":"github","sourceId":"paultyng/skill-issue/discover-patterns","sourceUrl":"https://github.com/paultyng/skill-issue/tree/main/skills/discover-patterns","isPrimary":false,"firstSeenAt":"2026-05-18T13:21:25.691Z","lastSeenAt":"2026-05-18T19:09:00.794Z"}],"details":{"listingId":"b4074208-acee-45f7-9705-4eb5bb1b8a75","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"paultyng","slug":"discover-patterns","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":"82c3a8500d785bbe07cd63b66215b5647b290f0b","skill_md_path":"skills/discover-patterns/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/paultyng/skill-issue/tree/main/skills/discover-patterns"},"layout":"multi","source":"github","category":"skill-issue","frontmatter":{"name":"discover-patterns","description":">-"},"skills_sh_url":"https://skills.sh/paultyng/skill-issue/discover-patterns"},"updatedAt":"2026-05-18T19:09:00.794Z"}}