From 12253f4b51efcb102bfd69a0f8af74c844eeaaab Mon Sep 17 00:00:00 2001 From: Rohit Ghumare <48523873+rohitg00@users.noreply.github.com> Date: Wed, 28 Jan 2026 17:44:29 +0000 Subject: [PATCH] fix: address CodeRabbit review suggestions - Move Gemini API key to server-side route (security) - Add default type='button' to Button component - Use dynamic agent count instead of hardcoded 32 - Add 'use client' directive to Documentation - Fix stale closure in SkillSubmitForm with useCallback - Add URL validation for external references - Add noopener to external links for security - Fix Clawdbot path in agents.mdx - Update cicd.mdx with correct CLI commands - Capitalize proper nouns (Markdown, provider names) - Add text language to README code block - Update date example in quickstart.mdx --- docs/fumadocs/README.md | 2 +- docs/fumadocs/content/docs/agents.mdx | 2 +- docs/fumadocs/content/docs/cicd.mdx | 6 +- docs/fumadocs/content/docs/commands.mdx | 2 +- docs/fumadocs/content/docs/quickstart.mdx | 2 +- docs/fumadocs/content/docs/skills.mdx | 2 +- docs/fumadocs/content/docs/testing.mdx | 4 +- .../src/app/api/generate-skill/route.ts | 127 ++++++++++++++++ docs/fumadocs/src/components/Agents.tsx | 3 +- docs/fumadocs/src/components/Button.tsx | 2 + .../fumadocs/src/components/Documentation.tsx | 2 + .../src/components/SkillGenerator.tsx | 29 ++-- .../src/components/SkillSubmitForm.tsx | 11 +- docs/fumadocs/src/services/geminiService.ts | 136 ++---------------- 14 files changed, 183 insertions(+), 147 deletions(-) create mode 100644 docs/fumadocs/src/app/api/generate-skill/route.ts diff --git a/docs/fumadocs/README.md b/docs/fumadocs/README.md index e3ad46cb..ccd2de97 100644 --- a/docs/fumadocs/README.md +++ b/docs/fumadocs/README.md @@ -20,7 +20,7 @@ pnpm build ## Structure -``` +```text docs/fumadocs/ ├── content/docs/ # MDX documentation files ├── src/ diff --git a/docs/fumadocs/content/docs/agents.mdx b/docs/fumadocs/content/docs/agents.mdx index 849cba5e..0c9d0209 100644 --- a/docs/fumadocs/content/docs/agents.mdx +++ b/docs/fumadocs/content/docs/agents.mdx @@ -20,7 +20,7 @@ SkillKit uses an adapter pattern to support 32 AI coding platforms. Each adapter | Windsurf | `.windsurf/skills/` | Markdown | | Antigravity | `.antigravity/skills/` | SKILL.md | | Amp | `.amp/skills/` | SKILL.md | -| Clawdbot | `skills/` | SKILL.md | +| Clawdbot | `.clawdbot/skills/` (alt: `skills/`) | SKILL.md | | Droid (Factory) | `.factory/skills/` | SKILL.md | | Goose | `.goose/skills/` | SKILL.md | | Kilo Code | `.kilocode/skills/` | SKILL.md | diff --git a/docs/fumadocs/content/docs/cicd.mdx b/docs/fumadocs/content/docs/cicd.mdx index 33b9151b..88e062e1 100644 --- a/docs/fumadocs/content/docs/cicd.mdx +++ b/docs/fumadocs/content/docs/cicd.mdx @@ -10,9 +10,9 @@ Generate templates for automated skill management. ## Generate Templates ```bash -skillkit cicd github-action -skillkit cicd gitlab-ci -skillkit cicd pre-commit +skillkit cicd init --provider github +skillkit cicd init --provider gitlab +skillkit cicd init --provider circleci ``` ## GitHub Actions diff --git a/docs/fumadocs/content/docs/commands.mdx b/docs/fumadocs/content/docs/commands.mdx index 103c3969..e5e21a5b 100644 --- a/docs/fumadocs/content/docs/commands.mdx +++ b/docs/fumadocs/content/docs/commands.mdx @@ -41,7 +41,7 @@ skillkit install [options] | `--yes` | `-y` | boolean | Skip confirmation prompts | | `--global` | `-g` | boolean | Install to global directory | | `--force` | `-f` | boolean | Overwrite existing skills | -| `--provider` | `-p` | string | Force provider: github, gitlab, bitbucket | +| `--provider` | `-p` | string | Force provider: GitHub, GitLab, Bitbucket | | `--list` | `-l` | boolean | List available skills without installing | | `--agent` | — | array | Target specific agents (repeatable) | diff --git a/docs/fumadocs/content/docs/quickstart.mdx b/docs/fumadocs/content/docs/quickstart.mdx index 15a77b7b..b56f97ad 100644 --- a/docs/fumadocs/content/docs/quickstart.mdx +++ b/docs/fumadocs/content/docs/quickstart.mdx @@ -160,7 +160,7 @@ Your choices are saved to `~/.skillkit/preferences.json`: "lastSelectedAgents": ["claude", "cursor"], "autoSync": true, "marketplace": { - "lastRefresh": "2024-01-01T00:00:00Z" + "lastRefresh": "2025-01-01T00:00:00Z" } } ``` diff --git a/docs/fumadocs/content/docs/skills.mdx b/docs/fumadocs/content/docs/skills.mdx index 4ee50260..aa5361e7 100644 --- a/docs/fumadocs/content/docs/skills.mdx +++ b/docs/fumadocs/content/docs/skills.mdx @@ -5,7 +5,7 @@ description: Understanding AI agent skills - format, lifecycle, and quality # Skills -A skill is an instruction file that teaches AI coding agents how to handle specific tasks. Each skill uses a universal markdown format (SKILL.md) with YAML frontmatter. +A skill is an instruction file that teaches AI coding agents how to handle specific tasks. Each skill uses a universal Markdown format (SKILL.md) with YAML frontmatter. ## Skills vs Context vs Commands diff --git a/docs/fumadocs/content/docs/testing.mdx b/docs/fumadocs/content/docs/testing.mdx index ce6244fb..560ee17c 100644 --- a/docs/fumadocs/content/docs/testing.mdx +++ b/docs/fumadocs/content/docs/testing.mdx @@ -1,11 +1,11 @@ --- title: Testing -description: Test skills with 14+ assertion types +description: Test skills with multiple assertion types --- # Testing -SkillKit includes a testing framework with 14+ assertion types. +SkillKit includes a testing framework with multiple assertion types. ## Run Tests diff --git a/docs/fumadocs/src/app/api/generate-skill/route.ts b/docs/fumadocs/src/app/api/generate-skill/route.ts new file mode 100644 index 00000000..affb1a1a --- /dev/null +++ b/docs/fumadocs/src/app/api/generate-skill/route.ts @@ -0,0 +1,127 @@ +import { GoogleGenAI, Type, Schema } from "@google/genai"; +import { NextRequest, NextResponse } from "next/server"; + +const agentSkillSchema: Schema = { + type: Type.OBJECT, + properties: { + name: { type: Type.STRING, description: "Skill name in slug format (e.g., 'react-best-practices')" }, + title: { type: Type.STRING, description: "Human readable title" }, + description: { type: Type.STRING, description: "Brief description of what this skill teaches AI agents" }, + version: { type: Type.STRING, description: "Semantic version (e.g., '1.0.0')" }, + tags: { + type: Type.ARRAY, + items: { type: Type.STRING }, + description: "Tags for categorization" + }, + applicability: { type: Type.STRING, description: "When the AI agent should apply this skill (e.g., 'Apply when working with React components')" }, + principles: { + type: Type.ARRAY, + items: { + type: Type.OBJECT, + properties: { + title: { type: Type.STRING }, + description: { type: Type.STRING, description: "Detailed instruction for the AI agent" }, + priority: { type: Type.STRING, description: "must, should, or may" } + }, + required: ["title", "description", "priority"] + }, + description: "Core principles and guidelines (5-8 items)" + }, + patterns: { + type: Type.ARRAY, + items: { + type: Type.OBJECT, + properties: { + name: { type: Type.STRING }, + description: { type: Type.STRING }, + example: { type: Type.STRING, description: "Code example demonstrating the pattern" }, + language: { type: Type.STRING, description: "Programming language for syntax highlighting" } + }, + required: ["name", "description", "example"] + }, + description: "Code patterns with examples (3-5 items)" + }, + antiPatterns: { + type: Type.ARRAY, + items: { + type: Type.OBJECT, + properties: { + name: { type: Type.STRING }, + description: { type: Type.STRING }, + badExample: { type: Type.STRING, description: "Code showing what NOT to do" }, + goodExample: { type: Type.STRING, description: "Code showing the correct approach" } + }, + required: ["name", "description"] + }, + description: "Anti-patterns to avoid (2-4 items)" + }, + filePatterns: { + type: Type.ARRAY, + items: { type: Type.STRING }, + description: "Glob patterns for files this skill applies to (e.g., '*.tsx', 'src/components/**')" + }, + references: { + type: Type.ARRAY, + items: { type: Type.STRING }, + description: "Links to official documentation or resources" + } + }, + required: ["name", "title", "description", "version", "tags", "applicability", "principles", "patterns", "antiPatterns"] +}; + +export async function POST(request: NextRequest) { + const apiKey = process.env.GEMINI_API_KEY; + if (!apiKey) { + return NextResponse.json({ error: "Gemini API key not configured" }, { status: 500 }); + } + + try { + const { topic } = await request.json(); + const sanitizedTopic = topic?.trim().slice(0, 500) || ''; + if (!sanitizedTopic) { + return NextResponse.json({ error: "Topic is required" }, { status: 400 }); + } + + const ai = new GoogleGenAI({ apiKey }); + const response = await ai.models.generateContent({ + model: "gemini-2.0-flash", + contents: `Create a comprehensive AI coding agent skill for: "${sanitizedTopic}" + +This skill will be used by AI coding assistants (like Claude Code, Cursor, GitHub Copilot) to provide better code suggestions and follow best practices. + +The skill should include: +1. Clear principles that tell the AI WHAT to do and WHEN +2. Code patterns with REAL, WORKING examples (not pseudocode) +3. Anti-patterns showing common mistakes and how to fix them +4. Specific file patterns where this skill applies + +Make the instructions actionable and specific. The AI agent should be able to directly apply these guidelines when writing code. + +Focus on practical, production-ready patterns used in modern development.`, + config: { + responseMimeType: "application/json", + responseSchema: agentSkillSchema, + systemInstruction: `You are an expert software architect creating AI agent skills. +Your skills are used by AI coding assistants to write better code. + +Guidelines: +- Write instructions as commands to the AI (e.g., "Always use...", "Never...", "Prefer...") +- Include REAL code examples, not pseudocode +- Be specific and actionable +- Focus on modern best practices (2024+) +- Include edge cases and error handling patterns +- Make principles enforceable and testable` + } + }); + + if (!response.text) { + return NextResponse.json({ error: "No response from Gemini" }, { status: 500 }); + } + + const data = JSON.parse(response.text); + return NextResponse.json(data); + } catch (error) { + console.error("Gemini API Error:", error); + return NextResponse.json({ error: "Failed to generate skill" }, { status: 500 }); + } +} diff --git a/docs/fumadocs/src/components/Agents.tsx b/docs/fumadocs/src/components/Agents.tsx index afe855bf..e977772b 100644 --- a/docs/fumadocs/src/components/Agents.tsx +++ b/docs/fumadocs/src/components/Agents.tsx @@ -307,12 +307,13 @@ const SCROLL_ANIMATION_STYLES = ` export function Agents(): React.ReactElement { const duplicatedAgents = [...AGENTS, ...AGENTS]; + const agentCount = AGENTS.length; return (

- Works with 32 AI Agents + Works with {agentCount} AI Agents

diff --git a/docs/fumadocs/src/components/Button.tsx b/docs/fumadocs/src/components/Button.tsx index 5fe5dcdf..73eb48fe 100644 --- a/docs/fumadocs/src/components/Button.tsx +++ b/docs/fumadocs/src/components/Button.tsx @@ -22,6 +22,7 @@ export function Button({ fullWidth = false, isLoading = false, disabled, + type = 'button', ...props }: ButtonProps): React.ReactElement { const widthClass = fullWidth ? 'w-full' : ''; @@ -36,6 +37,7 @@ export function Button({ return (