Repository navigation
Add persistent agent instruction file output mode (Copilot, Claude Code, Cursor) #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Alan Jowett (Alan-Jowett)
merged 5 commits into
main
from
copilot/output-copilot-instructions-files
Mar 18, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8d25b8a
Initial plan
Copilot b590c70
Add agent instruction file output mode for GitHub Copilot, Claude Cod…
Copilot f05dc69
Rework: produce composable Copilot skill files, not monolithic copilo…
a767862
Fix: ask for target project path, never write to PromptKit repo
056eb6b
fix: reorder bootstrap steps and restrict scope param
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,167 @@ | ||
| <!-- SPDX-License-Identifier: MIT --> | ||
| <!-- Copyright (c) PromptKit Contributors --> | ||
|
|
||
| --- | ||
| name: agent-instructions | ||
| type: format | ||
| description: > | ||
| Output format for persistent agent instruction files. Produces | ||
| composable skill files for GitHub Copilot | ||
| (.github/instructions/*.instructions.md) and platform-appropriate | ||
| equivalents for Claude Code and Cursor. Files are version-controlled | ||
| and automatically loaded by agent runtimes. | ||
| produces: agent-instruction-file | ||
| --- | ||
|
|
||
| # Format: Agent Instruction Files | ||
|
|
||
| The output MUST be one or more ready-to-commit agent instruction files | ||
| for the specified platform(s). For GitHub Copilot, each PromptKit | ||
| protocol produces a **separate skill file** with an `applyTo` glob so | ||
| skills compose automatically — mirroring PromptKit's own compositional | ||
| architecture. | ||
|
|
||
| Do NOT produce raw prompt output with PromptKit section headers — the | ||
| content must be continuous, natural instruction prose suitable for direct | ||
| consumption by the target agent runtime. | ||
|
|
||
| ## Output Structure | ||
|
|
||
| ### 1. File Manifest | ||
|
|
||
| List every file that will be created: | ||
|
|
||
| | Platform | File Path Pattern | Scope | | ||
| |----------|-------------------|-------| | ||
| | GitHub Copilot | `.github/instructions/<name>.instructions.md` | Per-skill (targeted via `applyTo`) | | ||
| | Claude Code | `CLAUDE.md` | Project-wide | | ||
| | Cursor | `.cursorrules` | Project-wide | | ||
|
|
||
| For GitHub Copilot, produce **one skill file per logical concern**. The | ||
| recommended decomposition is: | ||
|
|
||
| | Skill file | Contents | `applyTo` example | | ||
| |------------|----------|-------------------| | ||
| | `<persona>.instructions.md` | Condensed persona identity and guardrail protocols (anti-hallucination, self-verification) | `**` | | ||
| | `<analysis-protocol>.instructions.md` | A single analysis protocol's checks and phases | Language-specific glob (e.g., `**/*.c`) | | ||
| | `<reasoning-protocol>.instructions.md` | A single reasoning protocol | `**` or task-specific glob | | ||
|
|
||
| State which file(s) will be produced and why. | ||
|
|
||
| ### 2. File Content — GitHub Copilot Skill Files | ||
|
|
||
| Each `.instructions.md` file MUST begin with YAML frontmatter: | ||
|
|
||
| ```markdown | ||
| --- | ||
| description: '<one-line summary of what this skill does>' | ||
| applyTo: '<glob pattern>' | ||
| --- | ||
|
|
||
| <instruction content> | ||
| ``` | ||
|
|
||
| **Frontmatter fields:** | ||
|
|
||
| - **`description`** *(required)* — A brief summary of the skill's purpose. | ||
| Wrap in single quotes. | ||
| - **`applyTo`** *(required)* — Comma-separated glob patterns specifying | ||
| which files activate this skill. Use `**` for all files, or | ||
| language-specific patterns like `**/*.c, **/*.h`. | ||
|
|
||
| **Content rules:** | ||
|
|
||
| - Open with `<!-- Generated by PromptKit — edit with care -->` immediately | ||
| after the frontmatter closing `---`. | ||
| - Write in **second person** ("You are…", "When you encounter…"). | ||
| - Condense protocol phases into standing directives — preserve all specific | ||
| checks but omit meta-commentary about protocol structure. | ||
| - Do NOT include PromptKit-internal headers (`# Identity`, | ||
| `# Reasoning Protocols`, `# Output Format`, etc.). | ||
| - Each skill file must be **self-contained** — it should make sense when | ||
| loaded independently by the agent runtime. | ||
|
|
||
| ### 3. File Content — Claude Code and Cursor | ||
|
|
||
| For Claude Code (`CLAUDE.md`) and Cursor (`.cursorrules`), produce a | ||
| **single combined file** containing all persona and protocol content | ||
| (these platforms do not support per-file skill targeting). | ||
|
|
||
| The content MUST: | ||
|
|
||
| - Begin with `<!-- Generated by PromptKit — edit with care -->` | ||
| - Contain all instructions as continuous, natural Markdown | ||
| - Be complete and self-contained | ||
|
|
||
| ### 4. Platform Notes | ||
|
|
||
| For each target platform, include a short note covering: | ||
|
|
||
| - **How it is loaded**: when and how the platform reads the file(s) | ||
| - **Known constraints**: size limits, unsupported syntax, scope restrictions | ||
| - **Recommended maintenance**: how to update and test the instructions | ||
|
|
||
| ### 5. Activation Checklist | ||
|
|
||
| A numbered checklist of steps to activate the instructions: | ||
|
|
||
| 1. Commit the file(s) to the repository. | ||
| 2. Reload the agent / editor extension. | ||
| 3. Verify the agent acknowledges the instructions in a test prompt. | ||
|
|
||
| ## Platform Reference | ||
|
|
||
| ### GitHub Copilot — `.github/instructions/*.instructions.md` | ||
|
|
||
| - **Loaded automatically** by GitHub Copilot in VS Code, JetBrains, and | ||
| GitHub.com when editing files matching the `applyTo` glob. | ||
| - **Scope**: Per-skill. Multiple skill files compose automatically; | ||
| all matching skills are combined for the current file context. | ||
| - **Size guidance**: Keep each skill file under ~4 KB for reliable | ||
| ingestion. Total combined instructions should stay under ~8 KB. | ||
| - **Naming**: Filenames must be lowercase, hyphen-separated, ending in | ||
| `.instructions.md` (e.g., `memory-safety-c.instructions.md`). | ||
| - **Syntax**: Plain Markdown with YAML frontmatter. `description` and | ||
| `applyTo` are required frontmatter fields. | ||
| - **Testing**: Open a Copilot Chat session while editing a file that | ||
| matches `applyTo` and ask "What instructions are active?" to confirm. | ||
|
|
||
| ### Claude Code — `CLAUDE.md` | ||
|
|
||
| - **Loaded automatically** by Claude Code when it starts in a directory | ||
| that contains this file (project root or any parent). | ||
| - **Scope**: Project-level (nearest `CLAUDE.md` takes precedence). | ||
| - **Size guidance**: No hard limit documented; keep concise for best results. | ||
| - **Syntax**: Plain Markdown. Claude Code reads the full file. | ||
| - **Testing**: Start a Claude Code session and ask "What project context | ||
| do you have?" to verify the file is loaded. | ||
|
|
||
| ### Cursor — `.cursorrules` | ||
|
|
||
| - **Loaded automatically** by Cursor as project-level rules applied to | ||
| all Cursor AI interactions within the workspace. | ||
| - **Scope**: Project-level. | ||
| - **Size guidance**: Keep under ~2 KB; Cursor may truncate longer files. | ||
| - **Syntax**: Plain text or Markdown. Cursor reads the raw content. | ||
| - **Testing**: Open Cursor in the repo and ask "What rules are you following?" | ||
|
|
||
| ## Formatting Rules | ||
|
|
||
| - Do NOT include PromptKit-internal section headers in generated file | ||
| content (`# Identity`, `# Reasoning Protocols`, `# Output Format`, etc.). | ||
| - Write instructions in **second person** directed at the agent | ||
| (e.g., "You are a…", "When reviewing code, always…"). | ||
| - Condense protocol and persona content — omit meta-commentary about the | ||
| protocol structure and retain only the actionable guidance. | ||
| - Every section in each output file MUST be present; omit sections only | ||
| if the platform imposes a size constraint, and note which sections were | ||
| omitted. | ||
| - Do NOT embed `{{param}}` placeholders in the output — all values must | ||
| be resolved before writing the file. | ||
| - For GitHub Copilot, choose `applyTo` globs that match the protocol's | ||
| natural scope: | ||
| - Language-specific protocols → language file extensions | ||
| (e.g., `**/*.c, **/*.h` for `memory-safety-c`) | ||
| - Guardrail / reasoning protocols → `**` (all files) | ||
| - Domain-specific protocols → relevant path patterns | ||
| (e.g., `**/infra/**` for infrastructure review) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.