Communitygithub.com

预提交自审清单

在提交重大代码变更前运行的结构化自审清单。涵盖边界情况、错误路径、测试覆盖、文档和代码质量——让 CI 成为最后手段,而非你的第一审查者。

预提交自审清单 是什么?

此技能提供一个结构化的自审清单,在提交重要的代码变更之前运行,帮助开发者和 AI 代理(如 Claude Code、Cursor、Codex)主动捕获问题,避免 CI 或用户发现问题。它涵盖五个关键领域:边界情况、错误路径、测试覆盖、文档和代码质量。该技能旨在充当“人类在环”的检查点,防止因缺乏人工审查而导致的常见回退和错误。它支持任何基于 Git 的开发环境,并提供可执行命令(如 git diff 和 make)来集成到工作流中。使用此技能可以节省 CI 迭代时间,减少用户可见的 Bug,并避免需要回滚的合并请求。

兼容平台✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/agentskillexchange/skills/tree/HEAD/skills/pre-landing-review

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

预提交自审清单 是做什么的?

在提交重大变更之前,逐一检查此清单。在 CI 捕捉到问题之前——或者更糟,在用户发现之前——先自己抓住它们。

何时使用

当以下任一情况成立时,运行此技能:

  • 更改了超过 100 行代码
  • 修改了超过 5 个文件
  • 触及了核心基础设施(执行器、存储、主调度循环)
  • 引入了新的抽象或公共 API
  • 对边界情况或设计选择不确定

快速判断:

git diff --stat HEAD | tail -5  # 更改了多少行?
git diff --name-only HEAD | wc -l  # 更改了多少文件?

何时跳过

  • 微小变更(≤50 行,≤3 个文件)
  • 纯文档或课程更新
  • 仅测试的更改(测试本身已有审查)
  • 简单的一行 Bug 修复,范围明显且有限
  • 无逻辑更改的机械性重构

清单

1. 边界情况

- [ ] 空/空输入已处理?
- [ ] 边界条件已测试(差一错误、空列表、零值)?
- [ ] 并发访问或竞态条件已考虑?
- [ ] 可能涉及 Unicode/编码问题?

2. 错误路径

- [ ] 所有异常在适当的层级捕获(不要过于宽泛)?
- [ ] 错误信息具有信息性(什么失败、为什么失败、如何解决)?
- [ ] 故障模式优雅降级,而非静默失败?
- [ ] 没有裸 `except:` 或吞掉错误?

3. 测试覆盖

- [ ] 关键路径有测试?
- [ ] 上述边界情况有测试?
- [ ] 测试实际运行并通过?
- [ ] 没有留下 `pass` 或 `...` 的测试桩?

4. 文档

- [ ] 文档字符串/注释与当前行为一致?
- [ ] 如果公共接口变更,README 已更新?
- [ ] 提交消息说明了更改了什么以及为什么?
- [ ] 相关架构文档仍然准确?

5. 代码质量

- [ ] 命名清晰且与周围代码一致?
- [ ] 没有明显的代码异味(上帝函数、魔术数字、硬编码路径)?
- [ ] 遵循文件/包中的现有模式?
- [ ] 静态分析 / 类型检查通过?

一行冒烟测试

# 在提交前运行(根据你的栈调整):
make format && make typecheck && pytest -x -q && echo "✅ 可以提交"

如果任何步骤失败,修复后再提交。不要带着红色状态发布。

反模式

反模式修正方法
"CI 会抓住它的"CI 是最后手段,不能替代你自己的判断。先自己抓住问题。
"我稍后再加测试"“稍后”永远不会来。现在就写测试,否则永久接受这个缺口。
"我手动测试过,没问题"手动测试不可复现。编写自动化测试,以便未来的会话也能验证。
"错误消息写的是 TODO"TODO 错误消息会以 TODO 形式发布。现在就写真实消息。
"我从代码中就能看出它处理了这个情况"如果没有测试,未来的重构会悄无声息地破坏它。

为什么这很重要

自主代理被训练为产生“足够好”的输出,以避免纠正。如果没有结构化的审查门控,自主代码提交就会绕过通常能捕获回退和边界情况的人类在环检查。此技能充当那个门控——五个针对性透镜按顺序运行,确保没有明显问题漏网。

回报是累积的:每次审查通过捕获一个真正的问题,就节省了一次 CI 往返、避免了一个用户 Bug、消除了一次回滚的合并请求。

相关

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

Academic Paper Citation Network Mapper

Builds citation networks from Semantic Scholar API and CrossRef DOI metadata. Visualizes paper influence graphs using NetworkX, identifies seminal works, and tracks research lineage across fields.

ACF Custom Fields REST Exposer

Exposes Advanced Custom Fields data through the WordPress REST API using register_rest_field and acf_format_value. Handles repeater fields, flexible content layouts, and gallery fields with proper serialization.

ACF Extended for Advanced Custom Fields Workflows

An ASE skill built around ACF Extended, the WordPress enhancement suite for Advanced Custom Fields that adds field types, admin improvements, front-end forms, options pages, and developer tooling. It is a practical fit for agents working inside complex WordPress content models and custom field workflows.

ACF to Gutenberg Block Migrator

Converts Advanced Custom Fields field groups into native Gutenberg blocks using the ACF Block API v2 and @wordpress/scripts build pipeline. Maps ACF repeaters, groups, and flexible content to InnerBlocks and block attributes with server-side rendering via acf_register_block_type().

Activepieces Open Source Workflow Automation

Activepieces is an open-source, self-hostable workflow automation platform with 200+ integrations. It provides a visual builder for creating automated workflows and exposes all its connectors as MCP servers for AI agent use.

ActivityWatch Cross-Platform Automated Time Tracker and Producti

ActivityWatch is a privacy-first, open-source automated time tracker that records application usage, browser activity, and AFK status across Windows, macOS, and Linux. With 16k+ GitHub stars, it provides detailed productivity analytics without sending data to external servers.

act Local GitHub Actions Runner

act is an open-source CLI tool that runs GitHub Actions workflows locally using Docker, enabling fast feedback on workflow changes without pushing to GitHub. It is a standard tool for local Actions development and testing.

Add a browser review checkpoint before risky agent actions with

Use AgentClick when an agent should pause before risky commands, plans, drafts, or code changes so a human can inspect, edit, approve, or reject them in a purpose-built browser UI.

Add Claude design-system and accessibility workflows with UX/UI

Use UX/UI Agent Skills when Claude should generate tokens, component specs, accessibility audits, and framework-specific UI code from a repeatable design workflow.

Add executable smoke tests for shell scripts and CLIs before ref

Use Bats-core when an agent needs to turn fragile shell scripts or command-line workflows into something it can verify repeatedly after edits. The agent writes focused Bash tests for success paths, failure paths, and output contracts, then runs them locally or in CI before a refactor, release, or incident fix goes out.

Add graph-backed memory and context retrieval to agent workflows

Use Cognee to ingest project knowledge into graph and vector memory so agents can retrieve durable context across sessions and workflows.

Add IDE-style semantic code navigation and symbol-safe refactors

Give a coding agent symbol-aware lookup, cross-file rename, and structural edit tools before it starts making brittle text-only changes.

Add managed long-term memory to LangGraph agents with LangMem

Give LangGraph agents memory management and search tools so they can store, retrieve, and update durable facts across sessions.

Add multimodal lifelong memory to MCP and Python agents with Sim

Use SimpleMem to store, compress, index, and retrieve text or multimodal memories for agents through MCP or Python integrations.

Add persistent project memory and hook-driven synthesis with Cla

Keep Claude Code sessions grounded in prior decisions, project context, and daily handoff notes instead of starting from zero every time.

Add Postgres-native vector retrieval to agent and RAG workflows

Store embeddings beside application data in Postgres, create vector indexes, and query nearest neighbors for semantic search, RAG, recommendations, or agent memory retrieval.

Address GitHub PR review comments from the current branch with g

Find the open PR for the current branch, gather unresolved review comments, and drive a focused comment-resolution workflow with gh-authenticated context.

Add runtime guardrails to TypeScript agents with VoltAgent

Use VoltAgent to intercept, validate, and enforce input/output policies in TypeScript agent workflows.

Add temporal context memory to agent workflows with Zep

Use Zep as an external context layer for agents that need to store events, assemble temporal graph context, and retrieve relevant memory before model calls.

Adobe Firefly API Batch Image Generator

Calls Adobe Firefly

相关技能