Write web search or MCP findings back into the KB so the same search doesn't recur
Capture knowledge gaps discovered during web searches or MCP queries and write them back into the relevant KB so future sessions answer from local context instead of the internet.
/enrich-kb dbt # Interactive: describes finding, picks KB path
/enrich-kb snowflake "dynamic tables" # Non-interactive: enriches Snowflake KB with dynamic tables pattern
/enrich-kb dagster --dry-run # Preview what would be created/updated
index.md or README.md with a navigation entryIf the technology is not provided, ask:
AskUserQuestion("What technology does this finding apply to?
Examples: dbt, snowflake, dagster, airbyte, terraform, ...")
Then map the technology to its KB path using the routing table in .claude/CLAUDE.md (Lookup Policy section). If the technology is not in the routing table, identify the closest category.
Read(".claude/CLAUDE.md") # get routing table
Glob(".claude/kb/{category}/{subcategory}/{technology}/") # confirm path exists
If no finding was provided as an argument, ask:
AskUserQuestion("What did you learn from the web search or MCP query?
Describe the pattern, command, or configuration — include enough detail
for a copy-paste example.")
If context was given as an argument, use it directly.
Check whether the finding belongs in an existing file or needs a new one:
Glob(".claude/kb/{path}/patterns/*.md") # list existing pattern files
Read(".claude/kb/{path}/index.md") # check what's already covered
Decision rules:
.claude/kb/{path}/patterns/{topic}.mdquick-reference.md insteadconcepts/{concept}.mdCreate or update the file following KB conventions (from .claude/rules/kb-development.md):
## {Pattern/Concept Name}
**When to use:** {one-line trigger condition}
**Why:** {rationale — what problem it solves}
```{language}
{copy-paste ready example}
Gotchas:
File size limits:
- `patterns/*.md`: ≤200 lines
- `concepts/*.md`: ≤150 lines
- `quick-reference.md`: ≤100 lines
```text
Write(".claude/kb/{path}/patterns/{topic}.md", content)
# or
Edit(".claude/kb/{path}/patterns/{existing}.md", old_string=..., new_string=...)
Add a navigation entry so the new content is discoverable:
Read(".claude/kb/{path}/index.md")
Edit(".claude/kb/{path}/index.md", ...) # add entry under patterns section
If category README.md exists, add or update the technology description there too.
ENRICH KB RESULTS
━━━━━━━━━━━━━━━━━
Technology : {technology}
KB Path : .claude/kb/{path}/
Action : {Created | Updated} {filename}
Index : {updated | no change needed}
Content preview:
{first heading and first 2 lines of the written content}
Next time this topic comes up, the KB will answer it directly.
━━━━━━━━━━━━━━━━━
| Flag | Description |
|---|---|
--dry-run | Show what would be created/updated without writing files |
# Capture a Snowflake dynamic tables pattern found via web search
/enrich-kb snowflake "dynamic tables — incremental refresh syntax and lag config"
# Capture a dbt unit test pattern after MCP lookup
/enrich-kb dbt "unit tests with overrides for ref() and source()"
# Interactive — will ask for technology and finding
/enrich-kb
# Preview without writing
/enrich-kb dagster "partitioned asset backfills" --dry-run
.claude/rules/kb-development.md — file size limits, required structure, validation.claude/CLAUDE.md — Lookup Policy section with KB routing table/create-kb — for adding an entirely new technology KB