feat: viral growth features — quick setup, badges, matrix, SKILL.md, federated search (#41)

* feat: add viral growth features (quick setup, badges, matrix, SKILL.md, federated search)

Tier 2: skillkit quick zero-friction entry, shareable badge generator,
agent compatibility matrix on website.

Tier 3: reposition as npm for agent skills, SKILL.md validate/init/check
commands, federated GitHub skill search with --federated flag on find.

* fix: matrix filtering, path traversal, cross-platform paths, fetch timeout

- CompatibilityMatrix: query matching agents now shows all categories
  (and vice versa) instead of hiding both dimensions independently
- quick.ts: sanitize skill names and validate targetInstallPath stays
  inside installDir before rmSync/cpSync/symlinkSync
- skillmd.ts: use path.relative() instead of string replace for
  cross-platform path display
- registry: add AbortController timeout (10s default) and distinct
  RateLimitError on 403 instead of silent empty return
- find.ts: handle RateLimitError with user-facing message
- Add quick-security.test.ts regression tests for path traversal

* fix: harden isPathInside with path.resolve, propagate RateLimitError

- isPathInside now uses path.resolve() + path.sep comparison instead of
  naive string replacement, fixing detection of paths completely outside
  the parent directory (both packages/core and src/core copies)
- FederatedSearch.search re-throws RateLimitError from rejected
  Promise.allSettled results so callers (find.ts) can handle 403s
- Updated security test to use the corrected isPathInside logic

* fix: use GITHUB_TOKEN/GH_TOKEN for authenticated GitHub API requests

GitHubSkillRegistry now reads GITHUB_TOKEN or GH_TOKEN from env and
sends Bearer auth header, raising the rate limit from 10 to 30 req/min
for code search. Matches the guidance shown to users on 403 errors.
This commit is contained in:
Rohit Ghumare
2026-02-03 13:48:35 +00:00
committed by GitHub
parent 549a21ad84
commit 5bd7ebf607
18 changed files with 1751 additions and 19 deletions
+5 -2
View File
@@ -14,10 +14,13 @@
[![Website](https://img.shields.io/badge/Website-agenstskills.com-black)](https://agenstskills.com)
[![Docs](https://img.shields.io/badge/Docs-agenstskills.com/docs-blue)](https://agenstskills.com/docs)
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![SKILL.md](https://img.shields.io/badge/SKILL.md-compatible-black?style=flat-square)](https://agenstskills.com)
## Supercharge Every AI Coding Agent
## One Skill. Every Agent.
**Give your AI agents new abilities with portable, reusable skills.** Install from a curated marketplace, create your own, and use them across Claude Code, Cursor, Codex, Windsurf, GitHub Copilot, and 27 more agents (32 total).
**The package manager for AI agent skills. Install, translate, and share skills across 32 coding agents.**
> Think npm, but for AI agent skills. Write once, deploy to Claude Code, Cursor, Codex, Windsurf, Copilot, and 27 more.
> **What are AI Agent Skills?** Skills are instruction files that teach AI coding agents how to handle specific tasks - like processing PDFs, following React best practices, or enforcing security patterns. Think of them as plugins for your AI assistant.
+9
View File
@@ -98,6 +98,10 @@ import {
GuidelineCreateCommand,
GuidelineRemoveCommand,
TreeCommand,
QuickCommand,
SkillMdValidateCommand,
SkillMdInitCommand,
SkillMdCheckCommand,
} from '@skillkit/cli';
const __filename = fileURLToPath(import.meta.url);
@@ -220,4 +224,9 @@ cli.register(GuidelineRemoveCommand);
cli.register(TreeCommand);
cli.register(QuickCommand);
cli.register(SkillMdValidateCommand);
cli.register(SkillMdInitCommand);
cli.register(SkillMdCheckCommand);
cli.runExit(process.argv.slice(2));
+26
View File
@@ -12,6 +12,8 @@ import { Attribution } from './components/Attribution';
import { AdvancedFeatures } from './components/AdvancedFeatures';
import { UseCases } from './components/UseCases';
import { TeamEnterprise } from './components/TeamEnterprise';
import { BadgeGenerator } from './components/BadgeGenerator';
import { CompatibilityMatrix } from './components/CompatibilityMatrix';
import { useStats } from './hooks/useStats';
const GITHUB_ICON = (
@@ -61,6 +63,20 @@ export default function App(): React.ReactElement {
>
Stack
</a>
<a
href="#matrix"
onClick={(e) => scrollToSection(e, 'matrix')}
className="text-zinc-500 hover:text-white transition-colors"
>
Matrix
</a>
<a
href="#badge"
onClick={(e) => scrollToSection(e, 'badge')}
className="text-zinc-500 hover:text-white transition-colors"
>
Badge
</a>
<a
href="#advanced"
onClick={(e) => scrollToSection(e, 'advanced')}
@@ -172,6 +188,16 @@ export default function App(): React.ReactElement {
<StackBuilder />
</section>
{/* Compatibility Matrix */}
<section id="matrix" style={{ scrollMarginTop: '4rem' }}>
<CompatibilityMatrix />
</section>
{/* Badge Generator */}
<section id="badge" style={{ scrollMarginTop: '4rem' }}>
<BadgeGenerator />
</section>
{/* Advanced Capabilities: Memory, Primer, Mesh, Messaging */}
<section id="advanced" style={{ scrollMarginTop: '4rem' }}>
<AdvancedFeatures />
+201
View File
@@ -0,0 +1,201 @@
import React, { useState, useMemo } from 'react';
const SKILLKIT_LOGO_SVG_BASE64 =
'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0id2hpdGUiPjxyZWN0IHdpZHRoPSI2IiBoZWlnaHQ9IjYiIHg9IjEiIHk9IjEiLz48cmVjdCB3aWR0aD0iNiIgaGVpZ2h0PSI2IiB4PSI5IiB5PSIxIi8+PHJlY3Qgd2lkdGg9IjYiIGhlaWdodD0iNiIgeD0iMSIgeT0iOSIvPjxyZWN0IHdpZHRoPSI2IiBoZWlnaHQ9IjYiIHg9IjkiIHk9IjkiLz48L3N2Zz4=';
const SUGGESTED_SKILLS = [
'react', 'typescript', 'nextjs', 'python', 'docker',
'kubernetes', 'tailwind', 'graphql', 'prisma', 'langchain',
'openai', 'rust', 'go', 'vue', 'svelte',
'security', 'testing', 'cicd', 'aws', 'terraform',
];
function encodeBadgeSegment(text: string): string {
return encodeURIComponent(text).replace(/-/g, '--');
}
function buildBadgeUrl(skills: string[]): string {
if (skills.length === 0) {
return `https://img.shields.io/badge/SkillKit-No%20Skills-555555?style=flat-square&logo=data:image/svg+xml;base64,${SKILLKIT_LOGO_SVG_BASE64}`;
}
const maxDisplay = 5;
const displayNames = skills.slice(0, maxDisplay);
const suffix = skills.length > maxDisplay ? ` +${skills.length - maxDisplay} more` : '';
const label = `SkillKit ${skills.length} skills`;
const message = displayNames.join(' | ') + suffix;
return `https://img.shields.io/badge/${encodeBadgeSegment(label)}-${encodeBadgeSegment(message)}-black?style=flat-square&logo=data:image/svg+xml;base64,${SKILLKIT_LOGO_SVG_BASE64}`;
}
export function BadgeGenerator(): React.ReactElement {
const [skills, setSkills] = useState<string[]>(['react', 'typescript', 'nextjs']);
const [inputValue, setInputValue] = useState('');
const [copiedType, setCopiedType] = useState<string | null>(null);
const badgeUrl = useMemo(() => buildBadgeUrl(skills), [skills]);
const markdown = `[![SkillKit Stack](${badgeUrl})](https://agenstskills.com)`;
const html = `<a href="https://agenstskills.com"><img src="${badgeUrl}" alt="SkillKit Stack" /></a>`;
function addSkill(skill: string): void {
const trimmed = skill.trim().toLowerCase();
if (trimmed && !skills.includes(trimmed)) {
setSkills([...skills, trimmed]);
}
setInputValue('');
}
function removeSkill(skill: string): void {
setSkills(skills.filter(s => s !== skill));
}
function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>): void {
if (e.key === 'Enter' && inputValue.trim()) {
e.preventDefault();
addSkill(inputValue);
}
}
async function copyToClipboard(text: string, type: string): Promise<void> {
try {
await navigator.clipboard.writeText(text);
setCopiedType(type);
setTimeout(() => setCopiedType(null), 2000);
} catch {
// silently ignore
}
}
const availableSuggestions = SUGGESTED_SKILLS.filter(s => !skills.includes(s));
return (
<section className="py-12 border-b border-zinc-800">
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
<div className="mb-6">
<h2 className="text-xl font-bold text-white mb-1 font-mono">Badge Generator</h2>
<p className="text-zinc-500 font-mono text-xs">
Create a shareable badge for your skill stack. Add it to your README.
</p>
</div>
<div className="flex flex-col lg:flex-row gap-6">
<div className="flex-1 space-y-4">
<div className="relative">
<input
type="text"
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
onKeyDown={handleKeyDown}
placeholder="Type a skill name and press Enter..."
className="w-full bg-zinc-900 border border-zinc-700 text-white px-4 py-3 focus:ring-2 focus:ring-white focus:border-transparent outline-none font-mono text-sm placeholder-zinc-600"
/>
</div>
<div className="space-y-2">
<span className="text-zinc-500 text-xs font-mono block">Quick add:</span>
<div className="flex flex-wrap gap-1.5">
{availableSuggestions.slice(0, 12).map(skill => (
<button
key={skill}
onClick={() => addSkill(skill)}
className="text-[10px] sm:text-xs bg-zinc-900 text-zinc-400 px-2 sm:px-3 py-1 sm:py-1.5 border border-zinc-700 hover:border-zinc-500 hover:text-white transition-colors font-mono"
>
+ {skill}
</button>
))}
</div>
</div>
{skills.length > 0 && (
<div className="space-y-2">
<div className="flex items-center justify-between">
<div className="text-xs font-mono text-zinc-500 uppercase tracking-wider">
Skills in Badge ({skills.length})
</div>
<button
onClick={() => setSkills([])}
className="text-zinc-500 hover:text-red-400 font-mono text-xs transition-colors"
>
Clear All
</button>
</div>
<div className="flex flex-wrap gap-2">
{skills.map(skill => (
<div
key={skill}
className="flex items-center gap-1.5 bg-zinc-900/50 border border-zinc-800 px-3 py-1.5 group"
>
<span className="font-mono text-sm text-white">{skill}</span>
<button
onClick={() => removeSkill(skill)}
aria-label={`Remove ${skill}`}
className="text-zinc-600 hover:text-red-400 transition-colors opacity-0 group-hover:opacity-100 focus-visible:opacity-100"
>
<svg className="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
))}
</div>
</div>
)}
</div>
<div className="lg:w-80 lg:flex-shrink-0">
<div className="lg:sticky lg:top-20 bg-zinc-900/30 border border-zinc-800 p-4 space-y-4">
<div className="text-xs font-mono text-zinc-500 uppercase tracking-wider">Preview</div>
<div className="flex justify-center py-3 bg-black/50 border border-zinc-800">
{skills.length > 0 ? (
<img
src={badgeUrl}
alt="SkillKit Stack Badge"
className="h-5"
/>
) : (
<span className="text-zinc-600 text-xs font-mono">Add skills to preview</span>
)}
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-zinc-500">Markdown</div>
<pre className="bg-black/50 p-2 overflow-x-auto text-[10px] border border-zinc-800">
<code className="font-mono text-zinc-300 whitespace-pre-wrap break-all">
{markdown}
</code>
</pre>
<button
onClick={() => copyToClipboard(markdown, 'markdown')}
className="w-full bg-zinc-800 text-zinc-300 py-1.5 font-mono text-xs hover:bg-zinc-700 hover:text-white transition-colors flex items-center justify-center gap-1.5 border border-zinc-700"
>
{copiedType === 'markdown' ? 'Copied!' : 'Copy Markdown'}
</button>
</div>
<div className="space-y-2">
<div className="text-xs font-mono text-zinc-500">HTML</div>
<pre className="bg-black/50 p-2 overflow-x-auto text-[10px] border border-zinc-800">
<code className="font-mono text-zinc-300 whitespace-pre-wrap break-all">
{html}
</code>
</pre>
<button
onClick={() => copyToClipboard(html, 'html')}
className="w-full bg-zinc-800 text-zinc-300 py-1.5 font-mono text-xs hover:bg-zinc-700 hover:text-white transition-colors flex items-center justify-center gap-1.5 border border-zinc-700"
>
{copiedType === 'html' ? 'Copied!' : 'Copy HTML'}
</button>
</div>
<div className="text-[10px] font-mono text-zinc-600 text-center pt-2 border-t border-zinc-800">
Powered by shields.io
</div>
</div>
</div>
</div>
</div>
</section>
);
}
@@ -0,0 +1,351 @@
import React, { useState, useMemo } from 'react';
type Support = 'full' | 'partial' | 'none';
interface AgentDef {
id: string;
name: string;
icon: string;
group: string;
}
interface CategoryDef {
id: string;
name: string;
icon: string;
}
const AGENTS: AgentDef[] = [
{ id: 'claude-code', name: 'Claude Code', icon: '\u27C1', group: 'Tier 1' },
{ id: 'cursor', name: 'Cursor', icon: '\u25EB', group: 'Tier 1' },
{ id: 'codex', name: 'Codex', icon: '\u25CE', group: 'Tier 1' },
{ id: 'gemini-cli', name: 'Gemini CLI', icon: '\u2726', group: 'Tier 1' },
{ id: 'opencode', name: 'OpenCode', icon: '\u2B21', group: 'Tier 1' },
{ id: 'windsurf', name: 'Windsurf', icon: '\u25C7', group: 'Tier 1' },
{ id: 'github-copilot', name: 'Copilot', icon: '\u2318', group: 'Tier 1' },
{ id: 'goose', name: 'Goose', icon: '\u25CA', group: 'Tier 2' },
{ id: 'kilo', name: 'Kilo', icon: '\u25B3', group: 'Tier 2' },
{ id: 'kiro-cli', name: 'Kiro CLI', icon: '\u25BD', group: 'Tier 2' },
{ id: 'roo', name: 'Roo', icon: '\u25C6', group: 'Tier 2' },
{ id: 'trae', name: 'Trae', icon: '\u25A0', group: 'Tier 2' },
{ id: 'amp', name: 'AMP', icon: '\u26A1', group: 'Tier 2' },
{ id: 'cline', name: 'Cline', icon: '\u25CF', group: 'Tier 3' },
{ id: 'continue', name: 'Continue', icon: '\u25B6', group: 'Tier 3' },
{ id: 'antigravity', name: 'Antigravity', icon: '\u2191', group: 'Tier 3' },
];
const CATEGORIES: CategoryDef[] = [
{ id: 'security', name: 'Security', icon: '\u25D0' },
{ id: 'testing', name: 'Testing', icon: '\u25D2' },
{ id: 'react-frontend', name: 'React/Frontend', icon: '\u269B' },
{ id: 'backend', name: 'Backend', icon: '\u2393' },
{ id: 'devops', name: 'DevOps', icon: '\u25D1' },
{ id: 'python', name: 'Python', icon: '\u25C9' },
{ id: 'go', name: 'Go', icon: '\u25C8' },
{ id: 'typescript', name: 'TypeScript', icon: '\u25C8' },
{ id: 'database', name: 'Database', icon: '\u25A3' },
{ id: 'performance', name: 'Performance', icon: '\u25CE' },
{ id: 'documentation', name: 'Documentation', icon: '\u25A1' },
{ id: 'ai-ml', name: 'AI/ML', icon: '\u25CE' },
];
const MATRIX: Record<string, Record<string, Support>> = {
'security': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'full', 'goose': 'partial',
'kilo': 'partial', 'kiro-cli': 'partial', 'roo': 'full', 'trae': 'partial',
'amp': 'full', 'cline': 'full', 'continue': 'partial', 'antigravity': 'partial',
},
'testing': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'full', 'goose': 'full',
'kilo': 'partial', 'kiro-cli': 'partial', 'roo': 'full', 'trae': 'partial',
'amp': 'full', 'cline': 'full', 'continue': 'full', 'antigravity': 'partial',
},
'react-frontend': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'partial', 'windsurf': 'full', 'github-copilot': 'full', 'goose': 'partial',
'kilo': 'partial', 'kiro-cli': 'partial', 'roo': 'full', 'trae': 'full',
'amp': 'full', 'cline': 'full', 'continue': 'full', 'antigravity': 'none',
},
'backend': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'full', 'goose': 'full',
'kilo': 'partial', 'kiro-cli': 'partial', 'roo': 'full', 'trae': 'partial',
'amp': 'full', 'cline': 'full', 'continue': 'full', 'antigravity': 'partial',
},
'devops': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'full', 'windsurf': 'partial', 'github-copilot': 'full', 'goose': 'partial',
'kilo': 'partial', 'kiro-cli': 'none', 'roo': 'partial', 'trae': 'partial',
'amp': 'full', 'cline': 'partial', 'continue': 'partial', 'antigravity': 'none',
},
'python': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'full', 'goose': 'full',
'kilo': 'partial', 'kiro-cli': 'partial', 'roo': 'full', 'trae': 'partial',
'amp': 'full', 'cline': 'full', 'continue': 'full', 'antigravity': 'partial',
},
'go': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'full', 'windsurf': 'partial', 'github-copilot': 'full', 'goose': 'partial',
'kilo': 'none', 'kiro-cli': 'none', 'roo': 'partial', 'trae': 'partial',
'amp': 'partial', 'cline': 'partial', 'continue': 'partial', 'antigravity': 'none',
},
'typescript': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'full', 'goose': 'full',
'kilo': 'partial', 'kiro-cli': 'partial', 'roo': 'full', 'trae': 'full',
'amp': 'full', 'cline': 'full', 'continue': 'full', 'antigravity': 'partial',
},
'database': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'partial', 'windsurf': 'partial', 'github-copilot': 'full', 'goose': 'partial',
'kilo': 'none', 'kiro-cli': 'none', 'roo': 'partial', 'trae': 'partial',
'amp': 'partial', 'cline': 'partial', 'continue': 'partial', 'antigravity': 'none',
},
'performance': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'partial', 'windsurf': 'partial', 'github-copilot': 'partial', 'goose': 'partial',
'kilo': 'none', 'kiro-cli': 'none', 'roo': 'partial', 'trae': 'partial',
'amp': 'partial', 'cline': 'partial', 'continue': 'partial', 'antigravity': 'none',
},
'documentation': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'full', 'windsurf': 'full', 'github-copilot': 'full', 'goose': 'full',
'kilo': 'partial', 'kiro-cli': 'partial', 'roo': 'full', 'trae': 'full',
'amp': 'full', 'cline': 'full', 'continue': 'full', 'antigravity': 'partial',
},
'ai-ml': {
'claude-code': 'full', 'cursor': 'full', 'codex': 'full', 'gemini-cli': 'full',
'opencode': 'partial', 'windsurf': 'partial', 'github-copilot': 'partial', 'goose': 'partial',
'kilo': 'none', 'kiro-cli': 'none', 'roo': 'partial', 'trae': 'partial',
'amp': 'partial', 'cline': 'partial', 'continue': 'partial', 'antigravity': 'none',
},
};
const SUPPORT_CONFIG: Record<Support, { color: string; bg: string; label: string }> = {
full: { color: 'text-green-400', bg: 'bg-green-400/10', label: 'Full' },
partial: { color: 'text-yellow-400', bg: 'bg-yellow-400/10', label: 'Partial' },
none: { color: 'text-red-400', bg: 'bg-red-400/10', label: 'None' },
};
const SUPPORT_SCORE: Record<Support, number> = { full: 2, partial: 1, none: 0 };
function SupportCell({ support }: { support: Support }): React.ReactElement {
const config = SUPPORT_CONFIG[support];
return (
<td className="px-1 py-2 text-center">
<div className={`inline-flex items-center justify-center w-5 h-5 rounded-full ${config.bg}`}>
<span className={`text-[10px] font-bold ${config.color}`}>
{support === 'full' ? '\u2713' : support === 'partial' ? '\u25CB' : '\u2715'}
</span>
</div>
</td>
);
}
function getAgentScore(agentId: string): number {
return Object.values(MATRIX).reduce((sum, row) => sum + SUPPORT_SCORE[row[agentId] || 'none'], 0);
}
function getMaxScore(): number {
return CATEGORIES.length * 2;
}
export function CompatibilityMatrix(): React.ReactElement {
const [filter, setFilter] = useState('');
const [groupFilter, setGroupFilter] = useState<string | null>(null);
const groups = useMemo(() => {
const seen = new Set<string>();
return AGENTS.reduce<string[]>((acc, a) => {
if (!seen.has(a.group)) {
seen.add(a.group);
acc.push(a.group);
}
return acc;
}, []);
}, []);
const { filteredAgents, filteredCategories } = useMemo(() => {
let agents = AGENTS;
if (groupFilter) {
agents = agents.filter(a => a.group === groupFilter);
}
if (!filter.trim()) {
return { filteredAgents: agents, filteredCategories: CATEGORIES };
}
const q = filter.toLowerCase();
const matchedAgents = agents.filter(a =>
a.name.toLowerCase().includes(q) || a.id.toLowerCase().includes(q)
);
const matchedCategories = CATEGORIES.filter(c =>
c.name.toLowerCase().includes(q) || c.id.toLowerCase().includes(q)
);
return {
filteredAgents: matchedAgents.length > 0 ? matchedAgents : (matchedCategories.length > 0 ? agents : []),
filteredCategories: matchedCategories.length > 0 ? matchedCategories : (matchedAgents.length > 0 ? CATEGORIES : []),
};
}, [filter, groupFilter]);
const maxScore = getMaxScore();
return (
<section className="py-12 border-b border-zinc-800" style={{ backgroundColor: '#09090b' }}>
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
<div className="flex flex-col sm:flex-row sm:items-center justify-between gap-2 mb-6">
<div>
<h2 className="text-lg sm:text-xl font-bold text-white mb-1 font-mono">Compatibility Matrix</h2>
<p className="text-zinc-500 font-mono text-[10px] sm:text-xs">
Skill support across 16 agents and 12 categories.
</p>
</div>
<div className="flex items-center gap-2">
<span className="w-2 h-2 bg-green-500 rounded-full"></span>
<span className="text-[10px] sm:text-xs font-mono text-zinc-500">Updated Feb 2026</span>
</div>
</div>
<div className="flex flex-col sm:flex-row gap-2 sm:gap-3 mb-6">
<div className="relative flex-1">
<svg className="absolute left-2.5 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-zinc-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
</svg>
<input
type="text"
value={filter}
onChange={(e) => setFilter(e.target.value)}
placeholder="Filter agents or categories..."
className="w-full bg-black border border-zinc-800 text-zinc-300 placeholder-zinc-700 font-mono text-xs px-8 py-2 focus:outline-none focus:border-zinc-600 transition-colors"
/>
{filter && (
<button
onClick={() => setFilter('')}
className="absolute right-2.5 top-1/2 -translate-y-1/2 text-zinc-600 hover:text-zinc-400 transition-colors"
>
<svg className="w-3.5 h-3.5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
)}
</div>
<div className="flex gap-1.5">
<button
onClick={() => setGroupFilter(null)}
className={`px-2.5 py-1.5 font-mono text-[10px] sm:text-xs transition-all ${
groupFilter === null
? 'bg-white text-black'
: 'bg-zinc-900 text-zinc-400 border border-zinc-800 hover:border-zinc-600 hover:text-white'
}`}
>
All
</button>
{groups.map(g => (
<button
key={g}
onClick={() => setGroupFilter(groupFilter === g ? null : g)}
className={`px-2.5 py-1.5 font-mono text-[10px] sm:text-xs transition-all ${
groupFilter === g
? 'bg-white text-black'
: 'bg-zinc-900 text-zinc-400 border border-zinc-800 hover:border-zinc-600 hover:text-white'
}`}
>
{g}
</button>
))}
</div>
</div>
<div className="flex items-center gap-4 mb-4">
{Object.entries(SUPPORT_CONFIG).map(([key, config]) => (
<div key={key} className="flex items-center gap-1.5">
<div className={`w-3 h-3 rounded-full ${config.bg} flex items-center justify-center`}>
<span className={`text-[8px] font-bold ${config.color}`}>
{key === 'full' ? '\u2713' : key === 'partial' ? '\u25CB' : '\u2715'}
</span>
</div>
<span className="text-[10px] font-mono text-zinc-500">{config.label}</span>
</div>
))}
</div>
<div className="overflow-x-auto -mx-4 px-4 sm:mx-0 sm:px-0">
<div className="min-w-[700px]">
<table className="w-full border-collapse font-mono text-[10px]">
<thead>
<tr className="border-b border-zinc-800">
<th className="text-left text-zinc-500 uppercase tracking-wider py-2 pr-3 sticky left-0 bg-[#09090b] z-10 min-w-[120px]">
Category
</th>
{filteredAgents.map(agent => (
<th key={agent.id} className="px-1 py-2 text-center">
<div className="flex flex-col items-center gap-0.5">
<span className="text-sm">{agent.icon}</span>
<span className="text-zinc-400 whitespace-nowrap max-w-[50px] truncate" title={agent.name}>
{agent.name.length > 7 ? agent.name.slice(0, 7) : agent.name}
</span>
</div>
</th>
))}
</tr>
</thead>
<tbody>
{filteredCategories.map(category => (
<tr key={category.id} className="border-b border-zinc-800/50 hover:bg-zinc-900/50 transition-colors">
<td className="py-2 pr-3 sticky left-0 bg-[#09090b] z-10">
<div className="flex items-center gap-1.5">
<span className="text-zinc-600">{category.icon}</span>
<span className="text-zinc-300 whitespace-nowrap">{category.name}</span>
</div>
</td>
{filteredAgents.map(agent => (
<SupportCell
key={agent.id}
support={MATRIX[category.id]?.[agent.id] || 'none'}
/>
))}
</tr>
))}
</tbody>
<tfoot>
<tr className="border-t border-zinc-700">
<td className="py-3 pr-3 sticky left-0 bg-[#09090b] z-10">
<span className="text-zinc-400 font-bold uppercase tracking-wider">Score</span>
</td>
{filteredAgents.map(agent => {
const score = getAgentScore(agent.id);
const pct = Math.round((score / maxScore) * 100);
const color = pct >= 80 ? 'text-green-400' : pct >= 50 ? 'text-yellow-400' : 'text-red-400';
return (
<td key={agent.id} className="px-1 py-3 text-center">
<div className={`font-bold text-xs ${color}`}>{pct}%</div>
<div className="text-zinc-600 text-[9px]">{score}/{maxScore}</div>
</td>
);
})}
</tr>
</tfoot>
</table>
</div>
</div>
{filteredAgents.length === 0 && (
<div className="text-center py-8 text-zinc-600 font-mono text-sm">
No agents match your filter.
</div>
)}
{filteredCategories.length === 0 && filteredAgents.length > 0 && (
<div className="text-center py-8 text-zinc-600 font-mono text-sm">
No categories match your filter.
</div>
)}
</div>
</section>
);
}
+2 -2
View File
@@ -9,7 +9,7 @@ interface Feature {
const FEATURES: Feature[] = [
{
title: 'Smart Recommendations',
description: 'AI analyzes your codebase and suggests perfect skills.',
description: 'AI analyzes your codebase and recommends from 15,000+ skills.',
icon: (
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9.663 17h4.673M12 3v1m6.364 1.636l-.707.707M21 12h-1M4 12H3m3.343-5.657l-.707-.707m2.828 9.9a5 5 0 117.072 0l-.548.547A3.374 3.374 0 0014 18.469V19a2 2 0 11-4 0v-.531c0-.895-.356-1.754-.988-2.386l-.548-.547z" />
@@ -18,7 +18,7 @@ const FEATURES: Feature[] = [
},
{
title: 'Auto Translation',
description: 'Write once, deploy to 32 agents. Zero manual conversion.',
description: 'The npm for agent skills. Write once, auto-translate to 32 formats.',
icon: (
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M8 7h12m0 0l-4-4m4 4l-4 4m0 6H4m0 0l4 4m-4-4l4-4" />
+5 -5
View File
@@ -134,14 +134,14 @@ export function Hero({ version }: HeroProps): React.ReactElement {
</div>
<h1 className="text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight text-white mb-3 font-mono">
Write Once.<br />
<span className="text-zinc-500">Deploy to 32 Agents.</span>
One Skill.<br />
<span className="text-zinc-500">32 Agents. Zero Rewrites.</span>
</h1>
<p className="text-sm text-zinc-400 mb-5 max-w-lg font-mono leading-relaxed">
The universal skill platform for AI coding agents. Auto-generate instructions
with Primer, persist learnings with Memory, distribute across Mesh networks.
One CLI for Claude, Cursor, Windsurf, Copilot, and 28 more.
The package manager for AI agent skills. Install from 15,000+ skills,
auto-translate between formats, persist learnings with Memory.
Works with Claude, Cursor, Windsurf, Copilot, and 28 more.
</p>
<div className="flex flex-wrap items-center gap-3 mb-4">
+8 -2
View File
@@ -2,7 +2,7 @@
"name": "skillkit-monorepo",
"version": "1.10.0",
"private": true,
"description": "Universal skills loader for AI coding agents - Monorepo",
"description": "The package manager for AI agent skills — install, translate, share across 32 coding agents",
"type": "module",
"scripts": {
"build": "turbo run build",
@@ -31,7 +31,13 @@
"coding-assistant",
"skill-loader",
"cli",
"monorepo"
"monorepo",
"skill-md",
"package-manager",
"plugin",
"workflow",
"automation",
"SKILL.md"
],
"author": "Rohit Ghumare",
"license": "Apache-2.0",
@@ -0,0 +1,69 @@
import { describe, it, expect } from 'vitest';
import { join, normalize, resolve, sep } from 'node:path';
function isPathInside(child: string, parent: string): boolean {
const resolved = resolve(child);
const resolvedParent = resolve(parent);
return resolved === resolvedParent || resolved.startsWith(resolvedParent + sep);
}
function sanitizeName(name: string): string {
return name.split(/[/\\]/).pop() || name;
}
describe('Quick Command Security', () => {
describe('path traversal protection', () => {
const installDir = '/home/user/.claude/skills';
it('should block skill names that escape the install directory', () => {
const maliciousNames = ['../evil', '../../etc/passwd', '../../../tmp/bad', '..\\evil'];
for (const name of maliciousNames) {
const sanitized = sanitizeName(name);
const targetPath = normalize(join(installDir, sanitized));
expect(isPathInside(targetPath, installDir)).toBe(true);
expect(sanitized).not.toContain('..');
expect(sanitized).not.toContain('/');
expect(sanitized).not.toContain('\\');
}
});
it('should sanitize "../evil" to "evil"', () => {
expect(sanitizeName('../evil')).toBe('evil');
});
it('should sanitize "../../etc/passwd" to "passwd"', () => {
expect(sanitizeName('../../etc/passwd')).toBe('passwd');
});
it('should sanitize "..\\evil" to "evil"', () => {
expect(sanitizeName('..\\evil')).toBe('evil');
});
it('should keep valid skill names unchanged', () => {
expect(sanitizeName('my-skill')).toBe('my-skill');
expect(sanitizeName('react-best-practices')).toBe('react-best-practices');
});
it('should produce a path inside installDir after sanitization', () => {
const evilName = '../evil';
const sanitized = sanitizeName(evilName);
const targetPath = normalize(join(installDir, sanitized));
expect(isPathInside(targetPath, installDir)).toBe(true);
expect(targetPath).toBe(join(installDir, 'evil'));
});
it('should detect unsanitized traversal names before normalization', () => {
const rawPath = `${installDir}/../evil`;
expect(isPathInside(rawPath, installDir)).toBe(false);
});
it('should ensure sanitization prevents the traversal entirely', () => {
const evilName = '../evil';
const sanitized = sanitizeName(evilName);
const targetPath = normalize(join(installDir, sanitized));
expect(targetPath).toBe(join(installDir, 'evil'));
expect(targetPath.startsWith(installDir)).toBe(true);
});
});
});
+39
View File
@@ -0,0 +1,39 @@
const SKILLKIT_LOGO_SVG_BASE64 =
'PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiIgZmlsbD0id2hpdGUiPjxyZWN0IHdpZHRoPSI2IiBoZWlnaHQ9IjYiIHg9IjEiIHk9IjEiLz48cmVjdCB3aWR0aD0iNiIgaGVpZ2h0PSI2IiB4PSI5IiB5PSIxIi8+PHJlY3Qgd2lkdGg9IjYiIGhlaWdodD0iNiIgeD0iMSIgeT0iOSIvPjxyZWN0IHdpZHRoPSI2IiBoZWlnaHQ9IjYiIHg9IjkiIHk9IjkiLz48L3N2Zz4=';
function encodeBadgeSegment(text: string): string {
return encodeURIComponent(text).replace(/-/g, '--');
}
export function generateBadge(skills: string[]): {
url: string;
markdown: string;
html: string;
} {
const count = skills.length;
if (count === 0) {
const url = `https://img.shields.io/badge/SkillKit-No%20Skills-555555?style=flat-square&logo=data:image/svg+xml;base64,${SKILLKIT_LOGO_SVG_BASE64}`;
return {
url,
markdown: `[![SkillKit Stack](${url})](https://agenstskills.com)`,
html: `<a href="https://agenstskills.com"><img src="${url}" alt="SkillKit Stack" /></a>`,
};
}
const maxDisplay = 5;
const displayNames = skills.slice(0, maxDisplay);
const suffix = count > maxDisplay ? ` +${count - maxDisplay} more` : '';
const label = `SkillKit ${count} skills`;
const message = displayNames.join(' | ') + suffix;
const encodedLabel = encodeBadgeSegment(label);
const encodedMessage = encodeBadgeSegment(message);
const url = `https://img.shields.io/badge/${encodedLabel}-${encodedMessage}-black?style=flat-square&logo=data:image/svg+xml;base64,${SKILLKIT_LOGO_SVG_BASE64}`;
return {
url,
markdown: `[![SkillKit Stack](${url})](https://agenstskills.com)`,
html: `<a href="https://agenstskills.com"><img src="${url}" alt="SkillKit Stack" /></a>`,
};
}
+41 -2
View File
@@ -8,6 +8,7 @@ import {
select,
header,
} from '../onboarding/index.js';
import { FederatedSearch, GitHubSkillRegistry, RateLimitError } from '@skillkit/core';
interface SkillResult {
name: string;
@@ -54,6 +55,10 @@ export class FindCommand extends Command {
description: 'Minimal output (just list skills)',
});
federated = Option.Boolean('--federated,-f', false, {
description: 'Search external registries (GitHub SKILL.md files)',
});
async execute(): Promise<number> {
const s = spinner();
const limit = parseInt(this.limit, 10) || 10;
@@ -128,12 +133,46 @@ export class FindCommand extends Command {
}
}
if (this.federated && this.query) {
s.start('Searching external registries...');
const fedSearch = new FederatedSearch();
fedSearch.addRegistry(new GitHubSkillRegistry());
try {
const fedResult = await fedSearch.search(this.query, { limit: parseInt(this.limit, 10) || 10 });
s.stop(`Found ${fedResult.total} external skill(s) from ${fedResult.registries.join(', ') || 'none'}`);
if (fedResult.skills.length > 0) {
console.log('');
console.log(colors.bold('External Skills (SKILL.md):'));
for (const skill of fedResult.skills) {
const stars = typeof skill.stars === 'number' ? colors.muted(` ★${skill.stars}`) : '';
const desc = skill.description
? colors.muted(` - ${skill.description.slice(0, 50)}${skill.description.length > 50 ? '...' : ''}`)
: '';
console.log(` ${colors.cyan(symbols.bullet)} ${colors.primary(skill.name)}${stars}${desc}`);
if (!this.quiet) {
console.log(` ${colors.muted(skill.source)}`);
}
}
console.log('');
}
} catch (err) {
if (err instanceof RateLimitError) {
s.stop(colors.warning('Rate limited by GitHub API'));
console.log(colors.muted('Set GITHUB_TOKEN env var or wait before retrying.'));
} else {
s.stop(colors.warning('Federated search failed'));
}
}
}
if (results.length === 0) {
console.log(colors.muted('No skills found matching your search'));
console.log('');
console.log(colors.muted('Try:'));
console.log(colors.muted(' skillkit find --top # Show featured skills'));
console.log(colors.muted(' skillkit ui # Browse in TUI'));
console.log(colors.muted(' skillkit find --top # Show featured skills'));
console.log(colors.muted(' skillkit find -f <query> # Search external registries'));
console.log(colors.muted(' skillkit ui # Browse in TUI'));
return 0;
}
+6
View File
@@ -108,3 +108,9 @@ export {
// Tree command for hierarchical skill browsing (Phase 21)
export { TreeCommand } from './tree.js';
// Quick setup (zero-friction entry)
export { QuickCommand } from './quick.js';
// SKILL.md ecosystem
export { SkillMdValidateCommand, SkillMdInitCommand, SkillMdCheckCommand } from './skillmd.js';
+375
View File
@@ -0,0 +1,375 @@
import { existsSync, mkdirSync, cpSync, rmSync, symlinkSync } from 'node:fs';
import { join, resolve, normalize } from 'node:path';
import { execFile } from 'node:child_process';
import { promisify } from 'node:util';
const execFileAsync = promisify(execFile);
import { Command } from 'clipanion';
import {
type ProjectProfile,
type SkillMetadata,
type AgentType,
ContextManager,
RecommendationEngine,
loadIndex as loadIndexFromCache,
isIndexStale,
buildSkillIndex,
saveIndex,
KNOWN_SKILL_REPOS,
isPathInside,
isLocalPath,
detectProvider,
} from '@skillkit/core';
import { getAdapter, detectAgent, getAllAdapters } from '@skillkit/agents';
import { getInstallDir, saveSkillMetadata } from '../helpers.js';
import {
welcome,
spinner,
step,
success,
error,
warn,
colors,
symbols,
confirm,
select,
outro,
formatAgent,
getAgentIcon,
isCancel,
cancel,
showProjectSummary,
progressBar,
formatQualityBadge,
saveLastAgents,
} from '../onboarding/index.js';
function truncate(str: string, maxLen: number): string {
if (str.length <= maxLen) return str;
return str.slice(0, maxLen - 3) + '...';
}
export class QuickCommand extends Command {
static override paths = [['quick']];
static override usage = Command.Usage({
description: 'Zero-friction skill setup: detect agents, analyze project, recommend and install',
examples: [
['Quick setup', '$0 quick'],
],
});
async execute(): Promise<number> {
const s = spinner();
try {
welcome();
step(`${colors.bold('Quick Setup')} - zero-friction skill installation`);
console.log('');
s.start('Detecting installed AI agents...');
const allAdapters = getAllAdapters();
const detectedAgents: AgentType[] = [];
for (const adapter of allAdapters) {
try {
const installDir = getInstallDir(false, adapter.type);
const globalDir = getInstallDir(true, adapter.type);
if (existsSync(installDir) || existsSync(globalDir) || existsSync(adapter.configFile)) {
detectedAgents.push(adapter.type);
}
} catch {
// skip
}
}
if (detectedAgents.length === 0) {
const fallback = await detectAgent();
detectedAgents.push(fallback);
}
s.stop(`Detected ${detectedAgents.length} agent${detectedAgents.length !== 1 ? 's' : ''}: ${detectedAgents.map(formatAgent).join(', ')}`);
s.start('Analyzing project...');
const targetPath = resolve(process.cwd());
const manager = new ContextManager(targetPath);
let context = manager.get();
if (!context) {
context = manager.init();
}
s.stop('Project analyzed');
if (!context) {
error('Failed to analyze project');
return 1;
}
const profile: ProjectProfile = {
name: context.project.name,
type: context.project.type,
stack: context.stack,
patterns: context.patterns,
installedSkills: context.skills?.installed || [],
excludedSkills: context.skills?.excluded || [],
};
const languages = profile.stack.languages.map((l: { name: string; version?: string }) => `${l.name}${l.version ? ` ${l.version}` : ''}`);
const frameworks = profile.stack.frameworks.map((f: { name: string; version?: string }) => `${f.name}${f.version ? ` ${f.version}` : ''}`);
showProjectSummary({
name: profile.name,
type: profile.type,
languages,
frameworks,
});
let index = loadIndexFromCache();
if (!index || index.skills.length === 0) {
s.start('Building skill index from known sources...');
try {
const result = await buildSkillIndex(KNOWN_SKILL_REPOS, (message: string) => {
s.message(message);
});
index = result.index;
saveIndex(index);
s.stop(`Indexed ${index.skills.length} skills`);
} catch {
s.stop(colors.error('Failed to build index'));
warn('Could not fetch skill index. Try running: skillkit recommend --update');
return 1;
}
} else if (isIndexStale(index)) {
step(colors.muted('Skill index is stale. Run "skillkit recommend --update" to refresh.'));
}
const engine = new RecommendationEngine();
engine.loadIndex(index);
const result = engine.recommend(profile, {
limit: 5,
minScore: 20,
excludeInstalled: true,
includeReasons: true,
});
const recommendations = result.recommendations;
if (recommendations.length === 0) {
warn('No matching skills found for your project.');
console.log(colors.muted('Try running: skillkit recommend --update'));
return 0;
}
console.log('');
console.log(colors.bold(`Top ${recommendations.length} Recommended Skills:`));
console.log('');
const options: Array<{ value: string; label: string; hint?: string }> = [];
for (let i = 0; i < recommendations.length; i++) {
const rec = recommendations[i];
let scoreColor: (text: string) => string;
if (rec.score >= 70) {
scoreColor = colors.success;
} else if (rec.score >= 50) {
scoreColor = colors.warning;
} else {
scoreColor = colors.muted;
}
const scoreBar = progressBar(rec.score, 100, 10);
const qualityScore = rec.skill.quality ?? null;
const qualityDisplay = typeof qualityScore === 'number' && Number.isFinite(qualityScore)
? ` ${formatQualityBadge(qualityScore)}`
: '';
console.log(` ${colors.bold(`${i + 1}.`)} ${scoreColor(`${rec.score}%`)} ${colors.dim(scoreBar)} ${colors.bold(rec.skill.name)}${qualityDisplay}`);
if (rec.skill.description) {
console.log(` ${colors.muted(truncate(rec.skill.description, 70))}`);
}
options.push({
value: `${i}`,
label: `${rec.skill.name} (${rec.score}% match)`,
hint: rec.skill.source || undefined,
});
}
console.log('');
const skipOption = { value: 'skip', label: 'Skip installation' };
const selectResult = await select({
message: 'Select a skill to install',
options: [...options, skipOption],
});
if (isCancel(selectResult) || selectResult === 'skip') {
cancel('Quick setup complete (no installation)');
return 0;
}
const selectedIndex = parseInt(selectResult as string, 10);
const selectedSkill = recommendations[selectedIndex];
if (!selectedSkill || !selectedSkill.skill.source) {
error('Selected skill has no installable source');
return 1;
}
const agentDisplay = detectedAgents.length <= 3
? detectedAgents.map(formatAgent).join(', ')
: `${detectedAgents.slice(0, 2).map(formatAgent).join(', ')} +${detectedAgents.length - 2} more`;
const confirmResult = await confirm({
message: `Install ${colors.bold(selectedSkill.skill.name)} to ${agentDisplay}?`,
initialValue: true,
});
if (isCancel(confirmResult) || !confirmResult) {
cancel('Installation cancelled');
return 0;
}
saveLastAgents(detectedAgents);
const providerAdapter = detectProvider(selectedSkill.skill.source);
if (!providerAdapter) {
error(`Could not detect provider for: ${selectedSkill.skill.source}`);
return 1;
}
s.start(`Fetching ${selectedSkill.skill.name}...`);
const cloneResult = await providerAdapter.clone(selectedSkill.skill.source, '', { depth: 1 });
if (!cloneResult.success || !cloneResult.path) {
s.stop(colors.error(cloneResult.error || 'Failed to fetch source'));
return 1;
}
const discoveredSkills = cloneResult.discoveredSkills || [];
const matchedSkill = discoveredSkills.find(ds => ds.name === selectedSkill.skill.name) || discoveredSkills[0];
if (!matchedSkill) {
s.stop(colors.error('Skill not found in repository'));
return 1;
}
s.stop(`Found ${selectedSkill.skill.name}`);
let primaryPath: string | null = null;
const installedAgents: string[] = [];
for (const agentType of detectedAgents) {
const adapter = getAdapter(agentType);
const installDir = getInstallDir(false, agentType);
if (!existsSync(installDir)) {
mkdirSync(installDir, { recursive: true });
}
const sanitizedName = matchedSkill.name.split(/[/\\]/).pop() || matchedSkill.name;
const targetInstallPath = normalize(join(installDir, sanitizedName));
if (!isPathInside(targetInstallPath, installDir)) {
error(`Skipping ${matchedSkill.name} for ${adapter.name} (install path escapes target directory)`);
continue;
}
const securityRoot = cloneResult.tempRoot || cloneResult.path;
if (!isPathInside(matchedSkill.path, securityRoot)) {
error(`Skipping ${matchedSkill.name} for ${adapter.name} (path traversal detected)`);
continue;
}
const useSymlink = detectedAgents.length > 1 && primaryPath !== null;
s.start(`Installing to ${adapter.name}${useSymlink ? ' (symlink)' : ''}...`);
try {
if (existsSync(targetInstallPath)) {
rmSync(targetInstallPath, { recursive: true, force: true });
}
if (useSymlink && primaryPath) {
symlinkSync(primaryPath, targetInstallPath, 'dir');
} else {
cpSync(matchedSkill.path, targetInstallPath, { recursive: true, dereference: true });
if (detectedAgents.length > 1 && primaryPath === null) {
primaryPath = targetInstallPath;
}
const packageJsonPath = join(targetInstallPath, 'package.json');
if (existsSync(packageJsonPath)) {
s.stop(`Installed to ${adapter.name}`);
s.start('Installing npm dependencies...');
try {
await execFileAsync('npm', ['install', '--production'], { cwd: targetInstallPath });
s.stop('Dependencies installed');
} catch {
s.stop(colors.warning('Dependencies failed'));
console.log(colors.muted('Run manually: npm install in ' + targetInstallPath));
}
s.start('Finishing installation...');
}
}
const metadata: SkillMetadata = {
name: matchedSkill.name,
description: selectedSkill.skill.description || '',
source: selectedSkill.skill.source,
sourceType: providerAdapter.type,
subpath: matchedSkill.name,
installedAt: new Date().toISOString(),
enabled: true,
};
saveSkillMetadata(targetInstallPath, metadata);
installedAgents.push(agentType);
s.stop(`Installed to ${adapter.name}${useSymlink ? ' (symlink)' : ''}`);
} catch (err) {
s.stop(colors.error(`Failed to install to ${adapter.name}`));
console.log(colors.muted(err instanceof Error ? err.message : String(err)));
}
}
const cleanupPath = cloneResult.tempRoot || cloneResult.path;
if (!isLocalPath(selectedSkill.skill.source) && cleanupPath && existsSync(cleanupPath)) {
rmSync(cleanupPath, { recursive: true, force: true });
}
if (installedAgents.length > 0) {
console.log('');
success(`Installed ${colors.bold(matchedSkill.name)} to ${installedAgents.length} agent${installedAgents.length !== 1 ? 's' : ''}`);
for (const a of installedAgents) {
console.log(colors.muted(` ${symbols.success} ${getAgentIcon(a)} ${formatAgent(a)}`));
}
console.log('');
const badgeUrl = `https://img.shields.io/badge/SkillKit-${encodeURIComponent(matchedSkill.name)}-black?style=flat-square`;
console.log(colors.dim('Add to your README:'));
console.log(colors.muted(` [![SkillKit](${badgeUrl})](https://agenstskills.com)`));
outro('Quick setup complete!');
console.log('');
console.log(colors.muted('Next steps:'));
console.log(colors.muted(` ${symbols.arrowRight} Run ${colors.cyan('skillkit sync')} to update agent configs`));
console.log(colors.muted(` ${symbols.arrowRight} Run ${colors.cyan('skillkit recommend')} for more suggestions`));
console.log(colors.muted(` ${symbols.arrowRight} Run ${colors.cyan('skillkit list')} to see installed skills`));
console.log('');
} else {
warn('No agents were installed');
}
return 0;
} catch (err) {
s.stop(colors.error('Quick setup failed'));
console.log(colors.muted(err instanceof Error ? err.message : String(err)));
return 1;
}
}
}
+440
View File
@@ -0,0 +1,440 @@
import { existsSync, readFileSync, writeFileSync, readdirSync } from 'node:fs';
import { join, resolve, basename, relative } from 'node:path';
import { Command, Option } from 'clipanion';
import {
colors,
symbols,
spinner,
step,
success,
error,
warn,
header,
} from '../onboarding/index.js';
interface SkillMdValidation {
path: string;
exists: boolean;
hasName: boolean;
hasDescription: boolean;
hasTriggers: boolean;
hasCapabilities: boolean;
triggerCount: number;
capabilityCount: number;
score: number;
issues: string[];
}
function validateSkillMd(filePath: string): SkillMdValidation {
const result: SkillMdValidation = {
path: filePath,
exists: false,
hasName: false,
hasDescription: false,
hasTriggers: false,
hasCapabilities: false,
triggerCount: 0,
capabilityCount: 0,
score: 0,
issues: [],
};
if (!existsSync(filePath)) {
result.issues.push('File does not exist');
return result;
}
result.exists = true;
const content = readFileSync(filePath, 'utf-8');
if (!content.trim()) {
result.issues.push('File is empty');
return result;
}
const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/);
const bodyContent = frontmatterMatch
? content.slice(frontmatterMatch[0].length)
: content;
if (frontmatterMatch) {
const frontmatter = frontmatterMatch[1];
if (/^name:\s*.+$/m.test(frontmatter)) result.hasName = true;
if (/^description:\s*.+$/m.test(frontmatter)) result.hasDescription = true;
}
if (!result.hasName) {
if (/^#\s+.+$/m.test(bodyContent)) result.hasName = true;
}
if (!result.hasDescription) {
if (/^##?\s*(description|about|overview)\b/im.test(bodyContent)) {
result.hasDescription = true;
} else {
const lines = bodyContent.split(/\r?\n/).filter(l => l.trim());
const nonHeaderLines = lines.filter(l => !l.startsWith('#'));
if (nonHeaderLines.length >= 2) result.hasDescription = true;
}
}
const triggerPatterns = [
/triggers?\s*when/i,
/when\s*to\s*use/i,
/use\s*this\s*when/i,
/\*\*triggers?\b/i,
/^[-*]\s+.+(when|if|pattern|trigger)/im,
/glob:/i,
];
for (const pattern of triggerPatterns) {
if (pattern.test(content)) {
result.hasTriggers = true;
break;
}
}
if (result.hasTriggers) {
const triggerSection = content.match(/triggers?\s*when[:\s]*\n((?:[-*]\s+.+\n?)+)/i);
result.triggerCount = triggerSection
? (triggerSection[1].match(/^[-*]\s+/gm) || []).length
: 1;
}
const capabilityPatterns = [
/capabilities?[:\s]/i,
/features?[:\s]/i,
/what\s*(it|this)\s*(does|can)/i,
/^##?\s*capabilities/im,
/^##?\s*features/im,
];
for (const pattern of capabilityPatterns) {
if (pattern.test(content)) {
result.hasCapabilities = true;
break;
}
}
if (result.hasCapabilities) {
const capSection = content.match(/(?:capabilities?|features?)[:\s]*\n((?:[-*]\s+.+\n?)+)/i);
result.capabilityCount = capSection
? (capSection[1].match(/^[-*]\s+/gm) || []).length
: 1;
}
if (!result.hasName) result.issues.push('Missing name field');
if (!result.hasDescription) result.issues.push('Missing description section');
if (!result.hasTriggers) result.issues.push('No trigger patterns found');
if (!result.hasCapabilities) result.issues.push('No capabilities list found');
let score = 0;
if (result.exists) score += 10;
if (result.hasName) score += 20;
if (result.hasDescription) score += 25;
if (result.hasTriggers) score += 20;
if (result.hasCapabilities) score += 15;
if (result.triggerCount >= 3) score += 5;
if (result.capabilityCount >= 3) score += 5;
if (frontmatterMatch) {
const fm = frontmatterMatch[1];
if (/^version:/m.test(fm)) score += 3;
if (/^license:/m.test(fm)) score += 2;
if (/^tags:/m.test(fm)) score += 3;
if (/^metadata:/m.test(fm)) score += 2;
}
result.score = Math.min(100, score);
return result;
}
function printValidation(validation: SkillMdValidation, verbose = false): void {
const scoreColor = validation.score >= 80
? colors.success
: validation.score >= 60
? colors.warning
: colors.error;
console.log(` ${colors.muted('Score:')} ${scoreColor(`${validation.score}`)}/100`);
console.log(` ${validation.hasName ? colors.success(symbols.success) : colors.error(symbols.error)} Name field`);
console.log(` ${validation.hasDescription ? colors.success(symbols.success) : colors.error(symbols.error)} Description section`);
console.log(` ${validation.hasTriggers ? colors.success(symbols.success) : colors.error(symbols.error)} Trigger patterns${validation.triggerCount > 0 ? ` (${validation.triggerCount})` : ''}`);
console.log(` ${validation.hasCapabilities ? colors.success(symbols.success) : colors.error(symbols.error)} Capabilities list${validation.capabilityCount > 0 ? ` (${validation.capabilityCount})` : ''}`);
if (verbose && validation.issues.length > 0) {
console.log('');
console.log(` ${colors.warning('Issues:')}`);
for (const issue of validation.issues) {
console.log(` ${colors.warning(symbols.warning)} ${issue}`);
}
}
}
export class SkillMdValidateCommand extends Command {
static override paths = [['skillmd', 'validate'], ['skill-md', 'validate']];
static override usage = Command.Usage({
description: 'Validate a SKILL.md file against the standard',
examples: [
['Validate SKILL.md in current directory', '$0 skillmd validate'],
['Validate specific file', '$0 skillmd validate ./path/to/SKILL.md'],
],
});
targetPath = Option.String({ required: false, name: 'path' });
verbose = Option.Boolean('--verbose,-v', false, {
description: 'Show detailed validation results',
});
json = Option.Boolean('--json', false, {
description: 'Output as JSON',
});
async execute(): Promise<number> {
const targetPath = this.targetPath || join(process.cwd(), 'SKILL.md');
const resolvedPath = resolve(targetPath);
const filePath = resolvedPath.endsWith('SKILL.md') ? resolvedPath : join(resolvedPath, 'SKILL.md');
if (!this.json) {
header('SKILL.md Validation');
step(`Validating: ${colors.cyan(filePath)}`);
console.log('');
}
const validation = validateSkillMd(filePath);
if (this.json) {
console.log(JSON.stringify(validation, null, 2));
return validation.score >= 60 ? 0 : 1;
}
console.log(colors.primary(basename(filePath)));
printValidation(validation, this.verbose);
console.log('');
if (validation.score >= 80) {
success(`SKILL.md is compliant (score: ${validation.score}/100)`);
} else if (validation.score >= 60) {
warn(`SKILL.md needs improvement (score: ${validation.score}/100)`);
} else {
error(`SKILL.md does not meet minimum standard (score: ${validation.score}/100)`);
}
return validation.score >= 60 ? 0 : 1;
}
}
export class SkillMdInitCommand extends Command {
static override paths = [['skillmd', 'init'], ['skill-md', 'init']];
static override usage = Command.Usage({
description: 'Create a template SKILL.md in the current directory',
examples: [
['Create SKILL.md template', '$0 skillmd init'],
['Create with custom name', '$0 skillmd init --name my-skill'],
],
});
name = Option.String('--name,-n', {
description: 'Skill name',
});
force = Option.Boolean('--force,-f', false, {
description: 'Overwrite existing SKILL.md',
});
async execute(): Promise<number> {
const outputPath = join(process.cwd(), 'SKILL.md');
if (existsSync(outputPath) && !this.force) {
warn('SKILL.md already exists');
console.log(colors.muted('Use --force to overwrite'));
return 1;
}
const skillName = this.name || basename(process.cwd());
const formattedName = skillName
.split('-')
.map((w: string) => w.charAt(0).toUpperCase() + w.slice(1))
.join(' ');
const template = [
'---',
`name: ${skillName}`,
'description: What this skill does and when to use it',
'version: "1.0"',
'license: MIT',
'tags: [general]',
'metadata:',
' author: your-name',
'---',
'',
`# ${formattedName}`,
'',
'Brief description of what this skill provides to AI coding agents.',
'',
'## Triggers when:',
`- User asks about ${skillName} related tasks`,
`- Project contains ${skillName} configuration files`,
`- Code changes involve ${skillName} patterns`,
'',
'## Capabilities:',
`- Provides best practices for ${skillName}`,
'- Generates boilerplate code and configurations',
'- Validates existing implementations',
'- Suggests improvements and optimizations',
'',
'## Steps',
'1. First step the AI agent should take',
'2. Second step with specific instructions',
'3. Third step with expected outcome',
'',
'## Examples',
'',
'```',
'Example code or configuration here',
'```',
'',
].join('\n');
writeFileSync(outputPath, template);
success(`Created SKILL.md for "${skillName}"`);
console.log('');
console.log(colors.muted('Next steps:'));
console.log(` ${colors.cyan('1.')} Edit SKILL.md with your skill instructions`);
console.log(` ${colors.cyan('2.')} Run ${colors.cyan('skillkit skillmd validate')} to check compliance`);
console.log(` ${colors.cyan('3.')} Run ${colors.cyan('skillkit publish submit')} to share with the marketplace`);
return 0;
}
}
export class SkillMdCheckCommand extends Command {
static override paths = [['skillmd', 'check'], ['skill-md', 'check']];
static override usage = Command.Usage({
description: 'Check all SKILL.md files in the project for compliance',
examples: [
['Check current directory', '$0 skillmd check'],
['Check specific directory', '$0 skillmd check ./skills'],
],
});
targetPath = Option.String({ required: false, name: 'path' });
verbose = Option.Boolean('--verbose,-v', false, {
description: 'Show detailed validation results',
});
async execute(): Promise<number> {
const targetPath = resolve(this.targetPath || process.cwd());
header('SKILL.md Compliance Check');
const s = spinner();
s.start('Scanning for SKILL.md files...');
const skillMdFiles = this.findSkillMdFiles(targetPath);
s.stop(`Found ${skillMdFiles.length} SKILL.md file(s)`);
if (skillMdFiles.length === 0) {
warn('No SKILL.md files found');
console.log(colors.muted(`Searched: ${targetPath}`));
console.log('');
console.log(colors.muted('Create one with:'));
console.log(` ${colors.cyan('skillkit skillmd init')}`);
return 0;
}
const validations: SkillMdValidation[] = skillMdFiles.map(f => validateSkillMd(f));
validations.sort((a, b) => b.score - a.score);
console.log('');
for (const validation of validations) {
const relativePath = relative(targetPath, validation.path);
const scoreColor = validation.score >= 80 ? colors.success : validation.score >= 60 ? colors.warning : colors.error;
console.log(`${scoreColor(symbols.bullet)} ${colors.primary(relativePath)} ${colors.muted(`(${validation.score}/100)`)}`);
if (this.verbose) {
printValidation(validation, true);
console.log('');
}
}
console.log('');
const passing = validations.filter(v => v.score >= 60).length;
const failing = validations.filter(v => v.score < 60).length;
const avgScore = Math.round(validations.reduce((sum, v) => sum + v.score, 0) / validations.length);
console.log(colors.muted('Summary:'));
console.log(` ${colors.muted('Total:')} ${validations.length}`);
console.log(` ${colors.success(symbols.success)} Passing (60+): ${passing}`);
if (failing > 0) {
console.log(` ${colors.error(symbols.error)} Failing: ${failing}`);
}
console.log(` ${colors.muted('Average score:')} ${avgScore}/100`);
console.log('');
if (failing > 0) {
error(`${failing} SKILL.md file(s) below minimum standard`);
return 1;
}
success('All SKILL.md files are compliant');
return 0;
}
private findSkillMdFiles(dir: string): string[] {
const results: string[] = [];
const directFile = join(dir, 'SKILL.md');
if (existsSync(directFile)) results.push(directFile);
const searchDirs = [
join(dir, 'skills'),
join(dir, '.claude', 'skills'),
join(dir, '.cursor', 'skills'),
join(dir, '.codex', 'skills'),
join(dir, '.github', 'skills'),
];
for (const searchDir of searchDirs) {
if (!existsSync(searchDir)) continue;
this.scanDir(searchDir, results, 0);
}
try {
const entries = readdirSync(dir, { withFileTypes: true });
for (const entry of entries) {
if (!entry.isDirectory()) continue;
if (entry.name.startsWith('.') || entry.name === 'node_modules') continue;
const entrySkillMd = join(dir, entry.name, 'SKILL.md');
if (existsSync(entrySkillMd) && !results.includes(entrySkillMd)) {
results.push(entrySkillMd);
}
}
} catch {
// ignore read errors
}
return results;
}
private scanDir(dir: string, results: string[], depth: number): void {
if (depth > 3) return;
try {
const entries = readdirSync(dir, { withFileTypes: true });
for (const entry of entries) {
const entryPath = join(dir, entry.name);
if (entry.isFile() && entry.name === 'SKILL.md') {
if (!results.includes(entryPath)) results.push(entryPath);
}
if (entry.isDirectory() && !entry.name.startsWith('.') && entry.name !== 'node_modules') {
this.scanDir(entryPath, results, depth + 1);
}
}
} catch {
// ignore read errors
}
}
}
+3
View File
@@ -104,3 +104,6 @@ export * from './execution/index.js';
// Hybrid Search (QMD-Inspired Vector + Keyword Search)
export * from './search/index.js';
// Federated Registry (External Skill Sources)
export * from './registry/index.js';
+163
View File
@@ -0,0 +1,163 @@
export interface ExternalSkill {
name: string;
description: string;
source: string;
registry: string;
path?: string;
stars?: number;
updatedAt?: string;
}
export interface ExternalRegistry {
name: string;
search(query: string, options?: { limit?: number; timeoutMs?: number }): Promise<ExternalSkill[]>;
}
export interface FederatedResult {
skills: ExternalSkill[];
registries: string[];
total: number;
query: string;
}
export class RateLimitError extends Error {
constructor(registry: string) {
super(`Rate limited by ${registry} API. Authenticate with a token or wait before retrying.`);
this.name = 'RateLimitError';
}
}
export class GitHubSkillRegistry implements ExternalRegistry {
name = 'github';
private baseUrl = 'https://api.github.com';
async search(query: string, options?: { limit?: number; timeoutMs?: number }): Promise<ExternalSkill[]> {
const limit = options?.limit ?? 20;
const timeoutMs = options?.timeoutMs ?? 10_000;
const searchQuery = `SKILL.md ${query} in:path,file`;
const controller = new AbortController();
const timer = setTimeout(() => controller.abort(), timeoutMs);
try {
const headers: Record<string, string> = {
Accept: 'application/vnd.github.v3+json',
'User-Agent': 'skillkit-cli',
};
const token = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
if (token) {
headers.Authorization = `Bearer ${token}`;
}
const response = await fetch(
`${this.baseUrl}/search/code?q=${encodeURIComponent(searchQuery)}&per_page=${limit}`,
{
headers,
signal: controller.signal,
},
);
clearTimeout(timer);
if (!response.ok) {
if (response.status === 403) {
throw new RateLimitError(this.name);
}
return [];
}
const data = (await response.json()) as {
items?: Array<{
repository: {
full_name: string;
description?: string;
html_url: string;
stargazers_count?: number;
updated_at?: string;
};
path: string;
name: string;
}>;
};
if (!data.items) return [];
const seen = new Set<string>();
const skills: ExternalSkill[] = [];
for (const item of data.items) {
const repo = item.repository.full_name;
if (seen.has(repo)) continue;
seen.add(repo);
const pathParts = item.path.split('/');
const skillName =
pathParts.length > 1
? pathParts[pathParts.length - 2]
: repo.split('/').pop() || repo;
skills.push({
name: skillName,
description: item.repository.description || '',
source: item.repository.html_url,
registry: this.name,
path: item.path,
stars: item.repository.stargazers_count,
updatedAt: item.repository.updated_at,
});
}
return skills;
} catch (err) {
clearTimeout(timer);
if (err instanceof RateLimitError) throw err;
return [];
}
}
}
export class FederatedSearch {
private registries: ExternalRegistry[] = [];
addRegistry(registry: ExternalRegistry): void {
this.registries.push(registry);
}
async search(query: string, options?: { limit?: number }): Promise<FederatedResult> {
const limit = options?.limit ?? 20;
const results = await Promise.allSettled(
this.registries.map((r) => r.search(query, { limit })),
);
const allSkills: ExternalSkill[] = [];
const activeRegistries: string[] = [];
for (let i = 0; i < results.length; i++) {
const result = results[i];
if (result.status === 'fulfilled' && result.value.length > 0) {
allSkills.push(...result.value);
activeRegistries.push(this.registries[i].name);
} else if (result.status === 'rejected' && result.reason instanceof RateLimitError) {
throw result.reason;
}
}
const seen = new Set<string>();
const deduplicated: ExternalSkill[] = [];
for (const skill of allSkills) {
const key = `${skill.source}:${skill.name}`;
if (!seen.has(key)) {
seen.add(key);
deduplicated.push(skill);
}
}
deduplicated.sort((a, b) => (b.stars ?? 0) - (a.stars ?? 0));
return {
skills: deduplicated.slice(0, limit),
registries: activeRegistries,
total: deduplicated.length,
query,
};
}
}
+4 -3
View File
@@ -1,5 +1,5 @@
import { existsSync, readdirSync, readFileSync } from 'node:fs';
import { join, basename } from 'node:path';
import { join, basename, resolve, sep } from 'node:path';
import { parse as parseYaml } from 'yaml';
import { SkillFrontmatter, SkillMetadata, type Skill, type SkillLocation } from './types.js';
@@ -391,6 +391,7 @@ export function validateSkill(skillPath: string): { valid: boolean; errors: stri
}
export function isPathInside(child: string, parent: string): boolean {
const relative = child.replace(parent, '');
return !relative.startsWith('..') && !relative.includes('/..');
const resolved = resolve(child);
const resolvedParent = resolve(parent);
return resolved === resolvedParent || resolved.startsWith(resolvedParent + sep);
}
+4 -3
View File
@@ -1,5 +1,5 @@
import { existsSync, readdirSync, readFileSync } from 'node:fs';
import { join, basename } from 'node:path';
import { join, basename, resolve, sep } from 'node:path';
import { parse as parseYaml } from 'yaml';
import { SkillFrontmatter, SkillMetadata, type Skill, type SkillLocation } from './types.js';
@@ -328,6 +328,7 @@ export function validateSkill(skillPath: string): { valid: boolean; errors: stri
}
export function isPathInside(child: string, parent: string): boolean {
const relative = child.replace(parent, '');
return !relative.startsWith('..') && !relative.includes('/..');
const resolved = resolve(child);
const resolvedParent = resolve(parent);
return resolved === resolvedParent || resolved.startsWith(resolvedParent + sep);
}