Logique de détection d'archétype projet consommée par /onboard STEP 1.
Aucune exécution autonome — ce fichier documente l'algorithme que le skill applique.
~/.claude/lib/project-archetypes/*.md (hors _TEMPLATE.md)Lire chaque archétype. Pour chaque archétype, charger les blocs :
Types de signaux (syntaxe à matcher) :
| Syntaxe | Vérification |
|---|---|
FILE: <path> |
test -f <path> (relatif au projet root) |
DIR: <path>/ |
test -d <path> |
STRING_IN_FILE: <path> contient "<pattern>" |
grep -q "<pattern>" <path> (fichier existe requis) |
DEP: <manifest> contient "<pkg>" |
parse manifest, vérifie clé dependencies OU devDependencies contient pkg |
EXT: N fichiers .<ext> |
find . -name "*.<ext>" -not -path "*/node_modules/*" -not -path "*/.git/*" \| wc -l → >= N |
TOOL: <cmd> |
command -v <cmd> existe |
REGEX: <path> matches "/<pattern>/" |
grep regex sur fichier |
Pour chaque archétype :
score_raw = Σ (signal_matched ? signal_weight : 0)
score_max = Σ signal_weight_total
score_pct = score_raw / score_max (si score_max > 0, sinon 0)
Aussi compter strong_hits : nombre de strong signals matchés.
Classer archétypes par score_raw décroissant.
Règles de sélection (dans l'ordre) :
Certains projets sont combinés. Cas de composition détectés AUTOMATIQUEMENT :
wordpress + overlay woocommerce (si détecté)monorepo, on applique l'archétype par packageastro-static, noter la présence d'islands React dans les signauxdrupal avec flag multisiteNe pas inventer de compositions non listées.
ARCHETYPE DETECTION
─────────────────────
Scores (top 5) :
1. <name> score: XX/YY (zz%) — strong: N, medium: N, weak: N [SELECTED | CANDIDATE | REJECTED]
2. ...
SELECTED : <name> (confiance : HAUTE | MOYENNE | BASSE | AMBIGU)
COMPOSITION : <overlay si applicable, sinon "none">
JUSTIFICATION (signaux déterminants) :
✓ [strong] <signal>
✓ [medium] <signal>
✗ [strong] <signal> (attendu pour cet archétype, absent)
IMPLICATIONS AUTO-APPLIQUÉES :
- public : true | false
- database : required | optional | none
- audit_stack: [liste]
- plugins : [recommandations]
Si AMBIGUOUS :
⚠️ ARCHÉTYPE AMBIGU — plusieurs candidats proches :
A) <name> score: XX (signaux: ...)
B) <name> score: XX (signaux: ...)
C) <name> score: XX (signaux: ...)
D) None of the above — I'll describe it manually
Which one? (A / B / C / D)
Si UNKNOWN :
⚠️ AUCUN ARCHÉTYPE RECONNU
Je vois : <signaux détectés, ex : PHP files, no manifest, custom Makefile>
Questions manuelles :
1. Quel type de projet ? (web / API / CLI / lib / desktop / mobile / game / firmware / autre)
2. Public-facing (visible en recherche) ? (yes / no)
3. Utilise une base de données ? (yes / no / depends)
4. Stack principale ? (libre)
~/.claude/lib/project-archetypes/.node_modules, .git, vendor, target, dist, build, .next, __pycache__ de tous les scans.monorepo est détecté par plugin-advisor, passer la détection par package (un archetype par sous-package, pas un archetype global).Ajouter un nouvel archétype :
~/.claude/lib/project-archetypes/<name>.md en respectant _TEMPLATE.md./onboard en dry-run sur un projet connu de ce type.Retirer un archétype :
CLAUDE.md manuellement.