npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ai-prompt-gen

v1.3.2

Published

Generate contextual prompts for AI assistants from your project files

Readme

AI Prompt Generator

🤖 Generate contextual prompts for AI assistants (ChatGPT, Claude, Gemini, etc.) from your project files with smart file filtering, wildcard patterns, and custom descriptions.

Installation

# Install in your project
npm install ai-prompt-gen --save-dev

# Or install globally
npm install -g ai-prompt-gen

Quick Start

# 1. Go to your project directory
cd my-project

# 2. Create intelligent config (scans current directory)
ai-prompt --init

# 3. Generate prompts immediately
ai-prompt default     # All important project files
ai-prompt frontend    # Default + frontend-specific files  
ai-prompt backend     # Default + backend-specific files

# 4. Add files when needed
ai-prompt add frontend src/NewComponent.vue
ai-prompt add frontend ./components/*.svelte "All Svelte components"
ai-prompt add backend ./api/**/*.js "All API endpoints"
ai-prompt add backend app/controllers/ApiController.php "REST API endpoints"

Features

Explicit file control - You define exactly which files to include
Wildcard patterns - Add multiple files at once with *, **, and ? patterns
File descriptions - Add context for each file to help AI understand
Multiple profiles - Different contexts for different use cases
Default project context - Core files automatically included in all prompts ✅ Intelligent initialization - Automatically scans your project for code files ✅ Gitignore support - Respects your .gitignore patterns automatically ✅ Easy file management - Add single files or patterns to profiles with simple commands ✅ Automatic clipboard - Generated prompts copied directly to clipboard
Syntax highlighting - Proper code formatting in prompts
Missing file warnings - Alerts for files that don't exist
Duplicate detection - Skip files already in profiles
Multi-AI support - Works with ChatGPT, Claude, Gemini, and any AI assistant

How It Works

1. Intelligent Initialization

When you run ai-prompt --init, the tool:

  • Scans your current directory for code files (HTML, CSS, JS, TS, PHP, Vue, Svelte, etc.)
  • Respects .gitignore - Automatically excludes files and folders listed in your .gitignore
  • Creates a smart config with found files organized into logical profiles
  • Generates descriptions automatically based on file types
  • Sets up a default profile with your most important project files

2. Default Project Context

Every profile (except 'default' itself) automatically includes files from the 'default' profile, ensuring consistent project context across all your prompts.

3. Easy File Management

Add new files to any profile with simple commands:

# Single file
ai-prompt add frontend src/components/NewComponent.vue "Main navigation component"

# Multiple files with wildcards
ai-prompt add frontend ./components/*.svelte "All Svelte components"
ai-prompt add backend ./api/**/*.js "All API endpoints in subdirectories"

Wildcard Patterns

The tool supports powerful wildcard patterns for adding multiple files at once:

| Pattern | Description | Example | |---------|-------------|---------| | * | Any characters (not across directories) | ./src/*.js - All .js files in src/ | | ** | Any characters including subdirectories | ./src/**/*.ts - All .ts files in src/ and subdirs | | ? | Single character | ./test?.js - test1.js, testA.js, etc. |

Wildcard Examples:

# All components in a directory
ai-prompt add frontend ./components/*.vue
ai-prompt add frontend ./components/*.svelte

# All files in subdirectories
ai-prompt add backend ./api/**/*.js
ai-prompt add frontend ./src/**/*.ts

# Specific patterns
ai-prompt add backend ./routes/*.route.js
ai-prompt add frontend ./pages/**/*.page.vue

# All test files
ai-prompt add testing ./tests/**/*.test.js
ai-prompt add testing ./**/*.spec.ts

Configuration

The ai-prompts.config.json file defines your prompt profiles. After running --init, it will look something like:

{
  "profiles": {
    "default": {
      "description": "Standard Projekt-Kontext mit allen relevanten Dateien",
      "files": [
        {
          "path": "package.json",
          "description": "Project dependencies and scripts"
        },
        {
          "path": "src/main.js",
          "description": "JavaScript Module - main.js"
        }
      ],
      "context": "Du hilfst bei der Entwicklung dieses Projekts. Analysiere die bereitgestellten Dateien und gib kontextbezogene Unterstützung."
    },
    "frontend": {
      "description": "Frontend-spezifische Entwicklung",
      "files": [
        {
          "path": "src/components/Header.vue",
          "description": "Vue Component - Header.vue"
        }
      ],
      "context": "Du hilfst bei Frontend-Entwicklung. Fokus auf UI/UX, Components und User Interaction."
    }
  }
}

Usage in package.json

Add scripts to your package.json for easy access:

{
  "scripts": {
    "prompt:default": "ai-prompt default",
    "prompt:frontend": "ai-prompt frontend",
    "prompt:backend": "ai-prompt backend"
  }
}

Then use:

npm run prompt:default
npm run prompt:frontend

Commands

  • ai-prompt <profile> - Generate prompt for specified profile (includes default files)
  • ai-prompt default - Generate prompt with all core project files
  • ai-prompt add <profile> <file/pattern> [description] - Add file(s) to profile (supports wildcards)
  • ai-prompt --init - Scan current directory and create intelligent configuration
  • ai-prompt --list - Show available profiles
  • ai-prompt --help - Show help information

Examples

# Initialize in your project
ai-prompt --init

# Generate different contextual prompts
ai-prompt default                    # All core files
ai-prompt frontend                   # Default + frontend files
ai-prompt backend                    # Default + backend files

# Add single files to profiles
ai-prompt add frontend src/App.vue
ai-prompt add backend api/UserController.php "Handles user CRUD operations"
ai-prompt add default README.md "Project documentation"

# Add multiple files with wildcards
ai-prompt add frontend ./components/*.svelte "All Svelte components"
ai-prompt add backend ./api/**/*.js "All API endpoints"
ai-prompt add frontend ./src/*.{vue,js} "Vue and JS files in src"
ai-prompt add testing ./tests/**/*.test.js "All test files"
ai-prompt add docs ./**/*.md "All documentation files"

# Complex patterns
ai-prompt add backend ./models/**/*.model.js "Database models"
ai-prompt add frontend ./pages/**/*.page.vue "All page components"
ai-prompt add config ./*.config.js "Configuration files"

Programmatic Usage

You can also use the generator programmatically:

const { AIPromptGenerator } = require('ai-prompt-gen');

const generator = new AIPromptGenerator();
generator.loadConfig();
const prompt = await generator.generatePrompt('frontend');

// Add files programmatically (supports wildcards)
generator.addFilesToProfile('frontend', './components/*.vue');

Why Use This?

Problem: Manually creating AI projects and uploading files is time-consuming, especially when you want different contexts for different types of questions. You also need consistent project context across different specialized prompts.

Solution:

  • Intelligent project scanning - Automatically discovers your code files
  • Wildcard file matching - Add multiple files instantly with patterns
  • Default project context - Core files included in every prompt for consistency
  • Smart profiles - Only relevant files with helpful descriptions for specific contexts
  • Instant generation - Prompts ready in your clipboard in seconds

Benefits:

  • Zero setup time - --init analyzes your project automatically
  • Bulk file operations - Wildcards let you add dozens of files instantly
  • Consistent context - Default files ensure AI always understands your project
  • Faster workflow - Generate prompts in seconds instead of minutes
  • Better AI responses - AI gets exactly the right files with descriptions
  • Always current - Uses your latest file versions every time
  • Token efficient - Only include relevant files for your specific question type
  • Universal - Works with ChatGPT, Claude, Gemini, and any AI assistant

License

MIT