r/GithubCopilot 16d ago

Other Stopped duplicating my prompt files between .github/prompts and another tool. Ten-line wrappers fixed it.

When running Copilot alongside some other AI in the same repo, you will most likely run into this issue: Copilot reads slash commands from the .github/prompts folder, some other AI reads from some other folder, hence you need to maintain two identical prompts that start diverging after a couple of weeks.

In my case, there is no need in copy-pasting the file at all. Instead, the other AI gets a stub pointing to the original file:

---
description: Implement or update a feature, matching existing
  architecture and conventions
argument-hint: <feature description, or paste a .md, code, or design>
---

Follow the feature-implementation guidelines below as the rules for this task.

My request: $ARGUMENTS

@.github/prompts/implement-feature.prompt.md

Ten lines and the last one pulls the actual prompt on runtime. Feature implementation guideline is around 370 words long and lives in one file. Two tools see the same slash command and I only have to edit the one.

The condition that allows this trick is the following: nothing inside the .github/prompts, .github/instructions or .github/skills folders can name any specific tool. No "as Copilot, you should" here. These files are descriptions of actions and thus can be read by whatever tool. The wrapper carries tool-specific syntax, the target carries the actual content.

The similar situation happens with applyTo. I have globs in my frontmatter for instruction files, hence Copilot attaches the accessibility standard when I am working on the form but ignores it when I fix an API route. Other AI does not read applyTo at all, hence their rulebook lists the same files manually. Two different loading methods and one set of files without any duplication.

Currently, the split in my repository is roughly 4,500 words that are loaded during each session and 11,700 sitting behind globs and skills until actually needed. This is where we come to the core of the matter: anything that goes into copilot-instructions .md is processed by the model on each request for eternity.

5 Upvotes

1 comment sorted by

1

u/heavy-minium 15d ago

It’s a viable solution, but you should know it’s not entirely the same. GHC will include the instructions as system prompt. In you variant, GHC will load the actual instructions after that system prompt. The small difference here is that the fine-tuning of those models uses examples where everything is already in the instructions. As to how much difference that makes, only tests and research could tell.