Skip to content

Instantly share code, notes, and snippets.

@johnlindquist
Last active December 7, 2025 20:16
Show Gist options
  • Select an option

  • Save johnlindquist/5c8a6d3529d588a4a4f354be5ffce001 to your computer and use it in GitHub Desktop.

Select an option

Save johnlindquist/5c8a6d3529d588a4a4f354be5ffce001 to your computer and use it in GitHub Desktop.
Microsoft AI Dev Days Talk: Scripting Copilot - Piping Hot Intelligence (Real-World Scenarios)

Scripting Copilot: Piping Hot Intelligence

Microsoft AI Dev Days Talk (15-20 min)


The Concept

"Piping Hot Intelligence" - Intelligence served fresh, straight from Unix pipes.

Core Theme: Software = Instructions + Tools

Every scenario shows Copilot CLI transforming a daily frustration into a one-liner.


ACT 1: THE HOOK (1-2 minutes)

Opening: The Mystery Command

Slide: A terminal prompt, blinking cursor

Start with intrigue:

$ ma task.copilot.md

Pause. Let it land.

"That markdown file just ran an AI agent. But that's not even the interesting part..."

Reveal the real magic:

$ git diff | copilot -p "review this"

"Data flows in. Intelligence flows out. The fifty-year-old pipe operator now carries something new."

The question that frames the talk:

"What if every annoying task you do this week could become a one-liner? Let me show you five scenarios you'll use Monday morning."


ACT 2: MAIN CONTENT - Five Real-World Scenarios (12-15 min)

The Foundation: How Copilot CLI Works (2 min)

Slide: The anatomy of a Copilot CLI command

# Interactive mode (can't pipe)
copilot

# Non-interactive with prompt
copilot -p "explain this error"

# The key insight: output is pipeable
git diff | copilot -p "summarize changes"

Why this matters:

"Non-interactive mode turns Copilot into a Unix citizen. It reads stdin, writes stdout. Fifty years of Unix tooling now has an AI ingredient."


SCENARIO 1: The Monday Morning PR Review (2-3 min)

Slide: "Monday 9:03 AM - 47 PR notifications"

The pain:

"You open Slack. 47 notifications. Half are PR reviews. Each one requires context-switching, reading diffs, understanding intent."

The old way:

gh pr view 123
gh pr diff 123
# ...read...think...type feedback...repeat

The new way:

gh pr diff 123 | copilot -p "review for bugs, security issues, and style"

Level up - batch review:

gh pr list --json number -q '.[].number' | \
  xargs -I {} sh -c 'echo "=== PR {} ===" && gh pr diff {} | copilot -p "one-line risk summary"'

The insight:

"You just triaged 47 PRs in the time it took to review one. The pipe didn't replace your judgment - it amplified it."


SCENARIO 2: The Mysterious Test Failure (2-3 min)

Slide: "CI Failed" badge in red

The pain:

"CI failed. The error is 500 lines of stack traces. You scroll, squint, grep, and 20 minutes later... it was a typo."

The old way:

npm test 2>&1 | less
# scroll...scroll...scroll

The new way:

npm test 2>&1 | copilot -p "identify root cause and suggest fix"

Model escalation for complex failures:

# Fast triage with Haiku
npm test 2>&1 | copilot --model claude-haiku-4.5 -p "SIMPLE or COMPLEX failure?"

# If complex, escalate to Opus
npm test 2>&1 | copilot --model claude-opus-4.5 -p "deep analysis with fix"

The insight:

"Haiku is 10x cheaper and 5x faster. Use the lightweight model to decide if you need the heavyweight. Intelligent cost control."


SCENARIO 3: The Documentation Debt (2-3 min)

Slide: A function with no comments, zero JSDoc

The pain:

"The code works. Nobody knows why. The original author left. Now you need to add docs for 47 exported functions."

The old way:

# Open each file
# Read code
# Write JSDoc manually
# Repeat 47 times

The new way:

cat src/utils.ts | copilot -p "generate JSDoc for all exports"

Batch documentation:

find src -name "*.ts" -exec sh -c \
  'copilot -p "generate JSDoc" < "$1" > "$1.doc"' _ {} \;

With permission boundaries (safety first):

copilot -p "document this module" --allow-tool 'Read'

The insight:

"The --allow-tool flag is your safety net. Read-only access means the AI can analyze but not modify. Lid on tight."


SCENARIO 4: The Legacy Refactor (2-3 min)

Slide: A 2000-line file with "DO NOT TOUCH" comments

The pain:

"You inherited a 2000-line file. It has callback hell, var declarations, and comments like 'DO NOT TOUCH - here be dragons.' You need to modernize it."

The old way:

# Pray
# Refactor manually
# Break everything
# Rollback
# Repeat

The new way - staged refactoring:

# Step 1: Understand what you're dealing with
cat legacy.js | copilot -p "list all side effects and dependencies"

# Step 2: Plan the refactor
cat legacy.js | copilot -p "create step-by-step modernization plan"

# Step 3: Execute with controlled permissions
copilot -p "modernize this file" \
  --allow-tool 'shell(npm:*)' \
  --allow-tool 'Read' \
  --allow-tool 'Write'

The permission ladder:

Level 1: Pure pipes      - cat code | copilot (safest)
Level 2: Read-only       - --allow-tool 'Read'
Level 3: Scoped write    - --allow-tool 'shell(npm:*)'
Level 4: Full autonomy   - --allow-all-tools (supervised)

The insight:

"The pipe doesn't grant permissions. You do. You control when the lid comes off."


SCENARIO 5: The New Hire Onboarding (2-3 min)

Slide: "Day 1 - Where do I even start?"

The pain:

"New developer joins. Spends three days figuring out the architecture. Asks the same questions every senior dev asked two years ago."

The old way:

# Read README (outdated)
# Grep for patterns
# Ask in Slack
# Wait for response

The new way - interactive codebase exploration:

# Architecture overview
find src -name "*.ts" | head -20 | xargs cat | \
  copilot -p "explain the architecture in 5 bullet points"

# Where does X happen?
copilot -p "trace the auth flow from login to session" \
  --allow-tool 'shell(git:*)' \
  --allow-tool 'Read'

# Team conventions
git log --oneline -50 | copilot -p "what naming conventions does this team use?"

The insight:

"The new hire's first commit happens on day one, not day three. The pipe compressed three days into thirty minutes."


ACT 3: THE RESOLUTION (3-4 minutes)

The Problem: Ephemeral Intelligence

Slide: A terminal history, scrolling into oblivion

"These one-liners are powerful. But be honest - will you remember the exact flag combinations tomorrow? Will you share them with your team via Slack?"

Pain points:

  • Complex flag combinations
  • Model selection logic
  • Permission boundaries
  • Team standardization

Transition:

"What if these patterns could become permanent? What if your team's best practices were executable files?"


The Reveal: markdown-agent

Slide: A markdown file with executable superpowers

$ ma review.copilot.md

How it reads:

  • review = your workflow name
  • .copilot = run with copilot
  • .md = it's just markdown

The recipe file:

# review.copilot.md
---
model: claude-sonnet-4
allow-tool:
  - 'shell(git:*)'
  - Read
---

Review this code for:
1. Bug risks (high/medium/low)
2. Security concerns
3. Performance issues

Prioritize by severity. Be specific about line numbers.

Usage:

git diff | ma review.copilot.md

"Your pipeline, in a file. Your file, in git. Your team's standards, automated."


Advanced: Variables and Imports

Slide: Recipe card with handwritten variations

# pr-review.copilot.md
---
args: [base_branch, focus_area]
model: claude-sonnet-4
---

## Changes to Review
!`git diff {{ base_branch | default: "main" }}..HEAD`

## Focus Area
Pay special attention to {{ focus_area | default: "all areas" }}.

## Output Format
Risk table with file:line references.

Run with custom parameters:

ma pr-review.copilot.md --base_branch develop --focus_area security

The Paradigm Shift

Slide: Two approaches side by side

Old way:

Learn tools → Memorize flags → Write scripts → Maintain scripts

New way:

Write markdown → Describe intent → Run it → Version it

The final equation:

Software = Instructions + Tools
Your prompts = Your codebase

CLOSING (1 minute)

Call to Action

Slide: Five tasks, five check boxes

Your assignment for Monday:

  1. One pipe: git diff | copilot -p "review"
  2. One escalation: Try --model claude-haiku-4.5 for triage
  3. One permission: Use --allow-tool 'Read' for safety
  4. One recipe: Create a .copilot.md file for something you do daily
  5. One share: Commit it. PR it. Your team will thank you.

Resources

  • GitHub Copilot CLI: Built into gh copilot
  • markdown-agent: github.com/johnlindquist/agents
  • This talk + recipes: [gist link]

Final Thought

Slide: A pipe | symbol, glowing

"The pipe carried data for fifty years. Now it carries intelligence. Same operator. New capability. Start piping."


TIMING GUIDE

Section Time Cumulative
Hook: Mystery command + git diff demo 2 min 2 min
Foundation: Copilot CLI basics 2 min 4 min
Scenario 1: PR Review 2.5 min 6.5 min
Scenario 2: Test Failures 2.5 min 9 min
Scenario 3: Documentation 2.5 min 11.5 min
Scenario 4: Legacy Refactor 2.5 min 14 min
Scenario 5: Onboarding 2.5 min 16.5 min
Resolution: markdown-agent reveal 2.5 min 19 min
Closing: Call to action 1 min 20 min

KEY TAKEAWAYS

  1. Pipes carry intelligence - Same |, new power
  2. Model escalation - Haiku for triage, Opus for depth
  3. Permission boundaries - --allow-tool controls access
  4. Recipe files - .copilot.md captures patterns forever
  5. Five scenarios - PR review, debugging, docs, refactoring, onboarding

COPILOT CLI COMMAND REFERENCE

# Basic non-interactive
copilot -p "your prompt"

# With model selection
copilot -p "prompt" --model claude-haiku-4.5
copilot -p "prompt" --model claude-sonnet-4
copilot -p "prompt" --model claude-opus-4.5

# With permission boundaries
copilot -p "prompt" --allow-tool 'shell(git:*)'
copilot -p "prompt" --allow-tool 'Read'
copilot -p "prompt" --allow-tool 'Write'
copilot -p "prompt" --allow-all-tools

# Piping data
git diff | copilot -p "review"
npm test 2>&1 | copilot -p "diagnose"
cat file.ts | copilot -p "document"

DEMO FILES

review.copilot.md

---
model: claude-sonnet-4
allow-tool:
  - 'shell(git:*)'
  - Read
---
Review this code for bugs, security issues, and performance concerns.
Prioritize findings by severity with file:line references.

triage.copilot.md

---
model: claude-haiku-4.5
args: [task]
---
Classify this as SIMPLE, MODERATE, or COMPLEX.
Respond with ONE word only.

Task: {{ task }}

debug.copilot.md

---
model: claude-sonnet-4
---
Analyze this test output:
1. Identify the root cause
2. Suggest a specific fix
3. Explain why it failed

Be concise. Code examples preferred.

document.copilot.md

---
model: claude-sonnet-4
allow-tool:
  - Read
---
Generate comprehensive JSDoc for all exported functions.
Include:
- @param with types
- @returns with type
- @example with usage
- @throws if applicable

onboard.copilot.md

---
model: claude-sonnet-4
allow-tool:
  - 'shell(git:*)'
  - Read
args: [question]
---
You are helping a new developer understand this codebase.

Question: {{ question | default: "What is the overall architecture?" }}

Provide:
1. Clear explanation
2. Relevant file paths
3. Key patterns to understand
4. Common gotchas

QUOTABLE MOMENTS

"Data flows in. Intelligence flows out."

"Haiku is 10x cheaper and 5x faster. Use the lightweight model to decide if you need the heavyweight."

"The pipe doesn't grant permissions. You do."

"The new hire's first commit happens on day one, not day three."

"Your prompts are your codebase now. Version them. Test them. Pipe them."

"The pipe carried data for fifty years. Now it carries intelligence."


DEMO CHECKLIST

  • Terminal with large font (24pt minimum)
  • Git repo with staged changes for git diff demos
  • Failing test suite for debugging demo
  • Undocumented TypeScript file for docs demo
  • Pre-written .copilot.md recipe files
  • Test all pipes before talk
  • Backup: screenshot/video of each demo
  • Verify copilot CLI is installed and authenticated
  • Verify ma (markdown-agent) is installed

Talk outline for Microsoft AI Dev Days Theme: Piping Hot Intelligence - Real-World Scenarios Duration: 15-20 minutes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment