Archéologue de commits

VérifiéPrudence

Reconstitue l'origine et l'intention du code via l'historique git local, les commits associés et les fichiers co-modifiés.

Spar Skills Guide Bot
DeveloppementIntermédiaire
29/08/2026
Claude CodeCursorCodex
#git-history#code-archaeology#blame-analysis#refactoring#intent-recovery

Recommandé pour

Synthèse automatique

Reconstitue, à partir de l'historique git local, pourquoi un fichier ou une plage de lignes existe : commit d'origine, modifications ultérieures, auteurs actuels, fichiers modifiés conjointement et indices d'intention dans les messages de commit.

Points forts

  • Combine git line-log, suivi des renommages et git blame pour produire une chronologie structurée en JSON
  • Détecte les fichiers qui changent régulièrement aux côtés de la cible comme indice de couplage
  • Extrait des signaux d'intention explicites (références d'issue, reverts, workarounds, marqueurs TODO) sans les surinterpréter
  • Fonctionne entièrement en local, sans réseau, sans clé API et sans écriture dans le dépôt

Limites

  • Limité aux dépôts clonés localement ; inutilisable sur un dépôt distant non cloné
  • Ne couvre qu'un fichier ou une plage de lignes, pas l'architecture globale du projet
  • Une liste de signaux vide signifie seulement que les messages ne disent rien, pas que le changement était sans raison
Quand l'utiliser

À utiliser avant une réécriture, un refactor ou une modification risquée, quand il faut retrouver les contraintes historiques d'un bloc de code surprenant.

Quand l'éviter

À éviter si l'utilisateur veut simplement une sortie brute de git blame, une liste de commits, ou s'il s'agit de réécrire ou supprimer l'historique git.

Analyse de sécurité

Prudence
Score qualité89/100

The skill is intended to run locally and read Git history only, with no network calls or repository writes claimed. However, it requires executing a local Python script through the shell, and the script source is not available for verification, so the appropriate rating is caution rather than safe.

Points d'attention
  • •Declares no allowed-tools but instructs running a local Python script via bash.
  • •Referenced scripts/archaeologist.py is not included in the provided SKILL.md, so its implementation cannot be audited here.
  • •Reads local Git repository history and commit metadata, which may include sensitive information in commit messages or paths.
Comment cette analyse est faite

Exemples

Why does this block exist?
Why does this code exist? Look at src/cache.py lines 40-72 and reconstruct the history before I refactor it.
Who wrote this function and why
Who introduced the retry logic in src/client.py and what changed afterwards? Give me a confidence-rated explanation.
Pre-rewrite history check
I'm about to rewrite the whole of src/auth.py — trace its full git history locally and tell me which companion files keep changing with it.

name: commit-archaeologist description: >- Reconstructs why code exists from local git history, including the introducing commit, later changes, current authors, repeated companion files, and likely intent. Use when the user asks "why does this code exist", "who wrote this function and why", or to "explain the history of this function" before a rewrite, refactor, or risky edit. Runs entirely locally. license: Apache-2.0 metadata: author: "Matt Van Horn" version: "1.0.0" source: "https://github.com/Shubhamsaboo/awesome-llm-apps"

Commit Archaeologist

git blame names the last person to touch a line. This skill reconstructs the reason the line exists. It traces a file or current line range through local git history, identifies its origin and later edits, finds files that repeatedly changed beside it, and extracts intent clues from commit messages.

Everything runs locally. No network calls, API keys, or repository writes.

When to use

  • The user asks why a block, function, or file exists
  • The user wants to know who introduced code and what changed afterward
  • A rewrite or refactor needs historical constraints and change risks
  • A workaround, temporary branch, or surprising design choice needs context

When not to use

  • The user only wants raw blame output or a commit list
  • The task is to squash, delete, or rewrite git history
  • The repository is remote and has not been cloned locally
  • The question is about project-wide architecture rather than one file or region

Gather the target

Get the repository path and tracked file path. Use a line range when the user names a current block or function. If either path is missing, ask only for the missing value. Do not scan sibling repositories.

Paths should be relative to the repository and use forward slashes. Line ranges use inclusive current line numbers such as 40-72.

Run the dig

From this skill directory:

python3 scripts/archaeologist.py /path/to/repo src/cache.py --lines 40-72 --json

For the complete history of a file, omit --lines:

python3 scripts/archaeologist.py /path/to/repo src/cache.py --json

The script is read-only. With a range it uses git line-log; without one it uses file history with rename following. It also reads current authorship with blame. If it rejects a path or range, report that error and ask for a corrected target.

Before interpreting the JSON, read references/reading-git-history.md. Its confidence rules prevent blame ownership, correlation, and commit-message hints from becoming false certainty.

Read the JSON

  • region: normalized repository, current and historical paths, mode, range, and co-change threshold
  • introduced_by: oldest commit in the selected history
  • timeline: commits ordered oldest to newest, with category, changed files, and detected renames
  • co_changed: files present beside the target in enough selected commits
  • authors: current blamed lines and historical commit counts, kept separate
  • intent_signals: issue references, reverts, workarounds, temporary markers, and unfinished-work markers found in commit messages

An empty signal list means the messages do not say why. It does not mean the change had no reason.

Write the report

Turn the JSON into a short "why this code exists" report:

  1. Bottom line. One or two sentences with the most likely explanation and a confidence label: high, medium, or low.
  2. Origin. Introducing hash, date, author, subject, and the neighboring files that make the initial purpose clearer.
  3. Timeline. Oldest to newest. Group mechanical edits when they do not change the story, but preserve reverts, fixes, and workarounds.
  4. Companion files. Explain repeated co-changes as a coupling clue. Do not treat a one-off file in changed_files as a dependency.
  5. Intent evidence. Quote short commit subjects or signal words. Label any conclusion beyond those facts as an inference.
  6. Change risk. Name the constraints, companion files, and unresolved temporary choices worth checking before an edit.

Keep hashes short in prose, but preserve enough characters to identify them. Do not dump the full JSON unless the user asks.

Evidence rules

  • Current blame ownership is not proof of original authorship.
  • The oldest selected commit is the region's introduction, not always the file's first commit.
  • Repeated co-change suggests coupling; it does not prove a dependency.
  • Commit categories are message heuristics, not verified issue types.
  • "Temporary" and "workaround" are strong intent clues, but only the message author or linked discussion can confirm whether the constraint still applies.
  • If the history is thin or messages are vague, say "the history shows" and "likely" instead of inventing a design rationale.

Follow-ups

End by offering one relevant follow-up, such as:

  • "Want me to assess whether this looks deliberate or accidental?"
  • "Want me to map what could break if this region changes?"

For a deliberate-choice question, weigh repeated edits, issue references, reverts, and explicit constraint words. For a change-risk question, inspect the repeated co-change files and the last behavior-changing commits before proposing edits. Do not modify code until the user asks.

Files

  • scripts/archaeologist.py: offline git history walker and JSON report builder
  • references/reading-git-history.md: interpretation and confidence guide

Du fichier au premier essai

Le téléchargement contient exactement le contenu affiché sur cette fiche. Cette copie peut différer de la dernière version du dépôt source.

Consulter la source et ses fichiers annexes

Ce téléchargement contient uniquement SKILL.md. Les scripts, références, modèles et dépendances éventuels ne sont pas inclus. Récupérez les fichiers nécessaires depuis la source en conservant leur arborescence avant de poursuivre.

1. Télécharger le fichier

Télécharger SKILL.md

Depuis la racine d’un projet de test, enregistrez le fichier sous .skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md, ou utilisez la commande suivante. Ce dossier sert à examiner la skill avant son installation.

Commande pour macOS/Linux ou WSL : un shell POSIX et curl sont nécessaires. Sous Windows sans WSL, utilisez le bouton de téléchargement et créez le dossier manuellement.

mkdir -p '.skill-downloads/commit-archaeologist-mte1lkv6' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/commit-archaeologist-mte1lkv6/download' --output '.skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md.part' && mv '.skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md.part' '.skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md'

2. Vérifier les prérequis

Lisez SKILL.md avant de l’utiliser. Si le fichier cite des scripts ou services externes, examinez-les et préparez les accès nécessaires dans votre environnement de test.

Aucune section de prérequis reconnue dans ce fichier. Cela ne signifie pas qu’il est autonome : les bibliothèques, outils et accès peuvent être cités ailleurs dans le contenu ou dans le dépôt source.

Les plateformes de la fiche sont des indications du catalogue. Les chemins ci-dessous suivent la documentation des outils ; ils ne prouvent pas que cette skill y a été exécutée. Aucune version minimale de ces outils n’est attestée pour cette fiche.

3. Charger la skill

Après vérification, copiez le dossier complet dans le projet avec l’une des commandes ci-dessous, puis ouvrez une nouvelle session de l’outil. La commande s’arrête si un dossier du même nom existe déjà : comparez les fichiers avant de le remplacer.

Claude Code
test -f '.skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md' && test -s '.skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/commit-archaeologist' && cp -R '.skill-downloads/commit-archaeologist-mte1lkv6' '.claude/skills/commit-archaeologist'

Cursor
test -f '.skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md' && test -s '.skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md' && mkdir -p '.cursor/skills' && test ! -e '.cursor/skills/commit-archaeologist' && cp -R '.skill-downloads/commit-archaeologist-mte1lkv6' '.cursor/skills/commit-archaeologist'

Codex
test -f '.skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md' && test -s '.skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md' && mkdir -p '.agents/skills' && test ! -e '.agents/skills/commit-archaeologist' && cp -R '.skill-downloads/commit-archaeologist-mte1lkv6' '.agents/skills/commit-archaeologist'

OpenSkills

OpenSkills doit déjà être installé. La procédure locale install/read est contrôlée avec OpenSkills 1.5.0, qui exige Node.js ≥ 20.6.0. Aucun slug du catalogue n’est résolu automatiquement.

Installation officielle d’OpenSkills
openskills install './.skill-downloads/commit-archaeologist-mte1lkv6'

openskills read 'commit-archaeologist-mte1lkv6'

La lecture doit afficher le contenu du fichier installé et son dossier de base. Elle ne lance ni la skill ni ses dépendances.

Pour un agent qui lit AGENTS.md, synchronisez ensuite l’index. Cette commande modifie AGENTS.md : relisez le diff avant de l’utiliser.

openskills sync

Mode manuel ou autre outil : joignez SKILL.md à une conversation, ou ouvrez-le dans un agent capable de lire les fichiers. Ajoutez les ressources annexes nécessaires. Il n’existe pas de dossier universel reconnu par tous les outils.

4. Faire un premier essai

Utilisez une entrée courte et fictive : un endpoint d’API, un petit document ou un brief d’interface. Dans une nouvelle conversation, joignez le fichier ou donnez son chemin à l’agent, puis adaptez cette demande :

Lis .skill-downloads/commit-archaeologist-mte1lkv6/SKILL.md et applique ses instructions à cet exemple : [décrire une entrée de test]. Indique les fichiers, dépendances ou accès qui manquent. Produis le résultat demandé par la skill sans inventer de données ni exécuter de script non examiné.

Résultat attendu : une sortie correspondant aux instructions de la skill, ou une liste précise des prérequis manquants. Une simple confirmation de lecture ne valide pas le premier usage. Si une ressource externe est indisponible, ce parcours reste à tester.

Skills similaires