feat: single source of truth for skills marketplace (#15)

* feat: single source of truth for skills marketplace

- Consolidate all skills data to marketplace/skills.json (15,062 skills)
- Add marketplace/sources.json for curated repository sources (31 repos)
- Add skillkit publish command for user skill submissions
- Add auto-publish prompt to skillkit init
- Add AI skill caching with localStorage (7-day TTL)
- Add Submit to Marketplace button for AI-generated skills
- Remove duplicate skills.json files (docs, core)
- Remove legacy src/tui/ folder (replaced by packages/tui)
- Update all imports to use single source files

* fix: address CodeRabbit review feedback

- Remove duplicate checklist items in SkillSubmitForm.tsx
- Add missing sources-schema.json file
- Add slugify method for URL-safe skill IDs
- Fix Windows browser open command (empty title param)
- Fix frontmatter parsing for CRLF and multiline tags

* fix: address additional review feedback

- Add TTY check to skip prompts in CI/non-interactive environments
- Guard against empty slug IDs with validation
- Print full URL in fallback (not truncated)
- Fix repo name parsing for names containing dots
- Add cache pruning and max entries limit (50) for localStorage

* fix: filter empty strings from YAML tags array parsing
This commit is contained in:
Rohit Ghumare
2026-01-27 00:02:40 +00:00
committed by GitHub
parent 6d36a4a3f7
commit 4a6003ec46
33 changed files with 126052 additions and 1625 deletions
+166 -15
View File
@@ -94,6 +94,87 @@ function downloadContent(content: string, filename: string): void {
URL.revokeObjectURL(url);
}
// localStorage cache for AI-generated skills
const CACHE_KEY = 'skillkit_ai_cache';
const CACHE_VERSION = 1;
const MAX_CACHE_ENTRIES = 50;
const CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
interface CachedSkill {
skill: AgentSkill;
query: string;
timestamp: number;
}
interface SkillCache {
version: number;
skills: Record<string, CachedSkill>;
}
function normalizeQuery(query: string): string {
return query.toLowerCase().trim().replace(/\s+/g, ' ');
}
function getSkillCache(): SkillCache {
try {
const cached = localStorage.getItem(CACHE_KEY);
if (cached) {
const parsed = JSON.parse(cached) as SkillCache;
if (parsed.version === CACHE_VERSION) {
// Prune expired entries
const now = Date.now();
let mutated = false;
for (const [key, value] of Object.entries(parsed.skills)) {
if (!value?.timestamp || now - value.timestamp >= CACHE_TTL_MS) {
delete parsed.skills[key];
mutated = true;
}
}
if (mutated) {
localStorage.setItem(CACHE_KEY, JSON.stringify(parsed));
}
return parsed;
}
}
} catch {
// Ignore parse errors
}
return { version: CACHE_VERSION, skills: {} };
}
function getCachedSkill(query: string): AgentSkill | null {
const cache = getSkillCache();
const key = normalizeQuery(query);
const cached = cache.skills[key];
if (cached && Date.now() - cached.timestamp < CACHE_TTL_MS) {
return cached.skill;
}
return null;
}
function setCachedSkill(query: string, skill: AgentSkill): void {
try {
const cache = getSkillCache();
const key = normalizeQuery(query);
cache.skills[key] = {
skill,
query: key,
timestamp: Date.now(),
};
// Enforce max entries limit
const entries = Object.entries(cache.skills);
if (entries.length > MAX_CACHE_ENTRIES) {
entries
.sort((a, b) => a[1].timestamp - b[1].timestamp)
.slice(0, entries.length - MAX_CACHE_ENTRIES)
.forEach(([k]) => delete cache.skills[k]);
}
localStorage.setItem(CACHE_KEY, JSON.stringify(cache));
} catch {
// Ignore storage errors (quota exceeded, etc.)
}
}
export function SkillGenerator(): React.ReactElement {
const [input, setInput] = useState('');
const [status, setStatus] = useState<LoadingState>(LoadingState.IDLE);
@@ -103,6 +184,7 @@ export function SkillGenerator(): React.ReactElement {
const [selectedSkill, setSelectedSkill] = useState<IndexedSkill | null>(null);
const [skillContent, setSkillContent] = useState<string | null>(null);
const [generatedSkill, setGeneratedSkill] = useState<AgentSkill | null>(null);
const [isFromCache, setIsFromCache] = useState(false);
const [activeTab, setActiveTab] = useState<'principles' | 'patterns' | 'antipatterns'>('principles');
const [error, setError] = useState<string | null>(null);
@@ -144,12 +226,25 @@ export function SkillGenerator(): React.ReactElement {
}
async function handleGenerateWithAI(): Promise<void> {
setStatus(LoadingState.LOADING);
setError(null);
// Check cache first
const cached = getCachedSkill(input);
if (cached) {
setGeneratedSkill(cached);
setIsFromCache(true);
setViewMode('generated');
setStatus(LoadingState.SUCCESS);
return;
}
setStatus(LoadingState.LOADING);
setIsFromCache(false);
try {
const result = await generateAgentSkill(input);
setGeneratedSkill(result);
setCachedSkill(input, result); // Cache the result
setViewMode('generated');
setStatus(LoadingState.SUCCESS);
} catch {
@@ -158,6 +253,46 @@ export function SkillGenerator(): React.ReactElement {
}
}
function submitToMarketplace(): void {
if (!generatedSkill) return;
const slug = generatedSkill.name.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
const skillContent = generateSkillMd(generatedSkill);
const body = `## 📤 AI-Generated Skill: ${generatedSkill.title}
### Skill Details
- **Name:** ${generatedSkill.name}
- **Description:** ${generatedSkill.description}
- **Tags:** ${generatedSkill.tags.join(', ')}
- **Version:** ${generatedSkill.version}
### SKILL.md Content
<details>
<summary>Click to expand</summary>
\`\`\`markdown
${skillContent.slice(0, 4000)}${skillContent.length > 4000 ? '\n...(truncated)' : ''}
\`\`\`
</details>
### Checklist for Maintainer
- [ ] Review skill content for quality
- [ ] Add to \`marketplace/skills.json\`
---
**Generated via:** AI Skill Generator
**Search query:** "${input}"`;
const title = encodeURIComponent(`[AI Skill] ${generatedSkill.title}`);
const encodedBody = encodeURIComponent(body);
const url = `https://github.com/rohitg00/skillkit/issues/new?title=${title}&body=${encodedBody}&labels=ai-generated,skill-submission`;
window.open(url, '_blank', 'noopener,noreferrer');
}
function handleBack(): void {
switch (viewMode) {
case 'content':
@@ -353,9 +488,9 @@ export function SkillGenerator(): React.ReactElement {
<div className="mt-6 pt-6 border-t border-zinc-800">
<p className="text-zinc-500 font-mono text-sm mb-3">Install with SkillKit:</p>
<pre className="bg-zinc-950 border border-zinc-800 p-4 text-sm">
<code className="text-zinc-300 font-mono">
skillkit install {selectedSkill.id.split('/').slice(0, 2).join('/')} --agent claude-code,cursor
<pre className="bg-zinc-950 border border-zinc-800 p-4 text-sm overflow-x-auto">
<code className="text-zinc-300 font-mono text-xs sm:text-sm whitespace-nowrap">
npx skillkit install {selectedSkill.id.split('/').slice(0, 2).join('/')}
</code>
</pre>
</div>
@@ -366,14 +501,19 @@ export function SkillGenerator(): React.ReactElement {
<div className="animate-fade-in-up">
<div className="flex items-start justify-between mb-8 border-b border-zinc-800 pb-6">
<div className="flex-1">
<div className="flex items-center gap-3 mb-2">
<h3 className="text-2xl font-bold text-white">{generatedSkill.title}</h3>
<div className="flex flex-wrap items-center gap-2 mb-2">
<h3 className="text-xl sm:text-2xl font-bold text-white">{generatedSkill.title}</h3>
<span className="text-xs font-mono text-zinc-500 bg-zinc-900 px-2 py-1 border border-zinc-800">
v{generatedSkill.version}
</span>
<span className="text-xs font-mono text-purple-400 bg-purple-900/30 px-2 py-1 border border-purple-800/50">
AI Generated
</span>
{isFromCache && (
<span className="text-xs font-mono text-green-400 bg-green-900/30 px-2 py-1 border border-green-800/50">
Cached
</span>
)}
</div>
<p className="text-zinc-400 font-mono text-sm mb-4">{generatedSkill.description}</p>
<div className="flex flex-wrap gap-2">
@@ -384,15 +524,26 @@ export function SkillGenerator(): React.ReactElement {
))}
</div>
</div>
<button
onClick={downloadGeneratedSkillMd}
className="flex items-center gap-2 bg-white text-black px-4 py-2 font-mono text-sm hover:bg-zinc-200 transition-colors shrink-0 ml-4"
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" />
</svg>
DOWNLOAD
</button>
<div className="flex flex-col sm:flex-row gap-2 shrink-0 ml-4">
<button
onClick={downloadGeneratedSkillMd}
className="flex items-center justify-center gap-2 bg-white text-black px-4 py-2 font-mono text-sm hover:bg-zinc-200 transition-colors"
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4" />
</svg>
DOWNLOAD
</button>
<button
onClick={submitToMarketplace}
className="flex items-center justify-center gap-2 bg-purple-600 text-white px-4 py-2 font-mono text-sm hover:bg-purple-500 transition-colors"
>
<svg xmlns="http://www.w3.org/2000/svg" className="h-4 w-4" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" />
</svg>
SUBMIT
</button>
</div>
</div>
<Card className="mb-6">
@@ -227,8 +227,6 @@ ${jsonEntry}
### Checklist for Maintainer
- [ ] Verify repository is public
- [ ] Add JSON entry to \`marketplace/skills.json\`
- [ ] Copy to \`docs/skillkit/data/skills.json\`
- [ ] Copy to \`packages/core/src/marketplace/data/skills.json\`
---
**Submitted by:** @${form.authorGithub || 'anonymous'}
@@ -255,8 +253,6 @@ ${form.skillContent.slice(0, 4000)}${form.skillContent.length > 4000 ? '\n...(tr
### Checklist for Maintainer
- [ ] Review SKILL.md content
- [ ] Add JSON entry to \`marketplace/skills.json\`
- [ ] Copy to \`docs/skillkit/data/skills.json\`
- [ ] Copy to \`packages/core/src/marketplace/data/skills.json\`
---
**Author:** @${form.authorGithub || 'anonymous'}`;
+2 -1
View File
@@ -1,4 +1,5 @@
import skillsData from './skills.json';
// Single source of truth: marketplace/skills.json
import skillsData from '../../../marketplace/skills.json';
export interface IndexedSkill {
id: string;
-161
View File
@@ -1,161 +0,0 @@
{
"$schema": "./schema.json",
"version": 1,
"updatedAt": "2026-01-26",
"skills": [
{
"id": "vercel-labs/agent-skills/vercel-react-best-practices",
"name": "Vercel React Best Practices",
"description": "Best practices for building React applications with Vercel",
"source": "vercel-labs/agent-skills",
"tags": ["react", "vercel", "frontend"]
},
{
"id": "vercel-labs/agent-skills/web-design-guidelines",
"name": "Web Design Guidelines",
"description": "Guidelines for designing modern web applications",
"source": "vercel-labs/agent-skills",
"tags": ["design", "ui", "frontend"]
},
{
"id": "remotion-dev/skills/remotion-best-practices",
"name": "Remotion Best Practices",
"description": "Best practices for creating videos with Remotion",
"source": "remotion-dev/skills",
"tags": ["remotion", "video", "react"]
},
{
"id": "anthropics/skills/frontend-design",
"name": "Frontend Design",
"description": "Frontend design patterns and best practices",
"source": "anthropics/skills",
"tags": ["design", "ui", "frontend"]
},
{
"id": "anthropics/skills/skill-creator",
"name": "Skill Creator",
"description": "Create and publish your own skills",
"source": "anthropics/skills",
"tags": ["meta", "skills"]
},
{
"id": "vercel-labs/agent-browser/agent-browser",
"name": "Agent Browser",
"description": "Browser automation skills for AI agents",
"source": "vercel-labs/agent-browser",
"tags": ["browser", "automation"]
},
{
"id": "supabase/agent-skills/supabase-postgres-best-practices",
"name": "Supabase Postgres Best Practices",
"description": "Best practices for Supabase and PostgreSQL",
"source": "supabase/agent-skills",
"tags": ["supabase", "postgres", "database"]
},
{
"id": "expo/skills/building-native-ui",
"name": "Building Native UI",
"description": "Build native mobile UIs with Expo and React Native",
"source": "expo/skills",
"tags": ["expo", "react-native", "mobile"]
},
{
"id": "callstackincubator/agent-skills/react-native",
"name": "React Native Development",
"description": "React Native mobile development best practices",
"source": "callstackincubator/agent-skills",
"tags": ["react-native", "mobile"]
},
{
"id": "anthropics/skills/typescript-best-practices",
"name": "TypeScript Best Practices",
"description": "TypeScript coding standards and patterns",
"source": "anthropics/skills",
"tags": ["typescript", "javascript"]
},
{
"id": "anthropics/skills/testing-patterns",
"name": "Testing Patterns",
"description": "Unit, integration, and E2E testing patterns",
"source": "anthropics/skills",
"tags": ["testing", "jest", "vitest"]
},
{
"id": "anthropics/skills/api-design",
"name": "API Design",
"description": "RESTful and GraphQL API design patterns",
"source": "anthropics/skills",
"tags": ["api", "rest", "graphql"]
},
{
"id": "anthropics/skills/security-audit",
"name": "Security Audit",
"description": "Security best practices and vulnerability scanning",
"source": "anthropics/skills",
"tags": ["security", "audit"]
},
{
"id": "anthropics/skills/git-workflow",
"name": "Git Workflow",
"description": "Git branching, commits, and collaboration patterns",
"source": "anthropics/skills",
"tags": ["git", "devops"]
},
{
"id": "anthropics/skills/docker-patterns",
"name": "Docker Patterns",
"description": "Docker containerization best practices",
"source": "anthropics/skills",
"tags": ["docker", "devops", "containers"]
},
{
"id": "openai/skills/code-review",
"name": "Code Review",
"description": "Automated code review and suggestions",
"source": "openai/skills",
"tags": ["code-review", "quality"]
},
{
"id": "openai/skills/documentation",
"name": "Documentation Generator",
"description": "Generate and maintain code documentation",
"source": "openai/skills",
"tags": ["documentation", "readme"]
},
{
"id": "davila7/claude-code-templates/nextjs-app",
"name": "Next.js App Router",
"description": "Next.js 14+ App Router patterns and best practices",
"source": "davila7/claude-code-templates",
"tags": ["nextjs", "react", "frontend"]
},
{
"id": "davila7/claude-code-templates/prisma-patterns",
"name": "Prisma Patterns",
"description": "Prisma ORM patterns and database design",
"source": "davila7/claude-code-templates",
"tags": ["prisma", "database", "orm"]
},
{
"id": "composioHQ/awesome-claude-code-skills/python-best-practices",
"name": "Python Best Practices",
"description": "Python coding standards and patterns",
"source": "composioHQ/awesome-claude-code-skills",
"tags": ["python"]
},
{
"id": "composioHQ/awesome-claude-code-skills/rust-patterns",
"name": "Rust Patterns",
"description": "Rust memory safety and performance patterns",
"source": "composioHQ/awesome-claude-code-skills",
"tags": ["rust"]
},
{
"id": "composioHQ/awesome-claude-code-skills/go-patterns",
"name": "Go Patterns",
"description": "Go concurrency and idiomatic patterns",
"source": "composioHQ/awesome-claude-code-skills",
"tags": ["golang", "go"]
}
]
}