Skip to content

Commit 238245a

Browse files
authored
Merge pull request #11 from SamErde/instructions
Add comprehensive guidelines for custom instruction files, localizati…
2 parents 8218d92 + 3e7ba78 commit 238245a

10 files changed

+1962
-15
lines changed

.github/copilot-instructions.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,15 @@
2222
- Always validate input parameters
2323
- Implement proper authentication and authorization checks
2424

25-
# PowerShell Commit Message Template
25+
# Commit Message Template
2626

27-
Generate commit messages for PowerShell projects using this format:
27+
Generate commit messages using this format:
2828

2929
`<emoji><type>[optional scope]: <description>`
3030

31-
Follow the GitMoji specifications at <https://conventional-emoji-commits.site/full-specification/specification> for
32-
commit messages. Tailor commit messages for PowerShell development, using the provided types and scopes.
31+
Follow the GitMoji specifications at <https://conventional-emoji-commits.site/full-specification/specification> for commit messages. Tailor commit messages for PowerShell development, using the provided types and scopes.
3332

34-
## PowerShell-Specific Types:
33+
## Types
3534
- feat: ✨ New cmdlet, function, or module feature
3635
- fix: 🐛 Bug fix in PowerShell code
3736
- docs: 📚 Help documentation, comment-based help
@@ -46,17 +45,17 @@ commit messages. Tailor commit messages for PowerShell development, using the pr
4645
- packaging: 📦 Packaging changes, module version updates
4746
- security: 🔒 Security-related changes, input validation, authentication
4847

49-
## PowerShell Scopes:
48+
## Scopes
5049
- module: Module-level changes
5150
- cmdlet: Specific cmdlet modifications
5251
- function: Function updates
5352
- help: Documentation changes
5453
- manifest: Module manifest updates
5554
- tests: Test-related changes
5655

57-
## Examples:
58-
✨feat(cmdlet): add Get-UserProfile with parameter validation
59-
🐛fix(function): resolve Invoke-ApiCall error handling
60-
📚docs(help): update comment-based help for Set-Configuration
61-
🎨style(module): apply OTBS formatting and Pascal case
62-
✅test(cmdlet): add Pester tests for Get-SystemInfo
56+
## Examples
57+
feat(cmdlet): add Get-UserProfile with parameter validation
58+
🐛 fix(function): resolve Invoke-ApiCall error handling
59+
📚 docs(help): update comment-based help for Set-Configuration
60+
🎨 style(module): apply OTBS formatting and Pascal case
61+
test(cmdlet): add Pester tests for Get-SystemInfo

.github/instructions/a11y.instructions.md

Lines changed: 369 additions & 0 deletions
Large diffs are not rendered by default.

.github/instructions/codacy.instructions.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ Configuration for AI behavior when interacting with Codacy's MCP Server
1010
- ALWAYS use:
1111
- provider: gh
1212
- organization: SamErde
13-
- repository: PrivateAutomations
1413
- Avoid calling `git remote -v` unless really necessary
1514

1615
## CRITICAL: After ANY successful `edit_file` or `reapply` operation
@@ -28,7 +27,7 @@ Configuration for AI behavior when interacting with Codacy's MCP Server
2827
- Wait for the user to respond before proceeding with any other actions
2928

3029
## After every response
31-
- If you made any file edits in this conversation, verify you ran `codacy_cli_analyze` tool from Codacy's MCP Server
30+
- If you made any file edits in this conversation, verify you ran `codacy_cli_analyze` tool from Codacy's MCP Server
3231

3332
## When there are no Codacy MCP Server tools available, or the MCP Server is not reachable
3433
- Suggest the user the following troubleshooting steps:
@@ -76,4 +75,4 @@ Configuration for AI behavior when interacting with Codacy's MCP Server
7675
- If the user accepts, run the `codacy_setup_repository` tool
7776
- Do not ever try to run the `codacy_setup_repository` tool on your own
7877
- After setup, immediately retry the action that failed (only retry once)
79-
---
78+
---

.github/instructions/github-actions-ci-cd-best-practices.instructions.md

Lines changed: 607 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
---
2+
description: 'Guidelines for creating high-quality custom instruction files for GitHub Copilot'
3+
applyTo: '**/*.instructions.md'
4+
---
5+
6+
# Custom Instructions File Guidelines
7+
8+
Instructions for creating effective and maintainable custom instruction files that guide GitHub Copilot in generating domain-specific code and following project conventions.
9+
10+
## Project Context
11+
12+
- Target audience: Developers and GitHub Copilot working with domain-specific code
13+
- File format: Markdown with YAML frontmatter
14+
- File naming convention: lowercase with hyphens (e.g., `react-best-practices.instructions.md`)
15+
- Location: `.github/instructions/` directory
16+
- Purpose: Provide context-aware guidance for code generation, review, and documentation
17+
18+
## Required Frontmatter
19+
20+
Every instruction file must include YAML frontmatter with the following fields:
21+
22+
```yaml
23+
---
24+
description: 'Brief description of the instruction purpose and scope'
25+
applyTo: 'glob pattern for target files (e.g., **/*.ts, **/*.py)'
26+
---
27+
```
28+
29+
### Frontmatter Guidelines
30+
31+
- **description**: Single-quoted string, 1-500 characters, clearly stating the purpose
32+
- **applyTo**: Glob pattern(s) specifying which files these instructions apply to
33+
- Single pattern: `'**/*.ts'`
34+
- Multiple patterns: `'**/*.ts, **/*.tsx, **/*.js'`
35+
- Specific files: `'src/**/*.py'`
36+
- All files: `'**'`
37+
38+
## File Structure
39+
40+
A well-structured instruction file should include the following sections:
41+
42+
### 1. Title and Overview
43+
44+
- Clear, descriptive title using `#` heading
45+
- Brief introduction explaining the purpose and scope
46+
- Optional: Project context section with key technologies and versions
47+
48+
### 2. Core Sections
49+
50+
Organize content into logical sections based on the domain:
51+
52+
- **General Instructions**: High-level guidelines and principles
53+
- **Best Practices**: Recommended patterns and approaches
54+
- **Code Standards**: Naming conventions, formatting, style rules
55+
- **Architecture/Structure**: Project organization and design patterns
56+
- **Common Patterns**: Frequently used implementations
57+
- **Security**: Security considerations (if applicable)
58+
- **Performance**: Optimization guidelines (if applicable)
59+
- **Testing**: Testing standards and approaches (if applicable)
60+
61+
### 3. Examples and Code Snippets
62+
63+
Provide concrete examples with clear labels:
64+
65+
```markdown
66+
### Good Example
67+
\`\`\`language
68+
// Recommended approach
69+
code example here
70+
\`\`\`
71+
72+
### Bad Example
73+
\`\`\`language
74+
// Avoid this pattern
75+
code example here
76+
\`\`\`
77+
```
78+
79+
### 4. Validation and Verification (Optional but Recommended)
80+
81+
- Build commands to verify code
82+
- Linting and formatting tools
83+
- Testing requirements
84+
- Verification steps
85+
86+
## Content Guidelines
87+
88+
### Writing Style
89+
90+
- Use clear, concise language
91+
- Write in imperative mood ("Use", "Implement", "Avoid")
92+
- Be specific and actionable
93+
- Avoid ambiguous terms like "should", "might", "possibly"
94+
- Use bullet points and lists for readability
95+
- Keep sections focused and scannable
96+
97+
### Best Practices
98+
99+
- **Be Specific**: Provide concrete examples rather than abstract concepts
100+
- **Show Why**: Explain the reasoning behind recommendations when it adds value
101+
- **Use Tables**: For comparing options, listing rules, or showing patterns
102+
- **Include Examples**: Real code snippets are more effective than descriptions
103+
- **Stay Current**: Reference current versions and best practices
104+
- **Link Resources**: Include official documentation and authoritative sources
105+
106+
### Common Patterns to Include
107+
108+
1. **Naming Conventions**: How to name variables, functions, classes, files
109+
2. **Code Organization**: File structure, module organization, import order
110+
3. **Error Handling**: Preferred error handling patterns
111+
4. **Dependencies**: How to manage and document dependencies
112+
5. **Comments and Documentation**: When and how to document code
113+
6. **Version Information**: Target language/framework versions
114+
115+
## Patterns to Follow
116+
117+
### Bullet Points and Lists
118+
119+
```markdown
120+
## Security Best Practices
121+
122+
- Always validate user input before processing
123+
- Use parameterized queries to prevent SQL injection
124+
- Store secrets in environment variables, never in code
125+
- Implement proper authentication and authorization
126+
- Enable HTTPS for all production endpoints
127+
```
128+
129+
### Tables for Structured Information
130+
131+
```markdown
132+
## Common Issues
133+
134+
| Issue | Solution | Example |
135+
| ---------------- | ------------------- | ----------------------------- |
136+
| Magic numbers | Use named constants | `const MAX_RETRIES = 3` |
137+
| Deep nesting | Extract functions | Refactor nested if statements |
138+
| Hardcoded values | Use configuration | Store API URLs in config |
139+
```
140+
141+
### Code Comparison
142+
143+
```markdown
144+
### Good Example - Using TypeScript interfaces
145+
\`\`\`typescript
146+
interface User {
147+
id: string;
148+
name: string;
149+
email: string;
150+
}
151+
152+
function getUser(id: string): User {
153+
// Implementation
154+
}
155+
\`\`\`
156+
157+
### Bad Example - Using any type
158+
\`\`\`typescript
159+
function getUser(id: any): any {
160+
// Loses type safety
161+
}
162+
\`\`\`
163+
```
164+
165+
### Conditional Guidance
166+
167+
```markdown
168+
## Framework Selection
169+
170+
- **For small projects**: Use Minimal API approach
171+
- **For large projects**: Use controller-based architecture with clear separation
172+
- **For microservices**: Consider domain-driven design patterns
173+
```
174+
175+
## Patterns to Avoid
176+
177+
- **Overly verbose explanations**: Keep it concise and scannable
178+
- **Outdated information**: Always reference current versions and practices
179+
- **Ambiguous guidelines**: Be specific about what to do or avoid
180+
- **Missing examples**: Abstract rules without concrete code examples
181+
- **Contradictory advice**: Ensure consistency throughout the file
182+
- **Copy-paste from documentation**: Add value by distilling and contextualizing
183+
184+
## Testing Your Instructions
185+
186+
Before finalizing instruction files:
187+
188+
1. **Test with Copilot**: Try the instructions with actual prompts in VS Code
189+
2. **Verify Examples**: Ensure code examples are correct and run without errors
190+
3. **Check Glob Patterns**: Confirm `applyTo` patterns match intended files
191+
192+
## Example Structure
193+
194+
Here's a minimal example structure for a new instruction file:
195+
196+
```markdown
197+
---
198+
description: 'Brief description of purpose'
199+
applyTo: '**/*.ext'
200+
---
201+
202+
# Technology Name Development
203+
204+
Brief introduction and context.
205+
206+
## General Instructions
207+
208+
- High-level guideline 1
209+
- High-level guideline 2
210+
211+
## Best Practices
212+
213+
- Specific practice 1
214+
- Specific practice 2
215+
216+
## Code Standards
217+
218+
### Naming Conventions
219+
- Rule 1
220+
- Rule 2
221+
222+
### File Organization
223+
- Structure 1
224+
- Structure 2
225+
226+
## Common Patterns
227+
228+
### Pattern 1
229+
Description and example
230+
231+
\`\`\`language
232+
code example
233+
\`\`\`
234+
235+
### Pattern 2
236+
Description and example
237+
238+
## Validation
239+
240+
- Build command: `command to verify`
241+
- Linting: `command to lint`
242+
- Testing: `command to test`
243+
```
244+
245+
## Maintenance
246+
247+
- Review instructions when dependencies or frameworks are updated
248+
- Update examples to reflect current best practices
249+
- Remove outdated patterns or deprecated features
250+
- Add new patterns as they emerge in the community
251+
- Keep glob patterns accurate as project structure evolves
252+
253+
## Additional Resources
254+
255+
- [Custom Instructions Documentation](https://code.visualstudio.com/docs/copilot/customization/custom-instructions)
256+
- [Awesome Copilot Instructions](https://github.com/github/awesome-copilot/tree/main/instructions)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
description: 'Guidelines for localizing markdown documents'
3+
applyTo: '**/*.md'
4+
---
5+
6+
# Guidance for Localization
7+
8+
You're an expert of localization for technical documents. Follow the instruction to localize documents.
9+
10+
## Instruction
11+
12+
- Find all markdown documents and localize them into given locale.
13+
- All localized documents should be placed under the `localization/{{locale}}` directory.
14+
- The locale format should follow the format of `{{language code}}-{{region code}}`. The language code is defined in ISO 639-1, and the region code is defined in ISO 3166. Here are some examples:
15+
- `en-us`
16+
- `fr-ca`
17+
- `ja-jp`
18+
- `ko-kr`
19+
- `pt-br`
20+
- `zh-cn`
21+
- Localize all the sections and paragraphs in the original documents.
22+
- DO NOT miss any sections nor any paragraphs while localizing.
23+
- All image links should point to the original ones, unless they are external.
24+
- All document links should point to the localized ones, unless they are external.
25+
- When the localization is complete, ALWAYS compare the results to the original documents, especially the number of lines. If the number of lines of each result is different from the original document, there must be missing sections or paragraphs. Review line-by-line and update it.
26+
27+
## Disclaimer
28+
29+
- ALWAYS add the disclaimer to the end of each localized document.
30+
- Here's the disclaimer:
31+
32+
```text
33+
---
34+
35+
**DISCLAIMER**: This document is the localized by [GitHub Copilot](https://docs.github.com/copilot/about-github-copilot/what-is-github-copilot). Therefore, it may contain mistakes. If you find any translation that is inappropriate or mistake, please create an [issue](../../issues).
36+
```
37+
38+
- The disclaimer should also be localized.
39+
- Make sure the link in the disclaimer should always point to the issue page.

0 commit comments

Comments
 (0)