Skip to content
Back to skills

Kb Search

ASecurity

Search across all KB files in docs/kb/ for a keyword, topic, or tag. Returns matching files and relevant excerpts.

  • 34 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 6, 2026
ai-agentsapidatabasesecurity

Works with

  • api

Security analysis

A100/100

Scanned September 6, 2026

npx -y skills add charlesjones-dev/claude-code-plugins-dev --skill kb-search --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Kb Search?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Kb Search
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/charlesjones-dev-kb-search/badge)](https://www.skillsdirectory.com/skills/charlesjones-dev-kb-search)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: kb-search
description: "Search across all KB files in docs/kb/ for a keyword, topic, or tag. Returns matching files and relevant excerpts."
disable-model-invocation: true
---

# Knowledge Base Search

You are a knowledge base search assistant. Your job is to search across the project's KB files for relevant information using content, tags, and cross-references.

## Instructions

### Step 1: Get Search Query

Check if the user provided a search term after the command (e.g., `/kb-search authentication` or `/kb-search tag:security`).

- **If a term was provided**: Use it as the search query.
- **If no term was provided**: Use AskUserQuestion to ask:
  - Question: "What keyword or topic would you like to search for in the knowledge base?"
  - Header: "KB Search"
  - Allow free-text input.

### Step 2: Parse Query Type

Determine the search mode:
- **Tag search**: If the query starts with `tag:` (e.g., `tag:security`), search frontmatter `tags` arrays.
- **Content search**: Otherwise, search file content, names, and tags.

### Step 3: Search KB Files

1. **Glob** for all `.md` files under `docs/kb/` (excluding `docs/kb/README.md`).
2. If no KB files exist, inform the user: "No KB files found in `docs/kb/`. Run `/kb-init` to set up the knowledge base." and stop.
3. For each KB file, read its frontmatter and content.

**For tag search:**
- Match the query tag against each file's `tags` array (case-insensitive).
- Also check `related` references for files that link to matching files.

**For content search:**
- **Grep** across all found KB files for the search query (case-insensitive).
- Check file names and directory names for matches (e.g., searching "api" should match `docs/kb/api-conventions.md`).
- Check frontmatter `tags` for matches (a content search for "security" should also surface files tagged `security`).

### Step 4: Search Global Learnings

1. Read `docs/kb/_global-learnings.md` if it exists (this is the dedicated global learnings KB file).
2. Check if any global learning entries match the search query.
3. Also check CLAUDE.md for a legacy `### Global Learnings` inline section (older KB setups may still have this). If found, search it too.

### Step 5: Display Results

Present results grouped by source, including frontmatter metadata:

```
KB Search Results for: "{query}"
================================

KB Files with matches:

1. docs/kb/api-conventions.md
   Tags: [api, rest, conventions]
   Related: [[auth]], [[database]]
   Last updated: 2026-04-01 | Pinned: No
   > Matching excerpt line 1
   > Matching excerpt line 2

2. docs/kb/auth/tokens.md
   Tags: [auth, security, tokens]
   Related: [[api-conventions]]
   Last updated: 2026-03-28 | Pinned: Yes
   > Matching excerpt

Also related (via cross-references):
3. docs/kb/database.md — related to matched file api-conventions.md

Global Learnings:
   > Matching learning entry

Found {count} match(es) across {file_count} file(s).
```

If no results found:
> "No matches found for '{query}' in the knowledge base. The KB currently has {file_count} file(s) with tags: {unique tags list}."

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.