repo-compliance-audit
Repo Compliance Audit
本 skill 提供一个两阶段工作流:先审计出报告,再由人类勾选需要整改的条目,最后执行选择性整改。核心目标是“合规审查可取证”和“整改最小化、默认不改业务逻辑”。
工作流(Audit → 人类勾选 → Remediation)
1) Audit(只读审计,默认不改仓库)
在目标仓库根目录运行(或用 --repo 指定):
python3 scripts/audit_repo.py --repo . --out /tmp/repo-compliance-audit
输出:
report.md:人类可读审计报告(结论摘要、风险分级、证据、整改清单)findings.json:机器可读发现列表(包含finding.id、证据与建议修复)
CI / 门禁用法(可选):
python3 scripts/audit_repo.py --repo . --out /tmp/repo-compliance-audit --fail-on high
推荐门禁策略(面向“执行过程对齐 AGENTS.md”)
- 最小门禁(推荐默认):用
--fail-on high,主要拦截:- 规则文件完整性高风险:
AGENTS_MD_DELETED/AGENTS_MD_MODIFIED - 过程证据高风险:
AGENTS_EXECUTION_TEST_EVIDENCE_MISSING - 明显安全风险:
POSSIBLE_SECRET_FOUND
- 规则文件完整性高风险:
- 严格门禁(按需启用):用
--fail-on medium,会额外拦截:- Spec-first 证据缺失类(例如
SPEC_ENTRYPOINT_MISSING、AGENTS_EXECUTION_SPEC_FIRST_EVIDENCE_MISSING) - worklog 过程证据缺失类(例如
AGENTS_EXECUTION_WORKLOG_EVIDENCE_MISSING)
- Spec-first 证据缺失类(例如
输出脱敏(共享报告时建议开启):
# 仅脱敏 report.md(保留 findings.json 供系统编排/整改使用)
python3 scripts/audit_repo.py --repo . --out /tmp/repo-compliance-audit --redact report
# report.md + findings.json 均脱敏(对外共享)
python3 scripts/audit_repo.py --repo . --out /tmp/repo-compliance-audit --redact all
降低泄露/噪声(可选):
python3 scripts/audit_repo.py --repo . --out /tmp/repo-compliance-audit --no-git-meta
python3 scripts/audit_repo.py --repo . --out /tmp/repo-compliance-audit --no-secret-scan
2) 人类勾选要整改的条目
从 report.md 或 findings.json 里选择 finding.id,用逗号分隔或写入文件。
3) Remediation(选择性整改,默认只跑 safe-to-autofix)
python3 scripts/remediate_repo.py \
--repo . \
--findings /tmp/repo-compliance-audit/findings.json \
--select DOCS_INDEX_MISSING,ENV_EXAMPLE_MISSING
约束:
- 默认仅执行
safe_to_autofix=true的修复项 - 默认不覆盖已有文件(除非显式
--overwrite) - 默认不改业务逻辑(只做“合规骨架/证据/仓库卫生”类修复)
输出如何被系统使用(强结构 vs 生态兼容)
- 控制面强结构:
findings.json用于系统级交互(可编排、可审计、可做门禁)。 - 对人类生态友好:
report.md以可读性优先,不强制结构化 JSON。 - 避免每个节点都强制结构化:仅在“门禁/节点确实需要机器可读判断”时启用
--fail-on或只对某些 finding 做 gate。 - 规则文件完整性优先:如果你关注编码智能体的规则被“删除/篡改”,可以重点关注审计输出中的
AGENTS_MD_DELETED/AGENTS_MD_MODIFIED/AGENTS_MD_UNTRACKED(基于 git 取证,若非 git 仓库则仅能提示)。
资源
./scripts/audit_repo.py:审计入口./scripts/remediate_repo.py:整改入口(按finding.id选择性执行)./references/finding-catalog.md:finding ID 目录(扩展/对齐口径用)
More from okwinds/miscellany
prd-to-engineering-spec
Transform PRD (Product Requirements Document) into actionable engineering specifications. Creates detailed technical specs that developers can implement step-by-step without ambiguity. Covers data modeling, API design, business logic, security architecture, deployment, and agent system design. Use when: converting product requirements to technical specs, validating PRD completeness, planning technical implementation, creating task breakdowns, or defining test specifications. Triggers: 'PRD to spec', 'convert requirements', 'technical spec from PRD', 'engineering doc from requirements', 'validate PRD'.
45headless-web-viewer
Render and view webpages using a headless browser (Playwright) to fetch JS-rendered HTML, extract visible text, and optionally save full-page screenshots. Use when a user asks to “无头浏览器打开/查看网页”, needs the rendered DOM instead of raw curl HTML, or wants a screenshot of a page.
33prd-writing-guide
Write complete, unambiguous PRDs that development teams can implement without guesswork. Includes requirement discovery framework, structured documentation methodology, completeness checklists, and common pitfall avoidance. Use when: writing new PRDs, reviewing PRD drafts, validating requirement completeness, preparing for engineering handoff. Triggers: 'write PRD', '写PRD', '产品需求文档', '需求文档', '需求规格', '需求评审', '完善需求', 'create requirements doc', 'product requirements', 'feature spec', 'requirements document'. Anti-triggers: 'technical design doc', 'architecture design', 'implementation plan', 'API design', '架构设计', '技术方案', '实现方案', '接口设计'.
23codebase-spec-extractor
Extract complete, replicable engineering specifications from existing codebases. Produces documentation detailed enough to fully replicate a project without seeing the original source code—even using a different tech stack. Use when: analyzing existing projects, documenting legacy systems, creating technical specs from code, preparing for system migration, or onboarding new teams. Triggers: 'extract spec from code', 'document codebase', 'analyze project architecture', 'create spec from existing system'.
16pptx-offline
PPTX 文档离线读写:解析/替换/重排/缩略图、OOXML 解包编辑回包,以及 html2pptx(HTML→PPT)工作流。适用于生成与维护演示文稿(依赖安装可能需要网络)。
14prd-to-uiux-rd-spec
从产品 PRD 产出“复刻级可落地”的 UI/UX 研发规格文档包(目录同构骨架、公共基座、组件/页面契约、覆盖映射、索引与 worklog)。适用于需要把 PRD 转成前端可复刻实现的规格文档、UI/UX 研发规格、界面契约与验收标准的场景;避免用于只要视觉灵感/纯 UI 赏析或直接写代码实现的请求。
14