Agent skill

Debug

by RussellSB in RussellSB/pytrendy

A skill your agent uses when debugging a pytrendy bug, reproducing a regression, or inspecting intermediate pipeline stage output.

MITAuto-check passedDevelopment

Install Debug

skills CLI
$ npx skills add RussellSB/pytrendy --skill debug -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install RussellSB/pytrendy debug --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/RussellSB/pytrendy.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.opencode/skills/debug .claude/skills/debug && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
debug
GitHub stars
106
Token cost
~1.9k tokens
SKILL.md length
709 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when debugging a pytrendy bug, reproducing a regression, or inspecting intermediate pipeline stage output.

  • Works in 2 steps: process_signals (rolling window flags) → segments_refine (post-processing bisect)
  • Debugging a pytrendy bug
  • SKILL.md covers Scratch sandbox: tests/test.py, Phase 1 — process_signals…, Phase 2 — segments_refine… and Handoff to formal tests
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Debug is an agent skill from RussellSB/pytrendy. Use when debugging a pytrendy bug, reproducing a regression, or inspecting intermediate pipeline stage output. Covers the tests/test.py sandbox convention, phase 1 (processsignals debug=True plots), phase 2 (segmentsrefine stage-by-stage bisect), and handoff to the test skill for formal regression tests.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Development, covering Debugging. The repository describes itself as: Trend Detection in Python. Applicable for real-world industry use cases in time series. The licence is MIT.

When your agent uses it

  • Debugging a pytrendy bug
  • Reproducing a regression
  • Inspecting intermediate pipeline stage output

Example prompts

  • “/debug”

Requirements

  • Python 3

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. process_signals (rolling window flags)
  2. segments_refine (post-processing bisect)

What it can do on your machine

Read from SKILL.md and the folder at commit 0d6d5bb. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Debug loads about 1.9k tokens when it runs. Until then it costs about 78 tokens; SKILL.md has 709 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~78
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from RussellSB/pytrendy at commit 0d6d5bb, republished under its MIT licence (© RussellSB). 709 words, ~1,926 tokens.

Download SKILL.mdSave it as .claude/skills/debug/SKILL.md (or your agent's skills folder).
name
debug
description
Use when debugging a pytrendy bug, reproducing a regression, or inspecting intermediate pipeline stage output. Covers the tests/test.py sandbox convention, phase 1 (process_signals debug=True plots), phase 2 (segments_refine stage-by-stage bisect), and handoff to the test skill for formal regression tests.

Debugging in pytrendy

Scratch sandbox: tests/test.py

tests/test.py is the committed reproduction sandbox. Key facts:

  • Not pytest-collected — filename test.py doesn't match the test_*.py glob, so pytest ignores it. Its module docstring states this explicitly.
  • # %% cell markers throughout → VSCode treats it as an interactive notebook. Run cells inline with Shift+Enter; plots render inline via the interactive backend.
  • Magic setup at top: %load_ext autoreload / %autoreload 2 — edits to pytrendy/ reload without restarting the kernel.
  • # TODONE: / # TODO: inline notes track fix status per cell — the file's distinctive convention (see line 30, 53, 89, etc. for examples).
  • Existing sections are specific bug reproductions (synth data + detect_trends() call + inspect plot), not generic templates. Agent-added sections must match: one # %% cell per bug, specific scenario/data/params.
When adding a section
  • # ---------- <bug summary> header (matches existing convention — see line 325 "New Reproduction: abrupt padding all-flat fallback on zero-baseline market entry").
  • # %% cell loading the data source once. Do not copy or rename the DataFrame per cell.
    • CSV fixture: load via pd.read_csv(...). Keep columns as-is; pass the actual column name to value_col in each detect_trends() call (e.g. value_col='zero_baseline_market_entry_2').
    • pytrendy built-in data (pt.load_data(...)) or inline synth: load once and reuse the reference across cells. Only reload if the scenario genuinely requires different data modifications.
  • # %% cell calling detect_trends(...) — with debug=True for phase-1 bugs, plain for phase-2 bugs.
  • # TODONE: note on the cell once the bug is fixed (matches the file's tracking convention).
  • Cell stays in place after migration to formal tests — not deleted.
After the fix

Mark the reproduction cell's note # TODONE:. Leave the cell in place; it stays useful for re-running after future changes. Then migrate the reproduction into a formal regression test — see the test skill ("Adding a regression test from a debug reproduction").

Phase 1 — process_signals (rolling window flags)

Bugs in flagging propagate everywhere downstream. Diagnose here first.

Pass debug=True to detect_trends(). process_signals.py:196 emits 7 diagnostic plots in sequence, each showing the value column on the left y-axis and the metric/flag on the right:

  1. SNR + THRESHOLD_NOISE line (2.5) — noise detection input.
  2. noise_flag — where SNR fell below threshold.
  3. smoothed — Savitzky-Golay output (window=15).
  4. smoothed_std — rolling std (window=7) for flat detection.
  5. flat_flag — where smoothed_std ≤ min non-zero rolling std.
  6. smoothed_deriv + ±derivative_limit lines — trend direction input.
  7. trend_flag — final per-day classification (1=Up, -1=Down, -2=Flat, -3=Noise).

If a flag is wrong here (e.g. noise_flag fires on a legitimate abrupt shift, or trend_flag misses an obvious uptrend), the bug is in process_signals.py. The knobs: THRESHOLD_NOISE=2.5, THRESHOLD_SMOOTH=0.001, WINDOW_SMOOTH=15, WINDOW_FLAT=7. Reproduce with a single series + debug=True in a # %% cell of tests/test.py and iterate.

Show full SKILL.md (290 more words)Show less

Phase 2 — segments_refine (post-processing bisect)

If process_signals flags look correct but the final segments are wrong, the bug is in the post-processing chain. pytrendy/post_processing/segments_refine/__init__.py:refine_segments() runs ~14 stage calls in a specific order, and bugs compound — a misclassification at classify_trends propagates through grouping, shaving, cleanup, and re-classification.

Stage order from __init__.py:

  1. classify_trends — DTW gradual/abrupt labels.
  2. group_segments (1st pass — sporadic flats/noises).
  3. expand_contract_segments — gradual boundary adjust (±7d extrema).
  4. shave_abrupt_trends — abrupt changepoint z-score shaving.
  5. clean_artifacts — remove overlaps from expand/contract.
  6. group_segments (2nd pass).
  7. clean_artifacts (again).
  8. classify_trends (reclassify — some graduals → abrupts).
  9. If changed: shave_abrupt_trends (2nd pass, second_pass=True, init_segments=...).
  10. group_segments + clean_artifacts.
  11. fill_in_flats — fill gaps with flats.
  12. group_segments (3rd pass, final) + clean_artifacts (inverse_only=True).
Primary bisect — comment in source

Open refine_segments() in pytrendy/post_processing/segments_refine/__init__.py. Comment out stages one at a time (working from the bottom of the chain upward, or from classify_trends onward). After each edit, re-run the tests/test.py reproduction cell (Shift+Enter in VSCode) to see the effect on the plot/segments. The first uncomment that reintroduces the wrong behavior isolates the culprit stage.

Alternative bisect — snapshot helper (exploration only, not persisted)

For faster iteration without touching source, run this loop outside tests/test.py (REPL, separate scratch notebook, inline eval). Prints segment state after each stage; the divergence point is the culprit. Throwaway — never persist this in tests/test.py.

python
import pytrendy as pt
from pytrendy.post_processing.segments_get import get_segments
from pytrendy.post_processing.segments_refine import (
    classify_trends, group_segments, expand_contract_segments,
    shave_abrupt_trends, clean_artifacts, fill_in_flats,
)

df = pt.load_data('series_synthetic')[['date', 'gradual']].set_index('date')
value_col = 'gradual'
method_params = dict(abrupt_padding=0)

segs = get_segments(df)
print('pre-refine', len(segs), [(s['direction'], str(s['start']), str(s['end'])) for s in segs])

for name, fn in [
    ('classify_trends', lambda s: classify_trends(df, value_col, s)),
    ('group_segments#1', lambda s: group_segments(s)),
    ('expand_contract', lambda s: expand_contract_segments(df, value_col, s)),
    ('shave_abrupt', lambda s: shave_abrupt_trends(df, value_col, s, method_params)),
    ('clean_artifacts#1', lambda s: clean_artifacts(df, value_col, s, method_params)),
    ('group_segments#2', lambda s: group_segments(s)),
    ('clean_artifacts#2', lambda s: clean_artifacts(df, value_col, s, method_params)),
    ('classify_trends#2', lambda s: classify_trends(df, value_col, s)),
    ('fill_in_flats', lambda s: fill_in_flats(df, s)),
    ('group_segments#3', lambda s: group_segments(s)),
    ('clean_artifacts#3', lambda s: clean_artifacts(df, value_col, s, method_params, inverse_only=True)),
]:
    segs = fn(segs)
    print(name, len(segs), [(s['direction'], str(s['start']), str(s['end'])) for s in segs])
Re-classification loop gotcha

Steps 8-10 only fire if classify_trends (reclassify) changes anything (if segments_refined != init_segments at __init__.py:52). If your bug only appears on series with mixed gradual/abrupt, the 2nd-pass shave_abrupt_trends with second_pass=True, init_segments=... is a likely culprit — it has different behavior than the 1st pass.

Handoff to formal tests

Once fixed, the test skill takes over — migrate the reproduction into tests/tests_crashes_edgecases/test_*.py using assert_segments_match / assert_segments_in_a_haystack from tests/conftest.py. The tests/test.py cell stays in place.

© RussellSB, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .opencode/skills/debug of RussellSB/pytrendy.

Open the folder on GitHubat commit 0d6d5bb

Compare with similar skills

Debug next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Debug compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Debug this skillRussellSB/pytrendy106—~1.9kAutomated safety check: PassMIT
Forge CLI Debug Workflowtailcallhq/forgecode7.6k1 repos~1.6kAutomated safety check: PassApache-2.0
Issue Fixmono/SkiaSharp5.6k—~5.1kAutomated safety check: PassMIT
React Router Bug Fix Workflowremix-run/react-router57k—~1.3kAutomated safety check: PassMIT
Runtime Debugvercel/next.js143k1 repos~618Automated safety check: PassMIT
OpenROAD Bug FixerThe-OpenROAD-Project/OpenROAD3.2k—~784Automated safety check: PassBSD-3-Clause

Similar skills

  • Forge CLI Debug Workflow

    tailcallhq/forgecode

    Gives a systematic process for debugging the forge CLI: build in debug mode, check the latest help output, test with the non-interactive -p flag, and clone conversations before reproducing bugs.

    7.6k GitHub starsUsed in 1 repo~1.6k tokens
    DevelopmentAuto-check passed
  • Issue Fix

    mono/SkiaSharp

    Fix bugs in SkiaSharp C bindings. An agent skill from mono/SkiaSharp.

    5.6k GitHub stars~5.1k tokensUpdated today
    DevelopmentAuto-check passed
  • React Router Bug Fix Workflow

    remix-run/react-router

    Fixes a React Router bug reported in a GitHub issue end to end: fetching the issue, validating the reproduction, writing a failing test and implementing the fix on a new branch.

    57k GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Runtime Debug

    vercel/next.js

    Official

    Debug and verification workflow for runtime-bundle and module-resolution regressions.

    143k GitHub starsUsed in 1 repo~618 tokens
    DevelopmentAuto-check passed
  • OpenROAD Bug Fixer

    The-OpenROAD-Project/OpenROAD

    Fixes an OpenROAD bug from a GitHub issue or error code: finds the root cause, implements the fix, adds a regression test and prepares a signed-off commit.

    3.2k GitHub stars~784 tokensUpdated today
    DevelopmentAuto-check passed
  • Extension Puppeteer Debugging

    mengxi-ream/read-frog

    Debug the built Read Frog extension in real Chrome. An agent skill from mengxi-ream/read-frog.

    10k GitHub stars~2k tokensUpdated today
    DevelopmentAuto-check: notes

More from RussellSB/pytrendy

  • Maintenance

    RussellSB/pytrendy

    A skill your agent uses when making ANY code change to pytrendy, creating issues, or opening PRs.

    106 GitHub stars~2.1k tokensUpdated yesterday
    Auto-check passed
  • PR Plots

    RussellSB/pytrendy

    A skill your agent uses when preparing a fix or feature PR for review and adding before/after plot evidence to the PR body.

    106 GitHub stars~1.2k tokensUpdated yesterday
    Auto-check passed
  • Pytrendy

    RussellSB/pytrendy

    A skill your agent uses when working on pytrendy code, tests, or data.

    106 GitHub stars~2.5k tokensUpdated yesterday
    Auto-check passed
  • Cicd

    RussellSB/pytrendy

    A skill your agent uses when touching .github/workflows/, release config (.releaserc), mkdocs.yml, docs deploy, or the whats-new generator.

    106 GitHub stars~1.6k tokensUpdated yesterday
    Auto-check passed

Questions about Debug

What does Debug do?

A skill your agent uses when debugging a pytrendy bug, reproducing a regression, or inspecting intermediate pipeline stage output. Debug is an agent skill from RussellSB/pytrendy. Use when debugging a pytrendy bug, reproducing a regression, or inspecting intermediate pipeline stage output.

When should I use Debug?

Debug fits situations like: debugging a pytrendy bug; reproducing a regression; inspecting intermediate pipeline stage output.

How do I install Debug in Claude Code?

Run `npx skills add RussellSB/pytrendy --skill debug -a claude-code`. Or copy the skill folder (.opencode/skills/debug in RussellSB/pytrendy) into .claude/skills/debug in your project. Claude Code loads it when a task matches its description.

How do I install Debug in Codex?

Run `npx skills add RussellSB/pytrendy --skill debug -a codex`. Or copy the skill folder (.opencode/skills/debug in RussellSB/pytrendy) into .agents/skills/debug in your project. Codex loads it when a task matches its description.

Can I use Debug in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add RussellSB/pytrendy --skill debug -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/debug, .gemini/skills/debug, .github/skills/debug and .opencode/skills/debug in your project.

What does Debug need to run?

SKILL.md names no scripts, command-line tools or credentials: Debug is instructions for the agent only. Our summary lists: Python 3.

Does Debug access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Debug safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Debug use?

Debug is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Debug use?

About 1.9k tokens (SKILL.md is roughly 7.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Debug?

Skills that share tags, products or a category with Debug: Forge CLI Debug Workflow (tailcallhq/forgecode, 7.6k stars), Issue Fix (mono/SkiaSharp, 5.6k stars), React Router Bug Fix Workflow (remix-run/react-router, 57k stars) and Runtime Debug (vercel/next.js, 143k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Debug?

RussellSB (a GitHub user) maintains it in RussellSB/pytrendy, which has 106 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on October 8, 2026.

Source: RussellSB/pytrendy on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.