Verify that Gemini CLI and Claude Code CLI are installed, authenticated, and API-reachable before starting a collaboration workflow; missing CLIs only skip that phase.
10 stars
0 votes
0 copies
0 views
Added September 24, 2026
ai-agentsgobashrailsgitapi
Works with
claude code
cli
api
Security analysis
A92/100
mediumInstalls packages at runtime which could introduce malicious dependencies
Installs into .claude/skills of the current project.
Are you the author of Latex Paper Collab Check?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/fourteen1416-latex-paper-collab-check)
---
name: latex-paper-collab-check
description: "Verify that Gemini CLI and Claude Code CLI are installed, authenticated, and API-reachable before starting a collaboration workflow; missing CLIs only skip that phase."
metadata:
short-description: Collaborator CLI health check
---
<!--ACAT-ADAPTED: 资产补齐自 yunshenwuchuxun/latex-paper-skills@d0f106108cb0(check-collaborators + _shared),正文未改。溯源见 references/UPSTREAM.md。2026-09-09 专项治理。-->
# Collaborator CLI Health Check
> **ACAT 宿主中立声明**:被检查的 CLI 是外部协作者而非执行宿主;任一缺位仅降级对应协作阶段,当前 Agent 可继续自审运行。
## When to use
- Before starting any collaboration workflow that depends on Gemini or Claude Code(可选增强检查:CLI 缺位时对应协作阶段直接跳过,不构成阻断)。
- When diagnosing CLI connectivity or authentication issues.
- After installing or reconfiguring either CLI.
## When not to use
- Both CLIs are already confirmed working in the current session.
- The task does not involve cross-agent collaboration.
## Inputs
- Current OS environment (auto-detected).
## Outputs
- Summary table: Collaborator x CLI / Version / Auth / API / Status.
- Actionable remediation advice for any failed step.
## Workflow
Run the Gemini and Claude detection chains **in parallel** where possible.
For each collaborator, execute steps sequentially and **short-circuit on the first failure** — skip subsequent steps and mark the failure reason.
### Step 0: Detect OS
Determine the platform to choose the correct binary-lookup command:
- **Windows** (`win32`): use `where`
- **Unix/macOS**: use `which`
Detect via `uname -s 2>/dev/null` (returns nothing or errors on Windows) or check `$OSTYPE`.
---
### Gemini Detection Chain
#### 1. CLI Exists
```bash
# Unix
which gemini
# Windows
where gemini
```
**Pass**: command exits 0 and outputs a path.
**Fail**: command not found — suggest: `npm install -g @anthropic-ai/gemini-cli` or see https://github.com/google-gemini/gemini-cli
#### 2. Version
```bash
timeout 15 bash -c 'GEMINI_CLI_NO_RELAUNCH=true gemini --version'
```
On Windows (no `timeout` command), run directly:
```bash
GEMINI_CLI_NO_RELAUNCH=true gemini --version
```
`GEMINI_CLI_NO_RELAUNCH=true` is **required** to prevent the CLI from hanging.
**Pass**: output contains a version string (e.g., `0.32.1`).
**Fail**: timeout or no version output.
#### 3. Auth
Check for any of the following (any one is sufficient):
1. Environment variable `GEMINI_API_KEY` is set and non-empty.
2. Environment variable `GOOGLE_API_KEY` is set and non-empty.
3. File `~/.gemini/oauth_creds.json` exists.
```bash
[[ -n "$GEMINI_API_KEY" ]] || [[ -n "$GOOGLE_API_KEY" ]]
test -f "$HOME/.gemini/oauth_creds.json"
```
**Pass**: any one condition is true.
**Fail**: none found — suggest: `export GEMINI_API_KEY=<key>` or run `gemini` interactively to complete OAuth.
#### 4. API Connectivity
```bash
timeout 30 gemini --prompt "Reply with exactly: HEALTH_OK"
```
**Pass**: stdout contains `HEALTH_OK`.
**Fail**: timeout or no `HEALTH_OK` in output — suggest checking network, API key validity, or quota.
**Note**: Gemini CLI may emit warnings (e.g., skill conflict notices) in its output. These are benign and do not affect the health check. The pass/fail criterion is solely whether `HEALTH_OK` appears in stdout.
---
### Claude Code Detection Chain
#### 1. CLI Exists
```bash
# Unix
which claude
# Windows
where claude
```
**Pass**: command exits 0 and outputs a path.
**Fail**: command not found — suggest: `npm install -g @anthropic-ai/claude-code` or see https://docs.anthropic.com/en/docs/claude-code
#### 2. Version
```bash
timeout 15 claude --version
```
**Pass**: output contains a version string (e.g., `2.1.74`).
**Fail**: timeout or no version output.
#### 3. Auth
```bash
claude auth status
```
**Pass**: output contains `Logged in` or JSON field `loggedIn: true`.
**Fail**: not logged in — suggest: run `claude` interactively and use `/login`.
#### 4. API Connectivity
```bash
timeout 30 claude --print "Reply with exactly: HEALTH_OK" --output-format text --no-session-persistence --max-budget-usd 0.50
```
**Pass**: stdout contains `HEALTH_OK`.
**Fail**: timeout or no `HEALTH_OK` — suggest checking API key, network, or account quota.
**Note**: `--max-budget-usd` must be at least `0.50`. Lower values (e.g., `0.01`, `0.05`) cause immediate `Exceeded budget` errors because model inference has a minimum cost floor.
---
## Output Format
Present a summary table after all checks:
```
| Collaborator | CLI | Version | Auth | API | Status |
|--------------|-----|---------|------|-----|-----------|
| Gemini | ✓/✗ | x.y.z | ✓/✗ | ✓/✗ | Available / Failed |
| Claude Code | ✓/✗ | x.y.z | ✓/✗ | ✓/✗ | Available / Failed |
```
- Use `✓` for passed steps, `✗` for failed steps, `—` for skipped steps (due to short-circuit).
- **Status** is `Available` only if all 4 steps pass; otherwise `Failed`.
- Version column shows the detected version string, or `—` if not reached.
For any failed step, append actionable remediation advice below the table:
```
### Issues Found
**Gemini — Auth failed**
No API key or OAuth credentials detected.
→ Set `GEMINI_API_KEY` environment variable, or run `gemini` to complete OAuth login.
**Claude Code — CLI not found**
Claude Code CLI is not installed.
→ Install: `npm install -g @anthropic-ai/claude-code`
→ Docs: https://docs.anthropic.com/en/docs/claude-code
```
If both collaborators pass all checks:
```
Both collaborators are available and ready for collaboration workflows.
```
## Verification
- Run this skill and confirm the summary table appears with correct status for each collaborator.
## Safety and guardrails
- Read-only checks only; no configuration files are modified.
- API connectivity tests consume minimal tokens (~$0.01 per check).
- Steps 2-4 spawn external CLI processes; run them outside sandbox (escalated permissions) to avoid hangs or `EPERM` errors.
- On Windows, `timeout` may not be available; run commands directly and watch for hangs.
- Gemini `--version` **must** use `GEMINI_CLI_NO_RELAUNCH=true` to prevent the CLI from relaunching itself.