# Part 3 — GitHub Copilot: Asset Templates

Downloadable, fill-in templates for every major Copilot configuration surface in
the QRefAI *AI Coding Field Guide*, Part 3. Copy these into your repo (or platform
repo) and replace every `<PLACEHOLDER>`.

```
.
├── .github/
│   ├── copilot-instructions.md            # 1. Repo-wide instructions; 4,000-char front-load zone MARKED
│   ├── instructions/
│   │   └── payments.instructions.md       # 2. Path-scoped rules via applyTo glob
│   ├── agents/
│   │   └── security-scout.agent.md        # 3a. Project-scoped custom agent
│   ├── prompts/
│   │   └── scaffold-service-module.prompt.md   # 4a. Prompt file → slash command; tools[] enumerated
│   ├── chatmodes/
│   │   └── secure-review.chatmode.md      # 4b. Chat mode persona; full tools[] enumerated
│   └── workflows/                         # 5. gh-aw Agentic Workflow starter set
│       ├── auto-triage-issues.md          #    label/triage new issues
│       ├── security-guard.md              #    per-PR security pass
│       ├── docs-sync.md                   #    keep docs in sync with code
│       ├── agents-md-maintainer.md        #    keep AGENTS.md accurate & lean
│       └── dependency-update.md           #    propose dependency bumps
├── .github-private/
│   └── agents/
│       └── security-scout.agent.md        # 3b. ORG/ENTERPRISE-wide variant (placement is the difference)
└── rulesets/
    └── main-protection.json               # 6. Auto Copilot review + required human review + status checks
```

## How the pieces relate (Copilot side of the common harness)

- **Instruction hierarchy** (Personal > Repository > Organization): repo-wide rules
  in `copilot-instructions.md`, subtree rules in `instructions/*.instructions.md`
  via `applyTo`, org-wide context in `AGENTS.md` (the cross-vendor standard).
- **The 4,000-char rule:** Copilot *code review* reads only the first ~4,000 chars
  of `copilot-instructions.md`. The front-load zone is marked in that file — keep
  must-enforce-in-review rules above the end marker.
- **Custom agents** are the Copilot twin of Claude subagents: one shared prompt
  body, two thin frontmatter wrappers. Project scope → `.github/agents/`; org scope
  → the special `.github-private` repo.
- **Prompt files vs chat modes:** prompt files are bounded chores (slash commands);
  chat modes are session personas. Both carry a `tools:` array — grant the minimum.
- **Agentic Workflows are OUTER-LOOP** (CI-triggered, repo-wide), complementary to
  Claude's inner-loop hooks. Every workflow here is **read-only by default** and
  writes only through **safe outputs**. Always compile with `gh aw compile --strict`.
- **The ruleset** makes review mandatory: it auto-requests the (non-blocking)
  Copilot review *and* requires a human approval, so every AI-authored change gets
  both passes.

## Notes

- **`rulesets/main-protection.json` uses `//`-prefixed keys for inline docs.** They
  parse as valid JSON; delete them in production if you prefer.
- **The `gh-aw` workflows are source Markdown.** The compiler turns each into a
  hardened, locked `*.lock.yml`. Run `gh aw compile --strict` — strict mode enforces
  the five security layers (read-only token, secret isolation, network firewall,
  containerized MCP gateway, SHA-pinning + linters).
- **Two honesty caveats from the guide:** `gh-aw` was in technical preview as of
  mid-2026, and Copilot's MCP registry enforcement matches on server name and can
  be bypassed — don't make either load-bearing without a fallback (a real gateway).

_Snapshot of the mid-2026 consensus. Re-verify vendor specifics (the 4,000-char
limit, ruleset field names, gh-aw schema) before relying on them — this field moves
monthly._
