brainstorming
brainstorming
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).
linguistic-semantic-algorithmsMapping out an unfamiliar codebase via NLP and graph algorithms — 40 algorithms across topic modelling, semantic embeddings, code graphs, repository mining, clone detection, IR-based bug localization, identifier linguistics, and complexity metrics. Trigger when hunting bugs across many files, scoping a new feature, identifying domain entities, or analyzing …
Independent GitHub snapshot · Automated classification · Original documentation governs
Reference of 40 algorithms an agent should reach for when extracting structure, meaning, history, or risk signals from source code and commit data. Categories are ordered by insight-per-effort — how much non-obvious truth the technique exposes relative to how easy it is to apply. The first two categories target the highest-leverage questions: what business entities live in this code? and where else does this concept already exist? — questions that grep and intuition cannot answer.
Reach for these algorithms when:
| Priority | Category | Impact | Prefix | Question answered |
|---|---|---|---|---|
| 1 | Concept & Domain Extraction | CRITICAL | concept- | What business entities live in this code? |
| 2 | Semantic Similarity & Feature Mapping | CRITICAL | sim- | Where else does this concept already exist? |
| 3 | Architectural Topology | HIGH | graph- | What is the shape of this codebase? |
| 4 | Co-Change & Temporal Mining | HIGH | mine- | What hidden couplings does history reveal? |
| 5 | Clone & Duplication Detection | MEDIUM-HIGH | clone- | Where are we repeating ourselves? |
| 6 | Bug & Feature Localization | MEDIUM-HIGH | local- | Given a description, where in code? |
| 7 | Identifier Linguistics | MEDIUM | ling- | How to prepare tokens so the other algorithms work? |
| 8 | Complexity & Risk Metrics | MEDIUM | risk- | Where is the danger concentrated? |
concept-lda-topic-modeling — LDA over identifier tokens surfaces latent business themesconcept-noun-phrase-mining — POS-tag + chunk identifiers to extract entity candidatesconcept-tfidf-rare-terms — IDF against a generic corpus isolates domain vocabulary from framework noiseconcept-identifier-cooccurrence-network — PMI-weighted co-occurrence graph reveals conceptual neighborhoodsconcept-entity-name-resolution — Cluster name variants (user/usr/u/userAccount) via embedding + edit distanceconcept-bounded-context-detection — Louvain + Jensen-Shannon divergence detects DDD bounded contextssim-codebert-embeddings — CodeBERT + cosine for semantic code search across renamessim-pdg-semantic-clones — Program Dependence Graph isomorphism finds Type-4 clonessim-cross-pr-feature-mapping — Embed merged PRs once, retrieve precedent at feature-design timesim-cosine-vsm-files — TF-IDF VSM file similarity when no GPU is availablesim-call-pattern-similarity — N-grams on call-sequence find behavioral twinssim-doc-code-alignment — Joint code-doc embedding flags drift between docs and codegraph-pagerank-core — PageRank the import graph to find the codebase coregraph-betweenness-bottlenecks — Betweenness centrality surfaces bottleneck modulesgraph-louvain-modules — Louvain community detection reveals natural module boundariesgraph-scc-cycle-tangles — Tarjan's SCC algorithm exposes circular-dependency tanglesgraph-feedback-arcs — Eades-Lin-Smyth FAS chooses the smallest cycle-breaking cutmine-change-coupling — Conditional probability over commit history exposes hidden couplingmine-hotspots-churn-complexity — Churn × complexity = canonical hotspot score (Tornhill)mine-bus-factor — Per-file authorship Gini coefficient surfaces knowledge concentrationmine-commit-topic-modeling — LDA on commit messages reveals quarterly themesmine-bug-fix-density — Classify commits, rank files by fix-density to find defect magnetsmine-codebase-aging — Last-modified age + reachability splits stable code from dead codeclone-minhash-lsh — MinHash + LSH for sub-linear near-duplicate retrievalclone-simhash — SimHash 64-bit fingerprints for O(1) Hamming-distance lookupsclone-suffix-array-cpd — Token-level suffix array (PMD CPD) for precise clone boundariesclone-ast-gumtree — GumTree algorithm for fine-grained AST differencingclone-zhang-shasha-ted — Zhang-Shasha tree edit distance for exact subtree similaritylocal-tfidf-bug-reports — TF-IDF rank source files against bug report tokenslocal-bm25-saturation — BM25 handles length normalization and TF saturationlocal-history-prior-localization — Bayesian fusion of IR score with bug-history priorlocal-embedding-bug-text — Two-stage BM25 + embedding re-rank for semantic localizationling-camel-snake-split — Split camelCase, snake_case, digit-boundaries before any analysisling-abbreviation-expansion — Expand idx→index, mgr→manager via dictionary + miningling-porter-stemming — Apply Porter stemmer to unify singular/plural formsling-pos-tagging-identifiers — POS-tag identifier heads to flag misnamed functions/classesrisk-cyclomatic-mccabe — McCabe cyclomatic complexity for branch-test surfacerisk-cognitive-complexity — SonarSource Cognitive Complexity for readability gatesrisk-halstead-volume — Halstead volume for language-agnostic size and effortrisk-shannon-entropy-naming — Per-token entropy flags overloaded namesPick the category that matches the user's question, then read one or two specific rules from that category. Most rules cite combinable partners ("Combine with mine-change-coupling...") that compound the signal — read the partner rule when you need higher precision.
For unfamiliar repos, the highest-ROI starting sequence is:
graph-pagerank-core → read the top-20 most central filesconcept-lda-topic-modeling + concept-tfidf-rare-terms → identify the business themesmine-hotspots-churn-complexity → find where the bugs concentratemine-change-coupling → uncover hidden architectural couplingsFor a single-task bug or feature, the pipeline is:
local-bm25-saturation (broad candidates) → local-embedding-bug-text (semantic re-rank) → local-history-prior-localization (fix-history boost)sim-cross-pr-feature-mapping for prior precedent on new featuresmine-change-coupling to surface partner files that historically move togetherAlways preprocess identifier tokens via ling-camel-snake-split → ling-abbreviation-expansion → ling-porter-stemming before any vocabulary-based algorithm. Skipping this step silently degrades every downstream signal.
Cross-language parsing. Most rule code examples use Python's built-in ast module for brevity. For real cross-language work (Go, Rust, Java, TS, C++ in the same repo), use tree-sitter — it provides robust parsers for 40+ languages with a uniform API. Every AST-based rule in this skill (PDG clones, GumTree, Zhang-Shasha, POS-tag heads, identifier co-occurrence) maps cleanly onto tree-sitter ASTs.
| File | Description |
|---|---|
| references/_sections.md | Category definitions and impact ordering |
| assets/templates/_template.md | Template for adding new algorithm rules |
| metadata.json | Version and reference information |