Skip to content

sajor2000/methodsmith / plugins/methodsmith/skills/method-language-detect

method-language-detect

Verified

Detects R, Python, or mixed-language signals in repo files and emits a language handoff. Use when a skill needs language evidence or the user asks the repo's stack.

FileKindSize
SKILL.mdskill md3.2 KB
references/detection-rules.mdmarkdown3.4 KB

references/detection-rules.md

View on GitHub
# Language Detection Rules (Repo Signals Only)

Use only repository signals. Do not ask the user.

## Table of contents

1. Signal classes and weights
2. Scoring
3. Classification thresholds
4. Tie-breaks
5. Examples

---

## 1. Signal classes and weights

### Python signals

- `pyproject.toml`, `requirements.txt`, `Pipfile`, `environment.yml` with Python deps: **+3**
- Python env markers (`.venv/`, `poetry.lock`, `uv.lock`, `pixi.toml`): **+2**
- Python source files (`**/*.py`) or notebooks (`**/*.ipynb`) in active code paths (`code/`, `src/`, `analysis/`): **+2**
- Python-specific imports (`pandas`, `polars`, `numpy`, `scipy`, `statsmodels`, `sklearn`, `clifpy`): **+1**

### R signals

- `renv.lock`, `.Rprofile`, `.Rproj`, `DESCRIPTION` with `Depends: R`: **+3**
- R project markers (`renv/`, `NAMESPACE`, `man/`): **+2**
- R source files (`**/*.R`, `**/*.Rmd`, `**/*.qmd`) in active code paths (`code/`, `R/`, `analysis/`): **+2**
- R-specific imports (`tidyverse`, `dplyr`, `data.table`, `arrow`, `survival`, `lme4`, `targets`, `brms`): **+1**

### Legacy statistical package signals

These are assessment signals, not primary-language classifications:

- SAS source files (`**/*.sas`) in active code paths: note `legacy=sas`
- Stata source files (`**/*.do`, `**/*.ado`) in active code paths: note `legacy=stata`
- SAS procedure patterns (`PROC LOGISTIC`, `PROC PHREG`, `PROC MIXED`, `LIBNAME`) or Stata model commands (`stcox`, `logit`, `regress`, `mi`) reinforce the legacy note

When SAS/Stata signals dominate and Python/R scores do not meet thresholds, keep `primary=unknown secondary=null source=auto` and recommend `method-sas-stata`.

## 2. Scoring

- Sum Python and R scores independently.
- Ignore generated/vendor directories (`.git/`, `node_modules/`, `dist/`, `build/`, `.venv/` contents, `renv/library/`).
- Prefer signals inside project workflow directories (`code/`, `analysis/`, `src/`, `R/`) over docs-only mentions.

## 3. Classification thresholds

- `python` when Python score >= 4 and R score <= 3
- `r` when R score >= 4 and Python score <= 3
- `both` when Python score >= 4 and R score >= 4
- `unknown` otherwise

`secondary` is:

- `r` when `primary=python` and R score >= 3
- `python` when `primary=r` and Python score >= 3
- `python` (or `r`) when `primary=both` using whichever score is smaller as secondary
- `null` for `unknown`, and when the other language scores 2 or less

## 4. Tie-breaks

When both languages have medium evidence but one is slightly stronger:

1. Prefer the language with executable scripts under `code/` / `analysis/`.
2. If still tied, prefer the language used in CI/test commands (`Rscript`, `pytest`, etc.).
3. If still tied, classify as `both`.

For CLIF repos:

- Presence of `renv.lock` + `code/templates/R/` is a strong R signal.
- Presence of `clifpy` usage is a strong Python signal.
- If both exist, classify as `both`.

## 5. Examples

- `renv.lock` + many `*.R` + no Python files -> `primary=r secondary=null source=auto`
- `pyproject.toml` + `src/*.py` + no R markers -> `primary=python secondary=null source=auto`
- `renv.lock` + `pyproject.toml` + active `code/*.R` and `code/*.py` -> `primary=both secondary=r|python source=auto`
- Only docs, no code markers -> `primary=unknown secondary=null source=auto` (or `source=cached` if cache exists)
- `analysis/*.sas` + `analysis/*.do` + no R/Python implementation files -> `primary=unknown secondary=null source=auto`, then load the `method-sas-stata` skill
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 469kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 321kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 321kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 321kUpdated Claude CodeCodexVerifiedInstall