im-shashanks/claude-plugins / shaktra/skills/shaktra-analyze
shaktra-analyze
VerifiedCodebase Analyzer workflow for brownfield codebases — deep structural analysis producing structured YAML artifacts for downstream agents. Use this skill whenever the user wants to analyze, assess, or understand an existing codebase — including requests like "analyze my codebase", "what's the health of this project", "check for tech debt", "audit dependencies", "understand this codebase before we start", or any brownfield due diligence task.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 13.4 KB |
| analysis-dimensions-core.md | markdown | 14.2 KB |
| analysis-dimensions-git.md | markdown | 5.5 KB |
| analysis-dimensions-health.md | markdown | 12.7 KB |
| analysis-output-schemas.md | markdown | 9.2 KB |
| debt-strategy.md | markdown | 5.7 KB |
| deep-analysis-workflow.md | markdown | 13.2 KB |
| dependency-audit.md | markdown | 6.1 KB |
| standard-analysis-workflow.md | markdown | 7.2 KB |
analysis-dimensions-git.md
View on GitHub# Analysis Dimensions — Git Intelligence (D9)
Historical signals from git that are invisible to static analysis. Answers "How has this codebase EVOLVED?" — change patterns, bug density, knowledge distribution, and code age.
**Used by:** shaktra-cba-analyzer agent during `/shaktra:analyze` workflow.
**Input dependency:** Requires a git repository. Consumes `static.yml` (file inventory for scoping).
**Companion:** `analysis-dimensions-core.md` defines D1-D4, `analysis-dimensions-health.md` defines D5-D8.
---
## Extraction Philosophy
All data in this dimension comes from **tool-based extraction** — the same philosophy as `static.yml`. Run git commands via Bash and parse the output. No LLM interpretation of git data. The CBA analyzer's role is structuring the output, not inferring meaning.
**Shallow clone guard:** Before extraction, check commit count with `git rev-list --count HEAD`. If fewer than 10 commits, note the limitation in `summary:` and produce minimal output (hotspots and code_age only, with a caveat).
---
## D9: Git Intelligence → `git-intelligence.yml`
**Scope:** Historical change patterns, bug-fix density, co-change coupling, knowledge distribution, and code age across all tracked source files.
**Downstream impact:** The cross-cutting risk correlation (D8) uses change frequency and bug-fix density as key risk factors. The sw-quality agent uses hotspots and bus factor to identify files needing extra review attention. Co-change patterns reveal hidden coupling that static analysis misses — the architect uses these to validate or challenge module boundary decisions.
**What to extract:**
1. **Hotspots** — files with the most commits. Use `git log --format=format: --name-only | sort | uniq -c | sort -rn` scoped to source files from `static.yml`. Classify: top 10% = hot, middle 40% = warm, bottom 50% = cold. Also extract distinct author count per file via `git shortlog -sn -- {file}`.
2. **Bug-fix density** — commits matching fix/bug/patch/hotfix patterns in their message. Use `git log --oneline --all -- {file}` and grep for `fix|bug|patch|hotfix` (case-insensitive). Compute fix_ratio = fix_commits / total_commits. Also count recent fixes (last 90 days) via `git log --since="90 days ago"`.
3. **Co-change patterns** — files that frequently change together in the same commit. Use `git log --format=format: --name-only` to get file lists per commit, then compute pairwise co-occurrence. Report clusters with minimum 3 co-occurrences. Flag `hidden_coupling: true` when co-changing files don't import each other (cross-reference `static.yml` dependency graph).
4. **Knowledge distribution** — author concentration per file. Use `git shortlog -sn -- {file}` for commit counts per author. Compute bus_factor (authors with >20% of commits). Flag `knowledge_risk: high` when bus_factor = 1 and file is on a critical path.
5. **Code age** — last modification date per file. Use `git log -1 --format=%aI -- {file}`. Classify: fresh (<30 days), recent (30-180 days), aging (180-365 days), stale (>365 days). Age categories are analysis constants, not quality gates.
**Git commands reference:**
- Hotspot ranking: `git log --format=format: --name-only --diff-filter=ACDMR | sort | uniq -c | sort -rn`
- Per-file authors: `git shortlog -sn -- {file}`
- Fix-commit detection: `git log --oneline --all --grep='fix\|bug\|patch\|hotfix' -i -- {file}`
- Recent fix commits: `git log --oneline --since="90 days ago" --grep='fix\|bug\|patch\|hotfix' -i -- {file}`
- Co-change extraction: `git log --format=format: --name-only` (group by blank-line-delimited commits)
- Code age: `git log -1 --format=%aI -- {file}`
- Commit count check: `git rev-list --count HEAD`
**Evidence requirements:**
- All data from actual git command output — no LLM inference
- Hotspot thresholds based on actual commit count distribution (percentile-based)
- Co-change patterns require minimum 3 co-occurrences to report
- Bug-fix matching uses commit message pattern matching, not code analysis
- Knowledge distribution uses commit count attribution (approximation, not perfect)
**Output structure:**
```yaml
summary: |
{Self-contained 400-token overview: hotspot count, highest-churn files,
co-change clusters, bug-fix density distribution, knowledge risks}
details:
hotspots:
- file: string
commits_last_90_days: integer
commits_last_365_days: integer
distinct_authors: integer
churn_category: hot | warm | cold
bug_fix_density:
- file: string
total_commits: integer
fix_commits: integer
fix_ratio: float
recent_fixes: integer
co_change_patterns:
- cluster_name: string
files: [string]
co_change_frequency: integer
linked_in_code: boolean
hidden_coupling: boolean
knowledge_distribution:
- file: string
primary_author: string
author_count: integer
bus_factor: integer
knowledge_risk: high | medium | low
code_age:
- file: string
last_modified: ISO-8601
age_category: fresh | recent | aging | stale
```
**Self-check before writing:**
- All data comes from actual git command output — no numbers inferred or estimated
- Hotspot thresholds are percentile-based on the actual commit distribution — not arbitrary cutoffs
- Co-change patterns have minimum 3 co-occurrences — don't report noise from single shared commits
- If commit count is <10 (shallow clone), this is noted in summary and only minimal output is produced
- Knowledge distribution uses commit count attribution — acknowledge this is an approximation in the summary
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |