Skip to content

[rig-tasks] Add 10 rig samples — 2026-07-25 - #136

Merged
pelikhan merged 1 commit into
mainfrom
rig-tasks/2026-07-25-75e61db57ac4095e
Jul 25, 2026
Merged

[rig-tasks] Add 10 rig samples — 2026-07-25#136
pelikhan merged 1 commit into
mainfrom
rig-tasks/2026-07-25-75e61db57ac4095e

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

Added 10 new rig sample files to skills/rig/samples/.

# File Description Typecheck
1 130-git-hotspot-analyzer.md Git hotspot analyzer using p.bash git log + shortlog, steering addon, s.record output pass
2 131-loc-statistics-gatherer.md LOC stats gatherer with defineTool aggregation per extension, s.enum complexity pass
3 132-import-cycle-detector.md Import cycle detector via p.bash madge, repair addon, nested s.array(s.object) pass
4 133-coverage-badge-updater.md Coverage badge updater with p.readOptional + p.writeOutput, s.record(s.number) pass
5 134-dep-license-auditor.md Dep license auditor with defineTool classification, p.bash npm ls pass
6 135-test-coverage-mapper.md Test coverage mapper with defineTool filename heuristics, repair addon pass
7 136-pkg-version-drift.md Package version drift reporter using p.read + p.bash npm outdated + p.writeOutput pass
8 137-git-author-stats.md Git author stats aggregator using p.bash shortlog + log, s.record per author pass
9 138-ts-path-alias-validator.md TypeScript path alias validator with defineTool using node:fs existsSync pass
10 139-markdown-frontmatter-checker.md Markdown frontmatter checker with defineTool using node:fs readFileSync + repair pass

Typecheck failures

Three tasks initially failed typecheck with TS2554: Expected 0 arguments, but got 1 when calling repair({ maxTurns: N }). The repair() addon takes no arguments — maxTurns belongs on the agent spec. All three were fixed before writing the sample files.

Tasks run

  • (reused) Hot-spot file analyzer — git log + shortlog, steering addon
  • (reused) Lines-of-code statistics gatherer — wc -l + find, defineTool aggregation
  • (reused) Import cycle detector — madge --circular, repair addon
  • (reused) Coverage badge updater — p.readOptional coverage summary, p.writeOutput badge markdown
  • (reused) Dependency license auditor — npm ls --json, defineTool license classifier
  • (reused) Test coverage mapper — find source/test files, defineTool filename heuristics
  • (new) Package version drift reporter — p.read package.json, npm outdated, p.writeOutput
  • (new) Git author stats aggregator — git shortlog + log, s.record per author
  • (new) TypeScript path alias validator — p.read tsconfig, defineTool with node:fs existsSync
  • (new) Markdown frontmatter checker — p.bash find .md, defineTool parseFrontmatter with readFileSync

Generated by Daily Rig Task Generator · sonnet46 126.5 AIC · ⌖ 6.67 AIC · ⊞ 6.7K ·

Samples cover git analysis, LOC stats, import cycles, coverage badges,
license auditing, test mapping, version drift, author stats, path alias
validation, and markdown frontmatter checking.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@pelikhan
pelikhan marked this pull request as ready for review July 25, 2026 11:05
@pelikhan
pelikhan merged commit 2d69c48 into main Jul 25, 2026
1 check passed
@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown
Contributor Author

🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skills-Based Review 🧠

Applied /codebase-design and /grill-with-docs — commenting on correctness and consistency issues. No changes are strictly blocking, but a few are worth addressing before these samples are used as reference patterns.

📋 Key Themes & Highlights

Key Themes

  • node:fs import style (samples 138, 139): Static top-level imports break the established pattern of await import("node:fs") inside async handlers. This matters because these samples teach the pattern to future agents.
  • git shortlog for per-file data (sample 130): git shortlog returns repo-wide author stats, not per-file contributors. The topContributors field will contain inaccurate data.
  • s.number vs s.int (sample 130): churnScore is semantically an integer; s.int should be used per SKILL.md guidance.
  • p.writeOutput placement (samples 133, 136): Embedding the side-effect intent mid-sentence in prose reduces readability; idiomatic placement is at the end of the template.
  • Schema descriptions on keyed records (sample 137): authors record key format (email) and topAuthor semantics benefit from a description string.

Positive Highlights

  • ✅ All 10 samples pass typecheck — the pre-commit fix to repair() arguments was caught and resolved correctly.
  • ✅ Good mix of addons: steering for constraint enforcement, repair for parse resilience.
  • defineTool is used appropriately as a deterministic helper, not to replace LLM judgment.
  • s.enum is used consistently for bounded classifications across all samples.
  • ✅ Correct use of p.readOptional(path, "{}") with a JSON-parseable fallback.

🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · sonnet46 60.2 AIC · ⌖ 4.61 AIC · ⊞ 6.3K
Comment /matt to run again

// Agent role: analyze which files are hot-spots by measuring commit churn and top contributors.
const gitHotspotAnalyzer = agent({
model: "small",
instructions: p`Analyze file churn in this repository. List all tracked files: ${p.bash("git ls-files --exclude-standard | head -100")}. Get commit counts per file: ${p.bash("git log --follow --name-only --format='' -- . | sort | uniq -c | sort -rn | head -40")}. Get top contributors per file via: ${p.bash("git shortlog -sn --no-merges HEAD~50..HEAD 2>/dev/null || git shortlog -sn --no-merges | head -20")}. For each hot-spot file compute a churnScore 0–100 (based on commit frequency relative to max) and list topContributors.`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/codebase-design] git shortlog gives overall commit counts per author for the whole repo — it does not provide per-file contributor data. The topContributors field will be populated with repository-wide top committers rather than file-specific ones, making the output semantically incorrect.

💡 Suggestion

Replace with a per-file approach using git log:

git log --format="%ae" -- <file> | sort | uniq -c | sort -rn | head -5

Or use defineTool with a per-file git log call so the LLM can query each hot-spot file individually, rather than injecting a single global shortlog that can't be decomposed per-file.

model: "small",
instructions: p`Analyze file churn in this repository. List all tracked files: ${p.bash("git ls-files --exclude-standard | head -100")}. Get commit counts per file: ${p.bash("git log --follow --name-only --format='' -- . | sort | uniq -c | sort -rn | head -40")}. Get top contributors per file via: ${p.bash("git shortlog -sn --no-merges HEAD~50..HEAD 2>/dev/null || git shortlog -sn --no-merges | head -20")}. For each hot-spot file compute a churnScore 0–100 (based on commit frequency relative to max) and list topContributors.`,
output: s.record(s.object({
churnScore: s.number,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/grill-with-docs] churnScore is declared as s.number but the instructions constrain it to integer values 0–100. Per SKILL.md, use s.int for integer-valued fields to make the schema contract precise and enable integer validation.

💡 Fix
output: s.record(s.object({
  churnScore: s.int,   // was s.number
  topContributors: s.array(s.string),
})),


```rig
import { agent, p, s, defineTool } from "rig";
import { existsSync } from "node:fs";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/grill-with-docs] Top-level import { existsSync } from "node:fs" deviates from the established pattern in existing samples (e.g. 66-ci-workflow-health.md, 119-source-map-analyzer.md), which use await import("node:fs") inside the handler. This inconsistency may cause issues in environments where ESM top-level imports of Node built-ins are restricted.

💡 Suggested fix
const checkAlias = defineTool("checkAlias", {
  description: "Check whether a TypeScript path alias target directory exists",
  parameters: s.object({ alias: s.string, target: s.string }),
  handler: async ({ alias, target }) => {
    const { existsSync } = await import("node:fs");
    const resolved = target.replace(/\/\*$/, "");
    const exists = existsSync(resolved);
    return JSON.stringify({ alias, target, exists });
  },
});

Same fix applies to sample 139 which uses import { readFileSync, existsSync } from "node:fs" at the top level.


Current README: ${p.readOptional("README.md", "")}

Parse the coverage summary JSON. Extract per-category percentages for statements, branches, functions, and lines. Compute overallPct as the average. Set rating: green (>=80%), yellow (60–79%), red (<60%). Generate shields.io badge markdown for each category and the overall percentage. Write the badge markdown to the output field badgeMarkdown. Set badgesWritten to true after generating. ${p.writeOutput("badgeMarkdown", "coverage-badges.md")}`,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/grill-with-docs] p.writeOutput("badgeMarkdown", "coverage-badges.md") is embedded mid-sentence in the instructions prose. While it works, the idiomatic pattern (per existing samples like 127-git-commit-annotator.md) places the p.writeOutput at the end of the template string, making the side-effect intent clearly visible and separate from the reasoning instructions.

💡 Suggestion

Move ${p.writeOutput(...)} to a new line at the end of the template:

instructions: p`...Set badgesWritten to true after generating.
${p.writeOutput("badgeMarkdown", "coverage-badges.md")}`,

Same pattern applies to sample 136 where p.writeOutput appears inline with via prose.

firstCommit: s.string,
lastCommit: s.string,
})),
topAuthor: s.string,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[/grill-with-docs] topAuthor: s.string is underspecified — it holds an author email, which should use s.string only if no more precise type is available. More importantly, the authors record is keyed by email (from %ae) but the field is named authors with no documentation of the key format in the schema. Consider adding a description to clarify the semantics.

💡 Suggestion
output: s.object({
  authors: s.record("keyed by author email", s.object({
    commitCount: s.int,
    firstCommit: s.string,
    lastCommit: s.string,
  })),
  topAuthor: s.string("email of the author with the most commits"),
  totalCommits: s.int,
}),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant