Skip to content

docs: add script authoring guidelines to copilot-instructions - #2950

Merged
Tom Meschter (tmeschter) merged 2 commits into
microsoft:mainfrom
tmeschter:tmeschter-script-authoring-guidelines
Jul 27, 2026
Merged

docs: add script authoring guidelines to copilot-instructions#2950
Tom Meschter (tmeschter) merged 2 commits into
microsoft:mainfrom
tmeschter:tmeschter-script-authoring-guidelines

Conversation

@tmeschter

@tmeschter Tom Meschter (tmeschter) commented Jul 23, 2026

Copy link
Copy Markdown
Member

Summary

Adds a new "Authoring Scripts in Skills" section to .github/copilot-instructions.md, based on recurring review feedback from the recent script-ification PRs in azure-validate and azure-diagnostics (#2854, #2855, #2856, #2862, #2932, #2933, #2934, #2935, #2936).

The goal is to help future changes that add or update helper scripts in skills avoid repeating the same review round-trips.

Guidelines added

  • General — ship both .sh/.ps1, keep behavior/options/exit codes in sync, document exit codes (0/1/2), match dry-run output to what runs, single source of truth for results, never silently misclassify errors.
  • PowerShell — no script-scope $ErrorActionPreference='Stop' (and no redundant ='Continue'); check $LASTEXITCODE after native commands; avoid [Parameter(Mandatory)]; stay Windows PowerShell 5.1-compatible; prefer Write-Error.
  • Bash — target Bash 3.2 (no declare -A/mapfile); no eval; command- not process-substitution under set -e; grep -F + handle exit 2; guard arg parsing (missing values, unknown options, type validation); --help exits 0; re-declare pipefail in a new Bash process; temp-file large output; strip shebang from --help; no || true on critical steps.
  • Deterministic CLI parsing--query ... -o tsv over grep/sed; standard install-hint call form.
  • Referencing scripts from Markdown — use links, explicit script paths (not bare PATH-style names), state the working directory, note PowerShell PascalCase params.

Docs-only change.

Distill recurring PR review feedback from the azure-validate and
azure-diagnostics script-ification PRs (2854, 2855, 2856, 2862, 2932,
2933, 2934, 2935, 2936) into a new "Authoring Scripts in Skills" section
covering cross-platform parity, PowerShell/bash pitfalls, deterministic
CLI parsing, markdown references, and eval conventions.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6926cbae-8d68-4845-9bbc-1c9086968b6d
Copilot AI review requested due to automatic review settings July 23, 2026 21:58
@tmeschter
Tom Meschter (tmeschter) requested a review from a team as a code owner July 23, 2026 21:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new “Authoring Scripts in Skills” section to .github/copilot-instructions.md to codify cross-platform script authoring and documentation guidance (bash + PowerShell), aiming to reduce recurring review feedback loops on script-related skill updates.

Changes:

  • Introduces cross-platform parity rules (paired .sh/.ps1, consistent options/output/exit codes, and dry-run fidelity).
  • Adds PowerShell- and Bash-specific implementation guidelines (non-interactive behavior, compatibility targets, safer parsing/error handling).
  • Documents expectations for deterministic CLI parsing, script references in markdown, and eval tagging/early termination guidance.
Show a summary per file
File Description
.github/copilot-instructions.md Adds a new section documenting recommended patterns and pitfalls when adding helper scripts to skills.

Review details

  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Low

Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
Comment thread .github/copilot-instructions.md Outdated
- Simplify intro and rename section to "General Guidelines"
- Fix shebang example to include leading '#'
- Reword pipefail note (bash -c is a new process, not a subshell)
- Drop npm run references parenthetical
- Remove the Evals for Scripted Behavior subsection

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 6926cbae-8d68-4845-9bbc-1c9086968b6d
@tmeschter
Tom Meschter (tmeschter) merged commit 7004651 into microsoft:main Jul 27, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants