Contributing - diShine-digital-agency/ai-prompt-library GitHub Wiki
How to contribute prompts, code, and frameworks to the AI Prompt Library.
- Adding New Prompts
- Prompt File Format
- Categories
- Adding Generator Frameworks
- Adding CLI Commands
- Running Tests
- Code Style Guidelines
- Pull Request Process
- Bug Reports
- Feature Requests
The easiest way to contribute. Each prompt is a single Markdown file in the prompts/ directory.
- Choose the right category โ see Categories below
-
Create the file โ
prompts/<category>/your-prompt-name.md - Add YAML frontmatter โ metadata at the top of the file
- Write the content โ follow the Prompt File Format
-
Run tests โ
node test/run.js(all tests must pass) - Open a pull request
# 1. Create the file
touch prompts/development/api-testing.md
# 2. Write the content (see format below)
# 3. Run tests
node test/run.js
# 4. The CLI picks it up automatically โ no registration step
node bin/prompt-lib.js show api-testingEvery prompt file follows this structure:
---
title: Your Prompt Title
category: development
tags: [api, testing, quality, automation]
difficulty: intermediate
models: [claude, gpt-4, gemini]
---
# Your Prompt Title
## When to Use
Describe when this technique or template is most useful.
Include specific scenarios and use cases. Also mention when
NOT to use it โ this helps users make better decisions.
## The Technique
Detailed explanation of the approach, methodology, or framework.
Include the reasoning behind why this works and any theory.
## Template
\```
You are a {{role}} specializing in {{domain}}.
TASK:
{{task_description}}
RULES:
- Rule 1
- Rule 2
- {{custom_constraint}}
OUTPUT FORMAT:
Respond in {{format}} with clear sections.
Before responding, verify that your answer is complete and accurate.
\```
## Examples
### Example 1: [Scenario Name]
**Input:**
\```
[Example input with filled placeholders]
\```
**Expected Output:**
\```
[Example of what the AI should produce]
\```
### Example 2: [Another Scenario]
...
## Tips
- Practical tip from real usage experience
- Common adjustment that improves results
- Model-specific advice (e.g., "Claude works best with XML tags here")
## Common Mistakes
- โ Mistake 1 โ why it's wrong and how to fix it
- โ Mistake 2 โ the impact and the correct approach
- โ Mistake 3 โ a subtle pitfall that's easy to miss| Field | Type | Description | Example |
|---|---|---|---|
title |
string | Human-readable title | API Testing Prompt |
category |
string | Category directory name | development |
tags |
array | Searchable keywords | [api, testing, automation] |
difficulty |
string |
beginner, intermediate, or advanced
|
intermediate |
models |
array | Compatible AI models | [claude, gpt-4, gemini] |
- Put the template inside a fenced code block (
```) - Use
{{placeholder_name}}for dynamic fields - Use underscores or hyphens in placeholder names:
{{task_description}},{{output-format}} - Placeholders are detected automatically by
findPlaceholders()using the regex/\{\{[\w_\-\s/]+\}\}/g
| Category | Directory | What Goes Here |
|---|---|---|
frameworks |
prompts/frameworks/ |
Core prompting techniques (Chain-of-Thought, Few-Shot, ReAct, etc.) |
model-specific |
prompts/model-specific/ |
Techniques optimized for specific LLMs (Claude, GPT, Gemini) |
system-prompts |
prompts/system-prompts/ |
Production-ready system prompts (coding assistant, researcher, etc.) |
marketing |
prompts/marketing/ |
Marketing and content templates |
development |
prompts/development/ |
Software engineering templates |
data |
prompts/data/ |
Data analysis and engineering templates |
business |
prompts/business/ |
Business and professional templates |
image-generation |
prompts/image-generation/ |
AI image creation templates |
To create a new category, simply create a new subdirectory in prompts/. The CLI discovers categories automatically from the directory structure.
Generator frameworks are defined in src/generator.js in the FRAMEWORKS object.
Edit src/generator.js and add a new entry to FRAMEWORKS:
'my-framework': {
name: 'My Framework',
description: 'What it does in one sentence',
questions: [
{
key: 'field1',
label: 'Question for the user',
required: true
},
{
key: 'field2',
label: 'Optional question',
required: false,
default: 'default value'
},
],
generate: (answers) => {
return `You are an expert in ${answers.field1}.
TASK:
${answers.field2}
RULES:
- Be specific and actionable
- Show your reasoning
OUTPUT FORMAT:
Structured markdown with clear sections`;
}
}| Field | Type | Required | Description |
|---|---|---|---|
name |
string | โ | Display name |
description |
string | โ | One-sentence description |
questions |
array | โ | Array of question objects |
generate |
function | โ |
(answers) โ string โ generates the prompt |
| Field | Type | Required | Description |
|---|---|---|---|
key |
string | โ | Key used in the answers object |
label |
string | โ | Question text shown to the user |
required |
boolean | โ | Whether the field must be filled |
default |
string | โ | Default value if not provided |
The framework automatically appears in:
- CLI:
prompt-lib generate - Prompt Workshop: Generate tab
CLI commands are defined in bin/prompt-lib.js.
-
Add a case to the
switchstatement inmain():
case 'mycommand': {
// Your command logic here
const arg = args[1];
// ...
break;
}- Add to the HELP string at the top of the file:
const HELP = `
...
Commands:
...
mycommand <arg> Description of what it does
...
`;- Add tests if the command involves new modules
- Interactive commands use
readlinefor user input - Use
copyToClipboard(text)for clipboard copy - Use
formatPromptDetail()etc. fromsrc/formatter.jsfor output - Respect
NO_COLORenvironment variable (handled by formatter.js) - Exit with
process.exit(1)on errors
node test/run.jsThe test suite (test/run.js) runs 46 tests with zero dependencies. Tests verify:
| Test Area | What It Checks |
|---|---|
| Prompt loading | 82+ prompts loaded from files + custom prompts |
| Required fields | Every prompt has slug, title, category, tags, content |
| Search | Scoring and ranking correctness |
| Categories | Category count validation |
| Custom prompts | Creation and persistence |
| Generator | Framework validation, required field checking |
| Linter | Scoring accuracy, rule evaluation |
| Optimizer | Transformation correctness |
| Recommender | Scoring and combo building |
# Before changes โ establish baseline
node test/run.js
# Make your changes...
# After changes โ verify nothing is broken
node test/run.jsAll tests must pass before submitting a pull request.
The project uses ES Modules (ESM). Use import/export syntax:
// โ
Correct
import { readFileSync } from 'fs';
export function myFunction() { ... }
// โ Wrong
const fs = require('fs');
module.exports = { myFunction };Do not add npm packages. Use only Node.js built-in modules:
| Allowed | Not Allowed |
|---|---|
fs, path, url
|
lodash, chalk, inquirer
|
readline, os
|
yargs, commander
|
child_process |
clipboardy, open
|
This is a core design principle. The library works with a fresh Node.js install โ no npm install needed.
- Match the existing code style โ look at nearby code for patterns
- Use
constby default,letwhen reassignment is needed - Use template literals for string interpolation
- Use descriptive variable names
- Comment only when the "why" isn't obvious from the code
-
viewer.htmlis self-contained โ all prompt data is embedded as JSON
-
Fork the repository and create a branch from
main - Make your changes โ follow the guidelines above
-
Run tests:
node test/run.jsโ all tests must pass - Open a pull request with a clear description of what you changed and why
- Keep PRs focused โ one feature or fix per PR
- Describe the change โ what, why, and how to test it
- Include examples โ if adding a prompt, show a sample use
-
Don't break existing behavior โ test CLI commands manually:
prompt-lib list,prompt-lib search, etc.
Open an issue with:
- What you expected to happen
- What actually happened
- Steps to reproduce
- Your environment: Node.js version, OS, browser (for Workshop issues)
Open an issue describing:
- What you want to do
- Why the current tools don't cover it
- How you'd expect it to work
By contributing, you agree that your contributions will be licensed under the MIT License.
Navigation: โ Desktop Apps | Home