Agent skill

Pytrendy

by RussellSB in RussellSB/pytrendy

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

MITAuto-check passedData & Analytics

Install Pytrendy

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

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

GitHub CLI
$ gh skill install RussellSB/pytrendy pytrendy --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/pytrendy .claude/skills/pytrendy && 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
pytrendy
GitHub stars
106
Token cost
~2.5k tokens
SKILL.md length
865 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

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

  • Working on pytrendy code
  • SKILL.md covers 5-stage pipeline, Module map, Datasets and PyTrendyResults…, plus 4 more sections
  • Calls pip and pytest

What it does

Pytrendy is an agent skill from RussellSB/pytrendy. Use when working on pytrendy code, tests, or data. Covers the 5-stage pipeline, module map, install/verify, datasets, PyTrendyResults API, and docs tooling.

Its SKILL.md is about 2.5k 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 Data & Analytics. 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

  • Working on pytrendy code

Example prompts

  • “/pytrendy”

Requirements

  • Python 3

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

    Shell commands in SKILL.md call:

    • pip
    • pytest

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

  • Network

    No URLs in SKILL.md. Its commands use pip, which can reach the network depending on how they are called.

    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

Pytrendy loads about 2.5k tokens when it runs. Until then it costs about 41 tokens; SKILL.md has 865 words of instructions outside code blocks.

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

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). 865 words, ~2,549 tokens.

Download SKILL.mdSave it as .claude/skills/pytrendy/SKILL.md (or your agent's skills folder).
name
pytrendy
description
Use when working on pytrendy code, tests, or data. Covers the 5-stage pipeline, module map, install/verify, datasets, PyTrendyResults API, and docs tooling.

pytrendy package architecture

5-stage pipeline

pytrendy/detect_trends.py — the only entrypoint that matters. detect_trends(df, date_col, value_col, plot=True, method_params=None, debug=False) runs:

text
df → process_signals → get_segments → refine_segments → analyse_segments → [plot_pytrendy] → PyTrendyResults

Stages mutate a copy of the input DataFrame and a list of segment dicts. The final PyTrendyResults wraps the segment list.

Module map

text
pytrendy/
├── __init__.py            # public exports: detect_trends, load_data, plot_pytrendy, dtw
├── detect_trends.py       # pipeline orchestrator (85 lines — read it first)
├── process_signals.py     # Savitzky-Golay smoothing + rolling stats → flat/noise/trend flags
├── simpledtw.py           # DTW for gradual-vs-abrupt classification (standalone, no deps on rest)
├── io/
│   ├── data_loader.py     # load_data('series_synthetic' | 'classes_signals')
│   ├── plot_pytrendy.py   # annotated matplotlib viz; called by detect_trends when plot=True
│   ├── results_pytrendy.py # PyTrendyResults: .print_summary(), filtering, ranking, tabular access
│   └── data/              # series_synthetic.csv, classes_signals.csv (packaged CSVs)
└── post_processing/
    ├── segments_get.py        # extract contiguous segments from trend_flag; min-length filter
    ├── segments_refine/       # package — the heaviest stage
    │   ├── __init__.py        # refine_segments() orchestrator
    │   ├── gradual_expand_contract.py  # boundary adjust via local extrema (±7d window)
    │   ├── trend_classify.py          # DTW-based gradual/abrupt labeling
    │   ├── abrupt_shaving.py          # z-score outlier changepoint detection on abrupt segs
    │   ├── segment_grouping.py        # merge short consecutive same-direction segments
    │   ├── artifact_cleanup.py        # remove invalid segments, fill gaps with flats
    │   └── update_neighbours.py       # boundary cascade when a neighbor changes
    └── segments_analyse.py    # per-segment metrics: change, duration, SNR, change_rank

Datasets

load_data(name) reads CSVs shipped in pytrendy/io/data/:

  • 'series_synthetic' — synthetic daily time series with embedded up/down/flat regions. The README quickstart and core plot tests use this.
  • 'classes_signals' — reference signals used internally by trend_classify for DTW alignment (gradual vs abrupt templates).

Adding a dataset = drop a CSV in pytrendy/io/data/ + extend data_loader.py. It's a plain pd.read_csv wrapper, not a registry.

PyTrendyResults (io/results_pytrendy.py)

Returned by detect_trends(). Constructed from the segment list and auto-populates best, df, df_summary, summary in __init__.

Attributes
AttrTypeWhat it is
.segmentslist[dict]Raw segment dicts (all directions including Flat/Noise).
.trend_segmentslist[dict]Subset with a trend_class key (Up/Down only — Flats/Noise excluded).
.bestdict | NoneSegment with lowest change_rank among trend_segments; None if no trends. Picked on total_change magnitude (steepness × length), not raw change.
.dfpd.DataFrameFull segment table, indexed by time_index. All columns: direction, start, end, trend_class, change, pct_change, days, total_change, SNR, change_rank (+ padded when abrupt_padding>0).
.df_summarypd.DataFrameSlimmer view: direction, start, end, days, total_change, change_rank, trend_class. What .print_summary() prints.
.summarydictdirection_counts (Counter→dict over Up/Down/Flat/Noise), trend_class_counts (gradual/abrupt), highest_total_change.
Methods
  • .print_summary() — prints direction counts, best trend (direction + date range), and the df_summary table. Use for high-level overview; cheap to paste into an LLM context when developing.
  • .filter_segments(direction='Any', sort_by='time_index', format='df') — the workhorse for narrowing focus.
    • direction: 'Any' | 'Up/Down' | 'Up' | 'Down' | 'Flat' | 'Noise'.
    • sort_by: 'time_index' (ascending) or 'change_rank' (descending by abs(total_change)).
    • format: 'df' (default) or 'dict'.
    • Returns DataFrame/list; slice with [:3] for top-N. Invalid direction/sort_by/format print a hint and fall through.
Usage patterns (from the example notebooks)
  • High-level overview → results.print_summary(). One-glance counts + best trend.
  • Debugging one direction → results.filter_segments(direction='Up') to isolate uptrends only (the abrupt notebook does this to compare uptrends against each other).
  • Rank the strongest trends → results.filter_segments(direction='Up/Down', sort_by='change_rank'). Rank 1 = steepest+longest by total_change magnitude.
  • Top-N → results.filter_segments(direction='Up', sort_by='change_rank')[:3].
  • Full per-segment metrics → results.df (includes change, pct_change, SNR that df_summary omits).
  • Raw dicts for downstream code → results.filter_segments(format='dict') or results.segments / results.trend_segments.
  • Best single segment → results.best (dict).
Metric columns (what they mean)
  • change / total_change — cumulative sum of day-over-day differences across the segment.
  • pct_change — relative change; e.g. 3.67 = +367%. Useful for comparing trends of different baselines.
  • days — segment length.
  • SNR — signal-to-noise ratio. Lower SNR ≈ noisier segment. Noise segments typically have SNR < ~7; clean gradual trends sit around 17-22. Borderline trends (e.g. SNR ~5.9) show up with high change_rank numbers — still detected but flagged as weak.
  • change_rank — 1 = strongest trend by abs(total_change). Lower is stronger. Artifact trends (short, low-magnitude) get high rank numbers and are effectively de-prioritized.
  • padded — True only when abrupt_padding>0 extended an abrupt segment's end date; NaN for gradual/flat/noise.
  • trend_class — gradual / abrupt / NaN (NaN for Flat/Noise).
Show full SKILL.md (404 more words)Show less
Use-case notes (from the notebooks)
  • Gradual trends — the default case; trend_class='gradual' for all Up/Down. Compare via filter_segments(direction='Up', sort_by='change_rank') to rank competing uptrends.
  • Abrupt trends — short, sharp shifts (changepoint-style). Pass method_params=dict(abrupt_padding=N) to extend each abrupt segment N days forward (for Interrupted Time Series / Pre-Post analysis). Padding stops early if the signal reverses; segments gain a padded=True column. Combine with gradual in one run — DTW classifies each segment independently, so a single detect_trends() call returns both classes.
  • Noise — direction='Noise' segments are flagged by a rolling SNR threshold, not by magnitude. Use filter_segments(direction='Noise') to inspect what got rejected. As noise std rises, trends shorten and more Noise/Flat segments appear; borderline trends keep high change_rank so they're easy to filter out.
  • Noise control via avoid_noise — method_params=dict(avoid_noise=False) opts out of noise detection entirely. Spikes and noisy regions are ignored and trend detection proceeds straight through them. Use case: new-market launches or quasi-experiments where the signal is zero before and after an activation window — with avoid_noise=True (default), the step-change boundaries produce Noise artifacts; with avoid_noise=False, you get clean Up/Down segments. See whats-new.md v1.2.0 entry / PR #110.

Tests exercise this heavily in tests/test_io_results.py (all @pytest.mark.core) — any API change there breaks the core suite immediately. Read results_pytrendy.py before extending the class.

Segment classification

  • direction ∈ {Up, Down, Flat, Noise} — assigned during process_signals/segments_get.
  • trend_class ∈ {gradual, abrupt, NaN} — assigned by segments_refine/trend_classify.py via DTW against classes_signals references. Only Up/Down segments get a class; Flat/Noise stay NaN.
  • Min segment length: Up/Down ≥3 days, Flat/Noise ≥1 day (enforced in segments_get.py).

method_params (the only tuning surface)

python
{'abrupt_padding': 0, 'avoid_noise': True}  # defaults; see maintenance skill for deprecation note

detect_trends reconstructs this dict from an allowlist — unknown keys are dropped. Adding a tunable = update the allowlist in detect_trends.py:72 + the docstring + add a test.

Install & verify

During development you can import pytrendy directly — no rebuild step needed. The commands below are primarily for end users or when setting up a fresh environment.

bash
pip install -e ".[dev]"           # dev: pytest, pytest-cov, pytest-mpl, pytest-timeout
pip install -e ".[dev,docs]"      # add mkdocs material + mkdocstrings for docs work

Verify before push — CI runs core first, then non-core with --cov-append:

bash
pytest tests/ -m core                       # essential, must pass
pytest tests/ -m "not core" --cov-append    # the rest
# or just: pytest  (pyproject addopts already set --mpl --cov=pytrendy)
  • 15s per-test timeout (pytest-timeout).
  • Plot tests use pytest-mpl with baselines pinned to matplotlib==3.10.8 (hard pin in pyproject.toml). Regenerating baselines on another version = false failures. See the test skill.
  • coverage.xml + .coverage are gitignored artifacts; don't commit.

Docs

  • MkDocs Material + mkdocstrings (Google-style). New page → register under nav: in mkdocs.yml.
  • mkdocs serve for local preview. PRs touching docs/, mkdocs.yml, or pytrendy/ auto-deploy a preview at russellsb.github.io/pytrendy/pr-<N>/ (bot comments the URL; removed on PR close; fork PRs skipped).
  • JupyterLite notebooks in docs/examples/ — run scripts/normalize_notebooks.sh before building docs (works around a JupyterLite text-output rendering bug).

© 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/pytrendy of RussellSB/pytrendy.

Open the folder on GitHubat commit 0d6d5bb

Compare with similar skills

Pytrendy 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.

Pytrendy compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Pytrendy this skillRussellSB/pytrendy106—~2.5kAutomated safety check: PassMIT
MatplotlibzLanqing/codex-claude-academic-skills4.7k17 repos~2.9kAutomated safety check: PassMIT
Exploratory Data Analysisspacering-net/codeg3.9k14 repos~3.6kAutomated safety check: PassMIT
Scikit LearnzLanqing/codex-claude-academic-skills4.7k16 repos~3.9kAutomated safety check: PassBSD-3-Clause
Chart Visualizationbytedance/deer-flow84k1 repos~840Automated safety check: PassMIT
TimesFM Forecastinggoogle-research/timesfm34k—~4.7kAutomated safety check: PassApache-2.0

Similar skills

  • Matplotlib

    zLanqing/codex-claude-academic-skills

    Low-level plotting library for full customization. An agent skill from zLanqing/codex-claude-academic-skills.

    4.7k GitHub starsUsed in 17 repos~2.9k tokens
    Data & AnalyticsAuto-check passed
  • Exploratory Data Analysis

    spacering-net/codeg

    Perform comprehensive exploratory data analysis on scientific data files across 200+ file formats.

    3.9k GitHub starsUsed in 14 repos~3.6k tokens
    Data & AnalyticsAuto-check passed
  • Scikit Learn

    zLanqing/codex-claude-academic-skills

    Machine learning in Python with scikit-learn. An agent skill from zLanqing/codex-claude-academic-skills.

    4.7k GitHub starsUsed in 16 repos~3.9k tokens
    Data & AnalyticsAuto-check passed
  • Chart Visualization

    bytedance/deer-flow

    Picks a suitable chart type from 26 options for your data, maps the data to that chart's parameters and generates a chart image through a JavaScript script.

    84k GitHub starsUsed in 1 repo~840 tokens
    Data & AnalyticsAuto-check passed
  • TimesFM Forecasting

    google-research/timesfm

    Forecasts any univariate time series zero-shot with Google's TimesFM model, returning point forecasts and calibrated prediction intervals without training.

    34k GitHub stars~4.7k tokensUpdated 11 days ago
    Data & AnalyticsAuto-check passed
  • Sandbox Bench

    vercel/next.js

    Official

    Benchmark React or Next.js changes on Vercel Sandbox VMs with paired A/B statistics: react PR/commit vs base, or Next.js PR/commit vs base, measured end-to-end through the bench/render-pipeline app…

    143k GitHub stars~4.1k tokensUpdated today
    Data & AnalyticsAuto-check passed

More from RussellSB/pytrendy

  • Debug

    RussellSB/pytrendy

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

    106 GitHub stars~1.9k tokensUpdated 3 days ago
    Auto-check passed
  • 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 3 days ago
    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 3 days ago
    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 3 days ago
    Auto-check passed

Questions about Pytrendy

What does Pytrendy do?

A skill your agent uses when working on pytrendy code, tests, or data. Pytrendy is an agent skill from RussellSB/pytrendy. Use when working on pytrendy code, tests, or data.

When should I use Pytrendy?

Pytrendy fits situations like: working on pytrendy code.

How do I install Pytrendy in Claude Code?

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

How do I install Pytrendy in Codex?

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

Can I use Pytrendy 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 pytrendy -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/pytrendy, .gemini/skills/pytrendy, .github/skills/pytrendy and .opencode/skills/pytrendy in your project.

What does Pytrendy need to run?

Going by SKILL.md and its folder, Pytrendy needs the command-line tools its instructions call (pip and pytest). Our summary lists: Python 3.

Does Pytrendy access the network?

SKILL.md contains no URLs. Its commands use pip, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Pytrendy 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 Pytrendy use?

Pytrendy 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 Pytrendy use?

About 2.5k tokens (SKILL.md is roughly 10k 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 Pytrendy?

Skills that share tags, products or a category with Pytrendy: Matplotlib (zLanqing/codex-claude-academic-skills, 4.7k stars), Exploratory Data Analysis (spacering-net/codeg, 3.9k stars), Scikit Learn (zLanqing/codex-claude-academic-skills, 4.7k stars) and Chart Visualization (bytedance/deer-flow, 84k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Pytrendy?

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.