Files
ki-copilot/08-anhang-cheatsheets.md
grok-bot 68739ecf53 Add hybrid Anhang A with stable core templates in the PDF.
Keep full materials online as versioned ZIPs; wire chapter cross-refs,
assembler order, and rebuild the book PDF.
2026-07-30 16:44:37 +02:00

22 KiB
Raw Permalink Blame History

Kapitel 8

Anhang – Cheatsheets, Vorlagen-Index und Glossar

Kern: Spickzettel zum Nachschlagen beim Arbeiten im echten Repo – nicht zum linearen Lesen statt der Kapitel 0–7.

So nutzt du den Anhang: Beim Arbeiten offen halten. Slash-Command oder Pfad nachschlagen → bei Unklarheit ins Kapitel springen. /help und copilot help sind Source of Truth – dieser Anhang ist eine Kernmenge (Stand Mitte/Ende 2026).

Hybrid: Syntax und Slash-Commands hier können driften. Stabile Kernvorlagen (kopierfertige Minima, Rituale, Permission-Faustregeln) stehen in Anhang A. Vollständige und laufend aktualisierte Materialien: Begleit-Service → Material.


8.1 Install & Auth (Spickzettel)

Plattform / Weg Befehl (prüfen)
npm (Node ≥ 22) npm install -g @github/copilot
Homebrew brew install --cask copilot-cli
WinGet winget install GitHub.Copilot
Install-Script (macOS/Linux) curl -fsSL https://gh.io/copilot-install | bash
Update copilot update
Version copilot --version
copilot login
# oder Headless:
export COPILOT_GITHUB_TOKEN=github_pat_YOUR_TOKEN   # fine-grained + Copilot Requests
# Precedence: COPILOT_GITHUB_TOKEN > GH_TOKEN > GITHUB_TOKEN
# Classic ghp_ : laut Doku nicht unterstützt

Details: Kapitel 01, 06.


8.2 Slash-Commands (Kernmenge)

Slash-Commands steuern den Harness (Session, Config, Diagnose) – nicht „das Modell umstimmen“.

Command Zweck Wann typisch
/help Hilfe Einstieg, unbekannter Befehl
? Quick help (leerer Prompt) Kurzreferenz
/login Authentifizierung erster Start, Token-Probleme
/init Instructions-Setup im Repo neues Repo; Ergebnis reviewen
/plan Plan-Workflow multi-file / unklare Architektur
/agent Custom/Built-in Agents wählen Spezial-Rolle
/model Modell wählen Qualität vs. Tempo/Kosten
/context Token-Visualisierung Drift, Kosten, „ignoriert Regeln“
/compact [FOKUS] History komprimieren Fenster voll; Fokus setzen
/clear, /new, /reset neue Conversation Themenwechsel
/resume Session fortsetzen gestern weitermachen
/session Session-Infos / Checkpoints / Plan / Files Diagnose, Persistenz
/diff Änderungen prüfen vor Commit/PR
/review agentic Code Review vor Commit/PR
/pr … PR view/create/fix/auto GitHub-Lifecycle (Kap. 3)
/usage Credits, Dauer, Token-Breakdown Budgets
/limits set / unset AI-Credit Session-Cap Kosten (Preview)
/instructions Instructions ein-/ausblenden / prüfen weiches Memory debuggen
/settings Settings interaktiv oder KEY VALUE Config
/mcp MCP verwalten Server add/status
/skills Skills Team-Workflows
/hooks Hooks ansehen Guardrail-Debug
/sandbox lokale Sandbox härtere Isolation
/add-dir, /list-dirs erlaubte Verzeichnisse multi-repo
/cwd, /cd Working Directory Fokus wechseln
/ide VS Code verbinden / Diffs im Editor IDE-Bridge
/delegate Cloud Agent asynchrone / tangentiale Tasks
/fleet parallele Subagents unabhängige Teilaufgaben
/research Deep-Research-Report Architektur, kein Code-Edit
/undo / /rewind Session/Workspace zurück nach Fehlschlag (Kap. 7)
/remote Remote Control on/off steuern von github.com/Mobile
/keep-alive Sleep verhindern Remote-Sessions
/rename Session benennen Resume-Picker
/share / /export Link, Gist, Markdown, HTML Session teilen – keine Secrets
/chronicle standup, tips, cost, search, improve Session-Historie auswerten
/allow-all, /yolo alle Permissions Risiko – selten
/reset-allowed-tools Session-Approvals zurück Permission-Hygiene
/feedback Feedback an GitHub Bugs/Features
/exit beenden Session schließen

Modi (Tastatur): Shift+Tab wechselt u. a. zwischen Standard, Plan und Autopilot (Labels können driften).

Eingabe-Präfixe:

Prefix Bedeutung
@pfad Datei/Anhang in den Kontext
#nummer Issue/PR referenzieren
!befehl Shell ohne Modell-Umweg

Vollständige und aktuelle Liste: ? / /help und CLI command reference. Session-Steuerung: Kapitel 07.

Compact-Fokus (Beispiele)

/compact Behalte freigegebenen Plan, geänderte Dateien, letzten Test-Fail.
Verwirf Explore-Umwege und gescheiterte Zwischenversuche.

/compact Fokus Auth-Modul. Entscheidung „JWT in Cookie“ behalten; CSS-Experiment verwerfen.

8.3 CLI-Flags & copilot help Topics

Häufige Start-Flags

Flag Zweck
-p / --prompt="…" programmatic: ein Prompt, dann Exit
-s silent / sauberere Ausgabe für Scripts
--continue letzte Session fortsetzen
--resume Session-Picker
--model NAME Modell setzen
--agent=NAME Custom Agent
--allow-tool=… Tool freigeben (wiederholbar)
--deny-tool=… Tool sperren (schlägt allow)
--allow-all-tools alle Tools ohne Prompt
--allow-all / --yolo breite Bypass-Permissions
--no-ask-user keine Rückfragen (CI)
--cloud Cloud-Sandbox-Session
--remote / --no-remote Remote Control erzwingen / sperren
--max-ai-credits=N Soft-Cap AI Credits (Preview)
--share=PATH / --share-gist programmatic Session teilen
--experimental experimentelle Features (Rewind/Schedule o. Ä.)
copilot -p "Führe die Unit-Tests aus und fasse Fehler zusammen. Keine Codeänderungen." \
  -s --no-ask-user \
  --allow-tool='shell(pytest)' \
  --deny-tool='write' \
  --deny-tool='shell(rm)'
# Review-only (Beispiel)
copilot -p '/review changes vs main. Bugs and security only.' \
  -s --no-ask-user --allow-tool='shell(git:*)' --deny-tool='write' --max-ai-credits 60

Help-Topics

copilot help
copilot help config
copilot help commands
copilot help environment
copilot help logging
copilot help permissions
copilot help providers
copilot help sandbox
copilot help billing
copilot help monitoring

Programmatic-Details: Run programmatically.


8.4 Dateipfade (User / Repo)

Merksatz: Repo teilen und reviewen; Local gitignoren; Managed/MDM gewinnt bei Policy.

Was Wo
User settings ~/.copilot/settings.json (oder $COPILOT_HOME)
Repo settings .github/copilot/settings.json
Local settings .github/copilot/settings.local.json
User instructions ~/.copilot/copilot-instructions.md
User modular instructions ~/.copilot/instructions/*.instructions.md
Repo instructions .github/copilot-instructions.md
Path-scoped instructions .github/instructions/**/*.instructions.md
Agent files (Discovery) AGENTS.md (wo unterstützt)
User agents ~/.copilot/agents/
Repo agents .github/agents/
Org/Enterprise agents /agents/ in Org-.github oder .github-private
User skills ~/.copilot/skills/**/SKILL.md
Repo skills .github/skills/**/SKILL.md
User hooks ~/.copilot/hooks/, inline in settings
Repo hooks .github/hooks/*.json
User MCP ~/.copilot/mcp-config.json
Repo MCP .mcp.json / .github/mcp.json (Doku prüfen)
Saved tool approvals ~/.copilot/permissions-config.json
Session state ~/.copilot/session-state/{id}/
Logs ~/.copilot/logs/
App state (nicht handeditieren) ~/.copilot/config.json

Settings-Precedence (später überschreibt früher): Defaults → MDM → User → Repo → Local → Env → Flags.

COPILOT_HOME ersetzt das gesamte Config-Root. Config-Dir-Referenz: cli-config-dir-reference.


8.5 Permission-Patterns

Precedence: --deny-tool schlägt --allow-tool und Allow-all.

CLI (Startbefehl)

# Häufig allow (Stack anpassen)
--allow-tool='shell(git:*)'
--allow-tool='shell(git status)'
--allow-tool='shell(pytest)'
--allow-tool='shell(npm run:*)'
--allow-tool='write'

# Häufig deny
--deny-tool='shell(rm)'
--deny-tool='shell(git push)'
--deny-tool='shell(git push --force)'
--deny-tool='write'          # read-only CI
Pattern Bedeutung
shell(git:*) git und Subcommands (laut Permissions-Hilfe)
shell(npm run:*) npm-Scripts
write Datei schreiben
MCP Server-/Tool-Namen laut copilot help permissions

Shell-Matching in permissions-config.json: literal; git:* matcht Subcommands; kein allgemeines git*-Glob.

Interaktiv

Yes · Session-Allow · No + Feedback · /reset-allowed-tools

Enterprise-Bypass-Sperre

{
  "permissions": {
    "disableBypassPermissionsMode": "disable"
  }
}

Hinweise: vorlagen/settings.permissions-hints.md, Kapitel 02, 04, 06. Minimale kopierfertige Baseline: Anhang A.3–A.4.


8.6 Explore → Plan → Code → Verify → Commit

Ritual ohne Slash-Pflicht (drift-resistenter): Anhang A.5. Unten die erweiterte Spickzettel-Form inkl. typischer Session-Commands (Namen: ? / /help).

1. Explore:  „Erkläre X. Ändere nichts.“
2. Plan:     Shift+Tab / /plan – noch kein Code
3. Review:   Plan lesen, anpassen, freigeben
4. Code:     „Setze den Plan um.“
5. Verify:   Tests/Lint aus den Instructions / Verify-Skill
6. Diff:     /diff  →  menschlich lesen
7. Optional: /review (Bugs/Security)
8. Commit:   erst nach Diff
9. PR:       /pr create – Merge bleibt menschlich
Modus Kurz
Plan Mode strukturierter Plan vor Code
Autopilot autonomer bis Task-Ende – nur mit Trust/Policy
Fleet parallele Subtasks – Credits beachten
/pr PR view/create/fix – auto nur mit Deny+Diff
/delegate Cloud Agent + PR
/undo Rewind nach Fehlschlag (vor Push)

Kapitel 03.


8.7 MCP / Skills / Hooks / Agents / Plugins

Bedarf Mittel Härte
Immer gültige Normen Custom Instructions weich
Wiederholbarer Task on-demand Skill (SKILL.md) weich, gezielt
Neue externe Fähigkeiten MCP Angriffsfläche
Erzwingen / Guardrail Hook hart
Spezial-Persona / Tool-Subset Custom Agent Isolation
Bundle verteilen Plugin / Marketplace review vor Trust
/mcp
/skills
/hooks
/agent
copilot plugins list

Kapitel 05.


8.8 Vorlagen- und Beispiel-Index

Zuerst im Buch: Anhang A – Stabile Kernvorlagen (A.1–A.7, kopierfertig, drift-resistent).

Vollständig und aktuell: Begleit-Service → Material (vorlagen.zip, beispiele.zip, MANIFEST/SHA256): https://books.maatini.space/projects/copilot-cli-harness/. Dort auch Stand & Drift, Errata und schnelle Hilfe. ZIP entpacken, dann beispiele/… bzw. vorlagen/….

Bedarf Im Buch Online (ZIP / Repo)
Minimale Repo-Instructions A.1 vorlagen/copilot-instructions.minimal.md (+ Team, path-scoped)
User-Instructions A.2 vorlagen/user/
Enge Permissions A.3 settings.permissions-hints.md, Rezept 01
Settings-Kern A.4 beispiele/configs/, settings.local…
Ritual Plan/Verify A.5 Rezepte 02–03
Permission-Faustregeln A.6 Kap. 1 + Stand & Drift
todo-cli Start A.7 beispiele/todo-cli/ (Code)
Skills / Hooks / Agents / MCP / Plugin / CI — jeweilige Pfade in vorlagen/, beispiele/
Vorlage / Beispiel (online) Ziel im echten Projekt
vorlagen/copilot-instructions.minimal.md .github/copilot-instructions.md (solo/minimal)
vorlagen/copilot-instructions.team.md .github/copilot-instructions.md (Team-Baseline)
vorlagen/path-instructions.example.md .github/instructions/….instructions.md
vorlagen/AGENTS.md.example Repo-Root AGENTS.md
vorlagen/user/ ~/.copilot/copilot-instructions.md (persönlich, nicht committen)
vorlagen/settings.permissions-hints.md Flags + permissions-config + Settings-Hinweise
vorlagen/permissions-config.example.json ~/.copilot/permissions-config.json
vorlagen/settings.local.example.jsonc .github/copilot/settings.local.json
vorlagen/hooks/guard-pretool.example.json .github/hooks/ + Scripts
vorlagen/hooks/format-posttool.example.json Format nach Tool-Use
vorlagen/hooks/scripts/ block-rm.sh, format-py.sh
vorlagen/skills/verify/SKILL.md .github/skills/verify/SKILL.md
vorlagen/agents/security-reviewer.agent.md .github/agents/
vorlagen/plugins/team-baseline/ Plugin-Skeleton (Verify bündeln)
vorlagen/PLAN.md.skeleton.md Repo-PLAN.md
vorlagen/mcp-config.beispiel.json MCP-Server-Gerüst
beispiele/configs/github-actions-copilot.yml .github/workflows/
beispiele/configs/settings.repo.example.jsonc .github/copilot/settings.json
beispiele/todo-cli/ Mitmach-Mini-Projekt (Referenz-Harness)
beispiele/rezepte/ Session-Rezepte (Permissions, Plan, Diff/Review, CI, Fleet)

8.9 Glossar

Begriff Bedeutung in diesem Buch
Coding-Agent Sprachmodell in einer Tool-Schleife: planen, lesen/schreiben, Shell, iterieren – bis Done, Abbruch oder Freigabe (Kap. 0)
GitHub Copilot CLI Terminal-Produkt copilot – allgemeiner Coding-Agent (lokal first) mit Harness im GitHub-Ökosystem
Assistive / Agentic Assistive: Inline/Chat-Vorschläge; Agentic: Tool-Ketten mit Freigaben (CLI, Cloud Agent, IDE Agent Mode)
Harness Schicht ums Modell: Tools, Permissions, weiches Memory, Loop, Sessions
Custom Instructions Weiches, reviewbares Memory (Markdown), z. B. .github/copilot-instructions.md
Copilot Memory Produkt: agent-abgeleitete Repo-Facts / User-Prefs (≠ Instruction-Dateien)
Permissions / Tool-Approval Harte Freigabe/Sperre von Tools (Prompt, Flags, Config)
permissions-config permissions-config.json – gespeicherte Approvals pro Location (keine Denys)
Trusted directory Verzeichnis, dem du für die Session (oder dauerhaft) vertraust
settings.json Verhalten/Policy-Schalter (User/Repo/Local + Managed)
MCP Model Context Protocol – externe Tool-Server
Skill On-demand-Workflow (SKILL.md + optional Scripts/Resources)
Hook Erzwungenes Lifecycle-Skript (pre/post Tool, Session, …)
Custom Agent Spezialisierte Agent-Persona (Prompt, Tools, Scope)
Plugin Gebündelte Customizations (oft Marketplace)
Plan Mode Plan zuerst, Code nach Freigabe
Autopilot Autonomeres Abarbeiten multi-step Tasks
Fleet Parallelisierung über Subagents/Subtasks
Cloud Agent / /delegate Arbeit in GitHub-Cloud → typisch PR
/pr PR-Lifecycle in der CLI (view/create/fix/auto)
/review Agentic Code Review im Terminal
Remote Control Laufende CLI-Session von github.com/Mobile steuern
Chronicle Session-Historie auswerten (/chronicle …)
Programmatic mode copilot -p / Pipe – non-interactive Automation
BYOK Bring Your Own Key – eigener Modell-Provider
Sandbox Isolation lokal (Tool-Einschränkung) oder Cloud (Remote-Session)
YOLO / allow-all Breite Permission-Bypass-Modi – hohes Risiko
Session-state Lokale History/Artefakte unter session-state/
Auto-Compact Automatische Kompression nahe ~95 % Kontextlimit
AI Credits Abrechnungs-/Kontingenteinheit; /usage, optional /limits
Rewind / /undo Session (und ggf. Workspace) auf früheren Prompt zurück

8.10 Env-Variablen (Auswahl)

Variable Rolle
COPILOT_GITHUB_TOKEN Auth (höchste Precedence)
GH_TOKEN / GITHUB_TOKEN Auth-Fallback
COPILOT_HOME Config-Root statt ~/.copilot
COPILOT_CACHE_HOME Cache-Root (plattformabhängig default)
COPILOT_PROVIDER_BASE_URL BYOK Base URL
COPILOT_PROVIDER_TYPE openai / azure / anthropic
COPILOT_PROVIDER_API_KEY BYOK Key
COPILOT_MODEL BYOK / Modell-ID
COPILOT_OFFLINE offline-orientierter Betrieb mit lokalem Provider

Vollständige Liste: copilot help environment.


8.11 Ressourcen (nur offiziell)

Ressource URL
Copilot-Dokumentation (Root) https://docs.github.com/en/copilot/
Copilot CLI How-tos https://docs.github.com/en/copilot/how-tos/copilot-cli
About Copilot CLI https://docs.github.com/en/copilot/concepts/agents/copilot-cli/about-copilot-cli
Best practices https://docs.github.com/en/copilot/how-tos/copilot-cli/cli-best-practices
CLI command reference https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference
Config directory reference https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-config-dir-reference
Programmatic mode https://docs.github.com/en/copilot/how-tos/copilot-cli/automate-copilot-cli/run-cli-programmatically
Custom instructions https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-custom-instructions
Copilot Memory (Konzept) https://docs.github.com/en/copilot/concepts/agents/copilot-memory
/pr / Code Review / Remote / Chronicle How-tos unter …/use-copilot-cli/
BYOK / own models https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/use-byok-models
Org custom agents https://docs.github.com/en/copilot/how-tos/administer-copilot/manage-for-organization/prepare-for-custom-agents
Produkt / Plans https://github.com/features/copilot
Begleit-Service (Übersicht) https://books.maatini.space/projects/copilot-cli-harness/
Stand & Drift https://books.maatini.space/projects/copilot-cli-harness/stand/
Errata https://books.maatini.space/projects/copilot-cli-harness/errata/
Material (ZIPs) https://books.maatini.space/projects/copilot-cli-harness/material/
Schnelle Hilfe https://books.maatini.space/projects/copilot-cli-harness/hilfe/
Feedback https://books.maatini.space/projects/copilot-cli-harness/feedback/
Official Skills exercise https://github.com/skills/create-applications-with-the-copilot-cli
Awesome Copilot (GitHub) https://github.com/github/awesome-copilot

Keine Fremd-Agent-Vergleiche in diesem Buch – bewusst.


8.12 Roadmap – so gehst du weiter

Phase Fokus Kapitel
1 Install, Trust, erste harmlose Session 01
2 Instructions + enge Permissions 02
3 Plan → Code → Diff → PR 03
4 Settings-Hierarchie, multi-repo, Sandbox 04
5 MCP, Skills, Hooks, Agents, Fleet 05
6 Team-Baseline, CI, Managed Policy 06
7 Kontext-Hygiene, Troubleshooting-Runbook 07
8 Diesen Anhang als Spickzettel pinnen 08
9 Stabile Kernvorlagen pinnen (Hybrid) Anhang A

Minimal-Team-Setup in einer Stunde:

  1. Kern aus Anhang A.1 / A.3 / A.4 oder vorlagen/copilot-instructions.team.md → .github/copilot-instructions.md
  2. Deny/Allow-Muster aus Anhang A.3 bzw. settings.permissions-hints.md
  3. Verify-Skill aus vorlagen.zip kopieren
  4. Optional CI-Gerüst ohne Auto-Merge
  5. /help einmal komplett überfliegen

Was du jetzt kannst

  • Kern-Slash-Commands und Flags nachschlagen, ohne die Kapitel zu durchwühlen
  • User- vs. Repo-Pfade und Permission-Patterns korrekt zuordnen
  • stabile Kerne aus Anhang A und volle Vorlagen/Beispiele aus dem Begleit-Service gezielt ins eigene Repo übernehmen
  • Begriffe des Harness-Modells einheitlich verwenden
  • Offizielle Docs als Source of Truth nutzen

Nächste Schritte

  • Buch schließen und im echten Repo eine Baseline committen (Start: Anhang A)
  • Internes Runbook aus Kapitel 07 ableiten
  • Vierteljährlich: copilot --version, /help, Docs-Changelog gegen eure Configs halten
  • Lesevertrag aus Kapitel 00 im Team teilen: Konzept behalten, Syntax verifizieren
  • ZIPs im Begleit-Service (Material) aktuell halten