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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
<!DOCTYPE html>
<html lang="en" data-theme="dark">
<head>
  <meta charset="UTF-8" />
  <link rel="icon" type="image/svg+xml" href="favicon.svg">
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>Contribute — PromptLean</title>
  <meta name="description" content="Add your prompts to PromptLean. Guidelines, schema, and review process.">
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
  <link rel="stylesheet" href="assets/css/main.css">
</head>
<body>

<nav>
  <div class="nav-inner">
    <a href="index.html" class="nav-logo">
      <img src="assets/img/logo.svg" alt="PromptLean" class="nav-logo-icon" style="border-radius:7px;">
      PromptLean
    </a>
    <div class="nav-links">
      <a href="browse.html" class="nav-link">Browse</a>
      <a href="compare.html" class="nav-link">Compare</a>
      <a href="about.html" class="nav-link">About</a>
      <a href="contribute.html" class="nav-link active">Contribute</a>
    </div>
    <div class="nav-actions">
      <a href="https://github.com/kishormorol/promptlean" target="_blank" rel="noopener" class="github-star-btn">
        <svg viewBox="0 0 16 16" fill="currentColor"><path d="M8 .25a7.75 7.75 0 1 0 0 15.5A7.75 7.75 0 0 0 8 .25Zm0 1.5a6.25 6.25 0 1 1 0 12.5A6.25 6.25 0 0 1 8 1.75Zm-.25 3.25a.75.75 0 0 1 .5 0l.963 2.97 3.124.022a.75.75 0 0 1 .44 1.354l-2.527 1.82.972 2.95a.75.75 0 0 1-1.154.838L8 12.845l-2.068 1.414a.75.75 0 0 1-1.154-.838l.972-2.95-2.527-1.82a.75.75 0 0 1 .44-1.354l3.124-.022L7.75 5Z"/></svg>
        <span>Star</span><span class="gh-star-sep">|</span><span id="gh-stars"></span>
      </a>
      <button class="theme-toggle" id="theme-toggle" title="Toggle theme">☀</button>
    </div>
  </div>
</nav>

<main class="page-content">
  <div class="container" style="max-width: 760px;">

    <div class="mb-8">
      <h1 style="font-size: 2rem; margin-bottom: 10px;">Contribute a Prompt</h1>
      <p style="font-size: 1.0625rem;">Every prompt in the library came from someone who needed it. Open a PR with yours.</p>
    </div>

    <div class="divider"></div>

    <!-- Steps -->
    <div class="mb-8">
      <h2 style="font-size: 1.25rem; margin-bottom: 16px;">How to contribute</h2>

      <div style="display: flex; flex-direction: column; gap: 12px;">
        <div class="card" style="display: flex; gap: 16px; align-items: flex-start;">
          <div style="min-width: 32px; height: 32px; background: var(--accent-bg); border: 1px solid var(--accent-border); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent-light); font-size: 0.875rem;">1</div>
          <div>
            <div style="font-weight: 600; margin-bottom: 4px;">Fork the repo</div>
            <p style="font-size: 0.875rem;"><a href="https://github.com/kishormorol/promptlean" target="_blank">github.com/kishormorol/promptlean</a> — fork, then clone to your machine.</p>
          </div>
        </div>

        <div class="card" style="display: flex; gap: 16px; align-items: flex-start;">
          <div style="min-width: 32px; height: 32px; background: var(--accent-bg); border: 1px solid var(--accent-border); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent-light); font-size: 0.875rem;">2</div>
          <div>
            <div style="font-weight: 600; margin-bottom: 4px;">Add your prompt to <code class="mono">data/prompts.json</code></div>
            <p style="font-size: 0.875rem;">Follow the schema below. All three variants are required. Use <code class="mono">[PLACEHOLDER]</code> syntax for user-filled values.</p>
          </div>
        </div>

        <div class="card" style="display: flex; gap: 16px; align-items: flex-start;">
          <div style="min-width: 32px; height: 32px; background: var(--accent-bg); border: 1px solid var(--accent-border); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--accent-light); font-size: 0.875rem;">3</div>
          <div>
            <div style="font-weight: 600; margin-bottom: 4px;">Open a pull request</div>
            <p style="font-size: 0.875rem;">Title: <code class="mono">feat: add "[Your Prompt Title]" to [Category]</code>. Include the output from at least one model in the PR description.</p>
          </div>
        </div>
      </div>
    </div>

    <div class="divider"></div>

    <!-- Prompt Builder -->
    <div class="mb-8">
      <h2 style="font-size: 1.25rem; margin-bottom: 6px;">Prompt Builder</h2>
      <p style="margin-bottom: 20px;">Fill in the form — the correct JSON is generated automatically. Copy it into <code class="mono">data/prompts.json</code>.</p>

      <div class="card" style="display: flex; flex-direction: column; gap: 16px;">

        <!-- Row 1: title + category -->
        <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 12px;">
          <div class="builder-field">
            <label class="builder-label">Title</label>
            <input class="builder-input" id="bf-title" placeholder="e.g. Write a SQL Migration" />
          </div>
          <div class="builder-field">
            <label class="builder-label">Category</label>
            <select class="builder-input" id="bf-category">
              <option>Code</option>
              <option>Data</option>
              <option>Research</option>
              <option>Writing</option>
              <option>AI / ML</option>
              <option>Productivity</option>
              <option>Engineering</option>
              <option>General Purpose</option>
              <option>Well-being &amp; Mental Health</option>
              <option>Safety &amp; Crisis Support</option>
              <option>Supportive Conversation</option>
              <option>Entertainment &amp; Creative</option>
              <option>Education &amp; Tutoring</option>
              <option>Career &amp; Professional Growth</option>
            </select>
          </div>
        </div>

        <!-- Row 2: tags + description -->
        <div class="builder-field">
          <label class="builder-label">Tags <span style="font-weight:400;color:var(--text-3);">(comma-separated, lowercase)</span></label>
          <input class="builder-input" id="bf-tags" placeholder="e.g. sql, migration, database" />
        </div>
        <div class="builder-field">
          <label class="builder-label">Description <span style="font-weight:400;color:var(--text-3);">(one sentence)</span></label>
          <input class="builder-input" id="bf-desc" placeholder="What does this prompt do and when should someone use it?" />
        </div>

        <!-- Row 3: variants -->
        <div style="display: grid; grid-template-columns: 1fr; gap: 12px;">
          <div class="builder-field">
            <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;">
              <label class="builder-label" style="margin:0;">⚡ Lean prompt</label>
              <span class="builder-token-count" id="bf-lean-count">0t</span>
            </div>
            <textarea class="builder-input builder-textarea" id="bf-lean" placeholder="Shortest effective prompt. Use [PLACEHOLDER] for user content." rows="3"></textarea>
          </div>
          <div class="builder-field">
            <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;">
              <label class="builder-label" style="margin:0;">⚖ Balanced prompt</label>
              <span class="builder-token-count" id="bf-balanced-count">0t</span>
            </div>
            <textarea class="builder-input builder-textarea" id="bf-balanced" placeholder="Structured prompt with consistent format." rows="4"></textarea>
          </div>
          <div class="builder-field">
            <div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:6px;">
              <label class="builder-label" style="margin:0;">★ Max Quality prompt</label>
              <span class="builder-token-count" id="bf-quality-count">0t</span>
            </div>
            <textarea class="builder-input builder-textarea" id="bf-quality" placeholder="Full rubric for external deliverables or expert review." rows="6"></textarea>
          </div>
        </div>

      </div>

      <!-- Generated JSON output -->
      <div class="prompt-block" style="margin-top: 16px;">
        <div class="prompt-block-header">
          <div class="prompt-block-meta">
            <span class="badge badge-cat">Generated JSON</span>
            <span style="font-size:0.75rem;color:var(--text-3);">model_notes &amp; benchmarks need manual completion</span>
          </div>
          <button class="copy-btn" id="copy-builder-btn" onclick="copyBuilderJson()">⧉ Copy</button>
        </div>
        <pre class="prompt-text" id="builder-output" style="max-height:360px;overflow-y:auto;">{
  "id": "your-prompt-id",
  ...
}</pre>
      </div>
    </div>

    <div class="divider"></div>

    <!-- Schema -->
    <div class="mb-8">
      <h2 style="font-size: 1.25rem; margin-bottom: 16px;">JSON Schema</h2>
      <div class="prompt-block">
        <div class="prompt-block-header">
          <div class="prompt-block-meta">
            <span class="badge badge-cat">data/prompts.json</span>
          </div>
          <button class="copy-btn" onclick="copySchema()">⧉ Copy</button>
        </div>
        <pre class="prompt-text" id="schema-block">{
  "id": "your-prompt-id",           // kebab-case, unique
  "title": "Your Prompt Title",
  "category": "Code",               // Code | Data | Research | Writing | AI/ML | Productivity | Engineering
  "tags": ["tag1", "tag2"],         // 3–6 lowercase tags
  "featured": false,                // leave false; maintainers set this
  "description": "One sentence describing what this prompt does and when to use it.",
  "model_notes": {
    "gpt-5.4": "...",
    "claude-sonnet-4-6": "...",
    "claude-opus-4-6": "...",
    "gemini-3.1-pro": "...",
    "grok-4": "...",
    "llama-4-scout": "...",
    "mistral-large-3": "...",
    "o1": "..."
  },
  "variants": {
    "lean": {
      "prompt": "Your lean prompt here. Use [PLACEHOLDER] for user content.",
      "token_estimate": 28          // count with tiktoken or similar
    },
    "balanced": {
      "prompt": "Your balanced prompt here.",
      "token_estimate": 72
    },
    "max_quality": {
      "prompt": "Your max quality prompt here.",
      "token_estimate": 165
    }
  }
}</pre>
      </div>
    </div>

    <div class="divider"></div>

    <!-- Guidelines -->
    <div class="mb-8">
      <h2 style="font-size: 1.25rem; margin-bottom: 16px;">Contribution guidelines</h2>

      <div style="display: grid; grid-template-columns: 1fr 1fr; gap: 16px;">
        <div>
          <div style="color: var(--lean); font-weight: 600; margin-bottom: 10px; font-size: 0.875rem;">✓ We accept</div>
          <ul style="font-size: 0.875rem; color: var(--text-2); line-height: 2.1; padding-left: 18px;">
            <li>Task-focused prompts with real-world use cases</li>
            <li>Prompts you've actually used in production or research</li>
            <li>Variants that meaningfully differ in token cost and quality</li>
            <li>New categories not yet represented</li>
            <li>Improvements to existing prompts (open an issue first)</li>
          </ul>
        </div>
        <div>
          <div style="color: var(--quality); font-weight: 600; margin-bottom: 10px; font-size: 0.875rem;">✗ We decline</div>
          <ul style="font-size: 0.875rem; color: var(--text-2); line-height: 2.1; padding-left: 18px;">
            <li>Prompts that generate harmful or deceptive content</li>
            <li>Jailbreaks or prompt injection exploits</li>
            <li>Vanity prompts with no clear use case</li>
            <li>Duplicates of existing prompts</li>
            <li>Lean variants that are just truncated max-quality prompts</li>
          </ul>
        </div>
      </div>
    </div>

    <div class="divider"></div>

    <!-- Quality bar -->
    <div class="mb-8">
      <h2 style="font-size: 1.25rem; margin-bottom: 12px;">Quality bar for variants</h2>
      <p style="margin-bottom: 12px;">The three variants should feel genuinely different — not just shorter versions of the same prompt. The quality difference should be real and measurable.</p>

      <div class="card">
        <div class="flex-center gap-2 mb-3">
          <span class="badge badge-lean">⚡ Lean</span>
        </div>
        <p style="font-size: 0.875rem;">Should produce a usable output with no wasted tokens. If the lean prompt gets 80%+ of the max-quality output, that's a good lean variant.</p>
      </div>

      <div class="card" style="margin-top: 12px;">
        <div class="flex-center gap-2 mb-3">
          <span class="badge badge-quality">★ Max Quality</span>
        </div>
        <p style="font-size: 0.875rem;">Should produce output that a human expert would rate noticeably higher than the lean variant. If the output is indistinguishable, the max-quality variant is not doing its job.</p>
      </div>
    </div>

    <div class="divider"></div>

    <!-- Community variants -->
    <div class="mb-8" id="community">
      <h2 style="font-size: 1.25rem; margin-bottom: 6px;">Community Variants</h2>
      <p style="margin-bottom: 16px;">Have a specialized take on an existing prompt? Add it as a community variant — it shows up as an extra tab on the prompt page without replacing the standard ones.</p>

      <div class="card mb-4">
        <div style="font-weight: 600; margin-bottom: 10px; font-size: 0.9rem;">How it works</div>
        <ol style="font-size: 0.875rem; color: var(--text-2); padding-left: 20px; line-height: 2.2;">
          <li>Fork the repo and create <code class="mono">community/{prompt-id}.json</code></li>
          <li>Add your variant(s) as a JSON array (schema below)</li>
          <li>Open a PR — include example output from at least one model</li>
        </ol>
        <p style="font-size: 0.8125rem; color: var(--text-3); margin-top: 10px;">
          Example: to add a variant for the <em>Code Review</em> prompt, create <code class="mono">community/code-review.json</code>.
        </p>
      </div>

      <div class="prompt-block">
        <div class="prompt-block-header">
          <span class="badge badge-cat">community/{prompt-id}.json</span>
          <button class="copy-btn" onclick="copyCommunitySchema()">⧉ Copy</button>
        </div>
        <pre class="prompt-text" id="community-schema">[
  {
    "id": "your-variant-id",         // kebab-case, unique within this prompt
    "label": "🔒 Your Variant Name", // shown in the tab — keep it short
    "author": "your-github-username",
    "description": "One sentence: what does this variant optimize for?",
    "prompt": "Your specialized prompt text. Use [PLACEHOLDER] for user content.",
    "token_estimate": 95             // rough count; use chars/4 as approximation
  }
]</pre>
      </div>
    </div>

    <div style="text-align: center; padding: 20px 0;">
      <a href="https://github.com/kishormorol/promptlean" class="btn btn-primary btn-lg" target="_blank">Open GitHub →</a>
    </div>

  </div>
</main>

<footer>
  <div class="footer-inner">
    <div class="footer-left">
      <span>⚡ PromptLean</span>
      <span>·</span>
      <span>Open source, MIT license</span>
    </div>
    <div class="footer-links">
      <a href="about.html" class="footer-link">About</a>
      <a href="contribute.html" class="footer-link">Contribute</a>
      <a href="https://github.com/kishormorol/promptlean/blob/main/ATTRIBUTION.md" class="footer-link" target="_blank">Attribution</a>
      <a href="https://github.com/kishormorol/promptlean" class="footer-link" target="_blank">GitHub</a>
    </div>
  </div>
</footer>

<div id="toast"></div>
<script src="assets/js/main.js"></script>
<script>
window.copySchema = () => {
  const text = document.getElementById('schema-block').textContent;
  PL.copy(text);
};
window.copyCommunitySchema = () => {
  const text = document.getElementById('community-schema').textContent;
  PL.copy(text);
};

window.copyBuilderJson = () => {
  const text = document.getElementById('builder-output').textContent;
  PL.copy(text, document.getElementById('copy-builder-btn'));
};

(function initBuilder() {
  const MODELS = ['gpt-5.4','claude-sonnet-4-6','claude-opus-4-6','gemini-3.1-pro','grok-4','llama-4-scout','mistral-large-3','o1'];

  const toSlug = (s) => s.toLowerCase().replace(/[^a-z0-9\s-]/g,'').trim().replace(/\s+/g,'-');
  const estimateTokens = (s) => Math.max(1, Math.ceil((s.trim().length || 0) / 4));

  const updateCount = (textareaId, countId) => {
    const text = document.getElementById(textareaId)?.value || '';
    const el = document.getElementById(countId);
    if (el) el.textContent = estimateTokens(text) + 't';
  };

  const generateJson = () => {
    const title     = (document.getElementById('bf-title')?.value || '').trim();
    const category  = document.getElementById('bf-category')?.value || 'Code';
    const tagsRaw   = document.getElementById('bf-tags')?.value || '';
    const desc      = (document.getElementById('bf-desc')?.value || '').trim();
    const leanP     = document.getElementById('bf-lean')?.value || '';
    const balP      = document.getElementById('bf-balanced')?.value || '';
    const qualP     = document.getElementById('bf-quality')?.value || '';

    const id   = toSlug(title) || 'your-prompt-id';
    const tags = tagsRaw.split(',').map(t => t.trim().toLowerCase()).filter(Boolean);

    const modelNotes = {};
    MODELS.forEach(m => { modelNotes[m] = 'Add notes about how this model handles this prompt type.'; });

    const benchmarks = {};
    MODELS.forEach(m => { benchmarks[m] = { lean: 4, balanced: 4, max_quality: 5, best: 'balanced' }; });

    const obj = {
      id,
      title:       title       || 'Your Prompt Title',
      category,
      tags:        tags.length ? tags : ['tag1', 'tag2'],
      featured:    false,
      description: desc        || 'One sentence describing what this prompt does and when to use it.',
      model_notes: modelNotes,
      benchmarks,
      variants: {
        lean:        { prompt: leanP || 'Your lean prompt here. Use [PLACEHOLDER] for user content.', token_estimate: estimateTokens(leanP || 'placeholder') },
        balanced:    { prompt: balP  || 'Your balanced prompt here.',     token_estimate: estimateTokens(balP  || 'placeholder') },
        max_quality: { prompt: qualP || 'Your max quality prompt here.',  token_estimate: estimateTokens(qualP || 'placeholder') }
      }
    };

    return JSON.stringify(obj, null, 2);
  };

  const refresh = () => {
    updateCount('bf-lean',     'bf-lean-count');
    updateCount('bf-balanced', 'bf-balanced-count');
    updateCount('bf-quality',  'bf-quality-count');
    const out = document.getElementById('builder-output');
    if (out) out.textContent = generateJson();
  };

  document.addEventListener('DOMContentLoaded', () => {
    ['bf-title','bf-category','bf-tags','bf-desc','bf-lean','bf-balanced','bf-quality']
      .forEach(id => document.getElementById(id)?.addEventListener('input', refresh));
    refresh();
  });
})();
</script>
</body>
</html>