A Claude Code skill that extracts engineering best practices from PR review history.
SaferSkills independently audited mine-best-practices (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Extract insights from PR review threads, validate against codebase, and consolidate into the best practices library.
You are the orchestrator for this multi-stage pipeline. Your responsibilities:
Key principle: Validate each stage's output before proceeding. Only interrupt the user when something needs human judgment.
Use when:
Don't use for:
/mine-best-practices --since 2025-01-01
/mine-best-practices --since 2025-06-01 --until 2025-07-01 --scope backendAll date ranges refer to PR merge date (inclusive on both ends).
For debugging and manual intervention:
/mine-best-practices resume validate --identifier web_2025-01-29
/mine-best-practices status
/mine-best-practices pending
/mine-best-practices for-topic error_handling--batch-size and --id-prefix are tuning parameters rarely needed in normal operation.
Before mining, ensure threads are up to date:
python3 scripts/mine.py refresh # Incremental (new PRs only)
python3 scripts/mine.py refresh --since 2025-01-01 # From specific merge date
python3 scripts/mine.py refresh --since 2026-01-09 --until 2026-01-26 # Specific range
python3 scripts/mine.py refresh --full # Full re-extractionRequires gh CLI authenticated with repo access. Safe to re-fetch overlapping ranges (deduplicates by thread_id).
NOTE: All commands run from the skill directory (where this SKILL.md lives).
python3 scripts/mine.py extract --since 2025-01-01 --scope backendOutputs extraction Task prompts for each batch.
Launch the Task prompts from Step 1 in parallel using the Task tool.
Output: tmp/mining_{identifier}/extraction/batch_{n}.yaml
After subagents complete, validate:
python3 scripts/aggregate_extraction.py {identifier}Merges results into insights.yaml and outputs validation Task prompts.
After aggregation, validate:
Launch validation Task prompts in parallel using the Task tool.
Output: tmp/mining_{identifier}/validation/batch_{n}.yaml
After subagents complete, validate:
python3 scripts/aggregate_validation.py {identifier}Updates insights.yaml with validation results and outputs topic assignment prompt.
After aggregation, validate:
Launch the topic assignment Task prompt(s) in parallel.
Output: tmp/mining_{identifier}/topics/batch_{n}.yaml
After subagents complete:
topics/batch_{n}.yaml outputsassignments lists into one topics.yaml in the working directory__new__: topics: same name across batches → keep as-is (natural merge). Similar but differently-named proposals → flag to user for resolution.python3 scripts/dispatch_synthesis.py {identifier}Applies topic assignments and outputs synthesis Task prompts (one per topic).
After dispatch, validate:
__new__: topics)Launch synthesis Task prompts in parallel using the Task tool (one per topic).
Output: Updates library/{topic}.yaml directly.
After subagents complete, validate:
Check that:
Stop and alert user if: practices were deleted without replacement, excessive additions, or empty library files.
python3 scripts/aggregate_synthesis.py {identifier}Marks all validated insights with topics as synthesized.
python3 scripts/build_sections.pyGenerates markdown files for the review skill.
Output: the configured sections_output_dir
python3 scripts/mine.py status
python3 scripts/mine.py pendingConfirm:
status shows insights as synthesizedpending shows no remaining workpython3 scripts/build_bugbot.pyProduces Task prompts for generating bugbot rules from the library. Launch the Task prompts (one per scope). Each subagent reads the existing BUGBOT.md and library practices, then merges incrementally — adding rules for new practices, removing rules for deleted practices, and preserving unchanged rules verbatim.
Sections use ## {topic} headings (matching library filenames) with **{practice_title}** rule keys. Related practices are synthesized into fewer condensed rules.
Targets: Scope-specific rules files from config.yaml
After subagents complete, verify:
.cursor/BUGBOT.md (manually maintained cross-cutting rules)python3 scripts/mine.py status # Overview: threads, insights, library
python3 scripts/mine.py pending # What needs work at each stage
python3 scripts/mine.py for-topic X # All insights for topic Xcode_insights/threads.yamlcode_insights/insights.yamlcode_insights/library/*.yamltmp/mining_{identifier}/User: /mine-best-practices --since 2024-01-01
|
v
mine.py --> Batch threads, output extraction prompts
|
v
Extraction subagents (parallel) --> batch_n.yaml
|
v
aggregate_extraction.py --> insights.yaml + validation prompts
|
v
Validation subagents (parallel) --> batch_n.yaml
|
v
aggregate_validation.py --> insights.yaml + topic prompt
|
v
Topic assignment subagent --> topics.yaml
|
v
dispatch_synthesis.py --> synthesis prompts (per topic)
|
v
Synthesis subagents (parallel) --> library/{topic}.yaml
|
v
[VERIFY: Check for anomalies]
|
v
aggregate_synthesis.py --> insights.yaml (status: synthesized)
|
v
build_sections.py --> sections/*.md
|
v
build_bugbot.py --> bugbot rules (via subagent)insights.yaml (full provenance)~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.