rseng-software-metrics
Skill20 starsChanged 4 months agoMITView on GitHub
Covers measuring code health quantitatively: cyclomatic complexity, code duplication, coupling and cohesion, code churn, maintainability index, size conventions and documentation coverage - running radon, lizard, jscpd, interrogate and SonarQube-class tools, interpreting numbers against community conventions and the software's tier, wiring metric gates into CI, and avoiding metric gaming. Use when the user asks how healthy, complex or maintainable their code is, wants metrics or duplication measured, mentions cyclomatic complexity, churn, coupling or maintainability index, or when a quality assessment (rseng-quality-framework) needs the quantitative half. For style and linting see rseng-code-quality; for runtime performance measurement see rseng-performance-profiling.
In this repository67 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rseng-agent-securitySkill
- rseng-ai-declarationSkill
- rseng-archivingSkill
- rseng-big-data-processingSkill
- rseng-ci-cdSkill
- rseng-citation-hygieneSkill
- rseng-citation-metadataSkill
- rseng-code-qualitySkill
- rseng-code-reviewSkill
- rseng-community-governanceSkill
- rseng-community-metricsSkill
- rseng-contributor-onboardingSkill
- rseng-data-management-plansSkill
- rseng-data-managementSkill
- rseng-debuggingSkill
- rseng-defensive-codingSkill
- rseng-dependency-managementSkill
- rseng-discoverySkill
- rseng-documentationSkill
- rseng-fact-checkingSkill
- rseng-fairguardSkill
- rseng-fair-mlSkill
- rseng-fair-softwareSkill
- rseng-gpu-computingSkill
- rseng-green-computingSkill
- rseng-honestySkill
- rseng-hpc-computingSkill
- rseng-human-verificationSkill
- rseng-language-guidesSkill
- rseng-legacy-codeSkill
- rseng-lessons-learnedSkill
- rseng-license-complianceSkill
- rseng-licensingSkill
- rseng-maintenance-sustainabilitySkill
- rseng-management-planningSkill
- rseng-notebooksSkill
- rseng-numerical-accuracySkill
- rseng-open-science-practicesSkill
- rseng-open-source-migrationSkill
- rseng-pair-programmingSkill
- rseng-performance-profilingSkill
- rseng-project-kickoffSkill
- rseng-project-scaffoldingSkill
- rseng-project-trackingSkill
- rseng-provenanceSkill
- rseng-publishing-releasingSkill
- rseng-quality-frameworkSkill
- rseng-regulatory-complianceSkill
- rseng-reproducibilitySkill
- rseng-reproducible-environmentsSkill
- rseng-research-integritySkill
- rseng-science-communicationSkill
- rseng-scientific-file-formatsSkill
- rseng-scientific-visualizationSkill
- rseng-securitySkill
- rseng-software-designSkill
- rseng-software-peer-reviewSkill
- rseng-software-publishingSkill
- rseng-software-reuseSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 71
Run measurements read-only first and report: worst five functions by complexity, duplication clusters, hotspot files (churn x complexity), …
- Distinctive: line 104
Every metric can be satisfied without improving anything: splitting functions mechanically to duck a complexity gate, deleting docstring …
- Distinctive: line 136
Check whether any of these applies before moving on:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Software metrics for research code
Quality talk stays opinion until something is measured. A cluster of the community research software quality indicators is explicitly quantitative - complexity, duplication, cohesion/coupling, churn, maintainability index, size and documentation coverage "within community conventions" - and all of it is measurable in minutes with free tools. The discipline is in the interpretation: metrics LOCATE problems, humans judge them; a number out of convention is a place to look, not a verdict. And Goodhart's law is the standing hazard - when a metric becomes a target, it stops measuring (the gaming section below is as important as the tools).
The metrics and what they actually indicate
- Cyclomatic complexity (independent paths per function): high values mean hard-to-test, hard-to-reason code; each point is roughly one more test case needed (rseng-testing). Look at the per-function outliers, never the average.
- Duplication ratio: copy-pasted blocks that must be fixed twice; research code's most common debt (the "second copy-paste" signal from rseng-software-design's extraction rule, made measurable).
- Coupling and cohesion: how tangled modules are (CBO-style counts) and how single-purpose they are internally - the quantitative face of rseng-software-design's change-cost test.
- Code churn (change frequency per file): files that change constantly are either active development or a design hotspot; churn x complexity is the best bug-risk locator in the set.
- Maintainability index: a composite; useful for trend and worst-file ranking, meaningless as an absolute grade.
- Size conventions (LOC per function/module): long functions correlate with everything bad; community conventions vary by language (rseng-language-guides).
- Documentation coverage: fraction of public functions/classes with docstrings (interrogate-style) - the measurable slice of rseng-documentation, and an explicit quality indicator.
Measuring: the tool layer
- Python: radon (complexity, maintainability index, raw metrics), interrogate (docstring coverage); lizard covers complexity across a dozen languages (C/C++, Java, JS, Fortran-adjacent stacks) with no setup.
- Duplication: jscpd scans mixed-language repositories quickly.
- Churn: git itself (
git log --format= --name-only | sort | uniq -c) - no tool needed; join with complexity for the hotspot map. - Platform-scale: SonarQube-class services aggregate all of the above with history when a team wants dashboards; overkill for a single analysis repo (match the tier).
Run measurements read-only first and report: worst five functions by complexity, duplication clusters, hotspot files (churn x complexity), doc-coverage percentage - with file:line locations so every number is actionable.
Interpreting against conventions and tier
"Community conventions" is the catalog phrasing for a reason - absolute thresholds are folklore, but working defaults exist: complexity warnings commonly start around 10 per function, duplication tolerance a few percent, doc coverage expectations scale with audience. Calibrate by tier (rseng-quality-framework): analysis code earns attention only for egregious outliers; shared libraries justify gates; infrastructure justifies trend tracking. State the convention being applied and why - an unexplained threshold is just a different opinion.
Gates and trends in CI
- Ratchet, do not ambush: set gates at the CURRENT values so metrics cannot regress, then tighten deliberately - a strict gate on a legacy codebase blocks all work and gets disabled within a week (the same start-where-you-are rule as rseng-fairguard's quality gates).
- Fail on new debt only where possible (changed-files scope), and keep the full-repo numbers as a tracked report, not a blocker (rseng-ci-cd).
- Trends beat snapshots: rising churn in a complex module is a refactoring signal (rseng-legacy-code, rseng-software-design) worth an issue, even when every absolute number still passes.
Metric gaming, named
Every metric can be satisfied without improving anything: splitting functions mechanically to duck a complexity gate, deleting docstring checks instead of writing docstrings, suppressing duplication detection with trivial edits. Flag the pattern when reviewing (rseng-pair-programming's pre-review pass), and keep metrics plural - a basket is harder to game than a single number. The metric serves the change-cost reality, never the reverse; when a metric and good judgment disagree, judgment wins and the exception gets a comment.
Working with this skill
This skill is source-independent: its authority is the tool documentation and the published indicator definitions linked below. It supplies the quantitative half of rseng-quality-framework assessments; rseng-code-quality owns style and linting, rseng-performance-profiling owns runtime measurement.
Learn more (verified):
- https://radon.readthedocs.io - radon (Python complexity and maintainability)
- https://github.com/terryyin/lizard - lizard multi-language complexity
- https://github.com/kucherenko/jscpd - jscpd duplication detection
- https://interrogate.readthedocs.io - interrogate docstring coverage
<!-- related-skills:begin -->Related skills
Check whether any of these applies before moving on:
- rseng-community-metrics - project-level counterpart to code metrics
- rseng-documentation - doc-coverage is its measurable slice
- rseng-legacy-code - hotspot map targets refactoring
- rseng-maintenance-sustainability - trend tracking signals sustainability risk
- rseng-quality-framework - supplies the quantitative half of assessments
- rseng-software-design - coupling numbers test the design
<!-- related-skills:end -->Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

