@manuelvanrijn/copilot-instructions-plugin
v0.3.0
Published
OpenCode plugin that loads .github/instructions/ files with applyTo: frontmatter into the system prompt — like GitHub Copilot instructions
Maintainers
Readme
@manuelvanrijn/copilot-instructions-plugin
An OpenCode plugin and Claude Code plugin that loads .github/instructions/ files into the AI agent's system prompt — following the same applyTo: convention as GitHub Copilot custom instructions.
Variants
This repo contains two plugin variants that share the same instruction source (.github/instructions/*.md):
| Variant | Target | Entry point |
|---|---|---|
| OpenCode plugin | OpenCode | src/index.ts (npm package) |
| Claude Code plugin | Claude Code | .claude-plugin/ (hook-based) |
How it works
.github/copilot-instructions.mdis always injected if it exists — this is the repository-level instructions file used by GitHub Copilot- Files with
applyTo:are injected on-demand when the agent reads, edits, or writes a file matching the glob pattern - Files without
applyTo:are always injected at the start of every session
This means you can keep your existing .github/copilot-instructions.md and .github/instructions/ setup and it works in both Copilot and OpenCode without any duplication.
Installation
opencode plugin @manuelvanrijn/[email protected] --globalOr add it to your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"plugin": ["@manuelvanrijn/[email protected]"]
}Instruction file format
Same format as GitHub Copilot — YAML frontmatter with applyTo::
---
applyTo: "app/controllers/**"
---
# Controllers Guide
Your instructions here...Multiple globs (comma-separated):
---
applyTo: "app/models/**, test/**"
---
# ModelsNo frontmatter = always active:
# General Rails Guidelines
Always use...Debugging
Enable verbose logging:
COPILOT_INSTRUCTIONS_DEBUG=1 opencodeTool: list_injected_copilot_instructions
The plugin exposes a tool the agent can call to report the current injection status:
list_injected_copilot_instructionsOutput shows which files are injected, which are pending, and which file paths have been seen in the session.
Releasing
Publishing to npm is fully automated via .github/workflows/publish.yml, triggered by pushing a v*.*.* tag.
Use the release script from a clean main:
git switch main && git pull
./scripts/release.sh patch # or: minor | majorThe script:
- Verifies the working tree is clean.
- Bumps the version in
package.json(npm version --no-git-tag-version). - Updates
CHANGELOG.md: renames## Unreleasedto## vX.Y.Z — YYYY-MM-DDand adds a fresh## Unreleasedsection at the top. - Commits (
chore: release vX.Y.Z), creates tagvX.Y.Z, and pushes both toorigin/main.
The tag push then triggers the GitHub Actions workflow, which:
- Verifies the tag matches
package.jsonversion. - Creates a GitHub Release with auto-generated notes.
- Publishes to npm with
--provenance(OIDC / sigstore).
License
MIT
Claude Code plugin
The .claude-plugin/ directory contains a Claude Code plugin variant that uses Claude hooks for the same lazy instruction loading.
How it works
- SessionStart adds always-active rules to Claude context.
- UserPromptSubmit extracts file paths from prompts and activates matching conditional rules.
- PreToolUse (Read, Write, Edit, Glob, Grep) tracks accessed files and activates matching rules.
- PreCompact preserves context paths across compaction.
Rules are delivered through Claude Code hook additionalContext, not systemMessage, so Claude receives them as hidden context instead of a user-facing warning. Current-session state is stored under Claude's persistent plugin data directory. When Claude resumes, active rules are re-sent because hook context is process-local even when the session id is reused.
Installation
For local development, register this checkout as a Claude Code marketplace and install the plugin:
claude plugin marketplace add /path/to/copilot-instructions-plugin
claude plugin install copilot-instructions@copilot-instructions --scope userIn Claude Code, the status helper is available as:
/list-copilot-instructionsIf you previously installed the early development marketplace name, remove it before reinstalling:
claude plugin uninstall copilot-instructions@copilot-instructions-plugin --scope userPublishing
This repo can act as the Claude marketplace source directly.
Add it to Claude Code with:
claude plugin marketplace add manuelvanrijn/copilot-instructions-plugin
claude plugin install copilot-instructions@copilot-instructionsFor a public Claude marketplace listing, submit this repository through Anthropic's plugin submission flow after the repo is live.
