gh
Skill97 starsChanged 58 days agoApache-2.0View on GitHub
Run GitHub CLI commands and inspect GitHub Issues and Pull Requests cleanly without PTY Glamour terminal truncation or comment-stripping traps.
- Commits and pushes
In this repository10 other files it gives its agents.
- AGENTS.mdAGENTS.md
- frontend/AGENTS.mdAGENTS.md
- functions/AGENTS.mdAGENTS.md
- scripts/AGENTS.mdAGENTS.md
- utils/AGENTS.mdAGENTS.md
- eval-prSkill
- pr-test-planSkill
- retrospectiveSkill
- workspace-overviewSkill
- workspace-syncSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 2 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 26
When running gh inside persistent agent terminal sessions, two subtle traps routinely corrupt output:
- Very specific: line 29
When gh outputs to a pseudo-terminal (PTY), it invokes Glamour (a terminal markdown renderer) to format headings, borders, and ANSI colors.
- Very specific: line 33
When piping to cat to bypass Glamour (gh issue view <id> | cat), gh treats view and view --comments as mutually exclusive:
- Very specific: line 98
Dedicated Scripts for Complex Synthesis: When an operation requires synthesizing multiple fragmented endpoints or bypassing severe terminal …
- Distinctive: line 103
When writing automated scripts or querying GitHub CLI directly without helper scripts, follow these canons:
- Distinctive: line 106
When extracting specific fields, always request structured JSON rather than parsing terminal output:
- Very specific: line 127
Never allow interactive prompts: Keep export GH_PROMPT_DISABLED=1 active in non-interactive agent sessions.
- Very specific: line 128
Do not shadow system binaries: Never install a silent gh wrapper into $PATH or use relative PATH modifications.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
GitHub CLI (gh)
This skill equips AI coding agents and human developers with clean, reliable execution patterns for GitHub CLI (gh) in Deliberate Lab. It solves terminal buffer truncation, bypasses markdown formatting bloat, and provides a unified script for viewing complete issue and PR discussions.
When to use
Invoke this skill when asked to:
- "Take a look at issue
<id>" - "What is issue
<id>about?" - "Inspect issue
<id>and its comments" - "Look at PR
<id>" - "What is PR
<id>about?" - "Read issue comments for
<id>" - "Run GitHub CLI command"
- "Check PR checks or status"
Background: The Terminal Truncation Trap
When running gh inside persistent agent terminal sessions, two subtle traps routinely corrupt output:
- PTY / Glamour Byte Inflation:
When
ghoutputs to a pseudo-terminal (PTY), it invokes Glamour (a terminal markdown renderer) to format headings, borders, and ANSI colors. This inflates the byte size by 12× to 16× (e.g. 6 KB of raw markdown expands to 70–100+ KB). - Terminal stdout 8 KB Buffer Ceiling:
While
view_filecan read up to 45 KiB (46,080 bytes) intact, the agent harness terminal stdout (run_command) truncates from the top once output exceeds 8,192 bytes (8 KB) (<truncated N lines>), silently discarding the issue title, problem statement, and earliest comments. - The Non-TTY Mutual-Exclusion Trap:
When piping to
catto bypass Glamour (gh issue view <id> | cat),ghtreatsviewandview --commentsas mutually exclusive:gh issue view <id> | catprints only the issue header and body.gh issue view <id> --comments | catprints only the comments (omitting the body). Neither command alone gives an agent complete context in a single call.
The helper scripts in this skill resolve all three issues cleanly: they bypass Glamour, combine threads, and automatically spill payloads exceeding 7 KB to a temporary file via mktemp with a one-liner directing the agent to inspect it intact via view_file.
Procedures
1. View an Issue (gh-issue-view.sh)
To inspect a GitHub Issue with its complete description and all comments:
./.agents/skills/gh/scripts/gh-issue-view.sh <number>(From a sibling worktree directory, call ../.agents/skills/gh/scripts/gh-issue-view.sh <number> or from repository root).
Features:
- Command Provenance: Visibly echoes the underlying commands (
$ gh issue view ... | cat) in clean plain text matching ADR 0003 before execution. - Complete Context: Streams the issue description first, followed by the complete discussion thread.
- Compact Payload & Automatic Overflow: Emits directly to stdout if under 7 KB; if larger, saves directly to a temporary markdown file via
mktempand provides the exact path for lossless inspection viaview_file.
Optional Flags:
--no-comments: Output only the issue header and description../.agents/skills/gh/scripts/gh-issue-view.sh <number> --no-comments--comments-only: Output only the discussion comments thread../.agents/skills/gh/scripts/gh-issue-view.sh <number> --comments-only
2. View a Pull Request with CI Checks & Inline Reviews (gh-pr-view.sh)
In GitHub CLI, gh pr view has a major blind spot: it does not display CI check statuses, and even with --comments, it completely ignores inline code review comments left on changed files.
To inspect a Pull Request with complete metadata, CI checks, PR discussion, and line-level code reviews in a single clean payload:
./.agents/skills/gh/scripts/gh-pr-view.sh <number>What it orchestrates:
- Metadata & Description:
$ gh pr view <id> | cat(branches, status, additions/deletions, summary). - CI Status & Checks:
$ gh pr checks <id> | cat(lists test runs, format checks, schema validations). - PR Discussion:
$ gh pr view <id> --comments | cat(general conversational thread). - Inline Code Reviews:
$ gh api repos/{owner}/{repo}/pulls/<id>/comments(formats line-level review comments as[path:line] author: body).
Optional Flags:
--checks-only: Only display CI check statuses.--reviews-only: Only display inline code review comments.--comments-only: Only display general discussion comments.--no-checks: Skip CI checks.--no-reviews: Skip inline code review comments.--no-comments: Skip general discussion comments.
3. The Complexity Boundary: When to Script vs. Use Raw gh
We draw a deliberate engineering boundary regarding GitHub CLI tooling:
- Dedicated Scripts for Complex Synthesis: When an operation requires synthesizing multiple fragmented endpoints or bypassing severe terminal traps (such as
gh-issue-view.shto prevent Glamour truncation and merge comments, orgh-pr-view.shto orchestrate metadata, CI checks, discussion, and inline code reviews), use the dedicated skill scripts. - Raw
ghfor Routine Commands: For standard, single-step operations (e.g.gh pr create,gh pr edit,gh issue comment), use standardghdirectly without redundant wrapper layers.
4. Direct GitHub CLI Best Practices (Programmatic Tooling)
When writing automated scripts or querying GitHub CLI directly without helper scripts, follow these canons:
- Prefer
--jsonand--jqfor Machine Consumption: When extracting specific fields, always request structured JSON rather than parsing terminal output:gh pr list --json number,title,headRefName,state gh issue view <id> --json title,body,labels -q '.title' - Never Run Plain
gh issue view <id> --commentsin a PTY: Direct terminal execution with comments will almost certainly trigger harness-level line truncation. Always usegh-issue-view.shor pipe throughcat. - Multi-Remote Resolution:
Deliberate Lab uses a triangle workflow (
originfork,upstreamcanonical). Ensure a default remote is configured once:
(Bonus: This writes togh repo set-default PAIR-code/deliberate-lab.bare/configand applies globally across all sibling worktrees). - Fork Qualification for
gh pr create: In a triangle workflow wheregh repo set-defaultpoints to upstream, passing a bare--head <branch>fails with a GraphQL error because GitHub looks for<branch>on the default upstream repository. Always qualify--headwith your fork username:gh pr create --head "$(gh api user -q .login):<branch>" --base main ...
Safety Rules
- Never allow interactive prompts: Keep
export GH_PROMPT_DISABLED=1active in non-interactive agent sessions. - Do not shadow system binaries: Never install a silent
ghwrapper into$PATHor use relative PATH modifications. Always call scripts explicitly to preserve command provenance. - Bounded execution: Script operations are bounded by non-blocking timeouts (
${GH_TIMEOUT:-5s}) per ADR 0003 Standard 6 to prevent headless credential store deadlocks.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

