|
| 1 | +# Copilot Instructions |
| 2 | + |
| 3 | +This directory contains instruction files for GitHub Copilot and other AI coding agents. These instructions are automatically applied when working with specific file types in this repository. |
| 4 | + |
| 5 | +## Purpose |
| 6 | + |
| 7 | +Instruction files provide high-level guidance, requirements, preferences, and constraints that AI agents should follow when modifying code. They are: |
| 8 | + |
| 9 | +- **Concise**: Sent with every AI request, so kept brief and focused |
| 10 | +- **High-level**: Define rules and requirements, not detailed procedures |
| 11 | +- **File-scoped**: Applied based on `applyTo` pattern in frontmatter |
| 12 | +- **Linked**: Reference detailed prompts in `.github/prompts/` for task-specific guidance |
| 13 | + |
| 14 | +## Structure |
| 15 | + |
| 16 | +Each instruction file follows this template: |
| 17 | + |
| 18 | +```markdown |
| 19 | +--- |
| 20 | +applyTo: '<glob-pattern>' |
| 21 | +description: 'Brief description of what this instruction covers' |
| 22 | +--- |
| 23 | + |
| 24 | +# Copilot Instructions for [Area] |
| 25 | + |
| 26 | +## PURPOSE |
| 27 | +What this instruction file is for |
| 28 | + |
| 29 | +## REQUIREMENTS |
| 30 | +### COMMON REQUIREMENTS |
| 31 | +- ALWAYS/NEVER statements for critical rules |
| 32 | + |
| 33 | +### SPECIFIC REQUIREMENTS |
| 34 | +- Domain-specific requirements |
| 35 | + |
| 36 | +## PREFERENCES |
| 37 | +- PREFER statements for recommended approaches |
| 38 | + |
| 39 | +## CONSTRAINTS |
| 40 | +- NEVER statements for forbidden actions |
| 41 | + |
| 42 | +## RELATED PROMPTS |
| 43 | +Links to detailed `.github/prompts/*.prompt.md` files |
| 44 | +``` |
| 45 | + |
| 46 | +## Instruction Files |
| 47 | + |
| 48 | +### `extractors_cds_tools_ts.instructions.md` |
| 49 | + |
| 50 | +**Applies to**: `extractors/cds/tools/**/*.ts` |
| 51 | + |
| 52 | +Provides guidance for TypeScript development in the CodeQL CDS extractor, including build requirements, testing practices, and architectural patterns. |
| 53 | + |
| 54 | +**Related Agent**: `.github/agents/cds-extractor-agent.md` |
| 55 | + |
| 56 | +**Related Prompt**: `.github/prompts/cds_extractor_development.prompt.md` |
| 57 | + |
| 58 | +### `javascript_cap_ql.instructions.md` |
| 59 | + |
| 60 | +**Applies to**: `javascript/frameworks/cap/**/*.ql`, `javascript/frameworks/cap/**/*.qll` |
| 61 | + |
| 62 | +Provides guidance for developing CodeQL queries and library models for the SAP CAP framework. |
| 63 | + |
| 64 | +**Related Agent**: `.github/agents/cap-modeling-agent.md` |
| 65 | + |
| 66 | +**Related Prompt**: `.github/prompts/cap_framework_development.prompt.md` |
| 67 | + |
| 68 | +### `javascript_ui5_ql.instructions.md` |
| 69 | + |
| 70 | +**Applies to**: `javascript/frameworks/ui5/**/*.ql`, `javascript/frameworks/ui5/**/*.qll` |
| 71 | + |
| 72 | +Provides guidance for developing CodeQL queries and library models for the SAPUI5 framework. |
| 73 | + |
| 74 | +**Related Agent**: `.github/agents/ui5-modeling-agent.md` |
| 75 | + |
| 76 | +**Related Prompt**: `.github/prompts/ui5_framework_development.prompt.md` |
| 77 | + |
| 78 | +### `javascript_xsjs_ql.instructions.md` |
| 79 | + |
| 80 | +**Applies to**: `javascript/frameworks/xsjs/**/*.ql`, `javascript/frameworks/xsjs/**/*.qll` |
| 81 | + |
| 82 | +Provides guidance for developing CodeQL queries and library models for the SAP XSJS framework. |
| 83 | + |
| 84 | +**Related Agent**: `.github/agents/xsjs-modeling-agent.md` |
| 85 | + |
| 86 | +**Related Prompt**: `.github/prompts/xsjs_framework_development.prompt.md` |
| 87 | + |
| 88 | +### `dependency_upgrades.instructions.md` |
| 89 | + |
| 90 | +**Applies to**: `extractors/cds/tools/package.json`, `.github/workflows/*.yml` |
| 91 | + |
| 92 | +Provides guidance for upgrading dependencies including Node.js packages, CodeQL/QLT CLI versions, and GitHub Actions. |
| 93 | + |
| 94 | +**Related Agent**: `.github/agents/dependency-upgrade-agent.md` |
| 95 | + |
| 96 | +**Related Prompt**: `.github/prompts/dependency_upgrade.prompt.md` |
| 97 | + |
| 98 | +### `github_maintenance.instructions.md` |
| 99 | + |
| 100 | +**Applies to**: `.github/**/*.md`, `.github/**/*.yml`, `PROMPTS.md` |
| 101 | + |
| 102 | +Provides guidance for maintaining the GitHub infrastructure including agents, instructions, prompts, templates, and workflows. |
| 103 | + |
| 104 | +**Related Agent**: `.github/agents/github-maintenance-agent.md` |
| 105 | + |
| 106 | +**Related Prompt**: `.github/prompts/github_maintenance.prompt.md` |
| 107 | + |
| 108 | +## How Instructions Are Used |
| 109 | + |
| 110 | +1. **Automatic Application**: When an AI agent works on a file matching the `applyTo` pattern, the corresponding instruction file is automatically included in the context. |
| 111 | + |
| 112 | +2. **Hierarchy**: Instructions are part of a larger hierarchy documented in `PROMPTS.md`: |
| 113 | + - Level 1: `.github/ISSUE_TEMPLATE/*.yml` - Entry points |
| 114 | + - Level 2: `.github/agents/*.md` - Agent definitions |
| 115 | + - Level 3: `.github/instructions/*.instructions.md` - High-level rules (this directory) |
| 116 | + - Level 4: `.github/prompts/*.prompt.md` - Detailed task guides |
| 117 | + |
| 118 | +3. **Enforcement**: Instructions define "ALWAYS" and "NEVER" rules that agents should strictly follow. |
| 119 | + |
| 120 | +4. **Guidance**: Instructions provide "PREFER" recommendations for best practices. |
| 121 | + |
| 122 | +## Best Practices |
| 123 | + |
| 124 | +When creating or modifying instruction files: |
| 125 | + |
| 126 | +1. **Keep them concise** - They're sent with every request |
| 127 | +2. **Use clear ALWAYS/NEVER statements** - Make requirements unambiguous |
| 128 | +3. **Link to prompts** - Reference detailed guidance in the RELATED PROMPTS section |
| 129 | +4. **Maintain structure** - Use the standard template format |
| 130 | +5. **Update the hierarchy** - Reflect changes in `PROMPTS.md` |
| 131 | + |
| 132 | +## Related Documentation |
| 133 | + |
| 134 | +- **Prompts Hierarchy**: `PROMPTS.md` - Overview of the entire agentic maintenance system |
| 135 | +- **Agents**: `.github/agents/` - Specialized AI agent definitions |
| 136 | +- **Prompts**: `.github/prompts/` - Detailed task-specific guidance |
| 137 | +- **Issue Templates**: `.github/ISSUE_TEMPLATE/` - Entry points for agent workflows |
| 138 | + |
| 139 | +## Contributing |
| 140 | + |
| 141 | +When adding new instruction files: |
| 142 | + |
| 143 | +1. Follow the template structure |
| 144 | +2. Define a clear `applyTo` pattern |
| 145 | +3. Link to related agents and prompts |
| 146 | +4. Update `PROMPTS.md` with the new instruction |
| 147 | +5. Test that the `applyTo` pattern matches the intended files |
0 commit comments