---
name: Repo Stats Auto Update
slug: repo-stats-auto-update
category: Automation
description: Repo Stats Auto Update keeps README badges and inline counts in sync with authoritative repo stats. Use it when published numbers drift or before a release; it runs from a pre-commit hook and can check for stale values.
github: "https://github.com/stevesolun/ctx/tree/main/skills/repo-stats-autoupdate"
language: Python
stars: 578
forks: 71
install: "npx degit https://github.com/stevesolun/ctx/tree/main/skills/repo-stats-autoupdate ~/.claude/skills/repo-stats-autoupdate"
installs_to: ~/.claude/skills/repo-stats-autoupdate
source_path: skills/repo-stats-autoupdate/SKILL.md
collection_size: 25
category_size: 1523
collection_url: "https://dirskills.com/collections/stevesolun/ctx"
added: 2026-08-25T05:13:56.803Z
last_synced: 2026-08-25T05:13:56.803Z
canonical_url: "https://dirskills.com/skills/repo-stats-auto-update"
---

# Repo Stats Auto Update

Repo Stats Auto Update keeps README badges and inline counts in sync with authoritative repo stats. Use it when published numbers drift or before a release; it runs from a pre-commit hook and can check for stale values.

**Install:**

```bash
npx degit https://github.com/stevesolun/ctx/tree/main/skills/repo-stats-autoupdate ~/.claude/skills/repo-stats-autoupdate
```

## README

# repo-stats-autoupdate

## What this skill does

Reads the **authoritative sources** for the ctx repo's key numbers and patches `README.md` in place so badges and inline counts never drift:

| Number | Source of truth |
|---|---|
| Skills | `~/.claude/skill-wiki/graphify-out/graph.json` — count nodes where `type == "skill"` |
| Agents | same file — count nodes where `type == "agent"` |
| Graph nodes | `len(graph["nodes"])` |
| Graph edges | `len(graph["edges"])`, formatted as `642K` / `1.2M` |
| Communities | `graph/communities.json` → `total_communities` |
| Converted pipelines | `~/.claude/skill-wiki/converted/` subdir count |
| Tests | checked-in README/docs inventory by default; set `CTX_UPDATE_REPO_STATS_LIVE_TESTS=1` to refresh from `pytest --collect-only -q` |

Fields that can't be resolved (e.g. wiki not deployed) are left untouched — the updater never blocks a commit.

## How to use it

**One-time install (per clone):**
```bash
git config core.hooksPath .githooks
```

After that, every `git commit` runs `.githooks/pre-commit` which calls the updater and re-stages `README.md` if any number drifted.

**Manual run:**
```bash
python src/update_repo_stats.py          # patch README
python src/update_repo_stats.py --check  # exit 1 if stale (for CI)
CTX_UPDATE_REPO_STATS_LIVE_TESTS=1 python src/update_repo_stats.py  # refresh test inventory
```

## When NOT to use it

- When you've deliberately phrased a number descriptively (e.g. "over 1,700 skills") — the regex patterns only match exact digits, so prose phrasings are safe, but double-check after big imports.
- When the wiki isn't deployed locally. The updater degrades gracefully: it prints a warning and skips fields it can't resolve. It does **not** invent numbers.

## Known gaps (intentionally out of scope)

- **Does not rebuild the graph or wiki.** Rebuilding `graph/wiki-graph.tar.gz` takes minutes and churns a large artifact — too heavy for per-commit. Run `ctx-wiki-graphify`, then `python src/validate_graph_artifacts.py --deep`, and repack the tarball manually when the skill catalog changes materially.
- **Does not verify graph integrity.** If `graphify-out/graph.json` is corrupt, you'll get junk numbers. Run the wiki health check (`python src/wiki_orchestrator.py --check`) separately.

## Related files

- [src/update_repo_stats.py](../../src/update_repo_stats.py) — the worker
- [.githooks/pre-commit](../../.githooks/pre-commit) — the per-commit trigger
- `README.md` — the target being kept in sync
