claude-setup 1.1.8 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/builder.js CHANGED
@@ -21,10 +21,16 @@ function replaceVars(template, vars) {
21
21
  }
22
22
  function processConditionals(template, flags) {
23
23
  let result = template;
24
- // {{#if VAR}}...{{else}}...{{/if}}
25
- result = result.replace(/\{\{#if\s+(\w+)\}\}\n?([\s\S]*?)\{\{else\}\}\n?([\s\S]*?)\{\{\/if\}\}/g, (_m, key, ifBlock, elseBlock) => flags[key] ? ifBlock : elseBlock);
26
- // {{#if VAR}}...{{/if}}
27
- result = result.replace(/\{\{#if\s+(\w+)\}\}\n?([\s\S]*?)\{\{\/if\}\}/g, (_m, key, block) => flags[key] ? block : "");
24
+ // Process innermost conditionals first, repeat until stable.
25
+ // This prevents outer {{#if}} from greedily matching inner {{else}}/{{/if}}.
26
+ let prev = "";
27
+ while (prev !== result) {
28
+ prev = result;
29
+ // {{#if VAR}}...{{else}}...{{/if}} first (innermost — no nested {{#if}} in either branch)
30
+ result = result.replace(/\{\{#if\s+(\w+)\}\}\n?((?:(?!\{\{#if\b)[\s\S])*?)\{\{else\}\}\n?((?:(?!\{\{#if\b)[\s\S])*?)\{\{\/if\}\}/g, (_m, key, ifBlock, elseBlock) => flags[key] ? ifBlock : elseBlock);
31
+ // Simple {{#if VAR}}...{{/if}} (no else, no nested if inside)
32
+ result = result.replace(/\{\{#if\s+(\w+)\}\}\n?((?:(?!\{\{#if\b|\{\{else\}\})[\s\S])*?)\{\{\/if\}\}/g, (_m, key, block) => flags[key] ? block : "");
33
+ }
28
34
  return result;
29
35
  }
30
36
  function formatList(items) {
@@ -1,34 +1,39 @@
1
1
  /**
2
2
  * Marketplace intelligence — provides catalog info and decision logic
3
- * for the add command to suggest plugins, skills, and MCP servers.
3
+ * for the add command to suggest plugins, skills, MCP servers, and agents.
4
+ *
5
+ * Implements the 4-catalog exhaustion pipeline (Rule 6) with 3-stage
6
+ * fetch resolution (Rule 7): find entry → navigate directory → download content.
4
7
  *
5
8
  * Zero API calls at import time. Catalog is fetched only when needed.
6
9
  */
10
+ export declare const VOLTAGENT_SUBAGENTS_REPO = "VoltAgent/awesome-claude-code-subagents";
11
+ export declare const VOLTAGENT_SUBAGENTS_API = "https://api.github.com/repos/VoltAgent/awesome-claude-code-subagents/contents/categories";
12
+ export declare const VOLTAGENT_SUBAGENTS_RAW = "https://raw.githubusercontent.com/VoltAgent/awesome-claude-code-subagents/main/categories";
13
+ export declare const VOLTAGENT_CATEGORIES: readonly ["01-core-development", "02-language-specialists", "03-infrastructure", "04-quality-security", "05-data-ai", "06-developer-experience", "07-specialized-domains", "08-business-product", "09-meta-orchestration", "10-research-analysis"];
7
14
  export declare const MARKETPLACE_REPO = "jeremylongshore/claude-code-plugins-plus-skills";
8
15
  export declare const MARKETPLACE_CATALOG_URL = "https://raw.githubusercontent.com/jeremylongshore/claude-code-plugins-plus-skills/main/.claude-plugin/marketplace.extended.json";
9
- /** Additional marketplace sources for broader coverage */
10
- export declare const ADDITIONAL_MARKETPLACE_SOURCES: readonly [{
11
- readonly name: "claude-plugins-official";
12
- readonly description: "Official Anthropic plugins (GitHub, Slack, Linear, Notion, etc.)";
13
- readonly installPrefix: "claude-plugins-official";
14
- readonly note: "No marketplace add needed — available by default";
15
- }, {
16
- readonly name: "awesome-claude-code";
17
- readonly description: "Community collection of Claude Code skills and workflows";
18
- readonly catalogUrl: "https://raw.githubusercontent.com/hesreallyhim/awesome-claude-code/main/catalog.json";
19
- readonly installPrefix: null;
20
- readonly note: "Browse and manually install skills";
21
- }];
16
+ export declare const VOLTAGENT_SKILLS_REPO = "VoltAgent/awesome-agent-skills";
17
+ export declare const VOLTAGENT_SKILLS_API = "https://api.github.com/repos/VoltAgent/awesome-agent-skills/contents";
18
+ export declare const COMPOSIO_REPO = "ComposioHQ/awesome-claude-skills";
19
+ export declare const COMPOSIO_API = "https://api.github.com/repos/ComposioHQ/awesome-claude-skills/contents";
20
+ export declare const COMPOSIO_RAW = "https://raw.githubusercontent.com/ComposioHQ/awesome-claude-skills/master";
22
21
  /** The 20 skill categories in the marketplace */
23
22
  export declare const SKILL_CATEGORIES: readonly ["01-code-quality", "02-testing", "03-security", "04-devops", "05-api-development", "06-database", "07-frontend", "08-backend", "09-mobile", "10-data-science", "11-documentation", "12-project-management", "13-communication", "14-research", "15-content-creation", "16-business", "17-finance", "18-visual-content", "19-legal", "20-productivity"];
24
23
  /** SaaS packs available in the marketplace */
25
24
  export declare const SAAS_PACKS: readonly ["Supabase", "Vercel", "OpenRouter", "GitHub", "Azure", "MongoDB", "Playwright", "Tavily", "Stripe", "Slack", "Linear", "Notion"];
26
- /** Keyword-to-category mapping for classifying user requests */
25
+ /** Keyword-to-category mapping for classifying skill requests */
27
26
  export declare const KEYWORD_CATEGORY_MAP: Record<string, string>;
28
- /** Classify a user request into marketplace categories */
29
- export declare function classifyRequest(input: string): {
27
+ export interface ClassificationResult {
30
28
  categories: string[];
31
29
  saasMatches: string[];
32
- };
33
- /** Generate fully-automated marketplace search and install instructions */
30
+ isAgent: boolean;
31
+ agentCategories: string[];
32
+ }
33
+ /** Detect whether the request is about agents/subagents/orchestration */
34
+ export declare function isAgentRequest(input: string): boolean;
35
+ /** Map input to VoltAgent agent category directories */
36
+ export declare function matchAgentCategories(input: string): string[];
37
+ /** Classify a user request into marketplace categories and detect agent requests */
38
+ export declare function classifyRequest(input: string): ClassificationResult;
34
39
  export declare function buildMarketplaceInstructions(input: string): string;
@@ -1,27 +1,38 @@
1
1
  /**
2
2
  * Marketplace intelligence — provides catalog info and decision logic
3
- * for the add command to suggest plugins, skills, and MCP servers.
3
+ * for the add command to suggest plugins, skills, MCP servers, and agents.
4
+ *
5
+ * Implements the 4-catalog exhaustion pipeline (Rule 6) with 3-stage
6
+ * fetch resolution (Rule 7): find entry → navigate directory → download content.
4
7
  *
5
8
  * Zero API calls at import time. Catalog is fetched only when needed.
6
9
  */
10
+ // ── Source 1: VoltAgent subagents (agents/sub-agents) ────────────────
11
+ export const VOLTAGENT_SUBAGENTS_REPO = "VoltAgent/awesome-claude-code-subagents";
12
+ export const VOLTAGENT_SUBAGENTS_API = `https://api.github.com/repos/${VOLTAGENT_SUBAGENTS_REPO}/contents/categories`;
13
+ export const VOLTAGENT_SUBAGENTS_RAW = `https://raw.githubusercontent.com/${VOLTAGENT_SUBAGENTS_REPO}/main/categories`;
14
+ export const VOLTAGENT_CATEGORIES = [
15
+ "01-core-development",
16
+ "02-language-specialists",
17
+ "03-infrastructure",
18
+ "04-quality-security",
19
+ "05-data-ai",
20
+ "06-developer-experience",
21
+ "07-specialized-domains",
22
+ "08-business-product",
23
+ "09-meta-orchestration",
24
+ "10-research-analysis",
25
+ ];
26
+ // ── Source 2: Community skills catalog (416+ plugins) ───────────────────
7
27
  export const MARKETPLACE_REPO = "jeremylongshore/claude-code-plugins-plus-skills";
8
28
  export const MARKETPLACE_CATALOG_URL = `https://raw.githubusercontent.com/${MARKETPLACE_REPO}/main/.claude-plugin/marketplace.extended.json`;
9
- /** Additional marketplace sources for broader coverage */
10
- export const ADDITIONAL_MARKETPLACE_SOURCES = [
11
- {
12
- name: "claude-plugins-official",
13
- description: "Official Anthropic plugins (GitHub, Slack, Linear, Notion, etc.)",
14
- installPrefix: "claude-plugins-official",
15
- note: "No marketplace add needed — available by default"
16
- },
17
- {
18
- name: "awesome-claude-code",
19
- description: "Community collection of Claude Code skills and workflows",
20
- catalogUrl: "https://raw.githubusercontent.com/hesreallyhim/awesome-claude-code/main/catalog.json",
21
- installPrefix: null,
22
- note: "Browse and manually install skills"
23
- }
24
- ];
29
+ // ── Source 3: VoltAgent curated agent skills ────────────────────────────
30
+ export const VOLTAGENT_SKILLS_REPO = "VoltAgent/awesome-agent-skills";
31
+ export const VOLTAGENT_SKILLS_API = `https://api.github.com/repos/${VOLTAGENT_SKILLS_REPO}/contents`;
32
+ // ── Source 4: ComposioHQ service integrations (1000+) ───────────────────
33
+ export const COMPOSIO_REPO = "ComposioHQ/awesome-claude-skills";
34
+ export const COMPOSIO_API = `https://api.github.com/repos/${COMPOSIO_REPO}/contents`;
35
+ export const COMPOSIO_RAW = `https://raw.githubusercontent.com/${COMPOSIO_REPO}/master`;
25
36
  /** The 20 skill categories in the marketplace */
26
37
  export const SKILL_CATEGORIES = [
27
38
  "01-code-quality", "02-testing", "03-security",
@@ -37,7 +48,71 @@ export const SAAS_PACKS = [
37
48
  "Supabase", "Vercel", "OpenRouter", "GitHub", "Azure", "MongoDB",
38
49
  "Playwright", "Tavily", "Stripe", "Slack", "Linear", "Notion",
39
50
  ];
40
- /** Keyword-to-category mapping for classifying user requests */
51
+ // ── Agent detection keywords ────────────────────────────────────────────
52
+ const AGENT_KEYWORDS = [
53
+ "agent", "subagent", "sub-agent", "orchestrat", "multi-agent",
54
+ "coordinator", "dispatcher", "workflow agent", "task routing",
55
+ "agent system", "agent framework", "meta-agent",
56
+ ];
57
+ /** Map agent keywords to VoltAgent category directories */
58
+ const AGENT_CATEGORY_MAP = {
59
+ // Meta / orchestration
60
+ "orchestrat": "09-meta-orchestration",
61
+ "coordinator": "09-meta-orchestration",
62
+ "dispatcher": "09-meta-orchestration",
63
+ "multi-agent": "09-meta-orchestration",
64
+ "meta-agent": "09-meta-orchestration",
65
+ "task routing": "09-meta-orchestration",
66
+ "workflow agent": "09-meta-orchestration",
67
+ "workflow orchestrat": "09-meta-orchestration",
68
+ // Core development
69
+ "code review agent": "01-core-development",
70
+ "api design": "01-core-development",
71
+ "refactor": "01-core-development",
72
+ // Language specialists
73
+ "typescript agent": "02-language-specialists",
74
+ "python agent": "02-language-specialists",
75
+ "rust agent": "02-language-specialists",
76
+ "go agent": "02-language-specialists",
77
+ "java agent": "02-language-specialists",
78
+ "powershell": "02-language-specialists",
79
+ // Infrastructure
80
+ "infra": "03-infrastructure",
81
+ "devops agent": "03-infrastructure",
82
+ "docker agent": "03-infrastructure",
83
+ "kubernetes agent": "03-infrastructure",
84
+ "cloud agent": "03-infrastructure",
85
+ "azure agent": "03-infrastructure",
86
+ "aws agent": "03-infrastructure",
87
+ // Quality & security
88
+ "security agent": "04-quality-security",
89
+ "test agent": "04-quality-security",
90
+ "qa agent": "04-quality-security",
91
+ "audit agent": "04-quality-security",
92
+ // Data & AI
93
+ "data agent": "05-data-ai",
94
+ "data pipeline": "05-data-ai",
95
+ "data engineer": "05-data-ai",
96
+ "ml agent": "05-data-ai",
97
+ "ml pipeline": "05-data-ai",
98
+ "ai agent": "05-data-ai",
99
+ // Developer experience
100
+ "dx agent": "06-developer-experience",
101
+ "productivity agent": "06-developer-experience",
102
+ "documentation agent": "06-developer-experience",
103
+ // Specialized
104
+ "domain agent": "07-specialized-domains",
105
+ "iot agent": "07-specialized-domains",
106
+ "embedded agent": "07-specialized-domains",
107
+ // Business
108
+ "business agent": "08-business-product",
109
+ "product agent": "08-business-product",
110
+ "pm agent": "08-business-product",
111
+ // Research
112
+ "research agent": "10-research-analysis",
113
+ "analysis agent": "10-research-analysis",
114
+ };
115
+ /** Keyword-to-category mapping for classifying skill requests */
41
116
  export const KEYWORD_CATEGORY_MAP = {
42
117
  // Code quality
43
118
  "lint": "01-code-quality", "format": "01-code-quality", "prettier": "01-code-quality",
@@ -79,13 +154,42 @@ export const KEYWORD_CATEGORY_MAP = {
79
154
  // Project management
80
155
  "project management": "12-project-management", "agile": "12-project-management",
81
156
  "sprint": "12-project-management", "kanban": "12-project-management",
157
+ // Communication
158
+ "slack": "13-communication", "email": "13-communication", "notification": "13-communication",
159
+ "discord": "13-communication", "telegram": "13-communication",
160
+ // Content
161
+ "content": "15-content-creation", "blog": "15-content-creation",
162
+ "seo": "15-content-creation", "copywriting": "15-content-creation",
163
+ // Productivity
164
+ "productivity": "20-productivity", "automation": "20-productivity",
165
+ "workflow": "20-productivity",
82
166
  };
83
- /** Classify a user request into marketplace categories */
167
+ /** Detect whether the request is about agents/subagents/orchestration */
168
+ export function isAgentRequest(input) {
169
+ const lower = input.toLowerCase();
170
+ return AGENT_KEYWORDS.some(kw => lower.includes(kw));
171
+ }
172
+ /** Map input to VoltAgent agent category directories */
173
+ export function matchAgentCategories(input) {
174
+ const lower = input.toLowerCase();
175
+ const matched = new Set();
176
+ for (const [keyword, category] of Object.entries(AGENT_CATEGORY_MAP)) {
177
+ if (lower.includes(keyword)) {
178
+ matched.add(category);
179
+ }
180
+ }
181
+ // Default to meta-orchestration for generic agent requests
182
+ if (matched.size === 0 && isAgentRequest(input)) {
183
+ matched.add("09-meta-orchestration");
184
+ }
185
+ return [...matched];
186
+ }
187
+ /** Classify a user request into marketplace categories and detect agent requests */
84
188
  export function classifyRequest(input) {
85
189
  const lower = input.toLowerCase();
86
190
  const categories = new Set();
87
191
  const saasMatches = [];
88
- // Check keyword matches
192
+ // Check keyword matches for skills
89
193
  for (const [keyword, category] of Object.entries(KEYWORD_CATEGORY_MAP)) {
90
194
  if (lower.includes(keyword)) {
91
195
  categories.add(category);
@@ -97,121 +201,359 @@ export function classifyRequest(input) {
97
201
  saasMatches.push(saas);
98
202
  }
99
203
  }
100
- return { categories: [...categories], saasMatches };
204
+ return {
205
+ categories: [...categories],
206
+ saasMatches,
207
+ isAgent: isAgentRequest(input),
208
+ agentCategories: matchAgentCategories(input),
209
+ };
101
210
  }
102
- /** Generate fully-automated marketplace search and install instructions */
211
+ // ── Marketplace instruction builder ─────────────────────────────────────
212
+ // Implements Rule 6 (4-catalog exhaustion) and Rule 7 (3-stage fetch).
213
+ // Agent requests route to VoltAgent subagents first.
214
+ // Skill requests route to jeremylongshore → VoltAgent skills → ComposioHQ.
103
215
  export function buildMarketplaceInstructions(input) {
104
- const { categories, saasMatches } = classifyRequest(input);
216
+ const classification = classifyRequest(input);
217
+ const { categories, saasMatches, isAgent: isAgentReq, agentCategories } = classification;
105
218
  const categoryFilter = categories[0] ?? "";
106
219
  const lines = [];
107
220
  lines.push(`## Marketplace — fully automated install (DO NOT ASK — JUST DO IT)`);
108
221
  lines.push(``);
109
- lines.push(`A plugin marketplace has 416 community skills + 13 official Anthropic plugins.`);
110
- lines.push(`Follow the steps below IN ORDER. Execute every command yourself. Do not stop until a skill is installed.`);
111
- lines.push(`**DO NOT ask the user clarifying questions. DO NOT suggest commands for the user to run. Execute them yourself.**`);
222
+ lines.push(`4 catalogs available. You MUST search them ALL in order before giving up.`);
223
+ lines.push(`A fetch failure is NOT a stop condition it is a routing signal to the next source.`);
224
+ lines.push(`**DO NOT ask the user clarifying questions. Execute every command yourself.**`);
225
+ lines.push(`**Rate-limit safe:** all api.github.com calls include GITHUB_TOKEN when set (5000/hr vs 60/hr).`);
226
+ lines.push(`Downloads use raw.githubusercontent.com (no limit). For heavy usage (10+ installs/hr), set GITHUB_TOKEN.`);
112
227
  lines.push(``);
113
- if (categories.length > 0 || saasMatches.length > 0) {
114
- lines.push(`### Matched for "${input}":`);
228
+ if (isAgentReq || categories.length > 0 || saasMatches.length > 0) {
229
+ lines.push(`### Classification for "${input}":`);
230
+ if (isAgentReq)
231
+ lines.push(`- **Type: AGENT** — routing to agent catalogs first`);
232
+ for (const cat of agentCategories)
233
+ lines.push(`- agent-category: ${cat}`);
115
234
  for (const cat of categories)
116
- lines.push(`- category: ${cat}`);
235
+ lines.push(`- skill-category: ${cat}`);
117
236
  for (const saas of saasMatches)
118
237
  lines.push(`- SaaS: ${saas}`);
119
238
  lines.push(``);
120
239
  }
240
+ // ── Universal resolution rules (applies to every catalog) ──────
241
+ buildUniversalRulesBlock(lines);
242
+ // ── Route based on request type ───────────────────────────────────
243
+ if (isAgentReq) {
244
+ buildAgentPipeline(lines, input, agentCategories, categoryFilter);
245
+ }
246
+ else {
247
+ buildSkillPipeline(lines, input, categoryFilter, saasMatches);
248
+ }
249
+ // ── Install result format ─────────────────────────────────────────
121
250
  lines.push(`---`);
122
251
  lines.push(``);
123
- lines.push(`### STEP 1 — Try official Anthropic plugins first (no schema errors, always works)`);
252
+ lines.push(`### Install result format`);
253
+ lines.push(`After installing, confirm with one of:`);
254
+ if (isAgentReq) {
255
+ lines.push(`✅ Agent installed: .claude/agents/<name>.md — [one line: what it orchestrates]`);
256
+ lines.push(`✅ Then add to CLAUDE.md agents section (separate from skills)`);
257
+ }
258
+ else {
259
+ lines.push(`✅ Installed: .claude/skills/<name>/SKILL.md — [one line: what it does]`);
260
+ }
261
+ lines.push(`⏭ No match in [source] — moving to next catalog`);
262
+ lines.push(`🔧 All 4 catalogs exhausted — created production-quality custom ${isAgentReq ? "agent" : "skill"}`);
263
+ lines.push(``);
264
+ return lines.join("\n");
265
+ }
266
+ // ── Agent pipeline (VoltAgent subagents → skills fallback) ──────────
267
+ function buildAgentPipeline(lines, input, agentCategories, categoryFilter) {
268
+ const safeName = input.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
269
+ const targetCategories = agentCategories.length > 0
270
+ ? agentCategories
271
+ : ["09-meta-orchestration"];
272
+ // ── STEP 1: VoltAgent/awesome-claude-code-subagents ──────────────
273
+ lines.push(`---`);
274
+ lines.push(``);
275
+ lines.push(`### STEP 1 — VoltAgent subagents (PRIMARY source for agents — 127+ specialized agents)`);
276
+ lines.push(``);
277
+ lines.push(`This is the preferred source for anything agent-shaped. 10 categories, 127+ agents.`);
278
+ lines.push(`If a match is found here, install to \`.claude/agents/\` (NOT .claude/skills/).`);
279
+ lines.push(``);
280
+ lines.push(`**1a. List agent files in the matched categories:**`);
281
+ lines.push(`If any curl below fails, skip to the next category or STEP 2 immediately.`);
282
+ lines.push(``);
283
+ for (const cat of targetCategories) {
284
+ lines.push(`\`\`\`bash`);
285
+ lines.push(`# Category: ${cat}`);
286
+ lines.push(`curl -sf \${GITHUB_TOKEN:+-H "Authorization: token \$GITHUB_TOKEN"} "${VOLTAGENT_SUBAGENTS_API}/${cat}" \\`);
287
+ lines.push(` | node -e "const d=JSON.parse(require('fs').readFileSync(0,'utf8'));` +
288
+ `if(!Array.isArray(d)){console.log('SKIP');process.exit(0)}` +
289
+ `d.filter(x=>x.name.endsWith('.md')&&x.name!=='README.md').forEach(x=>console.log(x.name))"`);
290
+ lines.push(`\`\`\``);
291
+ lines.push(``);
292
+ }
293
+ lines.push(`**1b. From the file list above, pick the BEST match for "${input}".**`);
294
+ lines.push(`Match by name and relevance. If multiple candidates exist, pick the closest one.`);
124
295
  lines.push(``);
296
+ lines.push(`**1c. Download the matched agent file (3-stage resolution — this is stage 3):**`);
297
+ lines.push(`\`\`\`bash`);
298
+ lines.push(`# Replace CATEGORY and AGENT_FILE with actual values from 1a/1b`);
299
+ lines.push(`CATEGORY="${targetCategories[0]}"`);
300
+ lines.push(`AGENT_FILE="matched-agent.md"`);
301
+ lines.push(`mkdir -p ".claude/agents"`);
302
+ lines.push(`curl -sf "${VOLTAGENT_SUBAGENTS_RAW}/\${CATEGORY}/\${AGENT_FILE}" \\`);
303
+ lines.push(` -o ".claude/agents/\${AGENT_FILE}"`);
125
304
  lines.push(`\`\`\``);
126
- lines.push(`/plugin marketplace add anthropics/claude-code`);
305
+ lines.push(``);
306
+ lines.push(`**1d. Verify the file has real content (Rule 7 — must not be empty):**`);
307
+ lines.push(`\`\`\`bash`);
308
+ lines.push(`# File must have frontmatter (---) and body content`);
309
+ lines.push(`head -3 ".claude/agents/\${AGENT_FILE}"`);
310
+ lines.push(`wc -l ".claude/agents/\${AGENT_FILE}"`);
127
311
  lines.push(`\`\`\``);
128
- lines.push(`Then search installed plugins for a match. If found, install:`);
312
+ lines.push(`If the file is empty or just frontmatter with no body: delete it, log the failure, continue to STEP 2.`);
313
+ lines.push(`If the file has real content: agent is installed. Skip to "Install result format" below.`);
314
+ lines.push(``);
315
+ lines.push(`**README-driven fallback:** If a category listing returns a README.md instead of agent files,`);
316
+ lines.push(`parse the README for entries with links. Entries may point to external repos — follow them`);
317
+ lines.push(`using the universal URL resolution rules (extract {owner}/{repo} dynamically from the link).`);
318
+ lines.push(`Navigate the foreign repo to locate the agent .md file and download it.`);
319
+ lines.push(``);
320
+ // ── STEP 2: jeremylongshore community skills (fallback for agents) ─
321
+ lines.push(`---`);
322
+ lines.push(``);
323
+ lines.push(`### STEP 2 — Community skills catalog (fallback — 416 plugins)`);
324
+ lines.push(``);
325
+ lines.push(`Only reach here if STEP 1 found no match.`);
326
+ lines.push(`Search for agent-like skills in the community catalog.`);
327
+ lines.push(`If curl fails, skip to STEP 3.`);
328
+ lines.push(``);
329
+ buildCommunitySkillsFetchBlock(lines, categoryFilter);
330
+ // ── STEP 3: ComposioHQ (fallback for SaaS/integration agents) ─────
331
+ lines.push(`---`);
332
+ lines.push(``);
333
+ lines.push(`### STEP 3 — ComposioHQ service integrations (1000+ skills — fallback)`);
334
+ lines.push(``);
335
+ lines.push(`Only reach here if STEP 1 and 2 found no match.`);
336
+ lines.push(`Strong for API and SaaS automation. Skills live in per-directory SKILL.md files.`);
337
+ lines.push(`If curl fails, skip to STEP 4.`);
338
+ lines.push(``);
339
+ buildComposioFetchBlock(lines, input);
340
+ // ── STEP 4: Create custom agent ───────────────────────────────────
341
+ lines.push(`---`);
342
+ lines.push(``);
343
+ lines.push(`### STEP 4 — All 3 catalogs exhausted. Create a production-quality custom agent.`);
344
+ lines.push(``);
345
+ lines.push(`You MUST have attempted all 3 sources above with real fetch calls before reaching here.`);
346
+ lines.push(`The custom agent must be production-valid on first write (Rule 4). No placeholders.`);
347
+ lines.push(``);
348
+ lines.push(`\`\`\`bash`);
349
+ lines.push(`mkdir -p ".claude/agents"`);
129
350
  lines.push(`\`\`\``);
130
- lines.push(`/plugin install <name>@claude-code-plugins`);
351
+ lines.push(`Then create \`.claude/agents/${safeName}.md\` with:`);
352
+ lines.push(`\`\`\`yaml`);
353
+ lines.push(`---`);
354
+ lines.push(`name: ${safeName}`);
355
+ lines.push(`description: "${input}"`);
356
+ lines.push(`tools: Read, Write, Edit, Bash, Glob, Grep`);
357
+ lines.push(`model: sonnet`);
358
+ lines.push(`---`);
359
+ lines.push(``);
360
+ lines.push(`[Complete agent instructions — task routing, responsibilities, integration points]`);
131
361
  lines.push(`\`\`\``);
132
- lines.push(`Official plugins: agent-sdk-dev, claude-opus-4-5-migration, code-review, commit-commands,`);
362
+ lines.push(`The body must contain real, actionable agent instructions — not a template stub.`);
363
+ lines.push(``);
364
+ }
365
+ // ── Skill pipeline (community → VoltAgent skills → ComposioHQ) ──────
366
+ function buildSkillPipeline(lines, input, categoryFilter, saasMatches) {
367
+ const safeName = input.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
368
+ // ── STEP 1: Official Anthropic plugins ────────────────────────────
369
+ lines.push(`---`);
370
+ lines.push(``);
371
+ lines.push(`### STEP 1 — Official Anthropic plugins (always work, no schema errors)`);
372
+ lines.push(``);
373
+ lines.push(`Check if any of these 13 official plugins match the request:`);
374
+ lines.push(`agent-sdk-dev, claude-opus-4-5-migration, code-review, commit-commands,`);
133
375
  lines.push(`explanatory-output-style, feature-dev, frontend-design, hookify, learning-output-style,`);
134
376
  lines.push(`plugin-dev, pr-review-toolkit, ralph-wiggum, security-guidance`);
135
377
  lines.push(``);
378
+ lines.push(`If a name above matches "${input}": install with \`/plugin install <name>@claude-code-plugins\``);
379
+ lines.push(`If no match, continue to STEP 2.`);
380
+ lines.push(``);
381
+ // ── STEP 2: jeremylongshore community skills ──────────────────────
136
382
  lines.push(`---`);
137
383
  lines.push(``);
138
- lines.push(`### STEP 2 — Search community catalog (jeremylongshore — 416 plugins)`);
384
+ lines.push(`### STEP 2 — Community skills catalog (jeremylongshore — 416 plugins)`);
139
385
  lines.push(``);
140
386
  lines.push(`NOTE: /plugin marketplace add FAILS for this repo (one entry has broken schema).`);
141
- lines.push(`Use the DIRECT FETCH approach below instead no marketplace add needed.`);
142
- lines.push(`If the curl command fails or returns an error, skip to STEP 3 immediately — do NOT stop.`);
387
+ lines.push(`Use the DIRECT FETCH approach below. If curl fails, skip to STEP 3.`);
143
388
  lines.push(``);
144
- lines.push(`**2a. Fetch catalog and find matching plugin:**`);
145
- lines.push(`\`\`\`bash`);
146
- lines.push(`curl -s "${MARKETPLACE_CATALOG_URL}" \\`);
147
- lines.push(` | node -e "const d=JSON.parse(require('fs').readFileSync(0,'utf8'));const q='${categoryFilter}';const r=d.plugins.filter(p=>(q===''||p.category.includes(q))&&p.name&&p.source).slice(0,10).map(p=>({name:p.name,source:p.source,desc:p.description}));console.log(JSON.stringify(r,null,2));"`);
148
- lines.push(`\`\`\``);
389
+ buildCommunitySkillsFetchBlock(lines, categoryFilter);
390
+ // ── STEP 3: VoltAgent curated skills ──────────────────────────────
391
+ lines.push(`---`);
392
+ lines.push(``);
393
+ lines.push(`### STEP 3 — VoltAgent curated agent skills (production-proven)`);
149
394
  lines.push(``);
150
- lines.push(`**2b. Pick the best match get its source path (e.g. \`./plugins/productivity/my-skill\`)**`);
395
+ lines.push(`Only reach here if STEP 2 found no match.`);
396
+ lines.push(`Curated real-world skills from engineering teams. If curl fails, skip to STEP 4.`);
151
397
  lines.push(``);
152
- lines.push(`**2c. List the skills inside that plugin:**`);
153
398
  lines.push(`\`\`\`bash`);
154
- lines.push(`# Replace PLUGIN_SOURCE_PATH with value from step 2b (e.g. plugins/productivity/my-skill)`);
155
- lines.push(`PLUGIN_SOURCE_PATH="plugins/productivity/my-skill"`);
156
- lines.push(`curl -s "https://api.github.com/repos/${MARKETPLACE_REPO}/contents/\${PLUGIN_SOURCE_PATH}/skills" \\`);
157
- lines.push(` | node -e "const a=JSON.parse(require('fs').readFileSync(0,'utf8'));console.log(a.map(x=>x.name).join('\\n'));"`);
399
+ lines.push(`curl -sf \${GITHUB_TOKEN:+-H "Authorization: token \$GITHUB_TOKEN"} "${VOLTAGENT_SKILLS_API}" \\`);
400
+ lines.push(` | node -e "const d=JSON.parse(require('fs').readFileSync(0,'utf8'));` +
401
+ `if(!Array.isArray(d)){console.log('SKIP');process.exit(0)}` +
402
+ `d.filter(x=>x.type==='dir'&&!x.name.startsWith('.')).forEach(x=>console.log(x.name))"`);
158
403
  lines.push(`\`\`\``);
159
- lines.push(``);
160
- lines.push(`**2d. For each skill listed, download and install it:**`);
404
+ lines.push(`If any directory name matches "${input}", fetch its SKILL.md:`);
161
405
  lines.push(`\`\`\`bash`);
162
- lines.push(`# Replace PLUGIN_SOURCE_PATH and SKILL_NAME with actual values`);
163
- lines.push(`PLUGIN_SOURCE_PATH="plugins/productivity/my-skill"`);
164
- lines.push(`SKILL_NAME="skill-directory-name"`);
165
- lines.push(`mkdir -p ".claude/skills/\${SKILL_NAME}"`);
166
- lines.push(`curl -s "https://raw.githubusercontent.com/${MARKETPLACE_REPO}/main/\${PLUGIN_SOURCE_PATH}/skills/\${SKILL_NAME}/SKILL.md" \\`);
167
- lines.push(` -o ".claude/skills/\${SKILL_NAME}/SKILL.md"`);
168
- lines.push(`echo "Installed: .claude/skills/\${SKILL_NAME}/SKILL.md"`);
406
+ lines.push(`SKILL_DIR="matched-skill"`);
407
+ lines.push(`mkdir -p ".claude/skills/\${SKILL_DIR}"`);
408
+ lines.push(`curl -sf "https://raw.githubusercontent.com/${VOLTAGENT_SKILLS_REPO}/main/\${SKILL_DIR}/SKILL.md" \\`);
409
+ lines.push(` -o ".claude/skills/\${SKILL_DIR}/SKILL.md"`);
169
410
  lines.push(`\`\`\``);
411
+ lines.push(`Verify content is real (not empty). If empty, delete and continue.`);
170
412
  lines.push(``);
171
- lines.push(`**On Windows, replace curl with:**`);
172
- lines.push(`\`\`\`powershell`);
173
- lines.push(`$url = "https://raw.githubusercontent.com/${MARKETPLACE_REPO}/main/$PLUGIN_SOURCE_PATH/skills/$SKILL_NAME/SKILL.md"`);
174
- lines.push(`New-Item -ItemType Directory -Force ".claude/skills/$SKILL_NAME" | Out-Null`);
175
- lines.push(`Invoke-WebRequest $url -OutFile ".claude/skills/$SKILL_NAME/SKILL.md"`);
176
- lines.push(`\`\`\``);
413
+ lines.push(`**README-driven fallback:** If the API returns a single file (README.md) instead of a directory listing,`);
414
+ lines.push(`parse its markdown sections for entries matching "${input}". Entries may link to external repos owned by`);
415
+ lines.push(`different authors — follow those links using the universal URL resolution rules above (extract {owner}/{repo}`);
416
+ lines.push(`dynamically, never hardcode). Navigate the foreign repo to find the installable .md file and download it.`);
177
417
  lines.push(``);
418
+ // ── STEP 4: ComposioHQ service integrations ───────────────────────
178
419
  lines.push(`---`);
179
420
  lines.push(``);
180
- lines.push(`### STEP 3Search additional sources`);
421
+ lines.push(`### STEP 4ComposioHQ service integrations (1000+ skills)`);
181
422
  lines.push(``);
182
- for (const source of ADDITIONAL_MARKETPLACE_SOURCES) {
183
- lines.push(`**${source.name}** ${source.description}`);
184
- if ("catalogUrl" in source && source.catalogUrl) {
185
- lines.push(`Catalog: ${source.catalogUrl}`);
186
- }
187
- if (source.note) {
188
- lines.push(`Note: ${source.note}`);
189
- }
190
- lines.push(``);
191
- }
423
+ lines.push(`Only reach here if STEPs 2+3 found no match.`);
424
+ lines.push(`Strong for API/SaaS automation: Gmail, Slack, GitHub, Notion, Stripe, Shopify, etc.`);
425
+ lines.push(`If curl fails, skip to STEP 5.`);
426
+ lines.push(``);
427
+ buildComposioFetchBlock(lines, input);
428
+ // ── STEP 5: Create custom skill ───────────────────────────────────
192
429
  lines.push(`---`);
193
430
  lines.push(``);
194
- lines.push(`### STEP 4If no match found in any source, create a custom skill`);
431
+ lines.push(`### STEP 5All 4 catalogs exhausted. Create a production-quality custom skill.`);
432
+ lines.push(``);
433
+ lines.push(`You MUST have attempted all 4 sources above with real fetch calls before reaching here.`);
434
+ lines.push(`The custom skill must be production-valid on first write (Rule 4). No placeholders.`);
195
435
  lines.push(``);
196
436
  lines.push(`\`\`\`bash`);
197
- lines.push(`mkdir -p ".claude/skills/${input.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')}"`);
437
+ lines.push(`mkdir -p ".claude/skills/${safeName}"`);
198
438
  lines.push(`\`\`\``);
199
- lines.push(`Then create SKILL.md with:`);
439
+ lines.push(`Then create \`.claude/skills/${safeName}/SKILL.md\` with:`);
200
440
  lines.push(`\`\`\`yaml`);
201
441
  lines.push(`---`);
202
- lines.push(`name: ${input.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '')}`);
203
- lines.push(`description: ${input}`);
442
+ lines.push(`name: ${safeName}`);
443
+ lines.push(`description: "${input}"`);
204
444
  lines.push(`---`);
205
445
  lines.push(``);
206
- lines.push(`[Skill instructions here]`);
446
+ lines.push(`[Complete skill instructions — not a stub. Must work on first use.]`);
207
447
  lines.push(`\`\`\``);
208
448
  lines.push(``);
209
- lines.push(`---`);
449
+ }
450
+ // ── Universal catalog resolution rules (applies to all sources) ─────────
451
+ function buildUniversalRulesBlock(lines) {
452
+ lines.push(`### Universal catalog resolution rules`);
210
453
  lines.push(``);
211
- lines.push(`### Install result format`);
212
- lines.push(`After installing, confirm:`);
213
- lines.push(`✅ Installed: .claude/skills/<name>/SKILL.md[one line: what it does]`);
214
- lines.push(`⏭ No match: searched [categories], created custom skill instead`);
454
+ lines.push(`These rules apply to EVERY source below. Read them first.`);
455
+ lines.push(``);
456
+ lines.push(`**1. Catalog shape detection detect before processing:**`);
457
+ lines.push(`When you fetch a catalog endpoint, the response determines your strategy:`);
458
+ lines.push(`- **JSON catalog**: valid JSON with a structured list (array of objects with name/source/description). Filter by relevance, navigate source paths, download.`);
459
+ lines.push(`- **README-driven catalog**: markdown organized into sections with headings. Each entry has a name, description, and a link — but that link may point to a **completely different external repository**. Parse sections, collect entries, follow external links.`);
460
+ lines.push(`- **Directory listing**: GitHub API array with "type"/"name"/"download_url" fields. List entries, match by name, download via raw URL.`);
461
+ lines.push(`Detect the shape first. Never assume one format.`);
462
+ lines.push(``);
463
+ lines.push(`**2. Universal GitHub URL resolution — works for ANY repo, ANY author:**`);
464
+ lines.push(`Convert any GitHub URL to a downloadable form by extracting {owner}, {repo}, {branch}, {path} dynamically:`);
465
+ lines.push(`- \`github.com/{owner}/{repo}/tree/{branch}/{path}\` → \`https://raw.githubusercontent.com/{owner}/{repo}/{branch}/{path}\``);
466
+ lines.push(`- \`github.com/{owner}/{repo}/blob/{branch}/{path}\` → \`https://raw.githubusercontent.com/{owner}/{repo}/{branch}/{path}\``);
467
+ lines.push(`- Directory URL → list via \`https://api.github.com/repos/{owner}/{repo}/contents/{path}\`, then download individual files`);
468
+ lines.push(`**Never hardcode a specific owner or repo in the resolution logic.** Always derive them dynamically from whatever link the catalog provides.`);
469
+ lines.push(``);
470
+ lines.push(`**3. README-driven external link navigation:**`);
471
+ lines.push(`When a catalog entry links to an external repository (different {owner}/{repo}):`);
472
+ lines.push(`1. Extract {owner}/{repo} from the link URL`);
473
+ lines.push(`2. Resolve to the raw file or directory listing in that foreign repo`);
474
+ lines.push(`3. If it points to a directory, list contents via API to find the installable .md file`);
475
+ lines.push(`4. Download from the foreign repo using universal resolution above`);
476
+ lines.push(`The catalog is just a curated map — the real content lives in the external repo.`);
477
+ lines.push(``);
478
+ lines.push(`**4. Candidate scoring — compare before choosing:**`);
479
+ lines.push(`When multiple candidates match, score each on three axes:`);
480
+ lines.push(`- **Relevance** (highest weight): does the description directly address the request?`);
481
+ lines.push(`- **Scope**: is it surgical and focused, or a kitchen-sink tool? Prefer focused — lower cost, easier to reason about.`);
482
+ lines.push(`- **Uniqueness**: does it duplicate something already installed in .claude/skills/ or .claude/agents/? Deprioritize duplicates.`);
483
+ lines.push(`Install only the highest-scoring candidate. One high-quality tool per task.`);
484
+ lines.push(``);
485
+ lines.push(`**5. Content verification — never keep stubs:**`);
486
+ lines.push(`After downloading any file, verify ALL of these before accepting:`);
487
+ lines.push(`- Not empty (0 bytes)`);
488
+ lines.push(`- Not only YAML frontmatter with no body (just \`---\\nname: x\\n---\` and nothing after)`);
489
+ lines.push(`- Contains at least 50 characters of instruction content after frontmatter`);
490
+ lines.push(`If verification fails: delete the file, log which source/candidate failed, continue to next candidate or next STEP.`);
491
+ lines.push(``);
492
+ }
493
+ // ── Shared fetch blocks ─────────────────────────────────────────────────
494
+ function buildCommunitySkillsFetchBlock(lines, categoryFilter) {
495
+ lines.push(`**Stage 1 — Fetch catalog and find matching plugin:**`);
496
+ lines.push(`\`\`\`bash`);
497
+ lines.push(`curl -sf "${MARKETPLACE_CATALOG_URL}" \\`);
498
+ lines.push(` | node -e "const d=JSON.parse(require('fs').readFileSync(0,'utf8'));` +
499
+ `const q='${categoryFilter}';` +
500
+ `const r=d.plugins.filter(p=>(q===''||p.category.includes(q))&&p.name&&p.source).slice(0,10)` +
501
+ `.map(p=>({name:p.name,source:p.source,desc:p.description}));` +
502
+ `console.log(JSON.stringify(r,null,2));"`);
503
+ lines.push(`\`\`\``);
504
+ lines.push(`If this returns an error or empty array, skip to the next STEP.`);
505
+ lines.push(``);
506
+ lines.push(`**Stage 2 — Score candidates and pick the best match (see rule 4: Relevance > Scope > Uniqueness):**`);
507
+ lines.push(`\`\`\`bash`);
508
+ lines.push(`# Replace PLUGIN_SOURCE_PATH with the "source" value from Stage 1`);
509
+ lines.push(`PLUGIN_SOURCE_PATH="plugins/category/plugin-name"`);
510
+ lines.push(`curl -sf \${GITHUB_TOKEN:+-H "Authorization: token \$GITHUB_TOKEN"} "https://api.github.com/repos/${MARKETPLACE_REPO}/contents/\${PLUGIN_SOURCE_PATH}/skills" \\`);
511
+ lines.push(` | node -e "const a=JSON.parse(require('fs').readFileSync(0,'utf8'));` +
512
+ `if(!Array.isArray(a)){console.log('NO_SKILLS_DIR');process.exit(0)}` +
513
+ `a.forEach(x=>console.log(x.name))"`);
514
+ lines.push(`\`\`\``);
515
+ lines.push(`If this fails or shows NO_SKILLS_DIR, the plugin has no installable skills — skip.`);
516
+ lines.push(``);
517
+ lines.push(`**Stage 3 — Download each skill file and install:**`);
518
+ lines.push(`\`\`\`bash`);
519
+ lines.push(`# Replace PLUGIN_SOURCE_PATH and SKILL_NAME with actual values`);
520
+ lines.push(`PLUGIN_SOURCE_PATH="plugins/category/plugin-name"`);
521
+ lines.push(`SKILL_NAME="skill-directory-name"`);
522
+ lines.push(`mkdir -p ".claude/skills/\${SKILL_NAME}"`);
523
+ lines.push(`curl -sf "https://raw.githubusercontent.com/${MARKETPLACE_REPO}/main/\${PLUGIN_SOURCE_PATH}/skills/\${SKILL_NAME}/SKILL.md" \\`);
524
+ lines.push(` -o ".claude/skills/\${SKILL_NAME}/SKILL.md"`);
525
+ lines.push(`\`\`\``);
526
+ lines.push(`Verify the file has real content (not empty, not just frontmatter). If empty: delete and move on.`);
527
+ lines.push(``);
528
+ }
529
+ function buildComposioFetchBlock(lines, input) {
530
+ lines.push(`**Stage 1 — List available skill directories:**`);
531
+ lines.push(`\`\`\`bash`);
532
+ lines.push(`curl -sf \${GITHUB_TOKEN:+-H "Authorization: token \$GITHUB_TOKEN"} "${COMPOSIO_API}" \\`);
533
+ lines.push(` | node -e "const d=JSON.parse(require('fs').readFileSync(0,'utf8'));` +
534
+ `if(!Array.isArray(d)){console.log('SKIP');process.exit(0)}` +
535
+ `d.filter(x=>x.type==='dir'&&!x.name.startsWith('.')).forEach(x=>console.log(x.name))"`);
536
+ lines.push(`\`\`\``);
537
+ lines.push(``);
538
+ lines.push(`**Stage 2 — Pick the directory that best matches "${input}":**`);
539
+ lines.push(`Match by name similarity. If no directory name is relevant, skip.`);
540
+ lines.push(``);
541
+ lines.push(`**Stage 3 — Download the SKILL.md from the matched directory:**`);
542
+ lines.push(`\`\`\`bash`);
543
+ lines.push(`SKILL_DIR="matched-directory"`);
544
+ lines.push(`mkdir -p ".claude/skills/\${SKILL_DIR}"`);
545
+ lines.push(`curl -sf "${COMPOSIO_RAW}/\${SKILL_DIR}/SKILL.md" \\`);
546
+ lines.push(` -o ".claude/skills/\${SKILL_DIR}/SKILL.md"`);
547
+ lines.push(`\`\`\``);
548
+ lines.push(`Verify the file has real content (rule 5 above). If empty: delete and move on.`);
549
+ lines.push(``);
550
+ lines.push(`**README-driven fallback:** If the directory listing above fails or returns unexpected content,`);
551
+ lines.push(`fetch the repo's README.md and parse it for sections matching "${input}":`);
552
+ lines.push(`\`\`\`bash`);
553
+ lines.push(`# Derive owner/repo dynamically from the catalog source — never hardcode`);
554
+ lines.push(`curl -sf "https://raw.githubusercontent.com/${COMPOSIO_REPO}/master/README.md" | head -300`);
555
+ lines.push(`\`\`\``);
556
+ lines.push(`Scan sections for entries with external links. Follow those links using universal URL resolution`);
557
+ lines.push(`(rule 2+3 above) to download from the linked repo, regardless of its owner.`);
215
558
  lines.push(``);
216
- return lines.join("\n");
217
559
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-setup",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "Setup layer for Claude Code — reads your project, writes command files, Claude Code does the rest",
5
5
  "type": "module",
6
6
  "bin": {
package/templates/add.md CHANGED
@@ -4,6 +4,7 @@ Add to Claude Code setup: "{{USER_INPUT}}"
4
4
 
5
5
  **CRITICAL: Marketplace-first. Do NOT ask clarifying questions. Search and install automatically.**
6
6
  **Execute every curl/install command yourself. The user expects zero-friction automation.**
7
+ **A fetch failure is NOT a stop — it is a routing signal to the next catalog.**
7
8
 
8
9
  ## Project context
9
10
  {{PROJECT_CONTEXT}}
@@ -37,7 +38,20 @@ Skills: {{SKILLS_LIST}} | Commands: {{COMMANDS_LIST}}
37
38
 
38
39
  Parse the user's request and take ALL applicable actions:
39
40
 
40
- ### 1. MCP servers
41
+ ### 1. Agents (if request is about agents/orchestration/subagents)
42
+ If the marketplace pipeline installed an agent file to `.claude/agents/`:
43
+ - Verify the file has YAML frontmatter (name, description, tools, model) and a body
44
+ - Document it in CLAUDE.md under a **separate agents section** (not mixed with skills)
45
+ - Agent entry format in CLAUDE.md:
46
+ ```
47
+ ## Agents
48
+ - **agent-name** — what it orchestrates, when to invoke it
49
+ ```
50
+
51
+ Agent files live in `.claude/agents/<name>.md` — NOT in `.claude/skills/`.
52
+ Agents and skills are architecturally different and must never be mixed.
53
+
54
+ ### 2. MCP servers
41
55
  If the request mentions an external service (database, API, browser, etc.):
42
56
  - Check the verified MCP package list below
43
57
  - If found: add to `.mcp.json` with OS-correct format (detected: {{DETECTED_OS}})
@@ -125,8 +139,8 @@ MCP format — create new .mcp.json:
125
139
  ```
126
140
  {{/if}}
127
141
 
128
- ### 2. Skills
129
- If the request mentions skills or capabilities:
142
+ ### 3. Skills
143
+ If the request mentions skills or capabilities (NOT agents):
130
144
  - Create `.claude/skills/<name>/SKILL.md` with proper frontmatter
131
145
  - Use `description:` so Claude knows when to load the skill
132
146
  - Search the marketplace for matching pre-built skills (see above)
@@ -141,7 +155,7 @@ description: What this skill does
141
155
  Instructions...
142
156
  ```
143
157
 
144
- ### 3. Hooks
158
+ ### 4. Hooks
145
159
  If the request implies automated actions (formatting, building, notifications):
146
160
  - Add to `.claude/settings.json` using the CORRECT hooks format
147
161
  - Verify the tool exists before adding a hook for it
@@ -165,13 +179,11 @@ Correct hooks format:
165
179
  }
166
180
  ```
167
181
 
168
- ### 4. Plugins
169
- If the request matches a marketplace category or SaaS platform:
170
- - Suggest the relevant plugin with install commands
171
- - Show the user exactly how to install it
172
-
173
182
  ### 5. CLAUDE.md
174
183
  Document any new capabilities, services, or patterns added.
184
+ - Skills go under `## Skills` section
185
+ - Agents go under `## Agents` section (separate — never mixed)
186
+ - MCP servers go under `## MCP Servers` section
175
187
 
176
188
  ## Rules
177
189
  - Read current content above before writing. Merge/append only.
@@ -180,6 +192,9 @@ Document any new capabilities, services, or patterns added.
180
192
  - All env var refs use `${VARNAME}` syntax. Document new vars in .env.example.
181
193
  - **NEVER write a "model" key into settings.json**
182
194
  - Produce valid JSON only.
195
+ - Agents install to `.claude/agents/` — Skills install to `.claude/skills/`
196
+ - Every installed file must contain real, functional content (Rule 7).
197
+ - A fetch failure is a routing signal, not a stop condition (Rule 6).
183
198
 
184
199
  ## Output — one line per file
185
200
  Updated: ✅ [path] — [what and why]