From lazy-obsidian
Met a jour _MOC.md en ajoutant les wikilinks vers les pages stables recemment creees dans pages/{01|02|03}-*. Additif uniquement (pas de suppression). Scope strict -- ignore le legacy. Detecte les renames sans modifier (signal humain). Encoding UTF-8 systematique, atomicite .tmp+rename.
How this skill is triggered — by the user, by Claude, or both
Slash command
/lazy-obsidian:moc-updateThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Scanner `pages/{01|02|03}-*/**/*.md`, identifier les pages avec `statut: stable` modifiees depuis le dernier run, ajouter les wikilinks manquants dans la section MOC correspondante.
Scanner pages/{01|02|03}-*/**/*.md, identifier les pages avec statut: stable modifiees depuis le dernier run, ajouter les wikilinks manquants dans la section MOC correspondante.
Inclus : uniquement pages/01-Concepts/, pages/02-Technique/, pages/03-Gouvernance/ (avec leurs sous-dossiers cluster).
Exclus : tout le reste (Formation Cybersecurite & Projet/, Dev/, IA/, LIVRES/, _Curated/, _Inbox/, _Sources/, etc.).
Set-Content -Encoding utf8 -NoNewline, Add-Content -Encoding utf8.Get-Content -Raw -Encoding utf8.Set-Content $path.tmp puis Move-Item -Path $path.tmp -Destination $path -Force.$statePath = "D:\tommyDossier\Documents\Obsidian Vault\99-Meta\lazy-obsidian-state.json"
$state = Get-Content $statePath -Raw -Encoding utf8 | ConvertFrom-Json
$lastRun = $state.last_run.'moc-update'
Si $lastRun correspond a aujourd'hui --> SKIP_IDEMPOTENT (logger dans runs.jsonl).
$pagesRoots = @("pages\01-Concepts", "pages\02-Technique", "pages\03-Gouvernance")
$allPages = @()
foreach ($root in $pagesRoots) {
$fullRoot = Join-Path $VaultRoot $root
if (Test-Path $fullRoot) {
$allPages += Get-ChildItem -Path $fullRoot -Recurse -Filter "*.md" -File
}
}
Pour chaque fichier :
foreach ($f in $allPages) {
if ($lastRun -and $f.LastWriteTimeUtc -le [DateTime]::Parse($lastRun)) { continue }
$lines = Get-Content $f.FullName -TotalCount 30 -Encoding utf8
$hasOpening = $lines.Count -gt 0 -and $lines[0].Trim() -eq "---"
if (-not $hasOpening) {
# Frontmatter manquant -- log dans Pages malformees
Add-Content -Path $auditMd -Encoding utf8 -Value "- [$nowDate] $($f.FullName) -- frontmatter manquant"
continue
}
# Extraire titre, cluster, statut depuis le frontmatter
$titre = ($lines | Where-Object { $_ -match '^titre:\s*"?(.+?)"?\s*$' } | ForEach-Object { $matches[1] }) | Select-Object -First 1
$cluster = ($lines | Where-Object { $_ -match '^cluster:\s*(\S+)' } | ForEach-Object { $matches[1] }) | Select-Object -First 1
$statut = ($lines | Where-Object { $_ -match '^statut:\s*(\S+)' } | ForEach-Object { $matches[1] }) | Select-Object -First 1
if ($statut -ne "stable") { continue }
# ... suite : INSERT dans _MOC.md
}
| Cluster | Section MOC | Sous-section eventuelle |
|---|---|---|
01-Red-Team | ## 🔴 Offensif (Red Team) | -- |
02-Blue-Team | ## 🔵 Defensif (Blue Team / SOC) | -- |
03-Cryptographie | ## 🔐 Cryptographie | -- |
04-Reseau-Protocoles | ## 🌐 Reseau & Protocoles | -- |
05-AppSec-DevSecOps | ## 💻 AppSec / DevSecOps | -- |
06-Cloud-Security | ## ☁️ Cloud | -- |
07-IAM-ActiveDirectory | ## 🆔 IAM & Active Directory | -- |
08-Forensics-DFIR | ## 🔍 Forensics & DFIR | -- |
09-Malware-Analysis | ## 🦠 Malware & Reverse Engineering | ### Malware Analysis |
10-Reverse-Engineering | ## 🦠 Malware & Reverse Engineering | ### Reverse Engineering |
11-IoT-OT-ICS | ## 🏭 IoT / OT / ICS | -- |
12-Mobile-Security | ## 📱 Mobile | -- |
13-Governance-Compliance | ## 📋 Gouvernance & Normes | -- |
14-Threat-Intelligence | ## 🎯 Threat Intelligence | -- |
15-Zero-Trust-Architecture | ## 🛡️ Zero Trust | -- |
16-Sujets-Controverses | ## ⚠️ Controverses / Dual-Use | -- |
Notes IMPORTANTES sur cette table :
_MOC.md actuel utilise ## 🔴 Offensif (Red Team) etc.). Match exact requis pour la detection de section. Lire _MOC.md au demarrage et adapter si besoin.### Malware Analysis et ### Reverse Engineering dans la section. Si absent, les creer (cluster 09 d'abord, puis 10).a. Construire le wikilink cible :
[[pages/<sous-dossier>/<cluster>/<filename-sans-extension>|<titre>]]
Exemple pour pages/02-Technique/01-Red-Team/Pass-the-Hash.md avec titre: "Pass-the-Hash (PtH)" :
[[pages/02-Technique/01-Red-Team/Pass-the-Hash|Pass-the-Hash (PtH)]]
b. Identifier la section MOC cible via le mapping.
c. Lire _MOC.md, extraire la sous-section correspondante (entre le ## <header> et le ## <header suivant> ou EOF).
d. Cas special 09/10 : si cluster 09 ou 10, verifier presence de ### Malware Analysis / ### Reverse Engineering. Si absent, les creer avec ordre 09-puis-10.
e. Verifier presence du wikilink (substring match sur pages/.../<filename> sans le titre) :
f. Si INSERT : log dans "Activite MOC auto" de Audit.md :
- [<date>] INSERT [[<wikilink>]] dans `## <section>`
_MOC.md.tmp puis Move-Item -Force.$state.last_run.'moc-update' = $now
$state | ConvertTo-Json -Depth 5 | Set-Content -Path $statePath -Encoding utf8 -NoNewline
$runEntry = @{
ts = $now
skill = "moc-update"
status = "OK" # ou PARTIAL, FAIL, SKIP_IDEMPOTENT
new = $insertedCount
skipped = $skippedCount
renames_detected = $renamesCount
errors = $errorCount
} | ConvertTo-Json -Compress
Add-Content -Path "...\99-Meta\lazy-obsidian-runs.jsonl" -Value $runEntry -Encoding utf8
✅ moc-update -- 3 wikilinks ajoutes, 0 renames detectes, 1 page malformee loggee.
- INSERT [[pages/02-Technique/01-Red-Team/BloodHound|BloodHound]] --> 🔴 Offensif
- INSERT [[pages/01-Concepts/03-Cryptographie/HMAC-MAC|HMAC & MAC]] --> 🔐 Cryptographie
- INSERT [[pages/02-Technique/09-Malware-Analysis/YARA-Rules|YARA -- Ecriture de regles]] --> 🦠 / ### Malware Analysis
| Cause | Action |
|---|---|
| Page sans frontmatter | Skip + log "Pages malformees" Audit.md |
| Cluster inconnu (pas dans la table) | Skip + log "Pages malformees" |
statut != stable | Skip silencieux (normal) |
_MOC.md introuvable | FAIL --> log dans state.json errors[] |
| Section MOC introuvable (header manquant) | Creer la section en fin de fichier avec le header attendu |
_MOC.md verrouille (Obsidian ouvert) | Retry 2s, si echec --> skip ce run |
Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub tommyrequillard/lazy-obsidian --plugin lazy-obsidian