Fetching Circleci Logs

Pulls step-level CircleCI job logs via the v1.1 API and prints only the failed steps

av NTCoding · NTCoding/claude-skillz

Fungerar med konfiguration ★ 8.4/10

Fetching Circleci Logs — Pulls step-level CircleCI job logs via the v1.1 API and prints only the failed steps

Vad den gör

Fetches CircleCI job logs through the v1.1 API, walks the steps/actions tree, and prints output only for steps that failed, truncating each to 2000 characters. Triggers when a CI check fails on a pull request, when a CircleCI job URL is pasted, or on phrases like "build failed", "CI failed", or "check the build logs". Reads the API token from ~/.circleci/cli.yml and derives org/repo from the git remote when only a job number is given.

Testrapport

I stood up a local mock CircleCI v1.1 endpoint (a failed job with 5 steps: 2 passing, 2 failing, 1 canceled, with 29,673 chars of jest/tsc log behind output_url) and ran both approaches against it. Baseline (my own instinct: curl the job and pipe to json.tool) produced 1,975 bytes naming which steps failed but containing none of the four diagnostic probes - "Expected: 19.99", "TS2345", "applyDiscount > rounds to 2dp", "1 failed, 27 passed" were all absent; the skill's verbatim command produced 2,362 bytes containing all four, having skipped the passing steps' logs entirely and truncated the 29,673-char message to exactly 2000. I independently confirmed against CircleCI's v1 docs and support material that actions[].{name,status,exit_code,failed} and the pre-signed output_url returning [{message,type,time}] are real fields, not invented, and its git-remote sed helper resolved all 4 common remote formats correctly; the install block placed SKILL.md correctly in a clean throwaway HOME. Two real gaps I observed: the script does not strip ANSI escape codes (I re-ran with realistic colored jest output and got raw \x1b[1m\x1b[31m sequences eating the 2000-char budget), and truncation takes the head of each message, so a tool that prints its error summary last would have it discarded. Verdict is "setup" not "pass" because the one step I could not execute is authentication against the live API - it needs a real CircleCI account token at ~/.circleci/cli.yml, so everything above is measured against a shape-faithful mock rather than production CircleCI. Trigger phrasings judged - SHOULD fire: "The CircleCI check on my PR is red, pull the logs and tell me what broke", "https://circleci.com/gh/acme/widgets/169955 why did this fail?", "Build failed on main again, can you check the CI logs?"; should NOT fire: "Our .circleci/config.yml fails to validate, fix the YAML" (config editing, not log fetching) and "The GitHub Actions workflow failed, show me the run logs" (wrong CI provider) - I would correctly load/not-load all 5, though the description's generic "check the logs" keyword is a false-positive risk on non-CI log requests.

Testad: 2026-07-21 · Claude Code 2.x (agent harness)

Installation

git clone --depth 1 https://github.com/NTCoding/claude-skillz.git /tmp/fetching-circleci-logs-src
mkdir -p ~/.claude/skills
cp -R /tmp/fetching-circleci-logs-src/fetching-circleci-logs ~/.claude/skills/fetching-circleci-logs
# Single-file skill (SKILL.md only) - no scripts, no deps beyond curl + python3 (both preinstalled on macOS/Linux).
#
# REQUIRED MANUAL STEP - the skill does nothing without a CircleCI API token:
#   brew install circleci && circleci setup
# or write it by hand:
#   mkdir -p ~/.circleci && printf 'host: https://circleci.com\ntoken: YOUR_TOKEN\n' > ~/.circleci/cli.yml
# Create the token at https://app.circleci.com/settings/user/tokens
#
# Plugin-marketplace alternative (this skill is registered in .claude-plugin/marketplace.json):
#   /plugin marketplace add ntcoding/claude-skillz
#   /plugin install fetching-circleci-logs@claude-skillz
#
# Usage: paste a job URL like https://circleci.com/gh/{org}/{repo}/{job_number} and ask why CI failed.

Kommandon och exempelprompter

  • /fetching-circleci-logsPulls step-level CircleCI job logs via the v1.1 API and prints only the failed steps

Skills triggas av vanliga förfrågningar — inga kommandon att memorera. Efter installationen aktiverar prompter som dessa skillen (på engelska):

  • Check why the CircleCI build failed
  • Fetch the logs for this CircleCI job URL
  • Show me the failed step in the last CI run