$npx -y skills add aviflombaum/claude-code-in-avinyc --skill configureConfigure or reconfigure qmd collections for this project. Triggers on "configure qmd", "set up qmd", "reconfigure qmd", "qmd setup".
| 1 | # QMD Configure |
| 2 | |
| 3 | Interactive interview to set up or reconfigure qmd collections for a project. Idempotent: works for both first-time setup and reconfiguration. |
| 4 | |
| 5 | Run this flow step by step. Do NOT skip steps or assume answers. |
| 6 | |
| 7 | ## Step 1: Check qmd is installed |
| 8 | |
| 9 | ```bash |
| 10 | command -v qmd |
| 11 | ``` |
| 12 | |
| 13 | If missing, tell the user: |
| 14 | |
| 15 | > qmd is not installed. Install it with: `npm install -g @tobilu/qmd` |
| 16 | |
| 17 | Then STOP. |
| 18 | |
| 19 | ## Step 2: Check qmd MCP server |
| 20 | |
| 21 | The search skill uses qmd's MCP tools for best performance (models stay warm between queries). Check if the MCP server is configured: |
| 22 | |
| 23 | ```bash |
| 24 | cat .mcp.json 2>/dev/null | grep -q '"qmd"' && echo "found in project" || echo "not in project" |
| 25 | ``` |
| 26 | |
| 27 | If not configured, tell the user: |
| 28 | |
| 29 | > qmd MCP server is not configured. Add it for the best search experience. |
| 30 | > |
| 31 | > **Option 1 — CLI (recommended):** |
| 32 | > ```bash |
| 33 | > claude mcp add qmd -- qmd mcp |
| 34 | > ``` |
| 35 | > |
| 36 | > **Option 2 — Manual:** Add to `.mcp.json` in the project root: |
| 37 | > ```json |
| 38 | > { |
| 39 | > "mcpServers": { |
| 40 | > "qmd": { |
| 41 | > "command": "qmd", |
| 42 | > "args": ["mcp"] |
| 43 | > } |
| 44 | > } |
| 45 | > } |
| 46 | > ``` |
| 47 | > |
| 48 | > The search skill will fall back to CLI if MCP isn't available, but MCP is significantly faster for repeated queries. |
| 49 | |
| 50 | Continue with setup regardless — MCP is recommended but not required. |
| 51 | |
| 52 | ## Step 3: Derive project name |
| 53 | |
| 54 | Get the git repo folder name and normalize it: |
| 55 | |
| 56 | ```bash |
| 57 | basename "$(git rev-parse --show-toplevel)" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/_/g; s/__*/_/g; s/^_//; s/_$//' |
| 58 | ``` |
| 59 | |
| 60 | Show the derived name to the user via `AskUserQuestion`. Let them confirm or type a custom name. Once confirmed, this is the canonical project name used for all collection prefixes. |
| 61 | |
| 62 | ## Step 4: Scan for indexable directories |
| 63 | |
| 64 | Find directories containing markdown files: |
| 65 | |
| 66 | ```bash |
| 67 | find . -maxdepth 2 -type f -name "*.md" -exec dirname {} \; | sort -u |
| 68 | ``` |
| 69 | |
| 70 | From the output, select only directories useful for a searchable document collection (docs/, plans/, tasks/, etc.). Ignore tmp/, vendor/, node_modules/, and other project cruft. |
| 71 | |
| 72 | ## Step 5: Ask which directories to index |
| 73 | |
| 74 | Use `AskUserQuestion` with `multiSelect: true`. List indexable directories as options. Explain that each directory becomes a qmd collection for fast semantic search. |
| 75 | |
| 76 | If no candidate directories were found, ask the user to type custom directory paths. |
| 77 | |
| 78 | ## Step 6: Get collection details |
| 79 | |
| 80 | For each selected directory, use `AskUserQuestion` to: |
| 81 | - Ask for a short description of what the directory contains (e.g., "Project architecture and feature docs") |
| 82 | - Confirm the file pattern (default: `**/*.md`, offer alternatives like `**/*.{md,txt}`) |
| 83 | |
| 84 | ## Step 7: Add collections |
| 85 | |
| 86 | For each selected directory, derive the collection name: `{project}_{dirname}` where dirname has `/` and `.` replaced with `_` and leading dots stripped. Example: `.cursor/rules` → `cursor_rules`, so collection is `myproject_cursor_rules`. |
| 87 | |
| 88 | Get the absolute path to the directory: |
| 89 | |
| 90 | ```bash |
| 91 | echo "$(git rev-parse --show-toplevel)/<dirname>" |
| 92 | ``` |
| 93 | |
| 94 | Then add the collection: |
| 95 | |
| 96 | ```bash |
| 97 | qmd collection add "<absolute_path>" --name "<collection_name>" --mask "<pattern>" |
| 98 | qmd context add "qmd://<collection_name>/" "<description>" |
| 99 | ``` |
| 100 | |
| 101 | If `qmd collection add` fails (collection already exists), ask the user whether to overwrite. If yes: |
| 102 | |
| 103 | ```bash |
| 104 | qmd collection remove "<collection_name>" |
| 105 | qmd collection add "<absolute_path>" --name "<collection_name>" --mask "<pattern>" |
| 106 | qmd context add "qmd://<collection_name>/" "<description>" |
| 107 | ``` |
| 108 | |
| 109 | ## Step 8: Write project config |
| 110 | |
| 111 | Use the Write tool to create `.claude/qmd.json`: |
| 112 | |
| 113 | ```json |
| 114 | { |
| 115 | "project": "<project_name>", |
| 116 | "collections": { |
| 117 | "<project>_<dirname>": { |
| 118 | "path": "<relative-dir-path>", |
| 119 | "pattern": "**/*.md", |
| 120 | "description": "<user-provided description>" |
| 121 | } |
| 122 | }, |
| 123 | "gitHook": false |
| 124 | } |
| 125 | ``` |
| 126 | |
| 127 | ## Step 9: Generate embeddings |
| 128 | |
| 129 | ```bash |
| 130 | qmd update && qmd embed |
| 131 | ``` |
| 132 | |
| 133 | Tell the user it's generating embeddings. This may take a moment for large collections. |
| 134 | |
| 135 | ## Step 10: Ask about git post-commit hook |
| 136 | |
| 137 | Use `AskUserQuestion`: "Install a git post-commit hook? When enabled, committing changes to .md files will automatically re-index in the background so search results stay fresh." |
| 138 | |
| 139 | Options: "Yes, install hook" / "No, skip" |
| 140 | |
| 141 | If yes, install the hook by appending to `.git/hooks/post-commit` (create the file if needed, ensure it's executable): |
| 142 | |
| 143 | ```bash |
| 144 | # qmd-auto-index:<project_name> |
| 145 | # Auto-update qmd index when markdown files change |
| 146 | export PATH="$HOME/.bun/bin:$HOME/.local/bin:$PATH" |
| 147 | if command -v qmd &>/dev/null; then |
| 148 | if git diff-tree --no-commit-id --name-only -r HEAD | grep -q '\.md$'; then |
| 149 | (qmd update && qmd embed) &>/dev/null & |
| 150 | fi |
| 151 | fi |
| 152 | ``` |
| 153 | |
| 154 | Check for the marker comment `# qmd-auto-index:<project_name>` first to avoid duplicates. Update `.claude/ |