exploring-codebases
First-encounter codebase orientation. Chains tree-sitting (structural inventory) and featuring (feature synthesis) into an EDA workflow for unfamiliar repositories. Use when someone says "explore this repo", "what does this do", "I just cloned this", "help me understand this codebase", or when starting work on an unfamiliar repository. This is the divergent "what's here?" skill — for targeted "where is X?" queries, use searching-codebases instead.
What this skill does
# Exploring Codebases Exploratory code analysis for unfamiliar repositories. Orchestrates tree-sitting (structural) and featuring (semantic) over a local copy. ## Workflow Five numbered steps, in order. Do not skip step 0. ### 0. Setup (once per session) ```bash uv venv /home/claude/.venv 2>/dev/null uv pip install tree-sitter-language-pack --python /home/claude/.venv/bin/python export PYTHON=/home/claude/.venv/bin/python export TREESIT=/mnt/skills/user/tree-sitting/scripts/treesit.py export GATHER=/mnt/skills/user/featuring/scripts/gather.py ``` If step 2's `--stats` later reports `Scanned 0 files ... Errors: 1`, the language pack isn't loaded — come back here and install. Treesit fails silently on missing deps; it does not raise a useful error. ### 1. Get the repo (tarball, not per-file) ```bash OWNER=... REPO=... REF=main # branch name, tag, or SHA. For a PR: pull/N/head curl -sL -H "Authorization: Bearer $GH_TOKEN" \ "https://api.github.com/repos/$OWNER/$REPO/tarball/$REF" -o /tmp/$REPO.tar.gz mkdir -p /tmp/$REPO && tar -xzf /tmp/$REPO.tar.gz -C /tmp/$REPO --strip-components=1 ls /tmp/$REPO | head # sanity check — did extraction land? ``` One HTTP call gets the whole repo. Do NOT curl README, cat files, or fetch via `contents/PATH` first — they're in the tarball. The Authorization header is only needed for private repos; public repos work without it. **Ref selection matters.** If exploring a feature branch, PR, or tag, set `REF` accordingly. The default `main` will silently give you stale code if the question is about an unmerged branch. ### 2. Structural scan ```bash $PYTHON $TREESIT /tmp/$REPO --stats ``` Read the output. It gives file counts, symbol counts, languages, and per-directory symbol density. This IS the orienting artifact — treat it as the product of this step, not warm-up. **Drill only if you have a specific question.** For pure "what is this repo" exploration, skip drilling and go to step 3 — featuring surfaces the interesting paths for you. Drill when a user asked about a specific subsystem, or when step 3's output raises a question that needs source. **When you do drill, batch queries in one invocation.** Every treesit call pays the full scan cost. Multiple queries added to the same command share that scan and each additional query adds ~0ms. If you're about to make a second treesit call on the same path, fold it into the first. ```bash # GOOD — one scan, three answers $PYTHON $TREESIT /tmp/$REPO --path=SUBDIR --detail=full \ 'find:*Handler*:function' 'source:main' 'refs:Config' # BAD — three scans, three answers (3× the cost for the same information) $PYTHON $TREESIT /tmp/$REPO --path=SUBDIR --detail=full $PYTHON $TREESIT /tmp/$REPO 'find:*Handler*:function' $PYTHON $TREESIT /tmp/$REPO 'refs:Config' ``` ### 3. Feature synthesis ```bash $PYTHON $GATHER /tmp/$REPO \ --skip tests,.github,node_modules --source-budget 8000 ``` Output includes a "Candidate areas for sub-files (by symbol density)" list near the top — that's your drill-target picker, ranked. ### 4. Reason about the combined output Synthesize 2+3: capabilities, feature groups, architecture, entry points, anomalies. Produce `_FEATURES.md` when warranted. This is the LLM step; everything before was mechanical. ## When to Use This vs Other Skills | Situation | Use | |-----------|-----| | "I just cloned this, what is it?" | **exploring-codebases** (this skill) | | "Where is the retry logic?" | searching-codebases | | "Find all files matching `class.*Error`" | searching-codebases | | "Show me the symbols in auth.py" | tree-sitting directly | | "Which files are most about CSRF / sessions / queryset filtering?" | bm25 | | "Rank these docs by relevance to a multi-word concept" | bm25 | | "Document what this codebase does" | featuring directly | Exploring is the **divergent** skill — you don't know what you're looking for yet. Searching is the **convergent** skill — you know what you want. ### Pairing bm25 with this workflow Once steps 2–3 have surfaced the rough shape of the repo, `bm25` is the natural complement when you want **ranked content search** beyond grep and beyond exact-symbol lookup. It ranks files by lexical relevance to a multi-word query, which is useful for "what's this codebase actually *about* when I search for X?" — particularly when you don't yet know the symbol name to feed to `tree-sitting`. ```bash BM25=/mnt/skills/user/bm25/scripts/bm25.py # Pass multiple queries — index builds once, all queries reuse it python3 $BM25 /tmp/$REPO 'auth flow' 'session backend' 'middleware pipeline' \ --exclude 'tests/*' --exclude '*/tests/*' --top-k 5 ``` Two patterns that pair especially well: 1. **bm25 → tree-sitting.** Use bm25 to find the top-ranked files for a concept; then `tree-sitting source:Symbol:path/to/file.py` to read the actual implementation. 2. **bm25 with `--exclude 'tests/*'`.** Test directories tend to dominate keyword queries because test names redundantly mention domain terms. Excluding them up front lands you on implementation files. bm25 is corpus-agnostic — it'll also work on `project` knowledge stores or `uploads/` if your exploration spans docs, transcripts, or PDFs. ## Notes - **Large repos (>100 files)**: use `--skip tests,vendored,docs,...` in step 2 to focus the scan. - **Monorepos**: treat each package/service as a separate exploration. Generate per-subsystem `_FEATURES.md` files linked from a root index. - **Drill heuristics** (if step 2 drilling is warranted): directories with high symbol-to-file ratio (dense logic), entry-point names (`main`, `cli`, `app`, `server`, `routes`), files with many imports (integration points).
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.