feat(skill): add PR review skill (#88)#90
Conversation
f44b325 to
abd5aae
Compare
|
@lijingrs , @Nixxx19 , done with it , im sure there would be improvements but im quite excited to work on mofaclaw and make more skills for it , also i couldnt use open router properly from my end so i tested it with my own minimax m2.5 key , and the screenshots are a result that , im happy to keep iterating on this , its good to work on such stuff |
nice one, i will try to review it as soon as possible, thanks!! |
There was a problem hiding this comment.
Pull request overview
Adds a new built-in pr-review skill to the skills catalog and integrates it into prompt construction/testing, while also changing session key sanitization to produce filesystem-safe storage keys.
Changes:
- Added
pr-reviewto the skills list and introducedskills/pr-review/SKILL.mdwith a structured PR-review workflow andghCLI commands. - Updated
SessionManagerto use a sanitizedstorage_key()when creating/deleting/loading sessions, plus added tests around the new key behavior. - Added
ContextBuildertests to assert thepr-reviewskill appears in the skills summary and loads when explicitly requested.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| skills/README.md | Adds pr-review to the documented built-in skills list. |
| skills/pr-review/SKILL.md | New skill documentation and command-driven workflow for structured PR reviews. |
| core/src/session/mod.rs | Routes session operations through a filesystem-safe storage key and adds related tests. |
| core/src/agent/context.rs | Adds tests asserting pr-review appears in the built system prompt output. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| requires: | ||
| bins: ["gh", "git"] | ||
| install: | ||
| - id: brew | ||
| kind: brew | ||
| formula: gh | ||
| bins: ["gh"] |
| # Check for SQL injection patterns (Unix/Mac) | ||
| gh pr diff <PR_NUMBER> --repo <OWNER/REPO> | grep -iE '(SELECT|INSERT|UPDATE|DELETE).*\+.*' | ||
|
|
||
| # Check for changed workflow, deployment, or secret-related files |
| pub async fn get_or_create(&self, key: impl Into<String>) -> Session { | ||
| self.inner.get_or_create(&key.into()).await | ||
| let key = key.into(); | ||
| self.inner.get_or_create(&storage_key(&key)).await |
| #[test] | ||
| fn test_storage_key_replaces_windows_unsafe_separators() { | ||
| assert_eq!(storage_key("cli:default"), "cli_default"); | ||
| assert_eq!(storage_key("discord:general/chat"), "discord_general_chat"); |
| #[tokio::test] | ||
| async fn test_skills_summary_includes_pr_review() { | ||
| let temp = tempdir().expect("tempdir"); | ||
| let mut config = default_config(); | ||
| config.agents.defaults.workspace = temp.path().display().to_string(); | ||
|
|
||
| let context = ContextBuilder::new(&config); | ||
| let prompt = context | ||
| .build_system_prompt(None) | ||
| .await | ||
| .expect("system prompt"); | ||
|
|
||
| assert!( | ||
| prompt.contains("pr-review"), | ||
| "prompt did not include pr-review skill summary" | ||
| ); |
|
will have a look at the suggestions , also could you check the #78 i have done the changes as requested |
|
looks good overall, nice one! nice addition of the one small follow-up note: this pr also includes session key normalization changes in thanks!! |
|
thanks for reviewing , i mustve forgotten to edit the pr description , i was aware of it , thats on me , will take care next time |
Summary
Add a new builtin PR review skill at
skills/pr-review/SKILL.mdthat helps reviewers inspect pull requests with a structured workflow covering:This closes issue #88.
What Changed
Added
skills/pr-review/SKILL.mdUpdated
skills/README.mdpr-reviewto the builtin skills indexAdded prompt-loading coverage in
core/src/agent/context.rspr-reviewappears in the skills summaryFixed Windows local-testing blocker in
core/src/session/mod.rscli:defaultTests Verification
1. Direct command verification against real mofaclaw PRs
All core commands documented by the skill were tested locally with
ghagainst real PRs inmofa-org/mofaclaw.PR #78 - feature PR
Commands tested:
gh pr view 78 --repo mofa-org/mofaclaw --json title,body,author,files,additions,deletions,changedFiles gh pr diff 78 --repo mofa-org/mofaclaw --name-only gh pr checks 78 --repo mofa-org/mofaclaw gh api repos/mofa-org/mofaclaw/pulls/78/commits --jq '.[].commit.message' gh run list --repo mofa-org/mofaclaw --branch feat/permission-based-tool-registry --limit 3Verified results:
Observed CI summary for PR #78:
PR #89 - docs PR
Commands tested:
Verified results:
PR #80 - medium feature PR
Commands tested:
Verified results:
PRs #3 and #4 - older PRs with no checks
Commands tested:
Verified results:
gh pr checkscorrectly reported no checks for those older branches2. End-to-end local mofaclaw verification
After fixing the Windows session-key issue, the skill was also exercised through a real local mofaclaw CLI run, not just raw
ghcommands.Local setup used for verification:
D:\mofaclaw-workspaceD:\cargo-targets\mofaclawCommand used:
cargo run --quiet -- agent -s upstream-pr-test -m "Review PR #78 in mofa-org/mofaclaw using the pr-review skill. Do not use my fork. Check scope, security, tests, and CI."Verified result:
pr-reviewmofa-org/mofaclaw3. Automated verification
Rust tests run locally:
Verified results:
test_skills_summary_includes_pr_reviewpassedtest_requested_pr_review_skill_is_loadedpassedAcceptance Criteria
SKILL.mdcreated with proper YAML frontmatterNotes
findstr, PowerShell examples).mofa-org/mofaclawexplicitly because the local git clone had a fork remote asorigin.