|
| 1 | +--- |
| 2 | +name: promptopskit |
| 3 | +description: Guidance for creating and editing promptopskit prompt files, defaults, variables, and validation-safe templates. |
| 4 | +--- |
| 5 | + |
1 | 6 | # promptopskit — Prompt Engineering Skill |
2 | 7 |
|
3 | 8 | This project uses **promptopskit** to manage LLM prompts as code. |
@@ -36,6 +41,13 @@ You are a helpful assistant. |
36 | 41 | Hello {{ name }}, how can I help you? |
37 | 42 | ``` |
38 | 43 |
|
| 44 | +When creating a new prompt file with "just the necessary fields", include only |
| 45 | +the fields required by that specific file: |
| 46 | +- Always include `id` and `schema_version: 1` |
| 47 | +- Include `provider` and `model` only if they are not inherited from `defaults.md` |
| 48 | +- Include `context.inputs` whenever the body contains `{{ variable }}` placeholders |
| 49 | +- Omit `context` entirely only when the body has no placeholders |
| 50 | + |
39 | 51 | --- |
40 | 52 |
|
41 | 53 | ## Front matter reference |
@@ -84,10 +96,31 @@ sections. Variables are replaced at render time. |
84 | 96 |
|
85 | 97 | Rules: |
86 | 98 | - Declare all variables in `context.inputs` — validation warns on undeclared usage |
| 99 | +- Before finishing a new prompt file, scan the body for every `{{ variable }}` and |
| 100 | + ensure each exact variable name appears in `context.inputs` |
87 | 101 | - Escape literal braces with `\{{` and `\}}` |
88 | 102 | - In strict mode, missing variables throw an error |
89 | 103 | - In permissive mode, unresolved placeholders are left intact |
90 | 104 |
|
| 105 | +Example: this is the minimal valid shape for a prompt that references |
| 106 | +`{{ pull_request }}` even when provider/model are inherited from defaults: |
| 107 | + |
| 108 | +```markdown |
| 109 | +--- |
| 110 | +id: summarizePullRequest |
| 111 | +schema_version: 1 |
| 112 | +context: |
| 113 | + inputs: |
| 114 | + - pull_request |
| 115 | +--- |
| 116 | + |
| 117 | +# Prompt template |
| 118 | + |
| 119 | +Summarize the following pull request: |
| 120 | + |
| 121 | +{{ pull_request }} |
| 122 | +``` |
| 123 | + |
91 | 124 | --- |
92 | 125 |
|
93 | 126 | ## Includes (composition) |
@@ -131,6 +164,9 @@ Supported default fields: |
131 | 164 | This lets you configure app-wide settings like `provider` and `model` |
132 | 165 | in a single root `defaults.md`, so individual prompts only declare what's unique to them. |
133 | 166 |
|
| 167 | +Important: `defaults.md` does not declare or infer `context.inputs` for a prompt. |
| 168 | +If a prompt body uses placeholders, the prompt file itself must declare them. |
| 169 | + |
134 | 170 | Rules: |
135 | 171 | - Nearest subfolder `defaults.md` overrides parent defaults |
136 | 172 | - Prompt-local values always take precedence over defaults |
@@ -316,7 +352,7 @@ Hello {{ name }} |
316 | 352 |
|
317 | 353 | 1. **One prompt per file** — each `.md` file is a single prompt asset |
318 | 354 | 2. **Always set `id` and `schema_version: 1`** in front matter (or inherit `schema_version` from `defaults.md`) |
319 | | -3. **Declare all variables** in `context.inputs` that appear in templates |
| 355 | +3. **Declare all variables** in `context.inputs` that appear in templates; do not leave placeholders undeclared just because other settings come from `defaults.md` |
320 | 356 | 4. **Use includes** for shared system instructions (tone, safety, formatting) |
321 | 357 | 5. **Keep prompt templates focused** — compose behavior via includes, not duplication |
322 | 358 | 6. **Use environment overrides** for dev/staging/prod model differences |
|
0 commit comments