From b8596ed8a7c2b65dcbb1e3665cf26628b25d9c65 Mon Sep 17 00:00:00 2001 From: Gemini AI Date: Sun, 14 Dec 2025 21:20:15 +0400 Subject: [PATCH] Skills: Imported 24 skills (16 Anthropic + 8 dev) - Updated README intelligent features --- README.md | 21 ++- lib/skills.mjs | 423 +++++++++++++++++++++++++++++++++++-------------- 2 files changed, 317 insertions(+), 127 deletions(-) diff --git a/README.md b/README.md index 3b79871..cd456e1 100644 --- a/README.md +++ b/README.md @@ -150,13 +150,20 @@ The redesigned settings panel gives you one-click access to all features with li ``` ### šŸŽÆ Skills Library (`/skills`, `/skill`) -**NEW!** 10 pre-built AI skill prompts for common tasks: -- `test` - Generate unit tests -- `refactor` - Code refactoring suggestions -- `review` - Thorough code review -- `docs` - Generate documentation -- `security` - Security audit -- `explain` - Explain code in simple terms +**NEW!** 24 pre-built AI skill prompts imported from [Anthropic's Official Skills](https://github.com/anthropics/skills): + +| Category | Skills | +|----------|--------| +| **Design** | `algorithmic-art`, `brand-guidelines`, `canvas-design`, `theme-factory`, `frontend-design` | +| **Documents** | `pdf`, `docx`, `pptx`, `xlsx` | +| **Development** | `mcp-builder`, `web-artifacts-builder`, `test`, `refactor`, `review`, `api`, `schema`, `explain` | +| **Testing** | `webapp-testing` | +| **Writing** | `doc-coauthoring`, `internal-comms` | +| **Creative** | `slack-gif-creator`, `skill-creator` | +| **Security** | `security` | +| **Docs** | `docs` | + +Usage: `/skill pdf` then describe what you need! ### šŸ”§ Debug Logging (`/debug`) **NEW!** Toggle detailed API request/response logging for debugging: diff --git a/lib/skills.mjs b/lib/skills.mjs index 1d5abea..ee14d31 100644 --- a/lib/skills.mjs +++ b/lib/skills.mjs @@ -1,18 +1,252 @@ /** - * Skills Library - Pre-built AI prompts for common tasks - * Provides /skills and /skill commands + * Skills Library - Anthropic-compatible AI prompts for OpenQode TUI + * Imported from: https://github.com/anthropics/skills/tree/main/skills + * Plus original development-focused skills * * Original implementation for OpenQode TUI */ /** - * Skill definition structure + * Anthropic Official Skills (16) */ -const SKILLS = { - // Development Skills - test: { +const ANTHROPIC_SKILLS = { + // Design & Creative + 'algorithmic-art': { + name: 'Algorithmic Art', + description: 'Create generative and algorithmic art pieces', + category: 'design', + prompt: `You are an expert in algorithmic and generative art. +Help the user create beautiful algorithmic art pieces using code. +Focus on: +- Mathematical patterns and fractals +- Procedural generation techniques +- Color theory and palettes +- SVG, Canvas, or Processing-style code +- Creating visually stunning outputs` + }, + + 'brand-guidelines': { + name: 'Brand Guidelines', + description: 'Create comprehensive brand identity guidelines', + category: 'design', + prompt: `You are a brand identity expert. +Create comprehensive brand guidelines including: +- Logo usage rules and variations +- Color palette (primary, secondary, accent) +- Typography hierarchy +- Voice and tone guidelines +- Do's and don'ts +- Application examples` + }, + + 'canvas-design': { + name: 'Canvas Design', + description: 'Design interactive canvas-based graphics', + category: 'design', + prompt: `You are an expert in HTML Canvas graphics. +Create interactive canvas-based designs including: +- Animations and transitions +- User interaction handling +- Particle systems +- Drawing and painting tools +- Game graphics +- Data visualizations` + }, + + 'theme-factory': { + name: 'Theme Factory', + description: 'Create custom themes for applications', + category: 'design', + prompt: `You are a theming expert. +Create comprehensive themes including: +- Color schemes (light/dark modes) +- CSS variables and tokens +- Component styling +- Consistent spacing and typography +- Accessibility considerations +- Theme switching logic` + }, + + 'frontend-design': { + name: 'Frontend Design', + description: 'Design beautiful frontend interfaces', + category: 'design', + prompt: `You are a frontend design expert. +Create stunning, modern UI designs with: +- Responsive layouts +- Modern CSS techniques (Grid, Flexbox) +- Micro-interactions and animations +- Accessibility best practices +- Performance optimization +- Cross-browser compatibility` + }, + + // Document Generation + 'pdf': { + name: 'PDF Generator', + description: 'Generate professional PDF documents', + category: 'documents', + prompt: `You are a PDF generation expert. +Create professional PDF documents with: +- Proper structure and formatting +- Headers, footers, page numbers +- Tables and figures +- Code for generating PDFs (jsPDF, pdfkit, etc.) +- Print-ready layouts +- Accessibility features` + }, + + 'docx': { + name: 'Word Document', + description: 'Generate Microsoft Word documents', + category: 'documents', + prompt: `You are a document generation expert. +Create professional Word documents with: +- Proper heading hierarchy +- Styled paragraphs and lists +- Tables and images +- Headers and footers +- Code for generating DOCX (docx npm package) +- Template-based generation` + }, + + 'pptx': { + name: 'PowerPoint Slides', + description: 'Generate presentation slides', + category: 'documents', + prompt: `You are a presentation expert. +Create compelling PowerPoint presentations with: +- Clear slide structure +- Visual hierarchy +- Charts and diagrams +- Speaker notes +- Code for generating PPTX (pptxgenjs) +- Consistent branding` + }, + + 'xlsx': { + name: 'Excel Spreadsheet', + description: 'Generate Excel spreadsheets with data', + category: 'documents', + prompt: `You are a spreadsheet expert. +Create professional Excel spreadsheets with: +- Formatted tables and cells +- Formulas and calculations +- Charts and visualizations +- Multiple worksheets +- Code for generating XLSX (exceljs, xlsx) +- Data validation` + }, + + // Communication + 'doc-coauthoring': { + name: 'Document Co-Author', + description: 'Collaborate on document writing', + category: 'writing', + prompt: `You are a collaborative writing expert. +Help co-author documents with: +- Maintaining consistent voice and style +- Seamless section integration +- Constructive editing suggestions +- Version tracking awareness +- Clear handoff points +- Coherent narrative flow` + }, + + 'internal-comms': { + name: 'Internal Communications', + description: 'Write internal company communications', + category: 'writing', + prompt: `You are an internal communications expert. +Create effective internal communications: +- Company announcements +- Team updates +- Policy communications +- Change management messages +- Appropriate tone for audience +- Clear calls to action` + }, + + 'slack-gif-creator': { + name: 'Slack GIF Creator', + description: 'Create custom GIFs for Slack', + category: 'creative', + prompt: `You are a GIF creation expert. +Create engaging animated GIFs for Slack: +- Reaction GIFs +- Celebration animations +- Custom team expressions +- Appropriate file sizes +- Loop optimization +- Accessibility considerations` + }, + + // Development + 'mcp-builder': { + name: 'MCP Builder', + description: 'Build Model Context Protocol servers', + category: 'development', + prompt: `You are an MCP (Model Context Protocol) expert. +Build MCP servers and tools with: +- Proper protocol implementation +- Tool definitions +- Resource handling +- Error handling +- TypeScript/JavaScript implementation +- Integration with Claude/AI assistants` + }, + + 'web-artifacts-builder': { + name: 'Web Artifacts Builder', + description: 'Create interactive web artifacts', + category: 'development', + prompt: `You are a web artifacts expert. +Create self-contained, interactive web artifacts: +- Single HTML file with embedded CSS/JS +- Interactive components +- Data visualizations +- Mini applications +- Shareable code snippets +- No external dependencies` + }, + + 'webapp-testing': { + name: 'Web App Testing', + description: 'Comprehensive web application testing', + category: 'testing', + prompt: `You are a web application testing expert. +Create comprehensive test suites including: +- Unit tests (Jest, Vitest) +- Integration tests +- E2E tests (Playwright, Cypress) +- Visual regression tests +- Performance testing +- Accessibility testing +- Coverage reports` + }, + + 'skill-creator': { + name: 'Skill Creator', + description: 'Create new Claude skills', + category: 'meta', + prompt: `You are a skill creation expert. +Help create new Claude/AI skills with: +- Clear skill definition +- Detailed prompts +- Example inputs/outputs +- Edge case handling +- Testing guidelines +- Documentation` + } +}; + +/** + * Development Skills (Original OpenQode) + */ +const DEV_SKILLS = { + 'test': { name: 'Unit Tests', - description: 'Generate comprehensive unit tests for code', + description: 'Generate comprehensive unit tests', category: 'development', prompt: `Generate comprehensive unit tests for the provided code. Include: @@ -21,11 +255,10 @@ Include: - Mock dependencies where appropriate - Clear test descriptions - Setup and teardown if needed - -Format: Use the appropriate testing framework for the language (Jest, pytest, etc.)` +Format: Use the appropriate testing framework (Jest, pytest, etc.)` }, - refactor: { + 'refactor': { name: 'Refactor Code', description: 'Suggest refactoring improvements', category: 'development', @@ -36,138 +269,97 @@ Focus on: - Performance optimizations - Design pattern opportunities - Type safety improvements - -Provide before/after examples for each suggestion.` +Provide before/after examples.` }, - review: { + 'review': { name: 'Code Review', - description: 'Perform a thorough code review', + description: 'Perform thorough code review', category: 'development', - prompt: `Perform a thorough code review of the provided code. + prompt: `Perform a thorough code review. Check for: - Bugs and logic errors - Security vulnerabilities - Performance issues -- Code style and consistency +- Code style consistency - Documentation gaps - Error handling - Rate severity: šŸ”“ Critical | 🟔 Warning | 🟢 Suggestion` }, - debug: { - name: 'Debug Helper', - description: 'Help diagnose and fix bugs', - category: 'development', - prompt: `Help debug the provided code/error. -Approach: -1. Identify the root cause -2. Explain why the error occurs -3. Provide the fix with explanation -4. Suggest prevention strategies - -Include stack trace analysis if provided.` - }, - - // Documentation Skills - docs: { - name: 'Documentation', - description: 'Generate comprehensive documentation', - category: 'documentation', - prompt: `Generate comprehensive documentation for the provided code. -Include: -- Overview/purpose -- Installation/setup (if applicable) -- API reference with parameters and return values -- Usage examples -- Configuration options -- Common issues/FAQ - -Format: Markdown with proper headings.` - }, - - readme: { - name: 'README Generator', - description: 'Create a professional README.md', - category: 'documentation', - prompt: `Create a professional README.md for this project. -Include: -- Project title and badges -- Description -- Features list -- Quick start guide -- Installation steps -- Usage examples -- Configuration -- Contributing guidelines -- License - -Make it visually appealing with emojis and formatting.` - }, - - // Analysis Skills - explain: { - name: 'Code Explainer', - description: 'Explain code in simple terms', - category: 'analysis', - prompt: `Explain the provided code in simple, clear terms. -Structure: -1. High-level purpose (what it does) -2. Step-by-step walkthrough -3. Key concepts used -4. How it fits in larger context - -Use analogies where helpful. Suitable for juniors.` - }, - - security: { + 'security': { name: 'Security Audit', description: 'Check for security vulnerabilities', - category: 'analysis', - prompt: `Perform a security audit of the provided code. + category: 'development', + prompt: `Perform a security audit. Check for: -- Injection vulnerabilities (SQL, XSS, etc.) +- Injection vulnerabilities (SQL, XSS) - Authentication/authorization issues - Sensitive data exposure -- Insecure dependencies - Cryptographic weaknesses - OWASP Top 10 issues - Severity: šŸ”“ Critical | 🟠 High | 🟔 Medium | 🟢 Low` }, - // Generation Skills - api: { + 'docs': { + name: 'Documentation', + description: 'Generate comprehensive documentation', + category: 'documentation', + prompt: `Generate comprehensive documentation. +Include: +- Overview/purpose +- API reference with parameters +- Usage examples +- Configuration options +- Common issues/FAQ +Format: Markdown with proper headings.` + }, + + 'explain': { + name: 'Code Explainer', + description: 'Explain code in simple terms', + category: 'development', + prompt: `Explain the provided code in simple, clear terms. +Structure: +1. High-level purpose +2. Step-by-step walkthrough +3. Key concepts used +4. How it fits in context +Use analogies. Suitable for juniors.` + }, + + 'api': { name: 'API Design', description: 'Design REST API endpoints', - category: 'generation', - prompt: `Design REST API endpoints for the described functionality. + category: 'development', + prompt: `Design REST API endpoints. Include: - Endpoint paths and methods - Request/response schemas (JSON) - Status codes - Authentication requirements - Rate limiting suggestions -- OpenAPI/Swagger format if helpful` +- OpenAPI/Swagger format` }, - schema: { + 'schema': { name: 'Database Schema', description: 'Design database schema', - category: 'generation', - prompt: `Design a database schema for the described requirements. + category: 'development', + prompt: `Design a database schema. Include: - Tables and columns with types - Primary/foreign keys - Indexes for performance -- Relationships diagram (text-based) -- Migration script if helpful - -Consider normalization and query patterns.` +- Relationships diagram +- Migration script +Consider normalization and queries.` } }; +// Merge all skills +const SKILLS = { ...ANTHROPIC_SKILLS, ...DEV_SKILLS }; + /** * Get all available skills */ @@ -183,14 +375,12 @@ export function getAllSkills() { */ export function getSkillsByCategory() { const categories = {}; - Object.entries(SKILLS).forEach(([id, skill]) => { if (!categories[skill.category]) { categories[skill.category] = []; } categories[skill.category].push({ id, ...skill }); }); - return categories; } @@ -202,26 +392,15 @@ export function getSkill(skillId) { } /** - * Execute a skill - returns the prompt to inject - * @param {string} skillId - Skill ID - * @param {string} userInput - User's additional input/code + * Execute a skill */ export function executeSkill(skillId, userInput = '') { const skill = getSkill(skillId); if (!skill) return null; - const fullPrompt = `[SKILL: ${skill.name}] - -${skill.prompt} - -USER INPUT/CODE: -${userInput} - -Please proceed with the ${skill.name.toLowerCase()} task.`; - return { skill, - prompt: fullPrompt + prompt: `[SKILL: ${skill.name}]\n\n${skill.prompt}\n\nUSER INPUT:\n${userInput}` }; } @@ -232,11 +411,15 @@ export function getSkillListDisplay() { const categories = getSkillsByCategory(); let output = ''; - for (const [category, skills] of Object.entries(categories)) { - output += `\nšŸ“ ${category.toUpperCase()}\n`; - skills.forEach(skill => { - output += ` /skill ${skill.id.padEnd(10)} - ${skill.description}\n`; - }); + const categoryOrder = ['design', 'documents', 'development', 'testing', 'writing', 'creative', 'documentation', 'meta']; + + for (const category of categoryOrder) { + if (categories[category]) { + output += `\nšŸ“ ${category.toUpperCase()}\n`; + categories[category].forEach(skill => { + output += ` /skill ${skill.id.padEnd(20)} ${skill.description}\n`; + }); + } } return output;