prompts.chat 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -3230,6 +3230,219 @@ var templates = {
3230
3230
  "If you don't know the answer, say so",
3231
3231
  "Cite relevant parts of the context if applicable"
3232
3232
  ]);
3233
+ },
3234
+ /**
3235
+ * Create a debugging prompt
3236
+ */
3237
+ debug: (options = {}) => {
3238
+ const b = builder().role("expert software debugger").task("Analyze the code and error, identify the root cause, and provide a fix.").variable("code", { required: true, description: "The code with the bug" }).variable("error", { required: false, description: "Error message or unexpected behavior" });
3239
+ if (options.language) {
3240
+ b.context(`Debugging ${options.language} code.`);
3241
+ }
3242
+ if (options.errorType) {
3243
+ b.context(`The error appears to be related to: ${options.errorType}`);
3244
+ }
3245
+ return b.constraints([
3246
+ "Identify the root cause, not just symptoms",
3247
+ "Explain why the bug occurs",
3248
+ "Provide a working fix with explanation"
3249
+ ]).output("1. Root cause analysis\n2. Explanation\n3. Fixed code\n4. Prevention tips");
3250
+ },
3251
+ /**
3252
+ * Create a writing assistant prompt
3253
+ */
3254
+ write: (options = {}) => {
3255
+ const typeDescriptions = {
3256
+ blog: "engaging blog post",
3257
+ email: "professional email",
3258
+ essay: "well-structured essay",
3259
+ story: "creative story",
3260
+ documentation: "clear technical documentation"
3261
+ };
3262
+ const b = builder().role("skilled writer").task(`Write a ${typeDescriptions[options.type || "blog"] || "piece of content"} based on the given topic or outline.`).variable("topic", { required: true, description: "Topic or outline to write about" });
3263
+ if (options.tone) {
3264
+ b.constraint(`Use a ${options.tone} tone throughout`);
3265
+ }
3266
+ return b.constraints([
3267
+ "Use clear and engaging language",
3268
+ "Structure content logically",
3269
+ "Maintain consistent voice and style"
3270
+ ]);
3271
+ },
3272
+ /**
3273
+ * Create an explanation/teaching prompt
3274
+ */
3275
+ explain: (options = {}) => {
3276
+ const levelDescriptions = {
3277
+ beginner: "someone new to the topic with no prior knowledge",
3278
+ intermediate: "someone with basic understanding who wants to go deeper",
3279
+ expert: "an expert who wants technical precision and nuance"
3280
+ };
3281
+ const b = builder().role("expert teacher and communicator").task("Explain the concept clearly and thoroughly.").variable("concept", { required: true, description: "The concept to explain" });
3282
+ if (options.level) {
3283
+ b.context(`Target audience: ${levelDescriptions[options.level]}`);
3284
+ }
3285
+ if (options.useAnalogies) {
3286
+ b.constraint("Use relatable analogies and real-world examples");
3287
+ }
3288
+ return b.constraints([
3289
+ "Break down complex ideas into digestible parts",
3290
+ "Build understanding progressively",
3291
+ "Anticipate and address common misconceptions"
3292
+ ]);
3293
+ },
3294
+ /**
3295
+ * Create a data extraction prompt
3296
+ */
3297
+ extract: (options = {}) => {
3298
+ const b = builder().role("data extraction specialist").task("Extract structured data from the provided text.").variable("text", { required: true, description: "Text to extract data from" });
3299
+ if (options.fields && options.fields.length > 0) {
3300
+ b.context(`Fields to extract: ${options.fields.join(", ")}`);
3301
+ }
3302
+ if (options.format) {
3303
+ b.output(`Return extracted data in ${options.format.toUpperCase()} format`);
3304
+ }
3305
+ return b.constraints([
3306
+ "Extract only factual information present in the text",
3307
+ "Use null or empty values for missing fields",
3308
+ "Maintain consistent formatting"
3309
+ ]);
3310
+ },
3311
+ /**
3312
+ * Create a brainstorming prompt
3313
+ */
3314
+ brainstorm: (options = {}) => {
3315
+ const b = builder().role("creative strategist and ideation expert").task("Generate diverse and innovative ideas based on the given topic or challenge.").variable("topic", { required: true, description: "Topic or challenge to brainstorm about" });
3316
+ if (options.count) {
3317
+ b.constraint(`Generate exactly ${options.count} ideas`);
3318
+ }
3319
+ if (options.creative) {
3320
+ b.constraint("Include unconventional and out-of-the-box ideas");
3321
+ }
3322
+ return b.constraints([
3323
+ "Ensure ideas are distinct and varied",
3324
+ "Consider different perspectives and approaches",
3325
+ "Make ideas actionable when possible"
3326
+ ]).output("List each idea with a brief description and potential benefits");
3327
+ },
3328
+ /**
3329
+ * Create a code refactoring prompt
3330
+ */
3331
+ refactor: (options = {}) => {
3332
+ const goalDescriptions = {
3333
+ readability: "improving code readability and clarity",
3334
+ performance: "optimizing performance and efficiency",
3335
+ maintainability: "enhancing maintainability and extensibility",
3336
+ all: "overall code quality improvement"
3337
+ };
3338
+ const b = builder().role("senior software engineer specializing in code quality").task(`Refactor the code with focus on ${goalDescriptions[options.goal || "all"]}.`).variable("code", { required: true, description: "Code to refactor" });
3339
+ if (options.language) {
3340
+ b.context(`The code is written in ${options.language}.`);
3341
+ }
3342
+ return b.constraints([
3343
+ "Preserve existing functionality",
3344
+ "Follow language best practices and idioms",
3345
+ "Explain each significant change"
3346
+ ]).output("1. Refactored code\n2. List of changes made\n3. Explanation of improvements");
3347
+ },
3348
+ /**
3349
+ * Create an API documentation prompt
3350
+ */
3351
+ apiDocs: (options = {}) => {
3352
+ const b = builder().role("technical documentation writer").task("Generate comprehensive API documentation for the provided code or endpoint.").variable("code", { required: true, description: "API code or endpoint definition" });
3353
+ if (options.style) {
3354
+ b.output(`Format documentation in ${options.style.toUpperCase()} style`);
3355
+ }
3356
+ if (options.includeExamples) {
3357
+ b.constraint("Include request/response examples for each endpoint");
3358
+ }
3359
+ return b.constraints([
3360
+ "Document all parameters with types and descriptions",
3361
+ "Include error responses and status codes",
3362
+ "Be precise and developer-friendly"
3363
+ ]);
3364
+ },
3365
+ /**
3366
+ * Create a unit test generation prompt
3367
+ */
3368
+ unitTest: (options = {}) => {
3369
+ const b = builder().role("test automation engineer").task("Generate unit tests for the provided code.").variable("code", { required: true, description: "Code to generate tests for" });
3370
+ if (options.framework) {
3371
+ b.context(`Use ${options.framework} testing framework.`);
3372
+ }
3373
+ const coverageConstraints = options.coverage === "comprehensive" ? ["Cover all code paths including edge cases", "Test error handling scenarios", "Include boundary value tests"] : ["Cover main functionality", "Include basic edge cases"];
3374
+ return b.constraints([
3375
+ ...coverageConstraints,
3376
+ "Write clear, descriptive test names",
3377
+ "Follow AAA pattern (Arrange, Act, Assert)"
3378
+ ]).output("Complete, runnable test file");
3379
+ },
3380
+ /**
3381
+ * Create a commit message prompt
3382
+ */
3383
+ commitMessage: (options = {}) => {
3384
+ const b = builder().role("developer with excellent communication skills").task("Generate a clear and descriptive commit message for the provided code changes.").variable("diff", { required: true, description: "Git diff or description of changes" });
3385
+ if (options.style === "conventional") {
3386
+ b.constraints([
3387
+ "Follow Conventional Commits format (type(scope): description)",
3388
+ "Use appropriate type: feat, fix, docs, style, refactor, test, chore"
3389
+ ]);
3390
+ }
3391
+ if (options.includeBody) {
3392
+ b.constraint("Include a detailed body explaining the why behind changes");
3393
+ }
3394
+ return b.constraints([
3395
+ "Keep subject line under 72 characters",
3396
+ "Use imperative mood (Add, Fix, Update, not Added, Fixed, Updated)"
3397
+ ]);
3398
+ },
3399
+ /**
3400
+ * Create a code review comment prompt
3401
+ */
3402
+ reviewComment: (options = {}) => {
3403
+ const b = builder().role("thoughtful code reviewer").task("Write a helpful code review comment for the provided code snippet.").variable("code", { required: true, description: "Code to comment on" }).variable("issue", { required: true, description: "The issue or improvement to address" });
3404
+ if (options.tone === "constructive") {
3405
+ b.constraint("Frame feedback positively and suggest improvements rather than just pointing out problems");
3406
+ }
3407
+ if (options.severity) {
3408
+ b.constraint("Indicate severity level: nitpick, suggestion, important, or blocker");
3409
+ }
3410
+ return b.constraints([
3411
+ "Be specific and actionable",
3412
+ "Explain the reasoning behind the suggestion",
3413
+ "Provide an example of the improved code when helpful"
3414
+ ]);
3415
+ },
3416
+ /**
3417
+ * Create a regex generator prompt
3418
+ */
3419
+ regex: (options = {}) => {
3420
+ const b = builder().role("regex expert").task("Create a regular expression that matches the described pattern.").variable("pattern", { required: true, description: "Description of the pattern to match" }).variable("examples", { required: false, description: "Example strings that should match" });
3421
+ if (options.flavor) {
3422
+ b.context(`Use ${options.flavor} regex flavor/syntax.`);
3423
+ }
3424
+ return b.constraints([
3425
+ "Provide the regex pattern",
3426
+ "Explain each part of the pattern",
3427
+ "Include test cases showing matches and non-matches"
3428
+ ]).output("1. Regex pattern\n2. Explanation\n3. Test cases");
3429
+ },
3430
+ /**
3431
+ * Create a SQL query prompt
3432
+ */
3433
+ sql: (options = {}) => {
3434
+ const b = builder().role("database expert").task("Write an SQL query based on the requirements.").variable("requirement", { required: true, description: "What the query should accomplish" }).variable("schema", { required: false, description: "Database schema or table definitions" });
3435
+ if (options.dialect) {
3436
+ b.context(`Use ${options.dialect.toUpperCase()} syntax.`);
3437
+ }
3438
+ if (options.optimize) {
3439
+ b.constraint("Optimize for performance and include index recommendations if applicable");
3440
+ }
3441
+ return b.constraints([
3442
+ "Write clean, readable SQL",
3443
+ "Use appropriate JOINs and avoid N+1 patterns",
3444
+ "Include comments explaining complex logic"
3445
+ ]);
3233
3446
  }
3234
3447
  };
3235
3448
  export {