mcpField
L
linguistic-semantic-algorithms

linguistic-semantic-algorithms

github.com/pproencaDevelopment218126 installsUpdated 11w ago
Repository

About linguistic-semantic-algorithms

A reference skill cataloging 40 algorithms for extracting concepts, similarity, architecture, history, and risk signals from source code and commits. It is aimed at agents analyzing unfamiliar codebases, locating bugs or features, and assessing refactor or maintenance risk.

Key features

  1. 01Organizes 40 algorithms into eight categories
  2. 02Extracts domain concepts and bounded contexts
  3. 03Finds semantic similarities and code clones
  4. 04Analyzes dependency graphs and change history
  5. 05Ranks bug locations and code risk

Use cases

  1. 01Map business concepts in an unfamiliar repository
  2. 02Find files related to a bug report or feature
  3. 03Review refactor impact and duplicated logic
  4. 04Identify architectural coupling and risky hotspots

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pproenca/dot-skills --skill linguistic-semantic-algorithms

After installing, type/linguistic-semantic-algorithmsin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

AGENTS.md
metadata.json
assets/templates/
_template.md
references/
_sections.md
clone-ast-gumtree.md
clone-minhash-lsh.md
clone-simhash.md
clone-suffix-array-cpd.md
clone-zhang-shasha-ted.md
concept-bounded-context-detection.md
concept-entity-name-resolution.md
concept-identifier-cooccurrence-network.md
concept-lda-topic-modeling.md
concept-noun-phrase-mining.md
concept-tfidf-rare-terms.md
graph-betweenness-bottlenecks.md
graph-feedback-arcs.md
graph-louvain-modules.md
graph-pagerank-core.md
graph-scc-cycle-tangles.md
ling-abbreviation-expansion.md
ling-camel-snake-split.md
ling-porter-stemming.md
ling-pos-tagging-identifiers.md
local-bm25-saturation.md
local-embedding-bug-text.md
local-history-prior-localization.md
local-tfidf-bug-reports.md
mine-bug-fix-density.md
mine-bus-factor.md

Details

From the project README

pproenca Linguistic and Semantic Algorithms Best Practices

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.

When to Apply

Reach for these algorithms when:

  • Orienting in an unfamiliar codebase: PageRank the import graph to find the core, run LDA over identifier tokens to discover business themes, mine change coupling to surface hidden architectural couplings.
  • Hunting a bug from a description: BM25 + history prior + embedding re-rank produces a ranked file shortlist far better than grep.
  • Scoping a feature: find prior PRs that did similar work via embedding similarity; map the feature's vocabulary against the codebase's domain via TF-IDF and noun-phrase mining.
  • Reviewing a refactor: AST-level GumTree diff reveals semantic impact text diff hides; PDG isomorphism finds the "same logic, different code" twin you should also update.
  • Auditing risk: hotspots (churn × complexity), bus factor, defect-magnet density, dead-code candidates — together they direct attention to the parts of the codebase that pay back attention.
  • Identifying domain entities and bounded contexts: noun-phrase mining + TF-IDF rare-term extraction + Louvain communities + Jensen-Shannon divergence on per-cluster vocabulary.

Rule Categories by Priority

PriorityCategoryImpactPrefixQuestion answered
1Concept & Domain ExtractionCRITICALconcept-What business entities live in this code?
2Semantic Similarity & Feature MappingCRITICALsim-Where else does this concept already exist?
3Architectural TopologyHIGHgraph-What is the shape of this codebase?
4Co-Change & Temporal MiningHIGHmine-What hidden couplings does history reveal?
5Clone & Duplication DetectionMEDIUM-HIGHclone-Where are we repeating ourselves?
6Bug & Feature LocalizationMEDIUM-HIGHlocal-Given a description, where in code?
7Identifier LinguisticsMEDIUMling-How to prepare tokens so the other algorithms work?
8Complexity & Risk MetricsMEDIUMrisk-Where is the danger concentrated?

Quick Reference

1. Concept & Domain Extraction (CRITICAL)
2. Semantic Similarity & Feature Mapping (CRITICAL)
3. Architectural Topology (HIGH)
4. Co-Change & Temporal Mining (HIGH)
5. Clone & Duplication Detection (MEDIUM-HIGH)
6. Bug & Feature Localization (MEDIUM-HIGH)
7. Identifier Linguistics (MEDIUM)
8. Complexity & Risk Metrics (MEDIUM)

How to Use

Pick 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:

  1. graph-pagerank-core → read the top-20 most central files
  2. concept-lda-topic-modeling + concept-tfidf-rare-terms → identify the business themes
  3. mine-hotspots-churn-complexity → find where the bugs concentrate
  4. mine-change-coupling → uncover hidden architectural couplings

For a single-task bug or feature, the pipeline is:

  1. local-bm25-saturation (broad candidates) → local-embedding-bug-text (semantic re-rank) → local-history-prior-localization (fix-history boost)
  2. sim-cross-pr-feature-mapping for prior precedent on new features
  3. mine-change-coupling to surface partner files that historically move together

Always 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.

Reference Files

FileDescription
references/_sections.mdCategory definitions and impact ordering
assets/templates/_template.mdTemplate for adding new algorithm rules
metadata.jsonVersion and reference information

Comments

Markdown supported