yield-analytics

Query and interpret yield analytics data from harvest-logger. Use when asked about yield trends over time, comparing crop performance, finding the best-performing field, analyzing grade quality rates, running season comparisons, or generating data for external reports. Triggers include "yield trend", "top crops", "grade analysis", "field performance", "season comparison", "best yield", "harvest analytics", or any task requiring aggregated harvest data rather than individual entries.

7 stars

Best use case

yield-analytics is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Query and interpret yield analytics data from harvest-logger. Use when asked about yield trends over time, comparing crop performance, finding the best-performing field, analyzing grade quality rates, running season comparisons, or generating data for external reports. Triggers include "yield trend", "top crops", "grade analysis", "field performance", "season comparison", "best yield", "harvest analytics", or any task requiring aggregated harvest data rather than individual entries.

Teams using yield-analytics should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/yield-analytics/SKILL.md --create-dirs "https://raw.githubusercontent.com/heldernoid/agentic-build-templates/main/projects/agriculture-farming/harvest-logger/skills/yield-analytics/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/yield-analytics/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How yield-analytics Compares

Feature / Agentyield-analyticsStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Query and interpret yield analytics data from harvest-logger. Use when asked about yield trends over time, comparing crop performance, finding the best-performing field, analyzing grade quality rates, running season comparisons, or generating data for external reports. Triggers include "yield trend", "top crops", "grade analysis", "field performance", "season comparison", "best yield", "harvest analytics", or any task requiring aggregated harvest data rather than individual entries.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# yield-analytics

Query aggregated yield data from harvest-logger's analytics endpoints for trend analysis, crop comparison, and quality reporting.

## When to Use

- Finding total yield for one crop across a date range
- Comparing yield performance across fields
- Identifying which crops have the best Grade A rate
- Generating weekly or monthly yield trend data
- Comparing this season's performance to last season
- Building reports from harvest data

## Analytics Endpoints

All endpoints support `?from=YYYY-MM-DD&to=YYYY-MM-DD` date range filtering.

### Yield by Crop

```bash
# Total yield per crop
curl "http://localhost:3003/api/analytics/yield-by-crop"

# With date range
curl "http://localhost:3003/api/analytics/yield-by-crop?from=2025-04-01&to=2025-04-30"
```

Response:
```json
{
  "data": [
    { "crop_id": "...", "crop_name": "Tomatoes", "total": 1840, "unit": "kg", "harvest_days": 24 },
    { "crop_id": "...", "crop_name": "Beans", "total": 940, "unit": "kg", "harvest_days": 18 }
  ]
}
```

### Yield by Field

```bash
curl "http://localhost:3003/api/analytics/yield-by-field?from=2025-04-01"
```

Response includes `total`, `unit`, `harvest_count`, and `area_acres` for yield-per-acre calculation.

### Yield Trend

```bash
# Daily totals for a crop
curl "http://localhost:3003/api/analytics/yield-trend?crop_id=...&granularity=day"

# Weekly totals across all crops
curl "http://localhost:3003/api/analytics/yield-trend?granularity=week"
```

Granularity values: `day`, `week`, `month`

Response:
```json
{
  "data": [
    { "period": "2025-W14", "total": 480 },
    { "period": "2025-W15", "total": 520 }
  ]
}
```

### Grade Breakdown

```bash
# Grade distribution per crop
curl "http://localhost:3003/api/analytics/grade-breakdown"

# For a specific crop
curl "http://localhost:3003/api/analytics/grade-breakdown?crop_id=..."
```

Response:
```json
{
  "data": [
    {
      "crop_name": "Tomatoes",
      "total": 1840,
      "grades": {
        "A": { "quantity": 1490, "percent": 81 },
        "B": { "quantity": 258, "percent": 14 },
        "C": { "quantity": 55, "percent": 3 },
        "reject": { "quantity": 37, "percent": 2 }
      }
    }
  ]
}
```

### Top Crops

```bash
# Top 10 crops by total volume
curl "http://localhost:3003/api/analytics/top-crops"

# Top 5 only
curl "http://localhost:3003/api/analytics/top-crops?limit=5"
```

## Season Comparison Pattern

To compare two seasons, make two calls with different date ranges:

```bash
# 2025 season (April only)
curl "http://localhost:3003/api/analytics/yield-by-crop?from=2025-04-01&to=2025-04-30"

# 2024 same period
curl "http://localhost:3003/api/analytics/yield-by-crop?from=2024-04-01&to=2024-04-30"
```

The Season Comparison page in the UI does this automatically.

## Calculated Metrics

Some metrics are derived from the raw data:

| Metric | Calculation |
|---|---|
| Average daily yield | total / harvest_days |
| Yield per acre | field_total / area_acres |
| Grade A rate | grade_A_quantity / total * 100 |
| Year-over-year change | (this_year - last_year) / last_year * 100 |

These calculations are performed client-side in the Analytics page using Chart.js datasets.

## Troubleshooting

### Top crops endpoint shows wrong ranking

The endpoint ranks by `SUM(quantity)`. If different crops use different units (some kg, some count), the ranking will not be unit-comparable. Ensure you use consistent units for crops you want to compare analytically, or filter by unit: `?unit=kg`.

### Yield trend shows gaps in dates

Dates with no harvests have no data points. The Chart.js line chart connects existing points, which may create visual gaps for days with no harvests. This is expected behavior.

### Grade breakdown shows less than 100%

If some entries are `ungraded`, the A+B+C+Reject percentages will not sum to 100%. The Analytics page UI shows ungraded as a separate segment.

Related Skills

api-analytics-proxy

7
from heldernoid/agentic-build-templates

Transparent HTTP reverse proxy that records every request and response to SQLite and exposes a React dashboard for traffic analytics, latency percentiles, and error inspection

SKILL.md - sales-analytics

7
from heldernoid/agentic-build-templates

## Overview

Skill: Uptime Monitoring

7
from heldernoid/agentic-build-templates

## Overview

Skill: Status Page

7
from heldernoid/agentic-build-templates

## Overview

Skill: unit-conversion

7
from heldernoid/agentic-build-templates

## Overview

Skill: recipe-scaler

7
from heldernoid/agentic-build-templates

## Overview

reading-list

7
from heldernoid/agentic-build-templates

Operate the reading-list API to save, manage, tag, search, and export articles.

email-digest

7
from heldernoid/agentic-build-templates

Configure, test, and troubleshoot the reading-list daily email digest delivered via nodemailer.

websocket-realtime

7
from heldernoid/agentic-build-templates

Use the WebSocket connection in poll-builder to receive live vote updates. Use when you need to stream real-time poll results, monitor a poll for new votes, or build a live dashboard. Triggers include "live results", "real-time updates", "stream votes", "watch poll", or "WebSocket".

poll-builder

7
from heldernoid/agentic-build-templates

Self-hosted poll creation tool with real-time results. Use when you need to create a poll, check vote counts, close a poll, export results, or get the shareable link for a poll. Triggers include "create poll", "vote", "poll results", "survey", "collect votes", "share poll", or any task involving polling or voting.

Skill: personal-finance

7
from heldernoid/agentic-build-templates

## Overview

Skill: csv-import

7
from heldernoid/agentic-build-templates

## Overview