Agent Skills › netalertx/NetAlertX › netalertx-pr-analysis

netalertx-pr-analysis

GitHub

指导 Agent 分析并响应 GitHub PR 审查评论。涵盖代码风格、测试规范及评论分类处理流程,强调根据反馈更新或创建 Skill,确保代码变更符合标准。

.github/skills/pr-analysis/SKILL.md netalertx/NetAlertX

Trigger Scenarios

需要处理 GitHub PR 审查意见 收到关于代码的评论或建议 需要决定如何回复 PR 线程中的问题

Install

npx skills add netalertx/NetAlertX --skill netalertx-pr-analysis -g -y
More Options

Non-standard path

npx skills add https://github.com/netalertx/NetAlertX/tree/main/.github/skills/pr-analysis -g -y

Use without installing

npx skills use netalertx/NetAlertX@netalertx-pr-analysis

指定 Agent (Claude Code)

npx skills add netalertx/NetAlertX --skill netalertx-pr-analysis -a claude-code -g -y

安装 repo 全部 skill

npx skills add netalertx/NetAlertX --all -g -y

预览 repo 内 skill

npx skills add netalertx/NetAlertX --list

SKILL.md

Frontmatter
{
    "name": "netalertx-pr-analysis",
    "description": "How to analyze and respond to GitHub PR review comments in NetAlertX. Use this whenever you are addressing PR feedback, review threads, or inline code comments."
}

PR Analysis

Standing Rule: A Repeated Comment Becomes a Skill Update

If a review comment corrects something a skill should already cover, don't just fix that one instance — update the relevant skill as part of addressing the comment, same PR, same turn. If no skill covers it yet, that's the signal to create one. Check the skill first, though — sometimes it already covers the point and just wasn't consulted; the fix is in applying it, not in the skill being incomplete.

Code Style

  • Prefer explicit, readable logic over compact-but-opaque expressions. When a built-in/clever expression (e.g. a max()-based one-liner) saves a line or two but a reader has to reverse-engineer why it produces the right answer, write it out as plain conditional logic instead.

Before Writing Any Test Code — Non-Negotiable Checklist

Run through this before creating or editing any file under test/:

  1. Helpers first: Check test/db_test_helpers.py for existing factories (make_db, make_device_dict, insert_device_from_dict, DummyDB). Use them. If what you need doesn't exist, add it there — never define it locally in the test file.
  2. MAC literals must be lowercase: Every MAC string in fixtures, parametrize, assertions, docstrings, and comments must be lowercase hex (e.g. aa:bb:cc:dd:ee:01). No exceptions.
  3. Test file location: Place new tests under a subdirectory of test/ that mirrors the source path (e.g. test/scan/ for server/scan/). Don't add new files directly in test/ root - a handful of existing ones there (e.g. test_plugin_helper.py, test_wol_validation.py) predate this convention; that's not license to add more, but don't migrate them unprompted either.
  4. No inline imports: All imports at the top of the file.

Before Acting on Any PR Comment

  1. Load code-standards skill — all code changes must comply with it before replying.
  2. Load testing-workflow skill — any test additions or changes must follow it.
  3. Load any domain-specific skill relevant to the files being changed (e.g. database-patterns for DB writes, settings-management for config).

Comment Classification

For each comment, determine:

Type Action
Request for code change Make the change, validate it, then reply with the short commit hash
Question about code Reply with a concise answer (no restatement of the question)
Suggestion / feedback Decide if it is actionable. If yes, act and reply. If not, do not reply.
General / praise Do not reply.

Acting on Comments — Step by Step

  1. Identify all actionable comments before touching any file.
  2. Load relevant skills to understand conventions that apply.
  3. Prepare a plan — list each file and the exact change required.
  4. Make changes one comment at a time — keep commits focused.
  5. Run targeted tests after each change (testing-workflow skill).
  6. Reply only after the commit is pushed via report_progress. Include the short SHA.

Reply Guidelines

  • Be concise. Do not summarize or restate the original comment.
  • State what was done and (optionally) why.
  • Include the short commit hash when relevant.
  • Do not thank or compliment the reviewer.

What to Check After Every Batch of Changes

  • MAC literals lowercase — grep for uppercase hex in every changed test file: grep -Pn '[0-9A-F]{2}:[0-9A-F]' test/ must be empty.
  • No local DB helpers — no DummyDB, make_db, or inline DDL defined outside test/db_test_helpers.py.
  • No inline imports — all imports at the top of the file.
  • Tests live under a subdirectory of test/ matching the source path, not in test/ root.
  • Secret scan (runtime-tools-secret_scanning) before committing.

Stacked / Base-Branch Issues

When a PR targets a non-default branch (e.g. next_release):

  • Do not retarget the branch yourself; note it in a reply so the author can do it from the GitHub UI.
  • Check CI failures on the base branch first before checking your branch.

Version History

  • cd1d0ed Current 2026-09-22 11:08

    新增 'Standing Rule':若评论纠正了技能应覆盖的内容,需在同一 PR 中更新或创建相应技能;新增 'Code Style' 章节,强调逻辑可读性优于紧凑表达式。

  • a686a01 2026-09-03 06:47

    优化脚手架和健壮性

  • 716a41a 2026-08-27 19:51

Same Skill Collection

.claude/skills/database-patterns/SKILL.md
.claude/skills/git-workflow/SKILL.md
.claude/skills/install-scripts/SKILL.md
.claude/skills/plugin-development/SKILL.md
.claude/skills/plugin-readme/SKILL.md
.claude/skills/plugin-review/SKILL.md
.claude/skills/pr-analysis/SKILL.md
.claude/skills/prd-writing/SKILL.md
.claude/skills/scan-pipeline/SKILL.md
.claude/skills/skill-hygiene/SKILL.md
.claude/skills/testing-workflow/SKILL.md
.claude/skills/ux-design-patterns/SKILL.md
.gemini/skills/database-patterns/SKILL.md
.gemini/skills/devcontainer-management/SKILL.md
.gemini/skills/git-workflow/SKILL.md
.gemini/skills/install-scripts/SKILL.md
.gemini/skills/logging-standards/SKILL.md
.gemini/skills/mcp-activation/SKILL.md
.gemini/skills/plugin-review/SKILL.md
.gemini/skills/pr-analysis/SKILL.md
.gemini/skills/prd-writing/SKILL.md
.gemini/skills/project-navigation/SKILL.md
.gemini/skills/scan-pipeline/SKILL.md
.gemini/skills/settings/SKILL.md
.gemini/skills/skill-hygiene/SKILL.md
.gemini/skills/skills-index/SKILL.md
.gemini/skills/testing-workflow/SKILL.md
.gemini/skills/ux-design-patterns/SKILL.md
.github/skills/api-development/SKILL.md
.github/skills/authentication/SKILL.md
.github/skills/code-standards/SKILL.md
.github/skills/database-patterns/SKILL.md
.github/skills/database-reset/SKILL.md
.github/skills/devcontainer-configs/SKILL.md
.github/skills/devcontainer-services/SKILL.md
.github/skills/devcontainer-setup/SKILL.md
.github/skills/docker-build/SKILL.md
.github/skills/docker-prune/SKILL.md
.github/skills/git-workflow/SKILL.md
.github/skills/install-scripts/SKILL.md
.github/skills/logging-standards/SKILL.md
.github/skills/mcp-activation/SKILL.md
.github/skills/plugin-readme/SKILL.md
.github/skills/plugin-review/SKILL.md
.github/skills/plugin-run-development/SKILL.md
.github/skills/prd-writing/SKILL.md
.github/skills/project-navigation/SKILL.md
.github/skills/sample-data/SKILL.md
.github/skills/scan-pipeline/SKILL.md

Metadata

Files
0
Version
f6010e0
Hash
d2edbc6d
Indexed
2026-08-27 19:51

Home - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-09-30 04:24
浙ICP备14020137号-1