AGENT SKILL

data-contracts

Reviews PR diffs for data consistency, schema/migration safety, and API/event contract compatibility. Use when analyze risk_class includes data or api, or when a PR changes schemas, migrations, public APIs, or event payloads.

License 许可
MIT
最近更新
2026-11-14
Stars
★ 1
Forks
0

01 前言 Front Matter

name
data-contracts
description
Reviews PR diffs for data consistency, schema/migration safety, and API/event contract compatibility. Use when analyze risk_class includes data or api, or when a PR changes schemas, migrations, public APIs, or event payloads.
allowed-tools
Bash Read Grep Glob

02 资源文件 2

03 SKILL.md 正文

Data & Contracts Review

Quality Review pass covering taxonomy categories 7 Data & consistency and 11 API / contract design. Emits Conventional Comment findings in the bug-finder schema.

Inputs

  • PR URL: Full GitHub/Enterprise PR URL
  • OUTPUT_DIR (optional): Defaults to private mktemp -d
  • Analysis JSON (optional): $OUTPUT_DIR/pr-analysis-<PR_NUMBER>.json

Outputs

Writes $OUTPUT_DIR/data-contracts-<PR_NUMBER>.json:

{
  "pr_number": 123,
  "pass": "data-contracts",
  "findings": [
    {
      "severity": "critical|high|medium",
      "label": "issue|suggestion|nitpick|question|thought|praise",
      "decoration": "blocking|non-blocking|if-minor",
      "path": "exact/path",
      "line": 42,
      "title": "5-10 words",
      "body": "explanation",
      "suggestion": "concrete fix",
      "suggested_change": "exact replacement for lines start_line..line, or omit"
    }
  ]
}

suggested_change posts as a committable GitHub suggestion. Emit it only when the fix is confined to the commented lines, you can reproduce the range verbatim from the diff, and it runs under ~10 lines; otherwise leave the prose suggestion alone. Most findings in this pass are design-level and will not qualify.

Step 0: Parse arguments

PR_URL="$1"
OUTPUT_DIR="${2:-$(mktemp -d -t pr-review-XXXXXX)}"
mkdir -p "$OUTPUT_DIR"
PR_NUMBER=$(echo "$PR_URL" | grep -oE 'pull/[0-9]+' | grep -oE '[0-9]+')

Step 1: Load context (progressive disclosure)

  1. Read references/anti-patterns.md.
  2. Read this skill's references/checklist.md.
  3. Optionally skim shared/severity-rubric.md.
  4. If present, read analysis JSON for schema/API impact hints.

Step 2: Load the PR diff

/review:review captures the PR once into $OUTPUT_DIR and every pass shares it. Read $OUTPUT_DIR/pr.diff and $OUTPUT_DIR/pr-view.json; never write to either — the other passes are reading them. Fetch only when run standalone:

if [ ! -s "$OUTPUT_DIR/pr.diff" ]; then
  gh pr diff "$PR_URL" > "$OUTPUT_DIR/pr.diff"
  gh pr view "$PR_URL" --json title,body,files,additions,deletions,commits \
    > "$OUTPUT_DIR/pr-view.json"
fi

Focus on migrations, schema files, serializers, OpenAPI/Protobuf/Avro, handlers with writes, public route/event definitions.

Step 3: Review

Walk checklist: data/consistency first, then API/contracts. Clean Code findings are blocking regardless of module reach — blast radius sets severity, not whether to block. Name the resolving refactoring in suggestion.

Prioritize:

  1. Migration expand/contract and integrity constraints
  2. Idempotency under at-least-once / dual-write hazards
  3. Backward compatibility and versioning of APIs/events
  4. PII minimization and delete/retention paths when in scope

Step 4: Emit JSON

jq -n \
  --argjson pr_number "$PR_NUMBER" \
  --arg pass "data-contracts" \
  --argjson findings "$FINDINGS_JSON" \
  '{pr_number: $pr_number, pass: $pass, findings: $findings}' \
  > "$OUTPUT_DIR/data-contracts-${PR_NUMBER}.json"

Notes

  • Standalone: /review:data-contracts <PR_URL> [OUTPUT_DIR]
  • Orchestrator runs when data or api ∈ risk_class

04 同仓库更多 Skills

ozzycodes2
ozzycodes2/claudellum

writing-design-docs

Use when the user wants to write a problem-statement design doc, says "let's plan a feature properly" / "write a design doc" / "I'm thinking about how to do X" for a non-trivial X, or before committing to a non-obvious technical direction

★ 1
ozzycodes2
ozzycodes2/claudellum

write-doc

Use when the user asks to write or draft a README, ADR, runbook, tutorial, how-to, explanation, or reference doc, or a caller passes "type ADR" or "type README". Picks the type, fills a template, adds diagrams. RFCs and design docs belong to writing-design-docs.

★ 1
ozzycodes2
ozzycodes2/claudellum

review-doc

Use when the user asks to review, critique, score, grade, or "how good is this doc" for a Markdown doc or pasted text. Read-only. Scores it on the 20 Practical Prose dimensions and emits a findings table. Does not edit; fix-doc applies the findings next.

★ 1
ozzycodes2
ozzycodes2/claudellum

fix-doc

Use when the user asks to fix, edit for prose quality, polish, tighten, humanize, or de-slop a Markdown doc or pasted text, or says "make this read less AI". Applies review-doc findings, generates flagged diagrams, lists substantive issues for the author, then runs the AI-tell pass last. Modifies the target.

★ 1
ozzycodes2
ozzycodes2/claudellum

create-slides

Use when the user asks for a slide deck, presentation, talk, or slides from a document, report, PR, notes, or topic. Builds one self-contained Machinify-branded HTML deck in a minimalist style, with headline-plus-visual slides, speaker notes, and every diagram drawn by architecture-design:create-diagram.

★ 1
ozzycodes2
ozzycodes2/claudellum

start-session

Open a Claude Code working session in a fresh, isolated git worktree, so the user can start a task with a single /start-session <name>. Use at the START of a session when the user says "start session", "start a worktree", "spin up a worktree for ABC-123", "begin work on <ticket>", or passes a name/ticket to work under. Creates and ENTERS a worktree via the EnterWorktree tool (never `git worktree add`) under .claude/worktrees/, named exactly after the argument, on a local branch `worktree-<argument>`. Reports what the worktree inherited (`.worktreeinclude` copies, symlinked node_modules) and whether its `.env` still points at the main checkout's stack. If the argument is a JIRA key (e.g. ABC-123, PROJ-1505), also loads that story with the Atlassian CLI (`acli`) when available and summarizes the implementation ask. Also renames the session to the argument (the same effect as `/rename <NAME>`) so it's easy to find in `/resume`. Then stops and waits — it sets up the workspace and context, it does not implement.

★ 1