Update Review Instructions
Generate or update .github/instructions/*.instructions.md files that guide GitHub Copilot code review for this project. Each file targets a specific project scope with review guidelines derived from the project's own documented conventions.
Why This Matters
GitHub Copilot code review reads instruction files from the PR's base branch. Without project-specific instructions, reviews miss convention violations unique to this codebase (cross-distribution parity, progressive disclosure compliance, agent delegation patterns). Each instruction file has a hard 4,000 character limit for code review.
Hard Rules
Process
Scope Selection
Present the user with available scopes. Read ${CLAUDE_SKILL_DIR}/references/scope-registry.md for the complete scope registry.
Display the scopes as a numbered list and ask the user to select one or more. If the user names a scope not in the registry, analyze the project to determine appropriate applyTo patterns and convention sources for the custom scope.
Phase 1: Convention Extraction
For the selected scope, gather all applicable conventions:
- Read
.claude/rules/files whosepaths:patterns overlap with the scope'sapplyTopattern - Read
DESIGN-GUIDELINES.mdsections relevant to the scope's artifact type - Read
plugins/agents-initializer/CLAUDE.mdfor plugin-specific conventions (if scope touches plugin paths) - Read existing instruction file (if updating) to identify what's already covered
- Scan actual files matching the scope pattern to identify real conventions not yet documented
Compile a deduplicated list of conventions with their sources.
Phase 2: Instruction Drafting
Read ${CLAUDE_SKILL_DIR}/references/instruction-writing-guide.md for format and quality standards.
Draft the instruction file following these principles:
- YAML frontmatter first:
applyTowith the scope's glob pattern - Title:
# {Scope Name} Review Guidelines - Group by concern: Use
##headings for each review concern area - Imperative directives: "Flag any...", "Check for...", "Verify that..."
- Concrete examples: Include code snippets showing correct AND incorrect patterns when helpful
- Priority ordering: Critical rules first, nice-to-haves last
- Common Issues section: End with a bullet list of the most likely defects
Phase 3: Budget Validation
Measure the character count of the drafted file:
wc -c < .github/instructions/{scope}.instructions.md
If over 4,000 characters:
- Remove the lowest-priority items
- Compress verbose explanations into terse directives
- Remove examples if the directive is clear without them
- Re-measure until under 4,000 characters
If under 2,000 characters, consider whether important conventions were missed in Phase 1.
Phase 4: Present and Apply
- Show the complete instruction file content
- Highlight what changed (if updating an existing file)
- Show character count and remaining budget
- Apply after user confirmation
If creating a new scope, also update ${CLAUDE_SKILL_DIR}/references/scope-registry.md to include the new scope.
Source: rodrigorjsf/agent-engineering-toolkit — distributed by TomeVault.