awesome-claude-plugins
A curated list of Plugins that let you extend Claude Code with custom commands, agents, hooks, and MCP servers through the plugin system.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/composio-community-awesome-claude-plugins)HTML
<a href="/listings/composio-community-awesome-claude-plugins"><img src="/api/listings/composio-community-awesome-claude-plugins/badge.svg" alt="findsafeskills safety rating" /></a>Install
Install instructions from the README
As written by the repo's author. findsafeskills has not verified these steps.
/connect-apps:setup
Paste your API key when asked. (Get a free key at [dashboard.composio.dev](https://dashboard.composio.dev/login?utm_source=Github&utm_medium=Banner&utm_content=AwesomePlugins)
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
.claude-plugin/marketplace.json · Manifest · 254 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- {
- "name": "awesome-claude-plugins",
- "owner": {
- "name": "Composio",
- "email": "support@composio.dev"
- },
- "metadata": {
- "description": "A curated marketplace of production-ready plugins for Claude Code",
- "version": "1.0.0",
- "pluginRoot": "./"
- },
- "plugins": [
- {
- "name": "connect-apps",
- "source": "./connect-apps",
- "description": "Connect Claude to 500+ apps - Gmail, Slack, GitHub, Notion, and more",
- "category": "integrations",
- "tags": ["integrations", "oauth", "gmail", "slack", "github", "notion"],
- "author": {
- "name": "Composio"
- }
- },
- {
- "name": "frontend-design",
- "source": "./frontend-design",
- "description": "Create distinctive, production-grade interfaces avoiding generic AI aesthetics",
- "category": "frontend",
- "tags": ["frontend", "design", "ui", "css", "react"],
- "author": {
- "name": "Anthropic"
- }
- },
- {
- "name": "artifacts-builder",
- "source": "./artifacts-builder",
- "description": "Build complex HTML artifacts with React, Tailwind CSS, and shadcn/ui",
- "category": "frontend",
- "tags": ["frontend", "react", "tailwind", "shadcn", "artifacts"],
- "author": {
- "name": "Composio"
- }
- },
- {
- "name": "theme-factory",
- "source": "./theme-factory",
- "description": "10 professional themes for slides, docs, reports, and landing pages",
- "category": "frontend",
- "tags": ["design", "themes", "styling", "branding"],
- "author": {
- "name": "Composio"
- }
- },
- {
- "name": "canvas-design",
- "source": "./canvas-design",
- "description": "Create museum-quality visual art in PNG and PDF formats",
- "category": "frontend",
- "tags": ["design", "art", "visual", "pdf", "png"],
- "author": {
- "name": "Composio"
- }
- },
- {
- "name": "senior-frontend",
- "source": "./senior-frontend",
- "description": "React/Next.js/TypeScript patterns with bundle analysis and optimization",
- "category": "frontend",
- "tags": ["frontend", "react", "nextjs", "typescript", "performance"],
- "author": {
- "name": "alirezarezvani"
- }
- },
- {
- "name": "frontend-developer",
- "source": "./frontend-developer",
- "description": "Frontend development specialist agent",
- "category": "frontend",
- "tags": ["frontend", "agent", "development"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "commit",
- "source": "./commit",
- "description": "Smart git commits using conventional commit format",
- "category": "git",
- "tags": ["git", "commits", "conventional-commits"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "create-pr",
- "source": "./create-pr",
- "description": "Automates pull request creation with proper templates",
- "category": "git",
- "tags": ["git", "pull-request", "github"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "pr-review",
- "source": "./pr-review",
- "description": "Comprehensive PR reviews with detailed feedback",
- "category": "git",
- "tags": ["git", "code-review", "pull-request"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "changelog-generator",
- "source": "./changelog-generator",
- "description": "Transform git commits into user-friendly changelogs",
- "category": "git",
- "tags": ["git", "changelog", "release-notes"],
- "author": {
- "name": "Composio"
- }
- },
- {
- "name": "ship",
- "source": "./ship",
- "description": "Complete PR workflow from commit to production",
- "category": "git",
- "tags": ["git", "workflow", "deployment", "ci-cd"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "code-review",
- "source": "./code-review",
- "description": "Comprehensive code review with best practices",
- "category": "quality",
- "tags": ["code-review", "quality", "best-practices"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "test-writer-fixer",
- "source": "./test-writer-fixer",
- "description": "Automatically write and fix unit tests",
- "category": "quality",
- "tags": ["testing", "unit-tests", "jest", "vitest"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "debugger",
- "source": "./debugger",
- "description": "Advanced debugging assistant",
- "category": "quality",
- "tags": ["debugging", "troubleshooting"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "bug-fix",
- "source": "./bug-fix",
- "description": "Analyzes and fixes bugs in your codebase",
- "category": "quality",
- "tags": ["debugging", "bug-fix", "troubleshooting"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "backend-architect",
- "source": "./backend-architect",
- "description": "Backend architecture patterns and system design",
- "category": "backend",
- "tags": ["backend", "architecture", "api", "database"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "mcp-builder",
- "source": "./mcp-builder",
- "description": "Build high-quality MCP servers for LLM integrations",
- "category": "backend",
- "tags": ["mcp", "servers", "integrations", "python", "typescript"],
- "author": {
- "name": "Composio"
- }
- },
- {
- "name": "agent-sdk-dev",
- "source": "./agent-sdk-dev",
- "description": "Claude Agent SDK development helper",
- "category": "backend",
- "tags": ["agent-sdk", "agents", "development"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "perf",
- "source": "./perf",
- "description": "Performance analysis and optimization",
- "category": "devops",
- "tags": ["performance", "optimization", "profiling"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "audit-project",
- "source": "./audit-project",
- "description": "Full project audit for quality and issues",
- "category": "devops",
- "tags": ["audit", "quality", "dependencies", "security"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "documentation-generator",
- "source": "./documentation-generator",
- "description": "Generate comprehensive documentation from code",
- "category": "docs",
- "tags": ["documentation", "readme", "api-docs"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "security-guidance",
- "source": "./security-guidance",
- "description": "Security best practices and vulnerability detection",
- "category": "security",
- "tags": ["security", "owasp", "vulnerabilities"],
- "author": {
- "name": "Community"
- }
- },
- {
- "name": "developer-growth-analysis",
- "source": "./developer-growth-analysis",
- "description": "Analyze coding patterns and get personalized learning resources",
- "category": "productivity",
- "tags": ["productivity", "learning", "growth", "analytics"],
- "author": {
- "name": "Composio"
- }
- }
- ]
- }
README.md · README · 236 lines
View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)
This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.
- <h1 align="center">Awesome Claude Code Plugins</h1>
- <p align="center">
- <a href="https://dashboard.composio.dev/login?utm_source=Github&utm_medium=Banner&utm_content=AwesomePlugins">
- <img width="1280" alt="Awesome Claude Plugins" src="./cover_image.png">
- </a>
- </p>
- <p align="center">
- <a href="https://awesome.re">
- <img src="https://awesome.re/badge.svg" alt="Awesome" />
- </a>
- <a href="https://makeapullrequest.com">
- <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square" alt="PRs Welcome" />
- </a>
- <a href="https://opensource.org/licenses/MIT">
- <img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" alt="License: MIT" />
- </a>
- </p>
- <div>
- <p align="center">
- <a href="https://twitter.com/composio">
- <img src="https://img.shields.io/badge/Follow%20on%20X-000000?style=for-the-badge&logo=x&logoColor=white" alt="Follow on X" />
- </a>
- <a href="https://www.linkedin.com/company/composiohq/">
- <img src="https://img.shields.io/badge/Follow%20on%20LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" alt="Follow on LinkedIn" />
- </a>
- <a href="https://discord.com/invite/composio">
- <img src="https://img.shields.io/badge/Join%20our%20Discord-5865F2?style=for-the-badge&logo=discord&logoColor=white" alt="Join our Discord" />
- </a>
- </p>
- </div>
- <p align="center">
- A curated list of production-ready plugins for Claude Code to supercharge your development workflow.
- </p>
- > **Want plugins that do more than generate text?** The [connect-apps](./connect-apps) plugin lets Claude send emails, create issues, post to Slack, and take actions across 1000+ apps.
- ---
- ## Give your skills real-world actions
- Skills tell your agent **how** to work. An MCP Gateway gives it secure access to the tools it needs.
- Composio [MCP Gateway](https://composio.dev/mcp-gateway) provides a single MCP endpoint for 1,000+ integrations with built-in authentication, team-based access controls, audit logs, and production-ready reliability.
- ### 1. Clone & Run
- ```bash
- git clone https://github.com/composiohq/awesome-claude-plugins.git
- cd awesome-claude-plugins
- claude --plugin-dir ./connect-apps
- ```
- ### 2. Run Setup
- ```shell
- /connect-apps:setup
- ```
- Paste your API key when asked. (Get a free key at [dashboard.composio.dev](https://dashboard.composio.dev/login?utm_source=Github&utm_medium=Banner&utm_content=AwesomePlugins)
- ### 3. Try It
- Ask Claude to send you a test email. If you receive it, Claude is now connected to 1000+ apps.
- **[See all supported apps →](https://composio.dev/tools)**
- ---
- ## Contents
- - [What Are Claude Plugins?](#what-are-claude-plugins)
- - [Plugins](#plugins)
- - [Integrations](#integrations)
- - [Frontend & Design](#frontend--design)
- - [Git & Version Control](#git--version-control)
- - [Code Quality & Testing](#code-quality--testing)
- - [Agent Memory](#agent-memory)
- - [Backend & Architecture](#backend--architecture)
- - [DevOps & Performance](#devops--performance)
- - [Documentation & Security](#documentation--security)
- - [Developer Productivity](#developer-productivity)
- - [Companion & Personality](#companion--personality)
- - [Getting Started](#getting-started)
- - [Contributing](#contributing)
- - [Resources](#resources)
- - [License](#license)
- ## What Are Claude Plugins?
- Claude Plugins are extensions that enhance Claude Code with custom slash commands, specialized agents, hooks, and skills. Plugins can be shared across projects and teams, providing consistent tooling and workflows.
- ## Plugins
- ### Integrations
- - [connect-apps](./connect-apps) - Connect Claude to any app. Send emails, create issues, post messages, update databases - take real actions across Gmail, Slack, GitHub, Notion, and 1000+ services.
- - [kaggle-skill](https://github.com/shepsci/kaggle-skill) - Complete Kaggle integration — account setup, competition reports, dataset/model downloads, notebook execution, submissions, and badge collection.
- ### Frontend & Design
- - [frontend-design](./frontend-design) - Create distinctive, production-grade interfaces. Avoids generic "AI slop" with bold typography, unique color palettes, and creative layouts.
- - [artifacts-builder](./artifacts-builder) - Suite of tools for creating elaborate, multi-component HTML artifacts using React, Tailwind CSS, and shadcn/ui.
- - [theme-factory](./theme-factory) - Applies professional font and color themes to artifacts including slides, docs, reports, and HTML landing pages with 10 pre-set themes.
- - [canvas-design](./canvas-design) - Creates beautiful visual art in PNG and PDF documents using design philosophy and aesthetic principles for posters and static pieces.
- - [senior-frontend](./senior-frontend) - React/Next.js/TypeScript development patterns with bundle analysis, component generation, and accessibility best practices.
- - [frontend-developer](./frontend-developer) - Frontend development specialist agent for building modern web interfaces.
- ### Git & Version Control
- - [commit](./commit) - Creates smart git commits using conventional commit format with meaningful messages and emojis.
- - [create-pr](./create-pr) - Automates pull request creation with proper templates, descriptions, and labels.
- - [pr-review](./pr-review) - Comprehensive PR reviews with detailed feedback on code quality, security, and best practices.
- - [changelog-generator](./changelog-generator) - Automatically creates user-facing changelogs from git commits by analyzing history and transforming technical commits into customer-friendly release notes.
- - [ship](./ship) - Complete PR workflow from commit to production. Lint, test, review, and deploy.
- ### Code Quality & Testing
- - [AgentLint](https://github.com/0xmariowu/AgentLint) - Lint your repo for AI agent compatibility. 33 evidence-backed checks across 5 dimensions. Claude Code plugin.
- - [code-review](./code-review) - Comprehensive code review with best practices, patterns, and improvement suggestions.
- - [test-writer-fixer](./test-writer-fixer) - Automatically write and fix unit tests. Supports Jest, Vitest, Pytest, and more.
- - [debugger](./debugger) - Advanced debugging assistant for tracking down and fixing complex bugs.
- - [bug-fix](./bug-fix) - Analyzes stack traces and code to identify and fix bugs in your codebase.
- ### Agent Memory
- - [glen](https://github.com/Glen-Web-App/glen-claude-code-plugin) - Shared team memory for coding agents. Recalls past decisions on every turn and records what you build, so your whole team's agents work from one history. ([Website](https://tryglen.com))
- ### Backend & Architecture
- - [backend-architect](./backend-architect) - Backend architecture patterns, API design, database schemas, and system design.
- - [mcp-builder](./mcp-builder) - Guides creation of high-quality MCP (Model Context Protocol) servers for integrating external APIs and services with LLMs.
- - [agent-sdk-dev](./agent-sdk-dev) - Claude Agent SDK development helper for building custom AI agents.
- - [maestro-orchestrate](https://github.com/josstei/maestro-orchestrate) - Multi-agent development orchestration coordinating 22 specialized subagents through 4-phase workflows with native parallel execution, persistent sessions, and standalone commands for code review, debugging, security audit, and more.
- ### DevOps & Performance
- - [perf](./perf) - Performance analysis and optimization. Identify bottlenecks and improve speed.
- - [audit-project](./audit-project) - Full project audit for code quality, dependencies, security, and best practices.
- - [MyVibe](https://www.myvibe.so) - Instant deployment to live URLs with `/myvibe:publish`.
- - [aws-cost-saver](https://github.com/prajapatimehul/aws-cost-saver) - Automated AWS cost optimization with 173 checks across EC2, RDS, S3, Lambda, and more. ML-powered recommendations and real pricing from AWS API.
- - [Manifest](https://github.com/mnfst/manifest) - Real-time cost observability for OpenClaw agents — track tokens, costs, messages, and model usage. Includes Claude Code [skill](https://github.com/mnfst/manifest/blob/main/skills/manifest/SKILL.md) for guided setup. Self-hosted, OTLP ingestion, 28+ LLM models. ([Website](https://manifest.build))
- ### Documentation & Security
- - [documentation-generator](./documentation-generator) - Generate comprehensive documentation from code. READMEs, API docs, and guides.
- - [security-guidance](./security-guidance) - Security best practices and vulnerability detection. OWASP guidelines and secure coding.
- - [security-sweep](https://github.com/Onome-AJ/security-sweep-plugin) - Comprehensive security scanner covering OWASP Top 10 (2025), Mobile Top 10 (2024), and LLM Top 10 (2025). Scans for hardcoded secrets, injection flaws, auth issues, misconfigurations, and AI-specific vulnerabilities.
- - [asqav-claude-code](https://github.com/jagmarques/asqav-claude-code) - Signs a tamper-evident Asqav receipt at the end of each Claude Code session: files edited (content hashes before/after), commands run (hashed), and git context. Verifiable by anyone at asqav.com/verify.
- ### Developer Productivity
- - [CCHub](https://github.com/Moresl/cchub) - Desktop app for managing the Claude Code ecosystem — MCP marketplace, config profiles, skills & plugins browser, workflow templates, security audit. Built with Tauri v2 + React + Rust.
- - [developer-growth-analysis](./developer-growth-analysis) - Analyzes your recent Claude Code chat history to identify coding patterns, development gaps, and curates personalized learning resources.
- - [skill-bus](./skill-bus) - The skill for connecting skills. Wire context, conditions, and other skills into any skill invocation — declaratively, without modification. Zero dependencies.
- - [context-mode](https://github.com/mksglu/claude-context-mode) - Process large outputs in sandboxed subprocesses, keeping only summaries in the context window. 98% context savings across 21 benchmarked scenarios.
- - [codebase-graph](https://github.com/Phoenixrr2113/codebase-graph) - Code intelligence MCP server that builds knowledge graphs from source code with 42-language tree-sitter AST parsing and FalkorDB.
- - [agntk](https://github.com/Phoenixrr2113/agntk) - Zero-config AI agent CLI with persistent named agents, 20+ built-in tools, and hardware-aware local model selection.
- - [backlog](https://github.com/backloghq/backlog) - Persistent, cross-session task management. 24 MCP tools for tasks, projects, tags, dependencies, and docs. 7 skills for planning, standups, and handoffs. Event-sourced storage, agent coordination, pure TypeScript. ([Website](https://backloghq.io))
- ### Companion & Personality
- - [claude-familiar](https://github.com/yaniv-golan/claude-familiar) - Enhance Claude Code's `/buddy` companion with personality, mood, lore, and interactive commands (fortune, roast, haiku, focus timer). Mood shifts automatically on tool success/failure. Extensible — other plugins can layer traits and lore via `"x-familiarExtensions"` in their `plugin.json`.
- ### Image and Video Generation
- - [nano-banana](https://github.com/Ibrahim-3d/nano-banana-claude-plugin) - Google Gemini image generation plugin. Text-to-image, text-guided image editing, style transfer, 4K output, search grounding, and multi-reference composition — all from a single `/genimage` command. Powered by `gemini-2.5-flash-image` and `gemini-3-pro-image-preview`.
- - [taisly-agent-kit](https://github.com/taisly/agent) - Claude Code plugin, skill, SDK, CLI, and MCP server for publishing short-form videos to TikTok, Instagram Reels, YouTube Shorts, X, and Facebook through Taisly.
- ## Getting Started
- ### Using Plugins
- Clone the repo and run Claude with any plugin:
- ```bash
- git clone https://github.com/composiohq/awesome-claude-plugins.git
- cd awesome-claude-plugins
- claude --plugin-dir ./commit
- ```
- Load multiple plugins at once:
- ```bash
- claude --plugin-dir ./commit --plugin-dir ./code-review --plugin-dir ./connect-apps
- ```
- ### Plugin Structure
- Each plugin follows the standard Claude Code plugin format:
- ```
- plugin-name/
- ├── .claude-plugin/
- │ └── plugin.json # Plugin metadata
- ├── skills/ # Skill definitions (optional)
- │ └── skill-name/
- │ └── SKILL.md
- ├── commands/ # Slash commands (optional)
- │ └── command.md
- ├── agents/ # Agent definitions (optional)
- │ └── agent.md
- └── hooks/ # Event hooks (optional)
- └── hooks.json
- ```
- ## Contributing
- Want to add your plugin?
- 1. Fork this repository
- 2. Add your plugin folder with the standard structure
- 3. Update this README with your plugin details
- 4. Submit a pull request
- Please ensure your plugin:
- - Addresses a real use case
- - Doesn't duplicate existing functionality
- - Follows the template structure
- - Has been tested
- ## Resources
- - [Claude Code Documentation](https://code.claude.com/docs)
- - [Plugin Development Guide](https://code.claude.com/docs/en/plugins)
- - [Discover Plugins](https://code.claude.com/docs/en/discover-plugins)
- - [ComposioHQ/awesome-claude-skills](https://github.com/ComposioHQ/awesome-claude-skills) - More skills and resources
- ## License
- MIT - See individual plugins for their specific licenses.
audit-project/lib/enhance/prompt-analyzer.js · Bundled script · 429 lines · 1 finding marked
- /**
- * Prompt Analyzer
- * Analyzes general prompts for prompt engineering best practices
- *
- * @author Avi Fenesh
- * @license MIT
- */
- const fs = require('fs');
- const path = require('path');
- const { promptPatterns, estimateTokens } = require('./prompt-patterns');
- const reporter = require('./reporter');
- /**
- * Detect prompt file type from path or content
- * @param {string} filePath - File path
- * @param {string} content - File content
- * @returns {string} File type: 'agent', 'command', 'skill', 'prompt', 'markdown'
- */
- function detectPromptType(filePath, content) {
- const lowerPath = filePath.toLowerCase();
- // Check path patterns
- if (lowerPath.includes('/agents/') || lowerPath.includes('\\agents\\')) {
- return 'agent';
- }
- if (lowerPath.includes('/commands/') || lowerPath.includes('\\commands\\')) {
- return 'command';
- }
- if (lowerPath.includes('/skills/') || lowerPath.includes('\\skills\\')) {
- return 'skill';
- }
- if (lowerPath.includes('/prompts/') || lowerPath.includes('\\prompts\\')) {
- return 'prompt';
- }
- // Check content patterns
- if (content) {
- // Agent frontmatter
- if (/^---\s*\nname:\s*\w+/m.test(content)) {
- return 'agent';
- }
- // System prompt indicators
- if (/<system>/i.test(content) || /^##?\s*system\s+prompt/im.test(content)) {
- Note: Usual in code (tag names in paths and patterns): Contains a <system> block, a common wrapper for instructions hidden in a tool description
- Line 44 on GitHub
- return 'prompt';
- }
- }
- return 'markdown';
- }
- /**
- * Analyze a single prompt file
- * @param {string} promptPath - Path to prompt file
- * @param {Object} options - Analysis options
- * @param {boolean} options.verbose - Include LOW certainty issues
- * @returns {Object} Analysis results
- */
- function analyzePrompt(promptPath, options = {}) {
- const { verbose = false } = options;
- const results = {
- promptName: path.basename(promptPath, path.extname(promptPath)),
- promptPath,
- promptType: null,
- tokenCount: 0,
- clarityIssues: [],
- structureIssues: [],
- exampleIssues: [],
- contextIssues: [],
- outputIssues: [],
- antiPatternIssues: []
- };
- // Read file
- if (!fs.existsSync(promptPath)) {
- results.structureIssues.push({
- issue: 'File not found',
- file: promptPath,
- certainty: 'HIGH',
- patternId: 'file_not_found'
- });
- return results;
- }
- let content;
- try {
- content = fs.readFileSync(promptPath, 'utf8');
- } catch (err) {
- results.structureIssues.push({
- issue: `Failed to read file: ${err.message}`,
- file: promptPath,
- certainty: 'HIGH',
- patternId: 'read_error'
- });
- return results;
- }
- // Detect prompt type
- results.promptType = detectPromptType(promptPath, content);
- // Calculate token count
- results.tokenCount = estimateTokens(content);
- // Run each pattern check
- for (const pattern of Object.values(promptPatterns)) {
- // Skip LOW certainty unless verbose
- if (pattern.certainty === 'LOW' && !verbose) {
- continue;
- }
- // Run the check
- const result = pattern.check(content);
- if (result) {
- const issue = {
- ...result,
- file: promptPath,
- certainty: pattern.certainty,
- patternId: pattern.id,
- autoFix: pattern.autoFix
- };
- // Route to appropriate issue category
- switch (pattern.category) {
- case 'clarity':
- results.clarityIssues.push(issue);
- break;
- case 'structure':
- results.structureIssues.push(issue);
- break;
- case 'examples':
- results.exampleIssues.push(issue);
- break;
- case 'context':
- results.contextIssues.push(issue);
- break;
- case 'output':
- results.outputIssues.push(issue);
- break;
- case 'anti-pattern':
- results.antiPatternIssues.push(issue);
- break;
- default:
- results.structureIssues.push(issue);
- }
- }
- }
- return results;
- }
- /**
- * Analyze all prompts in a directory
- * @param {string} promptsDir - Path to prompts directory
- * @param {Object} options - Analysis options
- * @returns {Array} Array of analysis results
- */
- function analyzeAllPrompts(promptsDir, options = {}) {
- const { recursive = true, extensions = ['.md', '.txt'], ...analyzeOptions } = options;
- const results = [];
- // Validate and normalize path
- if (!promptsDir || typeof promptsDir !== 'string') {
- return results;
- }
- // Resolve to absolute path to prevent path traversal
- const resolvedDir = path.resolve(promptsDir);
- if (!fs.existsSync(resolvedDir)) {
- return results;
- }
- // Collect prompt files
- const promptFiles = [];
- function findPromptFiles(dir) {
- let entries;
- try {
- entries = fs.readdirSync(dir, { withFileTypes: true });
- } catch (err) {
- return;
- }
- for (const entry of entries) {
- const fullPath = path.join(dir, entry.name);
- // Ensure traversed paths stay within the resolved directory
- const resolvedFullPath = path.resolve(fullPath);
- if (!resolvedFullPath.startsWith(resolvedDir)) {
- continue;
- }
- if (entry.isDirectory() && recursive) {
- // Skip common non-prompt directories
- if (!['node_modules', '.git', 'dist', 'build', 'tests', '__tests__'].includes(entry.name)) {
- findPromptFiles(fullPath);
- }
- } else if (entry.isFile()) {
- const ext = path.extname(entry.name).toLowerCase();
- if (extensions.includes(ext)) {
- // Skip README files
- if (entry.name.toLowerCase() !== 'readme.md') {
- promptFiles.push(fullPath);
- }
- }
- }
- }
- }
- findPromptFiles(resolvedDir);
- // Analyze each file
- for (const promptFile of promptFiles) {
- const result = analyzePrompt(promptFile, analyzeOptions);
- results.push(result);
- }
- return results;
- }
- /**
- * Main analyze function
- * @param {Object} options - Analysis options
- * @param {string} options.prompt - Specific prompt file path (optional)
- * @param {string} options.promptsDir - Path to prompts directory
- * @param {boolean} options.verbose - Include LOW certainty issues
- * @returns {Object|Array} Analysis results
- */
- function analyze(options = {}) {
- const {
- prompt,
- promptsDir,
- verbose = false
- } = options;
- if (prompt) {
- // Check if prompt is a directory or file
- try {
- const stats = fs.statSync(prompt);
- if (stats.isDirectory()) {
- return analyzeAllPrompts(prompt, { verbose });
- } else {
- return analyzePrompt(prompt, { verbose });
- }
- } catch (err) {
- // If doesn't exist, let analyzePrompt handle the error
- return analyzePrompt(prompt, { verbose });
- }
- } else if (promptsDir) {
- return analyzeAllPrompts(promptsDir, { verbose });
- } else {
- // Default: analyze common prompt locations
- const defaultDirs = ['prompts', 'agents', 'commands', 'skills'];
- const allResults = [];
- for (const dir of defaultDirs) {
- if (fs.existsSync(dir)) {
- const results = analyzeAllPrompts(dir, { verbose });
- allResults.push(...results);
- }
- }
- return allResults.length > 0 ? allResults : [];
- }
- }
- /**
- * Apply fixes to analysis results
- * Currently only aggressive_emphasis is auto-fixable
- * @param {Object|Array} results - Analysis results
- * @param {Object} options - Fix options
- * @returns {Object} Fix results
- */
- function applyFixes(results, options = {}) {
- const { dryRun = false, backup = true } = options;
- const fixResults = {
- applied: [],
- skipped: [],
- errors: []
- };
- // Collect all issues
- let allIssues = [];
- if (Array.isArray(results)) {
- for (const r of results) {
- allIssues.push(...(r.clarityIssues || []));
- allIssues.push(...(r.structureIssues || []));
- allIssues.push(...(r.exampleIssues || []));
- allIssues.push(...(r.contextIssues || []));
- allIssues.push(...(r.outputIssues || []));
- allIssues.push(...(r.antiPatternIssues || []));
- }
- } else {
- allIssues.push(...(results.clarityIssues || []));
- allIssues.push(...(results.structureIssues || []));
- allIssues.push(...(results.exampleIssues || []));
- allIssues.push(...(results.contextIssues || []));
- allIssues.push(...(results.outputIssues || []));
- allIssues.push(...(results.antiPatternIssues || []));
- }
- // Filter to auto-fixable HIGH certainty issues
- const fixableIssues = allIssues.filter(i =>
- i.certainty === 'HIGH' && i.autoFix
- );
- // Group by file
- const byFile = new Map();
- for (const issue of fixableIssues) {
- const fp = issue.file;
- if (!byFile.has(fp)) {
- byFile.set(fp, []);
- }
- byFile.get(fp).push(issue);
- }
- // Process each file
- for (const [filePath, fileIssues] of byFile) {
- try {
- if (!fs.existsSync(filePath)) {
- fixResults.errors.push({ filePath, error: 'File not found' });
- continue;
- }
- let content = fs.readFileSync(filePath, 'utf8');
- const appliedToFile = [];
- for (const issue of fileIssues) {
- try {
- if (issue.patternId === 'aggressive_emphasis') {
- content = fixAggressiveEmphasis(content);
- appliedToFile.push({
- issue: issue.issue,
- fix: 'Reduced aggressive emphasis',
- filePath
- });
- }
- // Add more fixers as needed
- } catch (err) {
- fixResults.errors.push({
- issue: issue.issue,
- filePath,
- error: err.message
- });
- }
- }
- // Write changes
- if (!dryRun && appliedToFile.length > 0) {
- if (backup) {
- fs.writeFileSync(`${filePath}.backup`, fs.readFileSync(filePath, 'utf8'), 'utf8');
- }
- fs.writeFileSync(filePath, content, 'utf8');
- }
- fixResults.applied.push(...appliedToFile);
- } catch (err) {
- fixResults.errors.push({
- filePath,
- error: err.message
- });
- }
- }
- return fixResults;
- }
- /**
- * Fix aggressive emphasis in content
- * @param {string} content - Content to fix
- * @returns {string} Fixed content
- */
- function fixAggressiveEmphasis(content) {
- if (!content) return content;
- // Replace aggressive CAPS phrases with normal case
- const replacements = [
- { pattern: /\bCRITICAL\b/g, replacement: 'critical' },
- { pattern: /\bIMPORTANT\b/g, replacement: 'important' },
- { pattern: /\bMUST\b/g, replacement: 'must' },
- { pattern: /\bNEVER\b/g, replacement: 'never' },
- { pattern: /\bALWAYS\b/g, replacement: 'always' },
- { pattern: /\bREQUIRED\b/g, replacement: 'required' },
- { pattern: /\bMANDATORY\b/g, replacement: 'mandatory' },
- { pattern: /\bESSENTIAL\b/g, replacement: 'essential' },
- { pattern: /\bWARNING\b/g, replacement: 'warning' },
- { pattern: /\bCAUTION\b/g, replacement: 'caution' }
- ];
- let result = content;
- for (const { pattern, replacement } of replacements) {
- result = result.replace(pattern, replacement);
- }
- // Reduce multiple exclamation marks
- result = result.replace(/!{2,}/g, '!');
- return result;
- }
- /**
- * Generate report from analysis results
- * @param {Object|Array} results - Analysis results
- * @param {Object} options - Report options
- * @returns {string} Markdown report
- */
- function generateReport(results, options = {}) {
- if (Array.isArray(results)) {
- return reporter.generatePromptSummaryReport(results, options);
- } else {
- return reporter.generatePromptReport(results, options);
- }
- }
- module.exports = {
- analyzePrompt,
- analyzeAllPrompts,
- analyze,
- applyFixes,
- fixAggressiveEmphasis,
- generateReport,
- detectPromptType,
- estimateTokens
- };
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.