Follow these steps to create a self-contained instruction file by studying an exemplar and adapting its patterns for a new concern domain. The governing principle is ambient-constraint authoring — study existing patterns, then encode them as passive rules that shape behavior without directing action. Begin with <step_1_understand> to capture intent and scope.
- Add TypeScript type-safety conventions for a project
- Create SQL query and schema standards for database work
- Write error handling rules for Python services
- Add API security conventions scoped to route files
- Create React component conventions for frontend development
Execute steps sequentially. Each step builds on the previous — intent determines scope, the exemplar informs structure, the spec governs content, generation produces the file, and validation confirms delivery readiness.
Capture the user's intent and determine instruction scope.
- Determine the concern domain — what topic the instruction covers (type safety, naming, error handling, security, testing, etc.)
- Determine the target file scope — what files or directories the rules apply to (
**/*.ts, src/api/**, **/*.py, etc.)
- Determine the discovery mode — file-triggered, on-demand, both, or manual. Default to "both" unless the user specifies otherwise
- Determine the output location — where to save the file. Default:
.github/instructions/
- If the concept describes a multi-step process or task workflow, redirect to skill-creator — instructions are ambient constraints, not procedures
- If the concept describes a persona or role, redirect to agent-creator — instructions are rules, not identities
Output of this step: concern domain, target file scope, discovery mode, output path, any domain-specific context the user provided.
Study the gold-reference exemplar to understand structural patterns.
- Load exemplar.md — study the embedded instruction alongside its structural annotations
- Observe how the exemplar handles: frontmatter field choices, prose intro with governing principle, XML group naming (domain-specific terms, not generic labels), rule style (NEVER/ALWAYS binary enforcement), scoping decisions (
applyTo glob granularity)
- Determine how many XML groups the new instruction needs — typically 2-4 groups, one concern per group
- Note what is absent: no
<workflow>, no <step_N_verb> tags, no identity prose, no subfolders — the output is a single flat file of passive rules
- Note the heading rule: markdown headers are allowed ONLY inside XML tag sections — never outside them. First-level headings (
#) are never allowed. Use headers only when a section contains multiple distinct blocks that need navigation; single-block sections get their scannability from the XML tag itself
Apply the structural specification to plan each section of the new instruction.
Load instruction-spec.md and plan:
Frontmatter — Plan fields based on discovery mode. File-triggered or both: include applyTo glob matching the target file scope. On-demand or both: include description following the "{verb} {scope} {concern}" formula. Omit name unless disambiguation is required. All string values single-quoted.
Prose intro — 1-2 imperative sentences before any XML tag. State the directive and the governing principle for the concern domain. No hedging, no conditionals.
XML groups — Plan 2-4 domain-named tags, each covering exactly one concern. Name tags using domain vocabulary the target developer would recognize (e.g., <type_safety>, <error_boundaries>, <query_style>). Never use generic names like <rules> or <guidelines>.
Rules — Plan 3-7 NEVER/ALWAYS rules per group. Each rule states one prohibition or mandate. Include inline code examples when the correct form is non-obvious. No hedge words.
Confirm output shape — The output is a SINGLE flat .instructions.md file. No <workflow>, no <step_N_verb>, no identity prose, no subfolder structure. Markdown headers are allowed inside XML groups only when a group contains multiple distinct blocks — never outside them. First-level headings (#) are never allowed.
Write the complete instruction file as a single flat .instructions.md file.
Frontmatter — YAML between --- fences. Include only the fields needed for the chosen discovery mode. All string values single-quoted.
Prose intro — 1-2 imperative sentences stating the directive and governing principle. Imperative voice, no hedging.
XML groups — Domain-named tags. Each group opens with an optional explanatory sentence stating the group's purpose, followed by 3-7 NEVER/ALWAYS bullet rules. One concern per group. Rules ordered from most common scenario to least common.
File naming — {concern}.instructions.md (e.g., typescript-conventions.instructions.md, error-handling.instructions.md). Name reflects the concern, not the target files.
Output — ONE file. Not a folder, not multiple files, not a skill structure.
Quality-check the generated instruction against all validation gates.
Load quality-gates.md and run each tier:
P1 — Blocking (fix before delivery):
- File ends in
.instructions.md
- YAML string values use single quotes
- No platform-reserved tags in body
- No secrets, drive letters, or absolute paths
- Single flat file — no subfolders
- 150 lines or fewer
- Markdown headers allowed ONLY inside XML tag sections — NEVER outside them. First-level headings (
#) are NEVER allowed. Use headers only in multi-block sections
P2 — Quality (fix before finalizing):
- Discovery mode appropriate for the concern
- XML groups use domain-specific names, not generic labels
- All rules use NEVER/ALWAYS — no hedge words
description follows "{verb} {scope} {concern}" formula if present
applyTo scope is neither too broad nor too narrow
- Prose intro present with imperative voice
- One concern per group, 3-7 rules per group
P3 — Polish (flag as suggestions):
- Active voice throughout
- Concise — no filler words
- Code examples enhance complex rules
Banned patterns scan — Check for: identity prose, workflow/step tags, stance words (should, prefer), hedge language (try to, when possible), generic group names, prompt variables, drive letters, temporal language
Fix all P1 and P2 issues. Report P3 suggestions to the user. If P1 fixes require structural changes, return to <step_4_generate>.
Recovery actions for common failure modes. Apply the matching recovery when an issue surfaces during any step.
- If the concept is too broad (multiple unrelated concerns in one instruction) — split into separate instruction files, one per concern domain
- If the concept is actually a multi-step workflow or procedure — redirect to skill-creator — instructions are ambient constraints, not task orchestration
- If the concept is a persona or role description — redirect to agent-creator — instructions are rules, not identities
- If all rules use "should" or "prefer" instead of NEVER/ALWAYS — rewrite with binary enforcement — hedged rules produce lower LLM compliance
- If P1 validation failures are found in step 5 — return to
<step_4_generate> and fix specific violations — do not regenerate the entire file unless structural issues require it
Reference files loaded on demand during workflow steps. All paths are relative to the skill folder.
References:
- instruction-spec.md — Instruction structural specification: frontmatter fields, discovery modes, body structure, scoping strategies, and design boundaries. Loaded in step 3.
- quality-gates.md — Validation tiers (P1/P2/P3), banned patterns, platform-reserved tags, and instruction anti-patterns. Loaded in step 5.
Assets:
- exemplar.md — Annotated gold-reference instruction (sql-conventions) with structural observations. Loaded in step 2.
1---2name: instruction-creator-23description: Guides creation of .instructions.md files that enforce coding standards, conventions, and project rules. Use when asked to "create an instruction", "add coding standards", "write convention rules", or "make a .instructions.md file". Produces a single self-contained .instructions.md file with frontmatter, prose intro, domain-named XML groups, and NEVER/ALWAYS enforcement rules.4---5
6Follow these steps to create a self-contained instruction file by studying an exemplar and adapting its patterns for a new concern domain. The governing principle is ambient-constraint authoring — study existing patterns, then encode them as passive rules that shape behavior without directing action. Begin with `<step_1_understand>` to capture intent and scope.
7
8
9<use_cases>
10
11- Add TypeScript type-safety conventions for a project
12- Create SQL query and schema standards for database work
13- Write error handling rules for Python services
14- Add API security conventions scoped to route files
15- Create React component conventions for frontend development
16
17</use_cases>
18
19
20<workflow>
21
22Execute steps sequentially. Each step builds on the previous — intent determines scope, the exemplar informs structure, the spec governs content, generation produces the file, and validation confirms delivery readiness.
23
24
25<step_1_understand>
26
27Capture the user's intent and determine instruction scope.
28
29- Determine the **concern domain** — what topic the instruction covers (type safety, naming, error handling, security, testing, etc.)
30- Determine the **target file scope** — what files or directories the rules apply to (`**/*.ts`, `src/api/**`, `**/*.py`, etc.)
31- Determine the **discovery mode** — file-triggered, on-demand, both, or manual. Default to "both" unless the user specifies otherwise
32- Determine the **output location** — where to save the file. Default: `.github/instructions/`
33- If the concept describes a multi-step process or task workflow, redirect to skill-creator — instructions are ambient constraints, not procedures
34- If the concept describes a persona or role, redirect to agent-creator — instructions are rules, not identities
35
36**Output of this step:** concern domain, target file scope, discovery mode, output path, any domain-specific context the user provided.
37
38</step_1_understand>
39
40
41<step_2_study>
42
43Study the gold-reference exemplar to understand structural patterns.
44
45- Load [exemplar.md](assets/exemplar.md) — study the embedded instruction alongside its structural annotations
46- Observe how the exemplar handles: frontmatter field choices, prose intro with governing principle, XML group naming (domain-specific terms, not generic labels), rule style (NEVER/ALWAYS binary enforcement), scoping decisions (`applyTo` glob granularity)
47- Determine how many XML groups the new instruction needs — typically 2-4 groups, one concern per group
48- Note what is absent: no `<workflow>`, no `<step_N_verb>` tags, no identity prose, no subfolders — the output is a single flat file of passive rules
49- Note the heading rule: markdown headers are allowed ONLY inside XML tag sections — never outside them. First-level headings (`#`) are never allowed. Use headers only when a section contains multiple distinct blocks that need navigation; single-block sections get their scannability from the XML tag itself
50
51</step_2_study>
52
53
54<step_3_plan>
55
56Apply the structural specification to plan each section of the new instruction.
57
58Load [instruction-spec.md](references/instruction-spec.md) and plan:
59
60- **Frontmatter** — Plan fields based on discovery mode. File-triggered or both: include `applyTo` glob matching the target file scope. On-demand or both: include `description` following the "{verb} {scope} {concern}" formula. Omit `name` unless disambiguation is required. All string values single-quoted.
61
62- **Prose intro** — 1-2 imperative sentences before any XML tag. State the directive and the governing principle for the concern domain. No hedging, no conditionals.
63
64- **XML groups** — Plan 2-4 domain-named tags, each covering exactly one concern. Name tags using domain vocabulary the target developer would recognize (e.g., `<type_safety>`, `<error_boundaries>`, `<query_style>`). Never use generic names like `<rules>` or `<guidelines>`.
65
66- **Rules** — Plan 3-7 NEVER/ALWAYS rules per group. Each rule states one prohibition or mandate. Include inline code examples when the correct form is non-obvious. No hedge words.
67
68- **Confirm output shape** — The output is a SINGLE flat `.instructions.md` file. No `<workflow>`, no `<step_N_verb>`, no identity prose, no subfolder structure. Markdown headers are allowed inside XML groups only when a group contains multiple distinct blocks — never outside them. First-level headings (`#`) are never allowed.
69
70</step_3_plan>
71
72
73<step_4_generate>
74
75Write the complete instruction file as a single flat `.instructions.md` file.
76
77- **Frontmatter** — YAML between `---` fences. Include only the fields needed for the chosen discovery mode. All string values single-quoted.
78
79- **Prose intro** — 1-2 imperative sentences stating the directive and governing principle. Imperative voice, no hedging.
80
81- **XML groups** — Domain-named tags. Each group opens with an optional explanatory sentence stating the group's purpose, followed by 3-7 NEVER/ALWAYS bullet rules. One concern per group. Rules ordered from most common scenario to least common.
82
83- **File naming** — `{concern}.instructions.md` (e.g., `typescript-conventions.instructions.md`, `error-handling.instructions.md`). Name reflects the concern, not the target files.
84
85- **Output** — ONE file. Not a folder, not multiple files, not a skill structure.
86
87</step_4_generate>
88
89
90<step_5_validate>
91
92Quality-check the generated instruction against all validation gates.
93
94Load [quality-gates.md](references/quality-gates.md) and run each tier:
95
96- **P1 — Blocking** (fix before delivery):
97 - File ends in `.instructions.md`
98 - YAML string values use single quotes
99 - No platform-reserved tags in body
100 - No secrets, drive letters, or absolute paths
101 - Single flat file — no subfolders
102 - 150 lines or fewer
103 - Markdown headers allowed ONLY inside XML tag sections — NEVER outside them. First-level headings (`#`) are NEVER allowed. Use headers only in multi-block sections
104
105- **P2 — Quality** (fix before finalizing):
106 - Discovery mode appropriate for the concern
107 - XML groups use domain-specific names, not generic labels
108 - All rules use NEVER/ALWAYS — no hedge words
109 - `description` follows "{verb} {scope} {concern}" formula if present
110 - `applyTo` scope is neither too broad nor too narrow
111 - Prose intro present with imperative voice
112 - One concern per group, 3-7 rules per group
113
114- **P3 — Polish** (flag as suggestions):
115 - Active voice throughout
116 - Concise — no filler words
117 - Code examples enhance complex rules
118
119- **Banned patterns scan** — Check for: identity prose, workflow/step tags, stance words (should, prefer), hedge language (try to, when possible), generic group names, prompt variables, drive letters, temporal language
120
121Fix all P1 and P2 issues. Report P3 suggestions to the user. If P1 fixes require structural changes, return to `<step_4_generate>`.
122
123</step_5_validate>
124
125
126</workflow>
127
128
129<error_handling>
130
131Recovery actions for common failure modes. Apply the matching recovery when an issue surfaces during any step.
132
133- If the concept is **too broad** (multiple unrelated concerns in one instruction) — split into separate instruction files, one per concern domain
134- If the concept is actually a **multi-step workflow or procedure** — redirect to skill-creator — instructions are ambient constraints, not task orchestration
135- If the concept is a **persona or role description** — redirect to agent-creator — instructions are rules, not identities
136- If all rules use **"should" or "prefer"** instead of NEVER/ALWAYS — rewrite with binary enforcement — hedged rules produce lower LLM compliance
137- If **P1 validation failures** are found in step 5 — return to `<step_4_generate>` and fix specific violations — do not regenerate the entire file unless structural issues require it
138
139</error_handling>
140
141
142<resources>
143
144Reference files loaded on demand during workflow steps. All paths are relative to the skill folder.
145
146**References:**
147
148- [instruction-spec.md](references/instruction-spec.md) — Instruction structural specification: frontmatter fields, discovery modes, body structure, scoping strategies, and design boundaries. Loaded in step 3.
149- [quality-gates.md](references/quality-gates.md) — Validation tiers (P1/P2/P3), banned patterns, platform-reserved tags, and instruction anti-patterns. Loaded in step 5.
150
151**Assets:**
152
153- [exemplar.md](assets/exemplar.md) — Annotated gold-reference instruction (sql-conventions) with structural observations. Loaded in step 2.
154
155</resources>