Read ${CLAUDE_PLUGIN_ROOT}/reference/lore-spec.md before doing anything — it defines the structure, frontmatter, and entry meta you will create. The seed files you copy live in ${CLAUDE_PLUGIN_ROOT}/reference/templates/.
When to use
- The project has no
docs/lore/yet and you want to bootstrap one. - The user asks to initialize, bootstrap, or set up project lore.
If docs/lore/ already exists, do NOT overwrite it. Switch to augment-mode: add only the missing core files and report what you added.
Procedure
- Detect existing lore. Check whether
docs/lore/already exists. If it does, switch to augment-mode — add only missing core files (README.md, an area'spitfalls.md/business-rules.md) and never clobber anything that is already there. - Infer the project type. Decide whether this is a frontend app, a backend service, a library, or a CLI. Use that to judge whether
api-map.mdis worth seeding (it pays off for API-heavy projects). When you are unsure, ask the user instead of guessing. If you still can't tell and the user doesn't answer, fall back to the safe minimum: scaffold only the core files and skipapi-map.mdandarchitecture/. - Infer the initial areas. Look at the codebase's top-level domains or subsystems and propose one or two starter areas (for example
payments/,auth/). Confirm the list with the user before creating anything. Never create areas without explicit confirmation — if the user doesn't respond, propose them and stop there, don't create them. While confirming, also ask which area (if any) is the project's core — the part that makes it worth building — and mark it in the Areas table's Core column only on explicit confirmation (see lore-spec's Core areas). - Create from the templates in
${CLAUDE_PLUGIN_ROOT}/reference/templates/:docs/lore/README.mdfromREADME.md.tmpl— fill the Areas table with the areas you chose.- For each starter area,
docs/lore/<area>/pitfalls.mdanddocs/lore/<area>/business-rules.mdfrompitfalls.md.tmplandbusiness-rules.md.tmpl, replacing the<AREA>placeholder with the real area name. - Optionally
docs/lore/api-map.mdfromapi-map.md.tmpland/ordocs/lore/architecture/index.mdfromarchitecture-index.md.tmpl, only when the project type warrants them.
- Check the glossary — but never scaffold it here. Resolve the glossary per lore-spec: if a root
CONTEXT.md/CONTEXT-MAP.mdexists, the vocabulary already lives there — report it as the project's canonical glossary and skip thelore-ulsuggestion below. Otherwise look fordocs/lore/glossary.md. Per lore-spec it is created lazily, the moment the first term is agreed with the user vialore-ul— never templated in bulk at init time, since terms must be user-confirmed, not generated. If it's missing (true for both a fresh scaffold and an existing base you're augmenting), say so plainly in your report and suggest runninglore:lore-ulwhenever the user wants to start aligning vocabulary. This is a report line, not an action — do not create the file yourself. - Wire up the trigger. Offer to add a one-line lore pointer to the project's
CLAUDE.md(orAGENTS.md) yourself — for example: "Project lore lives indocs/lore/— consult it before planning or bug-fixing, guard diffs against it before committing, and capture implicit knowledge into it." Add it on the user's confirmation; if they decline, just show them the line to paste. The plugin's SessionStart hook already nudges toward the lore skills in repos that havedocs/lore/, but the pointer makes triggering robust for teammates and agents running without the plugin installed.
Guardrail
This skill is idempotent: never overwrite existing content. Running it on a project that already has lore should only fill in missing core files, and it should report exactly what it added.
Note on content
What you scaffold is generic structure, not real knowledge. The areas start empty — the user fills them with actual lore later via lore-capture.