learn-from-code-review
Skill167 starsChanged 16 days agoMITView on GitHub
Distill code review feedback from GitHub PRs into reusable skills and guidelines. This skill should be used when users ask to "learn from code reviews", "distill PR feedback", "improve coding standards", "extract learnings from reviews", or want to generate skills/guidelines from historical review comments.
- Reads credentials
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 8 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈8
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 37
If not in a repository, ask the user which repository to analyze.
- Distinctive: line 88
If clear, actionable patterns emerge, generate focused skill files.
- Very specific: line 90
When creating skills, place them in .openhands/skills/{domain-name}/SKILL.md:
- Distinctive: line 107
Prefer skills over AGENTS.md updates, since AGENTS.md typically already contains general coding guidelines.
- Very specific: line 111
Use the create_pr tool to open a draft PR with the proposed changes.
- Distinctive: line 164
Avoid duplication: - Check existing AGENTS.md and skills before adding
- Distinctive: line 171
Repository has few PRs: If fewer than 10 merged PRs exist in the timeframe, inform the user that there may not be enough data to identify …
- Distinctive: line 172
No patterns emerge: When comments don't cluster into recurring themes (common for well-established codebases), report this to the user and …
- Distinctive: line 173
Token lacks repository access: If the GitHub API returns 403/404, explain that the token may not have access to the repository and suggest …
- Distinctive: line 178
Only analyzes accessible repositories (requires appropriate permissions)
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Learn from Code Review
Analyze code review comments from GitHub pull requests and distill them into reusable skills or repository guidelines that improve future code quality.
Overview
Code review feedback contains valuable institutional knowledge that often gets buried across hundreds of PRs. This skill extracts meaningful patterns from review comments and transforms them into:
- Repository-specific skills - Placed in
.openhands/skills/for domain-specific patterns - AGENTS.md guidelines - Overall repository conventions and best practices
Prerequisites
GITHUB_TOKENenvironment variable must be set- GitHub CLI (
gh) should be available
Workflow
Step 1: Identify Target Repository
Determine the repository to analyze:
# Get current repo info
gh repo view --json nameWithOwner -q '.nameWithOwner'If not in a repository, ask the user which repository to analyze.
Step 2: Fetch Review Comments
Retrieve PR review comments from the repository:
# Fetch merged PRs from the last 30 days (adjustable)
gh pr list --repo {owner}/{repo} \
--state merged \
--limit 50 \
--json number,title,mergedAt
# For each PR, fetch review comments
gh api repos/{owner}/{repo}/pulls/{pr_number}/comments \
--jq '.[] | {body: .body, path: .path, user: .user.login, created_at: .created_at}'
# Also fetch review-level comments (not tied to specific lines)
gh api repos/{owner}/{repo}/pulls/{pr_number}/reviews \
--jq '.[] | select(.body != "") | {body: .body, user: .user.login, state: .state}'Step 3: Filter and Categorize Comments
Apply noise filtering to keep only meaningful feedback:
Exclude:
- Bot comments (dependabot, copilot, github-actions, etc.)
- Low-signal responses ("LGTM", "+1", "looks good", "thanks", "nice")
- Comments shorter than 30 characters
- Auto-generated comments (CI status, coverage reports)
Categorize remaining comments by:
- Security concerns
- Performance patterns
- Code style/conventions
- Architecture/design patterns
- Error handling
- Testing requirements
- Documentation standards
Step 4: Distill Patterns
For each category with sufficient examples (3+ similar comments), identify:
- The recurring issue - What mistake or oversight keeps appearing
- The desired pattern - What reviewers consistently ask for
- Example context - Concrete before/after code snippets when available
Step 5: Generate Output
If clear, actionable patterns emerge, generate focused skill files. If no clear patterns emerge, report this to the user—it's fine to produce no output when the codebase already has strong conventions or when review comments don't cluster into recurring themes.
When creating skills, place them in .openhands/skills/{domain-name}/SKILL.md:
---
name: database-queries
description: Database query patterns and best practices for this repository.
---
# Database Query Guidelines
### Always Use Parameterized Queries
[Pattern description with examples]
### Connection Pool Management
[Pattern description with examples]Prefer skills over AGENTS.md updates, since AGENTS.md typically already contains general coding guidelines.
Step 6: Create Draft PR (if applicable)
Use the create_pr tool to open a draft PR with the proposed changes. The PR description should include:
- Number of PRs analyzed
- Number of comments processed
- Categories of patterns found
- List of proposed changes (new skills and/or AGENTS.md updates)
Example Output
Sample Skill: API Error Handling
---
name: api-error-handling
description: API error handling patterns for this repository.
---
# API Error Handling
## Always Return Structured Errors
❌ Avoid:
```python
return {"error": str(e)}✅ Prefer:
return {
"error": {
"code": "VALIDATION_ERROR",
"message": "Invalid input",
"details": {"field": "email", "reason": "Invalid format"}
}
}Log Before Returning Errors
logger.error(f"API error in {endpoint}: {e}", exc_info=True)
return error_response(e)
## Defaults
This workflow analyzes PRs from the past 30 days by default.
## Best Practices
1. **Run periodically** - Schedule monthly or quarterly to capture evolving patterns
2. **Review before merging** - Generated content is a draft; human review is essential
3. **Iterate** - Refine patterns based on team feedback
4. **Avoid duplication** - Check existing AGENTS.md and skills before adding
5. **Cite sources** - Reference PR numbers when documenting patterns
## Error Handling
Handle these common edge cases gracefully:
- **Repository has few PRs**: If fewer than 10 merged PRs exist in the timeframe, inform the user that there may not be enough data to identify patterns. Proceed with analysis but note the limited sample size.
- **No patterns emerge**: When comments don't cluster into recurring themes (common for well-established codebases), report this to the user and suggest either expanding the time range or that the codebase may already have strong conventions.
- **Token lacks repository access**: If the GitHub API returns 403/404, explain that the token may not have access to the repository and suggest checking token permissions.
- **`gh` CLI unavailable**: Fall back to direct GitHub API calls using `curl` with `$GITHUB_TOKEN`, or inform the user that `gh` needs to be installed.
## Limitations
- Only analyzes accessible repositories (requires appropriate permissions)
- Cannot capture verbal feedback from pair programming or meetings
- Patterns may reflect individual reviewer preferences vs. team consensus
- Historical comments may reference outdated code patterns
## Additional Resources
For posting structured code reviews, see the `github-pr-review` skill.
For creating new skills, see the `skill-creator` skill.In this repository68 other files it gives its agents.
- AGENTS.mdAGENTS.md
- add-javadocSkill
- add-skillSkill
- agent-canvas-environmentSkill
- agent-creatorSkill
- agent-memorySkill
- agent-sdk-builderSkill
- azure-devopsSkill
- bitbucket-cloudSkill
- bitbucket-data-centerSkill
- bitbucketSkill
- canvas-extension-apiSkill
- code-reviewSkill
- code-simplifierSkill
- datadogSkill
- denoSkill
- discordSkill
- dockerSkill
- evidence-based-citationsSkill
- flarglebargleSkill
- frontend-designSkill
- github-actionsSkill
- github-agents-md-maintainerSkill
- github-delivery-watchdogSkill
- github-issue-to-prSkill
- github-issue-triageSkill
- github-pr-reviewerSkill
- github-pr-reviewSkill
- github-repo-monitorSkill
- githubSkill
- github-stale-ci-pr-closerSkill
- gitlab-issue-to-mrSkill
- gitlabSkill
- incident-retrospectiveSkill
- iterateSkill
- jira-issue-to-prSkill
- jupyterSkill
- kubernetesSkill
- linearSkill
- linear-triageSkill
- news-digestSkill
- notionSkill
- npmSkill
- openhands-apiSkill
- openhands-automationSkill
- openhands-enterprise-troubleshootingSkill
- openhands-sdkSkill
- pdflatexSkill
- plain-english-contentSkill
- prdSkill
- qa-changesSkill
- release-notesSkill
- research-briefSkill
- securitySkill
- simplified-technical-englishSkill
- skill-creatorSkill
- slack-channel-monitorSkill
- slack-standup-digestSkill
- spark-version-upgradeSkill
- sshSkill
- The first 60 shown.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

