[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C1SX0TPDEND7244J75E5RF":3,"skill-same:01M6C1SX0TPDEND7244J75E5RF":85},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":31,"publishedAt":50,"linkOnly":51,"markdownContent":52,"markdownBody":53,"frontMatter":54,"refName":55,"commitSha":56,"skillDirectory":57,"forksCount":14,"repositoryHtmlUrl":58,"repositoryHomepageUrl":6,"ownerHtmlUrl":59,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":60,"install":61,"resources":74},"01M6C1SX0TPDEND7244J75E5RF","code-review",null,"Review GitHub pull requests by analyzing diffs and posting inline comments with a summary review. Includes domain-specific rules for Python backend (Pyramid, Cornice, SQLAlchemy, Marshmallow). Also handles resolving open review comments. Use when the user says \"review PR\", \"code review\", \"review pull request\", \"check this PR\", \"review #42\", \"resolve os comentarios\", or asks to review a specific PR number or URL.","cartaorobbin\u002Fpyramid-temporal","cartaorobbin","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F133803757?v=4","01M6C1SVA1FFVXFG0QTK8ZRNDV","robbin Pagamentos","01M6C1SVEDYW8ZDTP82V7DF2BQ",0,"MIT","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fcode-review\u002FSKILL.md",[18,23,26],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000007","代码审查","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",{"categoryNo":27,"categoryName":28,"taxonomyType":29,"taxonomyTypeDesc":30},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49],"review","code","code review","diffs","python","github","review pr","pull requests","pr","pull request","pull","analyzing","open","Rules","check","user","use","backend","2026-11-10 10:12:30",false,"---\nname: code-review\ndescription: >-\n  Review GitHub pull requests by analyzing diffs and posting inline comments\n  with a summary review. Includes domain-specific rules for Python backend\n  (Pyramid, Cornice, SQLAlchemy, Marshmallow). Also handles resolving open\n  review comments. Use when the user says \"review PR\", \"code review\",\n  \"review pull request\", \"check this PR\", \"review #42\", \"resolve os\n  comentarios\", or asks to review a specific PR number or URL.\n---\n\n> **MANAGED SKILL** — Do not edit this file here. It is managed from an external source repository.\n> To make changes, update the source and run \"update my skills\" to sync.\n\n\n# Code Review\n\nAnalyze a GitHub pull request, review each changed file for issues, and post inline comments plus a summary review directly on the PR.\n\nAlso run **Phase 6: Resolve Review Comments** when the user asks to address open PR review comments, e.g.:\n- \"leia os comentarios e resolva\"\n- \"resolve os comentarios do PR\"\n- \"fix the review comments\"\n\n---\n\n## Core Workflow\n\n1. Select the PR (user-provided or list open PRs)\n2. Fetch diff and file-level changes\n3. Read changed files for full context\n4. Analyze changes (severity: Critical \u002F Important \u002F Suggestion)\n5. Post review (local chat or pending on GitHub)\n6. Optionally resolve review comments in follow-up\n\n---\n\n## Reference Guide\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Pyramid \u002F Cornice \u002F SQLAlchemy \u002F Marshmallow | `pyramid-backend-rules.md` | PR contains Python files importing Pyramid, Cornice, SQLAlchemy, or Marshmallow |\n\n---\n\n## Constraints\n\n### MUST DO\n- Read the full file for context (not just the diff hunk) before commenting\n- Post all comments atomically as a single review (never individual comments)\n- Include severity prefix on every inline comment\n- Respond in Portuguese\n\n### MUST NOT DO\n- Auto-submit the review (must remain PENDING for user to confirm)\n- Comment on formatting\u002Fstyle that a linter handles\n- Invent issues to fill space when code is correct\n- Post inline comments on lines not visible in the diff (use file-level comment instead)\n\n---\n\n## GitHub API Access\n\nBefore performing any GitHub operations, determine which access method is available:\n\n1. **GitHub MCP** (preferred): Check if a GitHub MCP server is configured by scanning the mcps folder for a server matching `github` or containing `github` in its name. If found, verify with a `get_me` call. Note the server name for all subsequent MCP calls.\n2. **gh CLI** (fallback): Run `gh auth status` to verify authentication.\n\nAlso resolve `owner` and `repo` from the git remote:\n\n```bash\ngit remote get-url origin\n```\n\nParse `owner\u002Frepo` from the URL. Store these values — GitHub MCP tools require them as explicit parameters on every call.\n\nUse the detected method consistently for all operations below. Each operation shows both methods: **MCP** first, then **CLI**.\n\n---\n\n## Phase 1: Select PR\n\n### 1.0 Review mode\n\nBefore anything else, ask the user what kind of review this is:\n\n```yaml\ntitle: \"Review Mode\"\nquestions:\n  - id: mode\n    prompt: \"Is this review local-only or should it be submitted to GitHub?\"\n    options:\n      - id: local\n        label: \"Local only — show the review here in the chat\"\n      - id: github\n        label: \"Submit to GitHub — create as a pending review for me to confirm in the web UI\"\n```\n\nStore the selected mode. It affects Phase 4:\n\n- **local**: perform the full analysis (Phases 2-3) but do NOT post anything to GitHub. Display the complete review (summary + inline comments) directly in the chat.\n- **github**: perform the full analysis (Phases 2-3) and post the review as a **PENDING** review on GitHub. The user will review and submit it from the web interface.\n\n### 1.1 Determine the PR\n\nIf the user provided a PR number or URL, extract the number and skip to 1.2.\n\nOtherwise, list recent open PRs:\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=list_pull_requests\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"state\": \"open\", \"perPage\": 15 }\n```\n\n**Via CLI:**\n\n```bash\ngh pr list --limit 15 --json number,title,author,headRefName --template '{{range .}}#{{.number}} {{.title}} ({{.author.login}}, {{.headRefName}}){{\"\\n\"}}{{end}}'\n```\n\nUse `AskQuestion` to let the user pick:\n\n```yaml\ntitle: \"Select PR\"\nquestions:\n  - id: pr\n    prompt: \"Which pull request should I review?\"\n    options:\n      # one option per PR from the list\n      - id: \"\u003Cnumber>\"\n        label: \"#\u003Cnumber> — \u003Ctitle> (\u003Cauthor>)\"\n```\n\n### 1.2 Fetch PR metadata\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=pull_request_read\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"method\": \"get\" }\n```\n\n**Via CLI:**\n\n```bash\ngh pr view \u003Cnumber> --json number,title,body,headRefName,baseRefName,headRefOid,url,additions,deletions,changedFiles\n```\n\nStore the metadata — `headRefOid`, `headRefName`, `baseRefName`, `url`, and `number` are used in later phases.\n\nTell the user which PR you're reviewing: number, title, branch, and size (additions\u002Fdeletions\u002Ffiles changed).\n\n---\n\n## Phase 2: Fetch Context\n\n### 2.1 Get the diff\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=pull_request_read\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"method\": \"get_diff\" }\n```\n\n**Via CLI:**\n\n```bash\ngh pr diff \u003Cnumber>\n```\n\n### 2.2 Get file-level change details\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=pull_request_read\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"method\": \"get_files\", \"perPage\": 100 }\n```\n\n**Via CLI:**\n\n```bash\ngh api repos\u002F{owner}\u002F{repo}\u002Fpulls\u002F\u003Cnumber>\u002Ffiles --paginate\n```\n\nThis returns JSON with `filename`, `status`, `patch`, `additions`, `deletions`, and `changes` for each file.\n\nIf using CLI and you need to determine `{owner}\u002F{repo}`, extract it from the PR URL or from:\n\n```bash\ngh repo view --json nameWithOwner -q .nameWithOwner\n```\n\n### 2.3 Read changed files for context\n\nFor each changed file (that is not deleted), read the full file from the PR's head branch so you can understand the surrounding code — not just the diff hunks:\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=get_file_contents\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"path\": \"\u003Cfilepath>\", \"ref\": \"\u003CheadRefName>\" }\n```\n\n**Via CLI:**\n\n```bash\ngh api repos\u002F{owner}\u002F{repo}\u002Fcontents\u002F\u003Cfilepath>?ref=\u003CheadRefName> --jq '.content' | base64 -d\n```\n\nFor large PRs (more than 20 changed files), prioritize:\n1. Files with the most additions\u002Fchanges\n2. Source code files over config, lock files, or generated files\n3. Skip binary files, vendored dependencies, and auto-generated files\n\n---\n\n## Phase 3: Analyze Changes\n\n### Review philosophy\n\nYou are an experienced reviewer. Review in a direct, objective, pragmatic style:\n- Prioritize business rules and correctness\n- Avoid premature abstractions\n- Prefer simple, readable code over clever code\n- Flag architecture violations only when they are real\n\n### Language\n\nAlways respond in Portuguese.\n\n### Tone\n\n- Direct, no hedging.\n- Identify the problem → explain why it's a problem → suggest the fix.\n- No unnecessary praise (\"great work, but...\").\n- No artificially softened language (\"you might want to consider maybe...\").\n- No final summary in inline comments.\n\n### Severity levels\n\nRecord findings using three severity levels:\n\n#### ? Critical — blocks merge\n\n- **Logic bugs**: unhandled edge cases, incorrect conditions, unexpected behavior in critical flows.\n- **Bug fix without regression test**: if the PR fixes a bug but does not include a test that would have caught the bug before the fix, it must be blocked. Every bug fix needs a test that fails without the fix and passes with it.\n- **New code without tests**: any new view, service, or business logic being added without corresponding test coverage must be blocked. Code that ships untested is a liability — if it's worth writing, it's worth testing.\n- **Commented-out test**: a test function or block that is commented out must never be merged. Either fix the test or delete it — commented tests give false confidence that coverage exists when it doesn't.\n- **Cross-module database access**: a module must never query or write to another module's tables directly. E.g., `financing` importing models or querying tables from `charge` is a hard boundary violation. Modules communicate through APIs or explicit contracts, never by reaching into each other's database schema.\n- **Critical anti-patterns**: God class, feature envy, hidden side effects. Train wreck calls (`a.b().c().d()`) are Critical only when they obscure a critical flow or increase coupling — otherwise flag as Important.\n- **Security**: injection vulnerabilities (SQL, command, template), secrets or credentials committed in code, unsafe deserialization, path traversal, SSRF.\n\n#### ? Important — should be fixed\n\n- **Premature abstractions**: code made too generic before there's a real need. Prefer concrete and simple. Don't create base classes, mixins, or factories without at least 2–3 real use cases.\n- **Scattered business rules**: the same business decision appears duplicated across views, schemas, or services instead of being centralized.\n- **Codebase pattern violation**: if the project has an established pattern (services, repositories, views), code that diverges from it without clear justification should be flagged. Do not defend an existing pattern just because it exists — if the existing pattern is clearly harmful, flag the objective problem instead of the deviation itself.\n- **Missing tests on critical changes**: business logic or integration flows without test coverage.\n- **Low-quality tests**: happy path only, no edge cases; assertions that don't verify real behavior; tests fragile because they're coupled to implementation; excessive mocking that hides the real behavior being tested.\n- **Flaky \u002F intermittent test risk**: watch closely for tests that depend on timing (`sleep`, `time.time()`), ordering of unordered collections (sets, dict keys), hardcoded future dates without time freezing, shared mutable state between tests, or external service calls without mocking. These pass locally but fail randomly in CI. Flag them as Important with a concrete explanation of the flakiness vector.\n- **Complex logic inside tests**: tests must be dumb and linear — Arrange, Act, Assert. If a test contains `if\u002Felse`, `for`, `while`, `try\u002Fexcept`, or any branching logic, it's wrong. A test with control flow can silently skip the assertion or test different things on different runs. Split into separate test cases instead.\n- **Unnecessary complexity \u002F AI-generated code smell**: code harder to read than it needs to be. Flag when you see:\n  - Functions or classes that do too many things at once\n  - Deeply nested logic (more than 2–3 levels) that could be flattened with early returns or extracted functions\n  - Over-engineered solutions for simple problems (factory, strategy pattern, or abstract base class for something that could be a plain function)\n  - Unnecessary abstractions or indirection that force the reader to jump between files\u002Fclasses to understand a simple flow\n  - Verbose variable names that add noise instead of clarity (e.g., `user_object_instance`, `process_data_result_value`)\n  - Long functions (> ~30 lines) that mix concerns and are hard to scan\n  - Code that \"looks smart\" but is hard to maintain — clever one-liners, excessive list comprehensions with side effects, chained calls that obscure intent\n- **Error handling**: exceptions caught and silently swallowed, missing error propagation, unhelpful error messages that hide the root cause.\n\n#### ? Suggestion — optional, but relevant\n\nDo not request cosmetic refactors with low practical value. Only suggest naming, structure, or style changes when they improve correctness, readability, or maintainability in a meaningful way.\n\n- Weak naming: variables, functions, or classes that don't communicate intent.\n- Minor simplifications that improve readability without changing behavior.\n- Logic duplication that already exists elsewhere in the codebase.\n- DRY violations — duplicated logic that should be extracted.\n- Language-specific idiom violations.\n\n---\n\n### What to look for (general)\n\nReview each modified snippet **inline** — one comment per relevant snippet. If a snippet has nothing worth commenting on, skip it.\n\n**Only comment when there is a concrete problem, real risk, or clear simplification with material value. Do not invent issues to fill space.**\n\n**Bugs and logic errors**\n- Incorrect conditions, off-by-one errors, wrong variable used\n- Race conditions, missing synchronization\n- Null\u002Fundefined access without guards\n\n**Readability and maintainability**\n- Unclear naming that requires reading the implementation to understand intent\n- Overly complex logic that could be simplified\n- Dead code, commented-out code left behind\n- Missing context where a brief comment would prevent future confusion\n\n**Best practices**\n- Incorrect or missing type annotations (in typed languages)\n- Test coverage gaps for non-trivial logic\n\n---\n\n### Backend-specific rules (Pyramid \u002F Cornice \u002F SQLAlchemy)\n\nLoad `pyramid-backend-rules.md` when reviewing Python backend files that import Pyramid, Cornice, SQLAlchemy, or Marshmallow. Apply those rules in addition to the general rules above.\n\n---\n\n### Project pattern detection\n\nBefore criticizing architecture, read the established pattern in the codebase.\nFlag a deviation **only when**:\n1. The code clearly diverges from the existing project pattern, **OR**\n2. The anti-pattern is objectively bad regardless of context.\n\nDo not impose an architectural pattern that doesn't exist in the project.\nDo not defend an existing pattern just because it exists — if it's clearly harmful, flag the objective problem directly.\n\n---\n\n### Readability & complexity standard\n\nThe bar is: **a mid-level dev should be able to read and understand any function in under 30 seconds without asking questions.**\n\nIf that bar isn't met, it's worth flagging — regardless of whether the code is \"technically correct\". AI-generated code often passes correctness checks but fails this bar by introducing unnecessary layers, verbose boilerplate, or patterns that don't match the problem's actual complexity.\n\nWhen the fix is clear, show a simpler version with code.\nWhen the fix depends on project context, explain the direction of the change without inventing details.\n\n---\n\n### Test evaluation\n\nDon't just check whether a test exists. Evaluate:\n- Do the tests cover relevant edge cases beyond the happy path?\n- Do assertions verify real behavior, or just that the code ran without an exception?\n- Is the test coupled to implementation instead of behavior (fragile)?\n- Is there excessive mocking that hides the real behavior being tested?\n\n---\n\n### Guidelines\n\n- Be specific — reference the exact line and explain *why* something is a problem, not just *what* it is.\n- Suggest a fix when possible — use code examples only when they make the fix materially clearer.\n- Avoid nitpicking formatting or style that a linter\u002Fformatter should handle.\n- Acknowledge good patterns — note well-written code in the summary, not as inline noise.\n- If a file looks correct and well-written, do not force comments on it.\n\n---\n\n## Phase 4: Post Review\n\n**If the review mode is `local`**, skip all GitHub API calls. Instead, display the full review directly in the chat using the same format as 4.4 (summary) and 4.5 (inline comments), organized by file. Then skip to Phase 5.\n\n**If the review mode is `github`**, continue with 4.1 below.\n\n### 4.1 Build the review payload\n\nConstruct the review using the GitHub Pull Request Reviews API. This posts all inline comments atomically as a single **PENDING** review — the user will review and submit it from the GitHub web interface.\n\nThe `owner` and `repo` were resolved in the GitHub API Access section. Get the latest commit SHA:\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=pull_request_read\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"method\": \"get\" }\n```\n\nExtract `headRefOid` from the response.\n\n**Via CLI:**\n\n```bash\ngh pr view \u003Cnumber> --json headRefOid -q .headRefOid\n```\n\n### 4.2 Map line numbers to diff positions\n\nThe GitHub API requires diff positions (not file line numbers) for inline comments. For each comment, calculate the position within the file's diff patch.\n\nParse the `patch` field from the file data retrieved in Phase 2.2. The position is the 1-based line index within the patch (counting from the first `@@` line, which is position 1). Only lines visible in the diff can receive comments.\n\nIf a comment targets a line not present in the diff, convert it to a file-level comment by omitting the `line` field and prepending the line reference to the comment body.\n\n### 4.3 Post the review as PENDING\n\nThe review is created as **PENDING** — it is only visible to the author until they submit it from the GitHub web interface. Do NOT submit the review automatically.\n\n**Via MCP:**\n\nCreate the pending review (omit `event` to keep it pending):\n\n```\nCallMcpTool: server=github, toolName=pull_request_review_write\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"method\": \"create\", \"body\": \"\u003Csummary>\", \"commitID\": \"\u003CheadRefOid>\" }\n```\n\nThen add each inline comment to the pending review:\n\n```\nCallMcpTool: server=github, toolName=add_comment_to_pending_review\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"path\": \"app\u002Fviews\u002Fpartner.py\", \"line\": 42, \"side\": \"RIGHT\", \"subjectType\": \"line\", \"body\": \"**[? Critical]** Description of the issue.\\n\\nSuggested fix.\" }\n```\n\nDo NOT call `submit` — the review stays pending for the user to review and submit manually.\n\n**Via CLI:**\n\nOmit the `event` field so the review is created as PENDING:\n\n```bash\ngh api repos\u002F{owner}\u002F{repo}\u002Fpulls\u002F\u003Cnumber>\u002Freviews \\\n  --method POST \\\n  -f body=\"\u003Csummary>\" \\\n  -f commit_id=\"\u003CheadRefOid>\" \\\n  --input \u003Cjson-file>\n```\n\nWhere `\u003Cjson-file>` contains the comments array:\n\n```json\n{\n  \"body\": \"\u003Csummary text>\",\n  \"commit_id\": \"\u003Csha>\",\n  \"comments\": [\n    {\n      \"path\": \"app\u002Fviews\u002Fpartner.py\",\n      \"line\": 42,\n      \"side\": \"RIGHT\",\n      \"body\": \"**[? Critical]** Description of the issue.\\n\\nSuggested fix.\"\n    }\n  ]\n}\n```\n\n### 4.4 Summary review format\n\nThe summary body posted with the review should follow this structure:\n\n```\n## Code Review Summary\n\n**PR**: #\u003Cnumber> — \u003Ctitle>\n**Branch**: \u003CheadRefName> → \u003CbaseRefName>\n**Files reviewed**: \u003Ccount>\n\n### Findings\n\n- ? **Critical**: \u003Ccount>\n- ? **Important**: \u003Ccount>\n- ? **Suggestion**: \u003Ccount>\n\n### Overview\n\n\u003C2-3 sentences on what the PR does and the overall approach>\n\n### Key Observations\n\n\u003CBullet points covering the most important findings>\n\n### What Looks Good\n\n\u003CBullet points on well-written parts of the PR>\n```\n\n### 4.5 Inline comment format\n\nEach inline comment uses this format:\n\n```\n**[? Critical | ? Important | ? Suggestion]** — \u003Cdescription>\n\n\u003Csuggested fix or code example, if applicable>\n```\n\nUse code examples only when they make the fix materially clearer. Prefer short comments when the issue is obvious.\n\n### 4.6 No findings\n\nIf the review finds no issues, still post a summary review acknowledging the PR looks good. Skip the inline comments — post only the summary with a note that no issues were found.\n\n---\n\n## Phase 5: Summary\n\n**If mode is `github`:**\n\n- Link to the PR\n- How many inline comments were posted, broken down by severity (?\u002F?\u002F?)\n- Inform that the review was created as **PENDING** — the user must go to the GitHub web interface to review the comments and click **\"Submit review\"** to publish\n\n**If mode is `local`:**\n\n- How many findings were identified, broken down by severity (?\u002F?\u002F?)\n- The full review was already displayed in the chat during Phase 4\n\n---\n\n## Phase 6: Resolve Review Comments\n\n### When to use\n\nRun this phase when the user asks to fix open review comments on a PR. This handles fetching comments, applying fixes, running tests, and replying on GitHub.\n\n### 6.1 Fetch open comments\n\n```bash\ngh api repos\u002F{owner}\u002F{repo}\u002Fpulls\u002F\u003Cnumber>\u002Fcomments \\\n  --jq '.[] | {id: .id, path: .path, body: .body, position: .position, line: .line}'\n```\n\nRead every comment body carefully before touching any file.\n\n### 6.2 Apply the fixes\n\nFor each comment, make the necessary code change. Group related fixes logically (same file or same concern) so they can be committed together.\n\n### 6.3 Run tests before pushing\n\n**NEVER push or mark a comment as resolved before running the test suite.**\n\n```bash\nmake test\n```\n\nIf any test fails, fix it before proceeding. Only move to the next step when tests pass.\n\n### 6.4 Commit and push\n\nFollow the `git-commit` skill guidelines (Conventional Commits, group by context).\n\n```bash\ngit push\n```\n\n### 6.5 Ask the user for confirmation before submitting to GitHub\n\n**STOP here. Do NOT reply or resolve any comment yet.**\n\nPresent a summary of what was done for each comment, e.g.:\n\n> Todos os comentários foram resolvidos e os testes passando. Posso submeter as respostas e marcar os threads como resolvidos no GitHub?\n>\n> - ? `views\u002Fpartner.py` — validação de CNPJ duplicado adicionada\n> - ? `schemas\u002Fpartner.py` — campo `razao_social` renomeado para `company_name`\n> - ...\n\nWait for the user to explicitly confirm before proceeding to 6.6.\n\n### 6.6 Reply and resolve each comment\n\nAfter a successful push, for each comment that was addressed:\n\n**6.6a — Reply with a short message:**\n\n```bash\ngh api --method POST \\\n  repos\u002F{owner}\u002F{repo}\u002Fpulls\u002F\u003Cnumber>\u002Fcomments\u002F\u003Ccomment_id>\u002Freplies \\\n  --field body=\"Resolvido: \u003Cone-line description of the fix>\"\n```\n\n**6.6b — Mark the thread as resolved** (requires the GraphQL thread ID, not the comment ID):\n\nFirst, fetch all review thread IDs and match them by comment `databaseId`:\n\n```bash\ngh api graphql -f query='\n  query($owner:String!, $repo:String!, $pr:Int!) {\n    repository(owner:$owner, name:$repo) {\n      pullRequest(number:$pr) {\n        reviewThreads(first:50) {\n          nodes {\n            id\n            isResolved\n            comments(first:1) {\n              nodes { databaseId body }\n            }\n          }\n        }\n      }\n    }\n  }\n' -f owner={owner} -f repo={repo} -F pr=\u003Cnumber>\n```\n\nThen resolve each thread by its GraphQL `id`:\n\n```bash\ngh api graphql -f query='\n  mutation($threadId:ID!) {\n    resolveReviewThread(input:{threadId:$threadId}) {\n      thread { id isResolved }\n    }\n  }\n' -f threadId=\u003Cthread_id>\n```\n\n**Batch with a Python script to avoid repetition:**\n\n```python\npython3 \u003C\u003C 'PYEOF'\nimport subprocess, json\n\nOWNER = \"{owner}\"\nREPO  = \"{repo}\"\nPR    = \u003Cnumber>\n\n# Map comment databaseId → reply message\nresolutions = {\n    \u003Ccomment_id_1>: \"Resolvido: \u003Cdescrição do que foi feito>\",\n    \u003Ccomment_id_2>: \"Resolvido: \u003Cdescrição do que foi feito>\",\n}\n\n# Fetch all review threads\nresult = subprocess.run(\n    [\"gh\", \"api\", \"graphql\",\n     \"-f\", f\"query=query($owner:String!,$repo:String!,$pr:Int!){{repository(owner:$owner,name:$repo){{pullRequest(number:$pr){{reviewThreads(first:50){{nodes{{id isResolved comments(first:1){{nodes{{databaseId}}}}}}}}}}}}}}\",\n     \"-f\", f\"owner={OWNER}\", \"-f\", f\"repo={REPO}\", \"-F\", f\"pr={PR}\"],\n    capture_output=True, text=True\n)\ndata = json.loads(result.stdout)\nthreads = data[\"data\"][\"repository\"][\"pullRequest\"][\"reviewThreads\"][\"nodes\"]\n\nfor thread in threads:\n    if thread[\"isResolved\"]:\n        continue\n    comment_id = thread[\"comments\"][\"nodes\"][0][\"databaseId\"]\n    thread_id  = thread[\"id\"]\n\n    if comment_id not in resolutions:\n        continue\n\n    # Reply\n    subprocess.run(\n        [\"gh\", \"api\", \"--method\", \"POST\",\n         f\"repos\u002F{OWNER}\u002F{REPO}\u002Fpulls\u002F{PR}\u002Fcomments\u002F{comment_id}\u002Freplies\",\n         \"--field\", f\"body={resolutions[comment_id]}\"],\n        capture_output=True\n    )\n\n    # Resolve\n    subprocess.run(\n        [\"gh\", \"api\", \"graphql\",\n         \"-f\", f\"query=mutation($t:ID!){{resolveReviewThread(input:{{threadId:$t}}){{thread{{id isResolved}}}}}}\",\n         \"-f\", f\"t={thread_id}\"],\n        capture_output=True\n    )\n    print(f\"✓ comment {comment_id} replied and resolved\")\nPYEOF\n```\n\nDo not reply or resolve before the push succeeds.\n\n---\n\n## Edge Cases\n\n### Large PRs\n\nFor PRs with more than 30 changed files, warn the user and offer to focus on specific directories or file patterns:\n\n```yaml\ntitle: \"Large PR\"\nquestions:\n  - id: scope\n    prompt: \"This PR has \u003CN> changed files. Review all of them or focus on specific areas?\"\n    options:\n      - id: all\n        label: \"Review all files\"\n      - id: focus\n        label: \"Let me specify which files or directories to focus on\"\n```\n\n### Binary and generated files\n\nSkip binary files, lock files (`package-lock.json`, `poetry.lock`, etc.), and auto-generated files. Mention skipped files in the summary.\n\n### Insufficient permissions\n\nIf GitHub API calls fail with 403\u002F404 (whether via MCP or `gh api`), tell the user they may lack write access to the repository and suggest reviewing locally (print findings to the chat instead of posting).\n\n---\n\n## Error Recovery\n\n**GitHub API returns 403\u002F404:**\n- Verify authentication (`gh auth status` or MCP `get_me`)\n- If permissions are insufficient, fall back to local-only mode (display review in chat)\n- If the PR does not exist, confirm the number with the user\n\n**Diff too large (>2000 lines or >50 files):**\n- Offer to scope the review to specific directories or file patterns\n- Prioritize source files over config, lock files, and generated files\n- Skip binary files and vendored dependencies without asking\n\n**Pending review already exists:**\n- Fetch existing pending reviews via `gh api repos\u002F{owner}\u002F{repo}\u002Fpulls\u002F\u003Cnumber>\u002Freviews`\n- Warn the user and ask whether to delete the stale review or add to it\n\n**Rate limit hit mid-review:**\n- Post what was collected so far as a partial review\n- Tell the user which files remain unreviewed\n- Suggest resuming later or switching to local-only mode\n\n**Comment targets a line not in the diff:**\n- Convert to a file-level comment by omitting the `line` field\n- Prepend the line reference to the comment body (e.g., \"Line 42: ...\")\n","> **MANAGED SKILL** — Do not edit this file here. It is managed from an external source repository.\n> To make changes, update the source and run \"update my skills\" to sync.\n\n\n# Code Review\n\nAnalyze a GitHub pull request, review each changed file for issues, and post inline comments plus a summary review directly on the PR.\n\nAlso run **Phase 6: Resolve Review Comments** when the user asks to address open PR review comments, e.g.:\n- \"leia os comentarios e resolva\"\n- \"resolve os comentarios do PR\"\n- \"fix the review comments\"\n\n---\n\n## Core Workflow\n\n1. Select the PR (user-provided or list open PRs)\n2. Fetch diff and file-level changes\n3. Read changed files for full context\n4. Analyze changes (severity: Critical \u002F Important \u002F Suggestion)\n5. Post review (local chat or pending on GitHub)\n6. Optionally resolve review comments in follow-up\n\n---\n\n## Reference Guide\n\n| Topic | Reference | Load When |\n|-------|-----------|-----------|\n| Pyramid \u002F Cornice \u002F SQLAlchemy \u002F Marshmallow | `pyramid-backend-rules.md` | PR contains Python files importing Pyramid, Cornice, SQLAlchemy, or Marshmallow |\n\n---\n\n## Constraints\n\n### MUST DO\n- Read the full file for context (not just the diff hunk) before commenting\n- Post all comments atomically as a single review (never individual comments)\n- Include severity prefix on every inline comment\n- Respond in Portuguese\n\n### MUST NOT DO\n- Auto-submit the review (must remain PENDING for user to confirm)\n- Comment on formatting\u002Fstyle that a linter handles\n- Invent issues to fill space when code is correct\n- Post inline comments on lines not visible in the diff (use file-level comment instead)\n\n---\n\n## GitHub API Access\n\nBefore performing any GitHub operations, determine which access method is available:\n\n1. **GitHub MCP** (preferred): Check if a GitHub MCP server is configured by scanning the mcps folder for a server matching `github` or containing `github` in its name. If found, verify with a `get_me` call. Note the server name for all subsequent MCP calls.\n2. **gh CLI** (fallback): Run `gh auth status` to verify authentication.\n\nAlso resolve `owner` and `repo` from the git remote:\n\n```bash\ngit remote get-url origin\n```\n\nParse `owner\u002Frepo` from the URL. Store these values — GitHub MCP tools require them as explicit parameters on every call.\n\nUse the detected method consistently for all operations below. Each operation shows both methods: **MCP** first, then **CLI**.\n\n---\n\n## Phase 1: Select PR\n\n### 1.0 Review mode\n\nBefore anything else, ask the user what kind of review this is:\n\n```yaml\ntitle: \"Review Mode\"\nquestions:\n  - id: mode\n    prompt: \"Is this review local-only or should it be submitted to GitHub?\"\n    options:\n      - id: local\n        label: \"Local only — show the review here in the chat\"\n      - id: github\n        label: \"Submit to GitHub — create as a pending review for me to confirm in the web UI\"\n```\n\nStore the selected mode. It affects Phase 4:\n\n- **local**: perform the full analysis (Phases 2-3) but do NOT post anything to GitHub. Display the complete review (summary + inline comments) directly in the chat.\n- **github**: perform the full analysis (Phases 2-3) and post the review as a **PENDING** review on GitHub. The user will review and submit it from the web interface.\n\n### 1.1 Determine the PR\n\nIf the user provided a PR number or URL, extract the number and skip to 1.2.\n\nOtherwise, list recent open PRs:\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=list_pull_requests\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"state\": \"open\", \"perPage\": 15 }\n```\n\n**Via CLI:**\n\n```bash\ngh pr list --limit 15 --json number,title,author,headRefName --template '{{range .}}#{{.number}} {{.title}} ({{.author.login}}, {{.headRefName}}){{\"\\n\"}}{{end}}'\n```\n\nUse `AskQuestion` to let the user pick:\n\n```yaml\ntitle: \"Select PR\"\nquestions:\n  - id: pr\n    prompt: \"Which pull request should I review?\"\n    options:\n      # one option per PR from the list\n      - id: \"\u003Cnumber>\"\n        label: \"#\u003Cnumber> — \u003Ctitle> (\u003Cauthor>)\"\n```\n\n### 1.2 Fetch PR metadata\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=pull_request_read\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"method\": \"get\" }\n```\n\n**Via CLI:**\n\n```bash\ngh pr view \u003Cnumber> --json number,title,body,headRefName,baseRefName,headRefOid,url,additions,deletions,changedFiles\n```\n\nStore the metadata — `headRefOid`, `headRefName`, `baseRefName`, `url`, and `number` are used in later phases.\n\nTell the user which PR you're reviewing: number, title, branch, and size (additions\u002Fdeletions\u002Ffiles changed).\n\n---\n\n## Phase 2: Fetch Context\n\n### 2.1 Get the diff\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=pull_request_read\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"method\": \"get_diff\" }\n```\n\n**Via CLI:**\n\n```bash\ngh pr diff \u003Cnumber>\n```\n\n### 2.2 Get file-level change details\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=pull_request_read\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"method\": \"get_files\", \"perPage\": 100 }\n```\n\n**Via CLI:**\n\n```bash\ngh api repos\u002F{owner}\u002F{repo}\u002Fpulls\u002F\u003Cnumber>\u002Ffiles --paginate\n```\n\nThis returns JSON with `filename`, `status`, `patch`, `additions`, `deletions`, and `changes` for each file.\n\nIf using CLI and you need to determine `{owner}\u002F{repo}`, extract it from the PR URL or from:\n\n```bash\ngh repo view --json nameWithOwner -q .nameWithOwner\n```\n\n### 2.3 Read changed files for context\n\nFor each changed file (that is not deleted), read the full file from the PR's head branch so you can understand the surrounding code — not just the diff hunks:\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=get_file_contents\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"path\": \"\u003Cfilepath>\", \"ref\": \"\u003CheadRefName>\" }\n```\n\n**Via CLI:**\n\n```bash\ngh api repos\u002F{owner}\u002F{repo}\u002Fcontents\u002F\u003Cfilepath>?ref=\u003CheadRefName> --jq '.content' | base64 -d\n```\n\nFor large PRs (more than 20 changed files), prioritize:\n1. Files with the most additions\u002Fchanges\n2. Source code files over config, lock files, or generated files\n3. Skip binary files, vendored dependencies, and auto-generated files\n\n---\n\n## Phase 3: Analyze Changes\n\n### Review philosophy\n\nYou are an experienced reviewer. Review in a direct, objective, pragmatic style:\n- Prioritize business rules and correctness\n- Avoid premature abstractions\n- Prefer simple, readable code over clever code\n- Flag architecture violations only when they are real\n\n### Language\n\nAlways respond in Portuguese.\n\n### Tone\n\n- Direct, no hedging.\n- Identify the problem → explain why it's a problem → suggest the fix.\n- No unnecessary praise (\"great work, but...\").\n- No artificially softened language (\"you might want to consider maybe...\").\n- No final summary in inline comments.\n\n### Severity levels\n\nRecord findings using three severity levels:\n\n#### ? Critical — blocks merge\n\n- **Logic bugs**: unhandled edge cases, incorrect conditions, unexpected behavior in critical flows.\n- **Bug fix without regression test**: if the PR fixes a bug but does not include a test that would have caught the bug before the fix, it must be blocked. Every bug fix needs a test that fails without the fix and passes with it.\n- **New code without tests**: any new view, service, or business logic being added without corresponding test coverage must be blocked. Code that ships untested is a liability — if it's worth writing, it's worth testing.\n- **Commented-out test**: a test function or block that is commented out must never be merged. Either fix the test or delete it — commented tests give false confidence that coverage exists when it doesn't.\n- **Cross-module database access**: a module must never query or write to another module's tables directly. E.g., `financing` importing models or querying tables from `charge` is a hard boundary violation. Modules communicate through APIs or explicit contracts, never by reaching into each other's database schema.\n- **Critical anti-patterns**: God class, feature envy, hidden side effects. Train wreck calls (`a.b().c().d()`) are Critical only when they obscure a critical flow or increase coupling — otherwise flag as Important.\n- **Security**: injection vulnerabilities (SQL, command, template), secrets or credentials committed in code, unsafe deserialization, path traversal, SSRF.\n\n#### ? Important — should be fixed\n\n- **Premature abstractions**: code made too generic before there's a real need. Prefer concrete and simple. Don't create base classes, mixins, or factories without at least 2–3 real use cases.\n- **Scattered business rules**: the same business decision appears duplicated across views, schemas, or services instead of being centralized.\n- **Codebase pattern violation**: if the project has an established pattern (services, repositories, views), code that diverges from it without clear justification should be flagged. Do not defend an existing pattern just because it exists — if the existing pattern is clearly harmful, flag the objective problem instead of the deviation itself.\n- **Missing tests on critical changes**: business logic or integration flows without test coverage.\n- **Low-quality tests**: happy path only, no edge cases; assertions that don't verify real behavior; tests fragile because they're coupled to implementation; excessive mocking that hides the real behavior being tested.\n- **Flaky \u002F intermittent test risk**: watch closely for tests that depend on timing (`sleep`, `time.time()`), ordering of unordered collections (sets, dict keys), hardcoded future dates without time freezing, shared mutable state between tests, or external service calls without mocking. These pass locally but fail randomly in CI. Flag them as Important with a concrete explanation of the flakiness vector.\n- **Complex logic inside tests**: tests must be dumb and linear — Arrange, Act, Assert. If a test contains `if\u002Felse`, `for`, `while`, `try\u002Fexcept`, or any branching logic, it's wrong. A test with control flow can silently skip the assertion or test different things on different runs. Split into separate test cases instead.\n- **Unnecessary complexity \u002F AI-generated code smell**: code harder to read than it needs to be. Flag when you see:\n  - Functions or classes that do too many things at once\n  - Deeply nested logic (more than 2–3 levels) that could be flattened with early returns or extracted functions\n  - Over-engineered solutions for simple problems (factory, strategy pattern, or abstract base class for something that could be a plain function)\n  - Unnecessary abstractions or indirection that force the reader to jump between files\u002Fclasses to understand a simple flow\n  - Verbose variable names that add noise instead of clarity (e.g., `user_object_instance`, `process_data_result_value`)\n  - Long functions (> ~30 lines) that mix concerns and are hard to scan\n  - Code that \"looks smart\" but is hard to maintain — clever one-liners, excessive list comprehensions with side effects, chained calls that obscure intent\n- **Error handling**: exceptions caught and silently swallowed, missing error propagation, unhelpful error messages that hide the root cause.\n\n#### ? Suggestion — optional, but relevant\n\nDo not request cosmetic refactors with low practical value. Only suggest naming, structure, or style changes when they improve correctness, readability, or maintainability in a meaningful way.\n\n- Weak naming: variables, functions, or classes that don't communicate intent.\n- Minor simplifications that improve readability without changing behavior.\n- Logic duplication that already exists elsewhere in the codebase.\n- DRY violations — duplicated logic that should be extracted.\n- Language-specific idiom violations.\n\n---\n\n### What to look for (general)\n\nReview each modified snippet **inline** — one comment per relevant snippet. If a snippet has nothing worth commenting on, skip it.\n\n**Only comment when there is a concrete problem, real risk, or clear simplification with material value. Do not invent issues to fill space.**\n\n**Bugs and logic errors**\n- Incorrect conditions, off-by-one errors, wrong variable used\n- Race conditions, missing synchronization\n- Null\u002Fundefined access without guards\n\n**Readability and maintainability**\n- Unclear naming that requires reading the implementation to understand intent\n- Overly complex logic that could be simplified\n- Dead code, commented-out code left behind\n- Missing context where a brief comment would prevent future confusion\n\n**Best practices**\n- Incorrect or missing type annotations (in typed languages)\n- Test coverage gaps for non-trivial logic\n\n---\n\n### Backend-specific rules (Pyramid \u002F Cornice \u002F SQLAlchemy)\n\nLoad `pyramid-backend-rules.md` when reviewing Python backend files that import Pyramid, Cornice, SQLAlchemy, or Marshmallow. Apply those rules in addition to the general rules above.\n\n---\n\n### Project pattern detection\n\nBefore criticizing architecture, read the established pattern in the codebase.\nFlag a deviation **only when**:\n1. The code clearly diverges from the existing project pattern, **OR**\n2. The anti-pattern is objectively bad regardless of context.\n\nDo not impose an architectural pattern that doesn't exist in the project.\nDo not defend an existing pattern just because it exists — if it's clearly harmful, flag the objective problem directly.\n\n---\n\n### Readability & complexity standard\n\nThe bar is: **a mid-level dev should be able to read and understand any function in under 30 seconds without asking questions.**\n\nIf that bar isn't met, it's worth flagging — regardless of whether the code is \"technically correct\". AI-generated code often passes correctness checks but fails this bar by introducing unnecessary layers, verbose boilerplate, or patterns that don't match the problem's actual complexity.\n\nWhen the fix is clear, show a simpler version with code.\nWhen the fix depends on project context, explain the direction of the change without inventing details.\n\n---\n\n### Test evaluation\n\nDon't just check whether a test exists. Evaluate:\n- Do the tests cover relevant edge cases beyond the happy path?\n- Do assertions verify real behavior, or just that the code ran without an exception?\n- Is the test coupled to implementation instead of behavior (fragile)?\n- Is there excessive mocking that hides the real behavior being tested?\n\n---\n\n### Guidelines\n\n- Be specific — reference the exact line and explain *why* something is a problem, not just *what* it is.\n- Suggest a fix when possible — use code examples only when they make the fix materially clearer.\n- Avoid nitpicking formatting or style that a linter\u002Fformatter should handle.\n- Acknowledge good patterns — note well-written code in the summary, not as inline noise.\n- If a file looks correct and well-written, do not force comments on it.\n\n---\n\n## Phase 4: Post Review\n\n**If the review mode is `local`**, skip all GitHub API calls. Instead, display the full review directly in the chat using the same format as 4.4 (summary) and 4.5 (inline comments), organized by file. Then skip to Phase 5.\n\n**If the review mode is `github`**, continue with 4.1 below.\n\n### 4.1 Build the review payload\n\nConstruct the review using the GitHub Pull Request Reviews API. This posts all inline comments atomically as a single **PENDING** review — the user will review and submit it from the GitHub web interface.\n\nThe `owner` and `repo` were resolved in the GitHub API Access section. Get the latest commit SHA:\n\n**Via MCP:**\n\n```\nCallMcpTool: server=github, toolName=pull_request_read\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"method\": \"get\" }\n```\n\nExtract `headRefOid` from the response.\n\n**Via CLI:**\n\n```bash\ngh pr view \u003Cnumber> --json headRefOid -q .headRefOid\n```\n\n### 4.2 Map line numbers to diff positions\n\nThe GitHub API requires diff positions (not file line numbers) for inline comments. For each comment, calculate the position within the file's diff patch.\n\nParse the `patch` field from the file data retrieved in Phase 2.2. The position is the 1-based line index within the patch (counting from the first `@@` line, which is position 1). Only lines visible in the diff can receive comments.\n\nIf a comment targets a line not present in the diff, convert it to a file-level comment by omitting the `line` field and prepending the line reference to the comment body.\n\n### 4.3 Post the review as PENDING\n\nThe review is created as **PENDING** — it is only visible to the author until they submit it from the GitHub web interface. Do NOT submit the review automatically.\n\n**Via MCP:**\n\nCreate the pending review (omit `event` to keep it pending):\n\n```\nCallMcpTool: server=github, toolName=pull_request_review_write\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"method\": \"create\", \"body\": \"\u003Csummary>\", \"commitID\": \"\u003CheadRefOid>\" }\n```\n\nThen add each inline comment to the pending review:\n\n```\nCallMcpTool: server=github, toolName=add_comment_to_pending_review\narguments: { \"owner\": \"\u003Cowner>\", \"repo\": \"\u003Crepo>\", \"pullNumber\": \u003Cnumber>, \"path\": \"app\u002Fviews\u002Fpartner.py\", \"line\": 42, \"side\": \"RIGHT\", \"subjectType\": \"line\", \"body\": \"**[? Critical]** Description of the issue.\\n\\nSuggested fix.\" }\n```\n\nDo NOT call `submit` — the review stays pending for the user to review and submit manually.\n\n**Via CLI:**\n\nOmit the `event` field so the review is created as PENDING:\n\n```bash\ngh api repos\u002F{owner}\u002F{repo}\u002Fpulls\u002F\u003Cnumber>\u002Freviews \\\n  --method POST \\\n  -f body=\"\u003Csummary>\" \\\n  -f commit_id=\"\u003CheadRefOid>\" \\\n  --input \u003Cjson-file>\n```\n\nWhere `\u003Cjson-file>` contains the comments array:\n\n```json\n{\n  \"body\": \"\u003Csummary text>\",\n  \"commit_id\": \"\u003Csha>\",\n  \"comments\": [\n    {\n      \"path\": \"app\u002Fviews\u002Fpartner.py\",\n      \"line\": 42,\n      \"side\": \"RIGHT\",\n      \"body\": \"**[? Critical]** Description of the issue.\\n\\nSuggested fix.\"\n    }\n  ]\n}\n```\n\n### 4.4 Summary review format\n\nThe summary body posted with the review should follow this structure:\n\n```\n## Code Review Summary\n\n**PR**: #\u003Cnumber> — \u003Ctitle>\n**Branch**: \u003CheadRefName> → \u003CbaseRefName>\n**Files reviewed**: \u003Ccount>\n\n### Findings\n\n- ? **Critical**: \u003Ccount>\n- ? **Important**: \u003Ccount>\n- ? **Suggestion**: \u003Ccount>\n\n### Overview\n\n\u003C2-3 sentences on what the PR does and the overall approach>\n\n### Key Observations\n\n\u003CBullet points covering the most important findings>\n\n### What Looks Good\n\n\u003CBullet points on well-written parts of the PR>\n```\n\n### 4.5 Inline comment format\n\nEach inline comment uses this format:\n\n```\n**[? Critical | ? Important | ? Suggestion]** — \u003Cdescription>\n\n\u003Csuggested fix or code example, if applicable>\n```\n\nUse code examples only when they make the fix materially clearer. Prefer short comments when the issue is obvious.\n\n### 4.6 No findings\n\nIf the review finds no issues, still post a summary review acknowledging the PR looks good. Skip the inline comments — post only the summary with a note that no issues were found.\n\n---\n\n## Phase 5: Summary\n\n**If mode is `github`:**\n\n- Link to the PR\n- How many inline comments were posted, broken down by severity (?\u002F?\u002F?)\n- Inform that the review was created as **PENDING** — the user must go to the GitHub web interface to review the comments and click **\"Submit review\"** to publish\n\n**If mode is `local`:**\n\n- How many findings were identified, broken down by severity (?\u002F?\u002F?)\n- The full review was already displayed in the chat during Phase 4\n\n---\n\n## Phase 6: Resolve Review Comments\n\n### When to use\n\nRun this phase when the user asks to fix open review comments on a PR. This handles fetching comments, applying fixes, running tests, and replying on GitHub.\n\n### 6.1 Fetch open comments\n\n```bash\ngh api repos\u002F{owner}\u002F{repo}\u002Fpulls\u002F\u003Cnumber>\u002Fcomments \\\n  --jq '.[] | {id: .id, path: .path, body: .body, position: .position, line: .line}'\n```\n\nRead every comment body carefully before touching any file.\n\n### 6.2 Apply the fixes\n\nFor each comment, make the necessary code change. Group related fixes logically (same file or same concern) so they can be committed together.\n\n### 6.3 Run tests before pushing\n\n**NEVER push or mark a comment as resolved before running the test suite.**\n\n```bash\nmake test\n```\n\nIf any test fails, fix it before proceeding. Only move to the next step when tests pass.\n\n### 6.4 Commit and push\n\nFollow the `git-commit` skill guidelines (Conventional Commits, group by context).\n\n```bash\ngit push\n```\n\n### 6.5 Ask the user for confirmation before submitting to GitHub\n\n**STOP here. Do NOT reply or resolve any comment yet.**\n\nPresent a summary of what was done for each comment, e.g.:\n\n> Todos os comentários foram resolvidos e os testes passando. Posso submeter as respostas e marcar os threads como resolvidos no GitHub?\n>\n> - ? `views\u002Fpartner.py` — validação de CNPJ duplicado adicionada\n> - ? `schemas\u002Fpartner.py` — campo `razao_social` renomeado para `company_name`\n> - ...\n\nWait for the user to explicitly confirm before proceeding to 6.6.\n\n### 6.6 Reply and resolve each comment\n\nAfter a successful push, for each comment that was addressed:\n\n**6.6a — Reply with a short message:**\n\n```bash\ngh api --method POST \\\n  repos\u002F{owner}\u002F{repo}\u002Fpulls\u002F\u003Cnumber>\u002Fcomments\u002F\u003Ccomment_id>\u002Freplies \\\n  --field body=\"Resolvido: \u003Cone-line description of the fix>\"\n```\n\n**6.6b — Mark the thread as resolved** (requires the GraphQL thread ID, not the comment ID):\n\nFirst, fetch all review thread IDs and match them by comment `databaseId`:\n\n```bash\ngh api graphql -f query='\n  query($owner:String!, $repo:String!, $pr:Int!) {\n    repository(owner:$owner, name:$repo) {\n      pullRequest(number:$pr) {\n        reviewThreads(first:50) {\n          nodes {\n            id\n            isResolved\n            comments(first:1) {\n              nodes { databaseId body }\n            }\n          }\n        }\n      }\n    }\n  }\n' -f owner={owner} -f repo={repo} -F pr=\u003Cnumber>\n```\n\nThen resolve each thread by its GraphQL `id`:\n\n```bash\ngh api graphql -f query='\n  mutation($threadId:ID!) {\n    resolveReviewThread(input:{threadId:$threadId}) {\n      thread { id isResolved }\n    }\n  }\n' -f threadId=\u003Cthread_id>\n```\n\n**Batch with a Python script to avoid repetition:**\n\n```python\npython3 \u003C\u003C 'PYEOF'\nimport subprocess, json\n\nOWNER = \"{owner}\"\nREPO  = \"{repo}\"\nPR    = \u003Cnumber>\n\n# Map comment databaseId → reply message\nresolutions = {\n    \u003Ccomment_id_1>: \"Resolvido: \u003Cdescrição do que foi feito>\",\n    \u003Ccomment_id_2>: \"Resolvido: \u003Cdescrição do que foi feito>\",\n}\n\n# Fetch all review threads\nresult = subprocess.run(\n    [\"gh\", \"api\", \"graphql\",\n     \"-f\", f\"query=query($owner:String!,$repo:String!,$pr:Int!){{repository(owner:$owner,name:$repo){{pullRequest(number:$pr){{reviewThreads(first:50){{nodes{{id isResolved comments(first:1){{nodes{{databaseId}}}}}}}}}}}}}}\",\n     \"-f\", f\"owner={OWNER}\", \"-f\", f\"repo={REPO}\", \"-F\", f\"pr={PR}\"],\n    capture_output=True, text=True\n)\ndata = json.loads(result.stdout)\nthreads = data[\"data\"][\"repository\"][\"pullRequest\"][\"reviewThreads\"][\"nodes\"]\n\nfor thread in threads:\n    if thread[\"isResolved\"]:\n        continue\n    comment_id = thread[\"comments\"][\"nodes\"][0][\"databaseId\"]\n    thread_id  = thread[\"id\"]\n\n    if comment_id not in resolutions:\n        continue\n\n    # Reply\n    subprocess.run(\n        [\"gh\", \"api\", \"--method\", \"POST\",\n         f\"repos\u002F{OWNER}\u002F{REPO}\u002Fpulls\u002F{PR}\u002Fcomments\u002F{comment_id}\u002Freplies\",\n         \"--field\", f\"body={resolutions[comment_id]}\"],\n        capture_output=True\n    )\n\n    # Resolve\n    subprocess.run(\n        [\"gh\", \"api\", \"graphql\",\n         \"-f\", f\"query=mutation($t:ID!){{resolveReviewThread(input:{{threadId:$t}}){{thread{{id isResolved}}}}}}\",\n         \"-f\", f\"t={thread_id}\"],\n        capture_output=True\n    )\n    print(f\"✓ comment {comment_id} replied and resolved\")\nPYEOF\n```\n\nDo not reply or resolve before the push succeeds.\n\n---\n\n## Edge Cases\n\n### Large PRs\n\nFor PRs with more than 30 changed files, warn the user and offer to focus on specific directories or file patterns:\n\n```yaml\ntitle: \"Large PR\"\nquestions:\n  - id: scope\n    prompt: \"This PR has \u003CN> changed files. Review all of them or focus on specific areas?\"\n    options:\n      - id: all\n        label: \"Review all files\"\n      - id: focus\n        label: \"Let me specify which files or directories to focus on\"\n```\n\n### Binary and generated files\n\nSkip binary files, lock files (`package-lock.json`, `poetry.lock`, etc.), and auto-generated files. Mention skipped files in the summary.\n\n### Insufficient permissions\n\nIf GitHub API calls fail with 403\u002F404 (whether via MCP or `gh api`), tell the user they may lack write access to the repository and suggest reviewing locally (print findings to the chat instead of posting).\n\n---\n\n## Error Recovery\n\n**GitHub API returns 403\u002F404:**\n- Verify authentication (`gh auth status` or MCP `get_me`)\n- If permissions are insufficient, fall back to local-only mode (display review in chat)\n- If the PR does not exist, confirm the number with the user\n\n**Diff too large (>2000 lines or >50 files):**\n- Offer to scope the review to specific directories or file patterns\n- Prioritize source files over config, lock files, and generated files\n- Skip binary files and vendored dependencies without asking\n\n**Pending review already exists:**\n- Fetch existing pending reviews via `gh api repos\u002F{owner}\u002F{repo}\u002Fpulls\u002F\u003Cnumber>\u002Freviews`\n- Warn the user and ask whether to delete the stale review or add to it\n\n**Rate limit hit mid-review:**\n- Post what was collected so far as a partial review\n- Tell the user which files remain unreviewed\n- Suggest resuming later or switching to local-only mode\n\n**Comment targets a line not in the diff:**\n- Convert to a file-level comment by omitting the `line` field\n- Prepend the line reference to the comment body (e.g., \"Line 42: ...\")\n",{"name":5,"description":7},"main","ea5172c58cf8fe53f20b59482e62cc45741da12d",".cursor\u002Fskills\u002Fcode-review","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal","https:\u002F\u002Fgithub.com\u002Fcartaorobbin","2026-10-24 04:09:32",{"source":8,"skillName":5,"commands":62,"prompt":72,"zipAvailable":73},[63,66,69],{"tool":64,"command":65},"npx","npx skills add cartaorobbin\u002Fpyramid-temporal --skill code-review",{"tool":67,"command":68},"bunx","bunx skills add cartaorobbin\u002Fpyramid-temporal --skill code-review",{"tool":70,"command":71},"pnpm","pnpm dlx skills add cartaorobbin\u002Fpyramid-temporal --skill code-review","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fcode-review\u002FSKILL.md",true,[75,81],{"path":76,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":79,"sourceHtmlUrl":80},".managed-skill.md","REFERENCE","参考文档",231,"https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fcode-review\u002F.managed-skill.md",{"path":82,"resourceType":77,"resourceTypeDesc":78,"sizeBytes":83,"sourceHtmlUrl":84},"pyramid-backend-rules.md",5425,"https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fcode-review\u002Fpyramid-backend-rules.md",[86,108,122,142,153,167],{"skillNo":87,"name":88,"nameZh":6,"description":89,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":90,"categories":91,"keywords":98,"publishedAt":50},"01M6C1TXVJXMQ0VWWGMHD7PKG9","write-pytest","Write pytest tests for any Python codebase. Use when the user asks to write tests, create tests, add tests, or test a module\u002Fservice\u002Fendpoint\u002Ffunction. Framework-agnostic; routes to framework-specific helpers when signals are detected. Follows a research-then-discuss-then-write flow.","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fwrite-pytest\u002FSKILL.md",[92,95],{"categoryNo":93,"categoryName":94,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":96,"categoryName":97,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000021","资料检索与研究",[99,100,101,48,47,102,36,103,104,105,106,107],"write","write pytest","research","write tests","test","endpoint","flow","framework","create",{"skillNo":109,"name":110,"nameZh":6,"description":111,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":115,"publishedAt":50},"01M6C1TTVR96XWX68FQY37S2QZ","quality-assurance","Run quality assurance checks on the current chat session — pre-task validation, post-task checklist, and code review. Use when finishing a task, before committing, or when the user asks for a QA review.","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fquality-assurance\u002FSKILL.md",[114],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[116,117,118,34,32,33,119,120,47,121,48],"quality","quality assurance","run","validation","qa","session",{"skillNo":123,"name":124,"nameZh":6,"description":125,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":126,"categories":127,"keywords":129,"publishedAt":50},"01M6C1TR2SWA481C00S2VQ12DW","python-developer","Python developer umbrella — installs Python coding conventions and bundles companion skills (best practices, testing, dependency management) in a single setup. Use when the user asks to set up Python development conventions, install Python skills, or says \"set up Python development\".","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fpython-developer\u002FSKILL.md",[128],{"categoryNo":27,"categoryName":28,"taxonomyType":29,"taxonomyTypeDesc":30},[130,36,131,132,133,134,47,135,136,48,137,138,139,140,141],"developer","python developer","SET","coding","management","dependency management","install","python development","best practices","testing","setup","development",{"skillNo":143,"name":144,"nameZh":6,"description":145,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":146,"categories":147,"keywords":148,"publishedAt":50},"01M6C1TNAANT8RS9XKB2F3JF3E","python-best-practices","Comprehensive Python coding conventions and best practices. Use when the user asks about Python conventions, coding patterns, best practices, code style, anti-patterns, or \"how should I write this\" in Python.","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fpython-best-practices\u002FSKILL.md",[],[149,138,36,150,33,151,133,99,47,48,152],"python best practices","code style","how","anti-patterns",{"skillNo":154,"name":155,"nameZh":6,"description":156,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":157,"categories":158,"keywords":160,"publishedAt":50},"01M6C1TJEMGMNGNVE4DKWF4TNA","pyramid-library","Library Developer persona: developing standalone Pyramid extensions (own repo, own package) that expose includeme for external consumers. Use when the user builds a reusable Pyramid library, designs includeme for consumers, registers custom directives\u002Ftweens\u002Frequest methods, or tests a library with a proper app.","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fpyramid-library\u002FSKILL.md",[159],{"categoryNo":27,"categoryName":28,"taxonomyType":29,"taxonomyTypeDesc":30},[161,162,163,164,165,130,166,47,48],"pyramid library","library","repo","core","package","persona",{"skillNo":168,"name":169,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":174,"publishedAt":50},"01M6C1TFT8Z6MCBEAQ7S24XQ77","pyramid-developer","Pyramid framework conventions — configuration\u002Fregistry, module system with includeme, pyramid_services, models, Cornice REST, ACL authorization, and transactions. Use when setting up Pyramid development conventions for a project.","https:\u002F\u002Fgithub.com\u002Fcartaorobbin\u002Fpyramid-temporal\u002Fblob\u002Fmain\u002F.cursor\u002Fskills\u002Fpyramid-developer\u002FSKILL.md",[173],{"categoryNo":27,"categoryName":28,"taxonomyType":29,"taxonomyTypeDesc":30},[175,130,141,176,106,177,178,179,180,181,182,48,183,36],"pyramid developer","registry","services","ACL","REST","authorization","transactions","system","micromonolith"]