GitHub Copilot CLI Deep Dive

Plan, Implement, Parallelize, Measure

Özgün Bal

© Innovance 2026. All Rights Reserved.

Agenda

Four phases of engineering with Copilot CLI

01 Plan — Concepts & mental models
02 Implement — Guardrails, automation & integration
03 Parallelize — Multi-agent task splitting
04 Measure — Token usage & optimization
05 Demo
06 Q&A
© Innovance 2026. All Rights Reserved.

1. Plan

Concepts & Mental Models

Understand the key building blocks before writing a single prompt. Know where Skills, Agents, Hooks, and MCP fit in your delivery workflow.

  • What problem does each abstraction solve?
  • When to compose vs. when to keep it simple
  • Mapping concepts to real engineering tasks
© Innovance 2026. All Rights Reserved.

The Four Building Blocks

Each solves a different problem in the AI-assisted workflow

Skill

Reusable domain knowledge and instructions. Extend what the agent knows — like plugins for context.

Agent

Autonomous task executor. Spawns sub-agents for parallel work. Reads, writes, and runs tools.

Hook

Event-driven guardrails. Trigger scripts before or after tool calls to validate, lint, or transform.

MCP

Model Context Protocol servers. Connect external tools and data sources as first-class capabilities.

© Innovance 2026. All Rights Reserved.

Implement

Guardrails, automation, and integration patterns

© Innovance 2026. All Rights Reserved.

2. Implement

Guardrail-First Development

Build safety nets before you automate. Hooks give you pre-tool and post-edit control points. Skills encode team standards. MCP connects your toolchain.

  • Three concrete automation patterns
  • Pre-tool-call hooks for safety
  • Post-edit hooks for quality gates
  • MCP for external tool integration
© Innovance 2026. All Rights Reserved.

Example 1: Schema → Migration

postToolUse hook generates migration SQL

▸ Trigger

Agent modifies a database model file

When the agent edits a model file, a postToolUse hook fires — the script checks the file path against **/models/*.ts and generates migration SQL.

▸ Action

Hook generates migration SQL

The hook runs a diff against the current schema and produces an ALTER TABLE migration file — no manual SQL writing needed.

© Innovance 2026. All Rights Reserved.
// .github/hooks/schema.json
{ "version": 1, "hooks": {
  "postToolUse": [{
    "type": "command",
    "bash": "./scripts/gen-migration.sh"
  }]
}}

// Output:
ALTER TABLE users
  ADD COLUMN role VARCHAR(20)
  DEFAULT 'member';

Example 2: Edit → Lint & Type Check

postToolUse hook validates touched files

▸ Trigger

Any TypeScript file is modified

A postToolUse hook parses the JSON payload, reads the file path via jq, and runs ESLint and tsc --noEmit — fast, targeted feedback.

▸ Outcome

Immediate quality gate

Type errors and lint violations surface within seconds. The agent can self-correct before proceeding.

© Innovance 2026. All Rights Reserved.
// .github/hooks/lint.json
{ "version": 1, "hooks": {
  "postToolUse": [{
    "type": "command",
    "bash": "./scripts/lint-check.sh"
  }]
}}

// scripts/lint-check.sh
FILE=$(cat | jq -r '.toolArgs.path')
[[ "$FILE" == *.ts ]] || exit 0
eslint "$FILE" && tsc --noEmit

// ✓ 0 errors, 0 warnings

Example 3: SQL Command Guardrail

preToolUse hook blocks destructive operations

▸ Trigger

Agent attempts a SQL command via bash

Before any bash tool call runs, the preToolUse hook receives the command via JSON stdin and inspects it for dangerous SQL patterns.

▸ Outcome

DELETE / DROP blocked, logged, and flagged

The hook outputs {"permissionDecision":"deny"} to stdout, blocking execution. The agent is told why and asked to revise.

© Innovance 2026. All Rights Reserved.
// .github/hooks/sql-guard.json
{ "version": 1, "hooks": {
  "preToolUse": [{
    "type": "command",
    "bash": "./scripts/sql-guard.sh"
  }]
}}

// scripts/sql-guard.sh
CMD=$(cat | jq -r '.toolArgs.command')
if echo "$CMD" | grep -qiE
  'DELETE|DROP|TRUNCATE'; then
  echo '{"permissionDecision":"deny"}'
fi

Parallelize

Splitting work across multiple agents

© Innovance 2026. All Rights Reserved.

3. Parallelize

Multi-Agent Execution

Not every task should be serial. Learn when to split work into independent sub-agents and when sequential processing is safer.

  • Task decomposition strategies
  • Agent fleet coordination
  • Parallel vs. serial trade-offs
  • Merging outcomes and conflict resolution
© Innovance 2026. All Rights Reserved.

When to Go Parallel vs. Serial

Choose based on task independence and risk profile

Parallel Execution

  • Independent scopes — no shared file edits
  • Exploration tasks — research multiple modules
  • Test generation — one agent per test suite
  • Code review — multiple reviewers on separate PRs
  • Speed gain — 3–5× faster on large scopes

Serial Execution

  • Dependent steps — output feeds next input
  • Shared state — same file or database
  • Strict ordering — schema before migration
  • Risk-sensitive — production changes need gates
  • Accuracy priority — correctness over speed
© Innovance 2026. All Rights Reserved.

Agent Fleet Pattern

Decompose → Dispatch → Merge

1. Decompose

Break the task into independent sub-problems. Each must have a clear scope and no overlapping file edits.

2. Dispatch

Launch sub-agents in background mode. Each runs with its own context window and tool access.

3. Merge

Collect results, resolve conflicts, and compose the final deliverable. Validate with hooks before commit.

© Innovance 2026. All Rights Reserved.

Measure

Token usage, observability, and cost optimization

© Innovance 2026. All Rights Reserved.

4. Measure

Observability & Optimization

You can't improve what you don't measure. Inspect token usage, compare strategies, and define optimization heuristics for your team.

  • Token consumption and context size tracking
  • Latency and success rate metrics
  • Model/task matching strategies
  • Cost-performance trade-off awareness
© Innovance 2026. All Rights Reserved.

Optimization Playbook

Tactical patterns to reduce cost and improve accuracy across your AI-assisted workflows.

Prompt Shaping Write precise instructions. Provide examples. Reduce ambiguity before execution.
Context Pruning Limit file reads to relevant modules. Use glob patterns to narrow scope.
Model / Task Matching Use fast models for exploration. Reserve premium models for complex reasoning.
Session Reuse Resume sessions to avoid rebuilding context. Use /resume and /chronicle.
Batch Operations Group related edits. Parallelize independent reads. Chain bash commands.
Measure & Iterate Track /usage per task. Compare strategies. Build team-level benchmarks.
© Innovance 2026. All Rights Reserved.

Commands & Features Reference

Key Copilot CLI commands to master

/plan & /autopilot Break work into structured tasks and execute them with autonomous control.
/agent & /tasks Launch background agents and track their progress. Monitor fleet status.
/skills & /find-skills Discover and attach domain skills. Extend agent capabilities on demand.
/mcp Connect Model Context Protocol servers. Integrate databases, APIs, and tools.
/model & /usage Switch models mid-session. Inspect token consumption and cost breakdown.
/review & /chronicle Review code changes before commit. Browse session history and replay.
© Innovance 2026. All Rights Reserved.

Rollout Checklist

Steps to adopt Copilot CLI workflows in your team, starting tomorrow.

1. Set up hooks Start with one post-edit hook for lint/typecheck on your primary language.
2. Create a team skill Document your coding standards, architecture patterns, and review criteria as a skill.
3. Define guardrail policies Agree on what agents can and cannot do. Encode boundaries in pre-tool hooks.
4. Measure baseline Track token usage and task completion rates for one sprint before optimizing.
5. Iterate and share Review what worked, share patterns across teams, and refine your playbook.
6. Scale with confidence Add MCP integrations and parallel agents once guardrails are proven.
© Innovance 2026. All Rights Reserved.

Demo Time

© Innovance 2026. All Rights Reserved.

Questions & Answers

Let's discuss your use cases and challenges

© Innovance 2026. All Rights Reserved.

Thank You!

© Innovance 2026. All Rights Reserved.
Loading presentation…