risk-synthesis-scan

Ranks Sokrates complexity, churn, and ownership metrics into explained, actionable code-risk findings.

3|1|Updated Aug 26, 2026
One-click install
npx skills add https://github.com/zeljkoobrenovic/sokrates-skills --skill risk-synthesis-scan-zeljkoobrenovic
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: risk-synthesis-scan
Source: https://github.com/zeljkoobrenovic/sokrates-skills/tree/main/skills/scanners/risk-synthesis-scan
Command: npx skills add https://github.com/zeljkoobrenovic/sokrates-skills --skill risk-synthesis-scan-zeljkoobrenovic

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve? Sokrates reports which files are large, complex, frequently changed, or single-owned, but it cannot say what those files do, whether the complexity is essential or accidental, or what a fix would look like. This Skill closes that gap by turning raw quantitative risk signals into explained findings a tech lead can act on. ## Core Features & Use Cases - Deterministic hotspot shortlisting: A bundled Python script ranks files by complexity, recent churn, and size, and extracts knowledge-risk and change-coupling signals from the Sokrates data exports. - Semantic risk explanation: The AI reads each shortlisted file's actual code and explains what it does, why its metrics make it risky, and what a proportionate fix would be, with severity calibration from info to high. - Use Case: After running a Sokrates analysis on a legacy repository, ask where the real maintenance risks are; the Skill produces findings covering hotspots, bus-factor concentration, and shotgun-edit coupling, each backed by code evidence and metric citations. ## Quick Start Ask the AI to run the risk synthesis scan on the existing _sokrates analysis and explain which files are the biggest maintenance risks and why.

Frequently Asked Questions about risk-synthesis-scan

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find the riskiest files in my codebase with Sokrates?

Run a Sokrates analysis first, then this scan ranks files by complexity, recent churn, and size using the select_hotspots.py script. The AI then reads each shortlisted file and explains what it does, why the metrics matter, and what fix would help.

How does the risk hotspot ranking work?

The script scores each file as (1 + max McCabe) × (1 + commits in 90 days) × log2(lines of code), so risk grows with both change difficulty and change frequency. With --src-root it also excludes embedded Rust test modules so test code does not inflate scores.

Does the risk scan work on a repository without git history?

Yes, but degraded. The script warns on stderr, marks history_data as absent, and falls back to a complexity-only ranking. Churn, ownership, and coupling findings collapse into a single info finding stating those signals are unmeasured.

What is bus factor or knowledge risk analysis in this scan?

The script extracts top-contributor commit shares and lists single-owner production files over 200 LOC, including each owner's last commit anywhere in the repo. An owner who has gone quiet strengthens the finding; active owners lower the severity.

Why are some change-coupling pairs marked as not real problems?

Pairs where a file lives in a same-named directory (Rust mod.rs or #[path] style) are flagged same_module_hint, meaning they are one logical module split across files. These are reported as info observations rather than boundary violations.