diff --git a/.claude/skills/enhance-claude-docs/SKILL.md b/.claude/skills/enhance-claude-docs/SKILL.md new file mode 100644 index 000000000..833648cf5 --- /dev/null +++ b/.claude/skills/enhance-claude-docs/SKILL.md @@ -0,0 +1,269 @@ +--- +name: enhance-claude-docs +description: Analyze recent PR review comments and update Claude documentation files with new insights. Fetches merged, open, and closed PRs from the last N days, extracts reviewer feedback, and proposes documentation improvements. Triggers on "update claude docs", "enhance docs from PRs", "analyze PR comments". +--- + +# Enhance Claude Docs + +Analyzes PR review comments from `UiPath/uipath-typescript` and updates Claude documentation files (`CLAUDE.md`, `Agents.md`, `agent_docs/`) with documentation-worthy insights not already captured. + +--- + +## Arguments + +- `days_back` (positional, default: `7`) — how many days back to scan for PR activity. + +Example invocations: +- `/enhance-claude-docs` — last 7 days +- `/enhance-claude-docs 14` — last 14 days + +--- + +## Step 1: Compute Date Range + +Compute the start date for the PR search. Handle both macOS and Linux date commands: + +```bash +# Try macOS first +START_DATE=$(date -v-${DAYS_BACK}d +%Y-%m-%d 2>/dev/null) || \ +START_DATE=$(date -d "${DAYS_BACK} days ago" +%Y-%m-%d 2>/dev/null) +END_DATE=$(date +%Y-%m-%d) +``` + +Store `START_DATE` and `END_DATE` for use in the PR body later. + +--- + +## Step 2: Fetch PRs + +Fetch all PRs updated in the date range: + +```bash +gh api "repos/UiPath/uipath-typescript/pulls?state=all&sort=updated&direction=desc&per_page=100" \ + --jq "[.[] | select(.updated_at >= \"${START_DATE}\") | {number, title, state, user: .user.login, updated_at}]" +``` + +If no PRs found, report "No PRs found in the last N days" and stop. + +--- + +## Step 3: Fetch Review Threads via GraphQL + +Use GitHub's GraphQL API to fetch **review threads** (not individual comments) for each PR. This gives us thread resolution status and the full conversation in one call. + +### GraphQL query (batch per PR) + +```bash +gh api graphql -f query=' +{ + repository(owner: "UiPath", name: "uipath-typescript") { + pullRequest(number: {pr_number}) { + title + state + author { login } + reviewThreads(first: 100) { + nodes { + isResolved + isOutdated + path + line + comments(first: 30) { + nodes { + author { login } + body + createdAt + } + } + } + } + } + } +}' +``` + +### Thread classification + +For each thread, classify it into one of three buckets: + +| Bucket | Criteria | Action | +|--------|----------|--------| +| **Resolved** | `isResolved: true` | Analyze for insights | +| **Effectively resolved** | `isResolved: false`, but has replies where the PR author acknowledged the feedback (e.g., "done", "fixed", "changed to X", "good point, updated", or any reply indicating the feedback was accepted and acted upon) | Analyze for insights | +| **Unresolved / Rejected** | `isResolved: false`, and either no replies, or the PR author pushed back / debated without acting on it, or the thread is an open question with no conclusion | **Skip entirely** | + +**Important:** Do NOT use keyword matching for the "effectively resolved" bucket. Read the full thread conversation and use semantic understanding to judge whether the PR author acknowledged and acted on the feedback. The signal could be anything — a one-word "done", a detailed explanation of what they changed, or even just agreement followed by a code change. + +### Additional filtering + +After thread classification, also discard threads where: +- All comments are from bots (user login ends with `[bot]`) +- The reviewer's comment is fewer than 10 characters (too short to contain insight) +- The thread is purely automated (`/`, `