Creating Custom Instructions
Process
Step 1: Plan the Instruction
Before creating, check for overlap and determine scope:
bash
# List existing instructions with patterns for f in .github/instructions/*.instructions.md; do echo "=== $(basename $f) ===" grep "applyTo:" "$f" done
Answer:
- •What file pattern(s) should this apply to?
- •Does this overlap with existing instructions?
- •What are the 3-5 most critical rules?
Decision:
- •Exact match exists → Modify existing (see "Modifying" below)
- •Partial overlap → Extend existing OR create with distinct scope
- •No overlap → Create new
Step 2: Initialize
bash
node .github/skills/creating-instructions/scripts/init_instruction.mjs {name}
# With custom pattern
node .github/skills/creating-instructions/scripts/init_instruction.mjs {name} --apply-to "glob-pattern"
Creates: .github/instructions/{name}.instructions.md with frontmatter and TODO sections.
Naming conventions:
| Scope | Pattern | Example |
|---|---|---|
| Package | {package}.instructions.md | atomic.instructions.md |
| File type | general.{type}.instructions.md | general.typescript.instructions.md |
| Tests | tests-{package}.instructions.md | tests-atomic.instructions.md |
| Technology | {tech}.instructions.md | msw-api-mocking.instructions.md |
See naming-conventions.md for details.
Step 3: Complete the Instruction
Fill in the generated file:
- •Start with the most critical rule
- •Organize by topic with clear headings
- •Provide concrete code examples
- •Reference related files with Markdown links
- •Document hierarchy if conflicts possible
For format details, see SPECIFICATION.md. For writing guidance, see best-practices.md. For examples, see examples.md.
Step 4: Validate
bash
node .github/skills/creating-instructions/scripts/validate_instruction.mjs .github/instructions/{name}.instructions.md
Manual checks:
- • Most critical rule appears first
- • Concrete examples provided
- • No duplicated content
- • Hierarchy documented if needed
Modifying Existing Instructions
Extending:
- •Read existing file to understand scope
- •Add new sections logically
- •Re-run validation
Changing scope:
- •Update
applyTofrontmatter - •Check for new conflicts
- •Update hierarchy documentation
Renaming:
- •Rename file following conventions
- •Search for references:
grep -r "{old-name}.instructions.md" .github/ - •Update references
- •Re-validate
Deprecating:
- •Verify no active references
- •If merging, copy unique content to target
- •Delete file
Existing Instructions
| File | Pattern | Purpose |
|---|---|---|
general.instructions.md | ** | Core principles |
general.typescript.instructions.md | **/*.ts, **/*.tsx | TypeScript rules |
atomic.instructions.md | packages/atomic/** | Atomic conventions |
tests-atomic.instructions.md | **/atomic/**/*.spec.ts | Atomic test patterns |
playwright-typescript.instructions.md | **/*.e2e.ts, **/*.spec.ts | E2E patterns |
msw-api-mocking.instructions.md | packages/atomic/**/*.stories.tsx | Storybook MSW |
Update this table when creating new instructions.
Reference Documentation
| Reference | When to Load |
|---|---|
| SPECIFICATION.md | VS Code instruction format, frontmatter, patterns |
| best-practices.md | Writing effective instructions, terminology |
| examples.md | Real-world instruction examples |
| naming-conventions.md | File naming patterns |
Scripts
| Script | Purpose |
|---|---|
init_instruction.mjs | Initialize with template |
validate_instruction.mjs | Validate structure per spec |