選項
首頁首頁 Skill 文件 shipping-artifacts

shipping-artifacts

phuryn/pm-skills phuryn/pm-skills

針對以 AI 建置的應用程式,記錄其架構、權限、機密資訊及測試覆蓋率地圖,以便在發布前進行審查。

...展開全部
0
更新時間 2026-09-29

傳遞人工智慧產出的程式碼:讓 AI 產出的程式碼可進行審查的文件

目的

AI 代理程式能快速編寫程式碼,卻未留下任何持久的意圖紀錄——系統應執行什麼任務、誰有權執行哪些操作、機密資料存放於何處,以及哪些規則實際上已通過驗證。 若缺乏這些記錄,任何人類(乃至任何稽核代理)都無法判斷程式碼是否安全可發布。本指南旨在定義這套能恢復可審查性的精簡文件集。

這些文件存放於/documentation/目錄下,並針對兩類讀者撰寫:人類審查員與下一位 AI 編碼代理。它們是日後每次稽核中「預期狀態」的部分——無論是安全性或效能審查,其價值取決於能否將程式碼與這些意圖進行比對。

這組文件的組織方式

這套文件並非固定清單——它由一小部分核心文件,加上僅在具備相關能力時才添加的條件性文件所組成。

  • 核心文件— 每個可審查的應用程式都具備這些面向,因此必須始終產出這些文件。
  • 條件式文件—— 僅當應用程式實際具備該功能時才納入。若無此功能,請在architecture.md中寫上一行說明(例如:「無排程任務 —— 無cron.md。」),而非創建一個空文件。 可審查性源自於真實的映射圖,「我們不做 X」也是映射圖的一部分。
  • 大多數文件是由/document-app 根據程式碼進行逆向工程生成的。唯一的例外是tests.md,它是由 /derive-tests 根據其他文件衍生而來——這是驗證地圖,而非子系統的描述。

對當前狀態要毫不留情地坦誠,但無需過度多疑。這項工作的重點在於繪製精確的地圖,而非開出「健康證明」。每份文件都簡短精煉,大量採用表格與項目符號,並省略通用的理論闡述。

核心文件

每個條目包含:檔案名稱 · 一行目的說明 · 必須涵蓋的內容 · 審閱者如何使用它。

  1. architecture.md— 系統的本質及其整體架構。

    • 必須涵蓋:產品概覽 + 關鍵假設;技術堆疊;授權/會話/聲明(claims)的端到端流程; 信任邊界(例如:服務角色與客戶端之間的區別);一份簡短的「已知風險/假設」清單(每項條目皆須附上在程式碼中出現的位置,而非泛用的核對清單);以及包含所有其他產出文件的「相關文件」索引。
    • 審查者使用方式:此為根文件 — 所有其他文件皆由此處相互參照。
  2. flows.md—— 實際行使權限與產生副作用的使用流程。

    • 必須涵蓋:每個承載負載的流程,包含執行者 + 先決條件 + 成功結果;從 UI → 伺服器 → 資料 → 工作 → 提供者 → 代理程式 的逐步序列;每個受保護步驟的授權檢查(涉及哪些聲明/角色/範圍、針對哪個資源,以及預期的拒絕情況);信任邊界的跨越(瀏覽器→伺服器、伺服器→供應商、工作→應用程式、代理程式→工具、Webhook→應用程式);每個步驟所引發的狀態變化與副作用(寫入操作、排入隊列的電子郵件、觸發的工作、外發呼叫)。
    • 審查者用途:靜態的permissions.md矩陣無法呈現的執行時視圖——授權在何處及以何種順序被強制執行,以及何處可以跳過。
    • 反 PRD 規則:若某個流程未涉及權限、資料完整性、外部副作用、金錢、隱私或營運安全,則不應包含於此。此為安全/營運地圖,而非功能規格書。
  3. permissions.md— 誰被允許執行哪些操作。

    • 必須涵蓋:角色/聲明;權限範圍的來源(憑證 vs. 資料庫);資源 × 操作 × 角色的矩陣;哪些資料表具有行級安全性,哪些則依賴程式碼強制執行的檢查。
    • 審查者用途:這是存取控制稽核用來與程式碼進行比對的基準。flows.md展示其運作過程;此文件則是靜態參考。
  4. variables.md— 配置與機密資訊,並與風險對應。

    • 必須涵蓋:包含名稱 · 使用方 · 範圍(伺服器/客戶端) · 來源 · 輪替週期 · 風險的表格;明確確認客戶端未封裝任何機密資訊;上線前檢查清單。
    • 審查員用途:機密資訊/個人識別資訊(PII)的洩漏風險面,以及事件應變期間的輪替計畫。
  5. tests.md— 驗證映射:哪些已記錄的規則實際經過檢查、哪些僅為建議、哪些則未經任何檢查。

    • 必須以三個明確分隔的區段呈現,以確保驗證地圖不會錯誤地顯示為「綠色」:
      • 現有覆蓋範圍—目前存放於儲存庫中的測試,每項皆與其對應的規則綁定(確保地圖反映實際狀況,而非願望清單)。
      • 建議測試— 尚未編寫的推薦案例,依測試類型標記(自動化單元/整合測試 · 受控實機測試 · 手動審查)。
      • 缺口— 完全未經驗證的已記錄規則,依違反時會暴露的問題嚴重程度排序。
    • 每行包含:用例 → 規則 → 預期行為(包含拒絕/負面案例) → 證據來源(文件 + 程式碼) → 狀態(現有/提案中/無)。同時註明哪些檢查是持續整合(CI)所必需,並作為合併至主分支的門檻。
    • 審閱者用途:這是「已記錄 == 已實作」的實際運作形式——它顯示其他文件所聲稱的每項規則,目前是否確實由測試所驗證、僅為提案,或是尚未經過驗證。
    • 由/derive-tests(而非/document-app)生成,因為它是從其他文件和現有測試套件推導而來,而非直接讀取自子系統。

條件式文件(僅在具備該功能時包含)

  1. emails.md— 系統發送的每則通知。僅在應用程式發送交易型或自動化電子郵件時才包含此文件。

    • 必須涵蓋:佇列 → 處理器 → 提供者的路徑;範本及其接受的變數;重試/退避行為;發送失敗時應查閱的位置。
    • 審查者用途:找出未經驗證的範本輸入及個人識別資訊(PII)外洩邊界。
  2. cron.md— 所有排程任務及其安全運作方式。僅在存在排程或背景工作時納入。

    • 必須涵蓋:清單表(工作 → 排程 → 函式 → 密鑰 → 限制 → 重試);各工作如何維持幺正性;內部呼叫的驗證方式;以及查看最近執行紀錄的位置。
    • 審查者用途:找出可偽造的觸發條件及無限制的背景工作。
  3. seo.md— 單頁應用程式如何處理 SEO 及社群預覽。僅在存在公開/可索引或面向爬蟲的路線時才納入。

    • 必須涵蓋:預覽方法(靜態元資料/預渲染/邊緣 HTML);路由 → 需 SEO → 僅公開資料的對應表;動態元資料如何進行淨化處理;機器人與人類的路由區分。
    • 審核人員用途:偵測「僅限公開資料」的違規情況,以及機器人路徑上的元資料注入。
  4. automation.md— 嵌入式代理程式及其他自動化路徑。僅在應用程式嵌入 AI 代理程式、大型語言模型(LLM)工作流程、工具呼叫、Webhook 或外部自動化時才需包含。

    • 必須針對每個自動化/代理記錄:觸發條件 + 負責人 + 是否自動執行或僅在批准後執行; 其可能讀取的輸入資料,以及可能呼叫的具體工具/API(工具介面本身即為一項嚴格的防護措施);引導機制所在之處(提示語)與非提示語的嚴格防護措施;回傳至應用程式的輸出合約(資料結構、驗證、錯誤處理);應用程式擁有的副作用與代理程式擁有的建議;以及相關控制機制——核准關卡、稽核/時間軸記錄、速率限制、重試機制、緊急關閉開關。
    • 審查員用途:使隱藏的自動化路徑顯現,並劃清代理程式所提議的內容與應用程式所強制執行的內容之間的界線——這正是現代 AI 建構的應用程式中風險最高的接觸面。

備註

  • 每份產出的文件都會在architecture.md的「相關文件」區段中新增對自身的引用,以確保整套文件集可被發現。
  • 若遇到不適用的條件式文件,請直接跳過,並以一行文字說明此情況,而非編造內容。
  • 請勿在這些文件中包含範例和完成的範本——它們描述的是本系統,而非通用方法。
  • 代理程式運作情境檔案(CLAUDE.md/AGENTS.md)屬於另一類產出物——其指令源自這些文件,而非系統文件。該檔案是在交接步驟中由/ship-check 產生,而非在此處。
  • tests.md由/derive-tests 產生;其餘文件則由/document-app 產生。
  • 請勿包含「更新日期」行;檔案的版本歷史才是權威來源。
在 GitHub 上查看
---
name: shipping-artifacts
description: Documents AI-built apps with architecture, permissions, secrets, and test coverage maps to make them reviewable before shipping.
---

# Shipping Artifacts: The Docs That Make AI-Built Code Reviewable

## Purpose

AI agents write code fast, but they leave no durable record of *intent* — what the system is supposed to do, who is allowed to do what, where the secrets live, which rules are actually verified. Without that record, no human (and no auditing agent) can tell whether the code is safe to ship. This skill defines the small set of documents that restore reviewability.

These docs live in `/documentation/` and are written for two readers: a human reviewer and the next AI coding agent. They are the **intended-state** half of every later audit — a security or performance review is only as good as the intent it can compare the code against.

## How the set is organized

The set is **not** a fixed list — it is a small **core** plus **conditional** docs you add only when the capability exists.

- **Core docs** — every reviewable app has these surfaces, so always produce them.
- **Conditional docs** — include one only if the app actually has that capability. If it doesn't, write a single line in `architecture.md` ("No scheduled work — no `cron.md`.") rather than inventing an empty document. Reviewability comes from an honest map, and "we don't do X" is part of the map.
- Most docs are reverse-engineered from code by `/document-app`. The one exception is `tests.md`, which is *derived from the other docs* by `/derive-tests` — it is the verification map, not a description of a subsystem.

Be brutally honest about the current state without being paranoid. The job is an accurate map, not a clean bill of health. Each doc is short, table-and-bullet heavy, and skips generic theory.

## Core documents

Each entry: file · one-line purpose · what it must capture · how a reviewer uses it.

1. **`architecture.md`** — what the system is and how it hangs together.
   - Must capture: product overview + key assumptions; tech stack; how auth/sessions/claims flow end to end; the trust boundaries (e.g. service-role vs. client); a short **Known risks / assumptions** list (each entry backed by where it shows up in the code, not a generic checklist); a "Related Documents" index of every other doc produced.
   - Reviewer use: the root document — everything else is cross-referenced from here.

2. **`flows.md`** — the journeys where permissions and side effects are actually exercised.
   - Must capture: each load-bearing flow as actor + precondition + success outcome; the step-by-step sequence across UI → server → data → jobs → providers → agents; the **authz check at each protected step** (which claim/role/scope, on which resource, and the expected *deny* case); the **trust-boundary crossings** (browser→server, server→provider, job→app, agent→tool, webhook→app); the state changes and side effects each step causes (writes, emails queued, jobs triggered, outbound calls).
   - Reviewer use: the runtime view a static `permissions.md` matrix can't show — *where* and *in what order* authorization is enforced, and where it can be skipped.
   - **Anti-PRD rule:** a flow that doesn't touch permissions, data integrity, external side effects, money, privacy, or operational safety does not belong here. This is a security/operations map, not a feature spec.

3. **`permissions.md`** — who is allowed to do what.
   - Must capture: roles/claims; where scope is derived (token vs. DB); a resource × operation × role matrix; which tables have row-level security and which rely on code-enforced checks.
   - Reviewer use: the baseline an access-control audit compares the code against. `flows.md` shows it in motion; this is the static reference.

4. **`variables.md`** — configuration and secrets, mapped to risk.
   - Must capture: a table of Name · used-by · scope (server/client) · source · rotation · risk; explicit confirmation that no secret is bundled client-side; a pre-go-live checklist.
   - Reviewer use: the secrets/PII-leak surface and the rotation plan during incident response.

5. **`tests.md`** — the verification map: which documented rules are actually checked, which are only proposed, and which are checked by nothing.
   - Must capture, in three clearly separated sections so the map can't read falsely green:
     - **Existing coverage** — tests that are in the repo *today*, each tied to the rule it pins (so the map reflects reality, not a wish-list).
     - **Proposed tests** — recommended cases not yet written, marked by **test type** (automated unit/integration · guarded live · manual review).
     - **Gaps** — documented rules with no verification at all, ranked by what crossing them exposes.
   - Each row carries: use-case → rule → expected behavior (including the deny/negative case) → evidence source (doc + code) → status (existing / proposed / none). It also notes which checks are CI-required and gate merges to `main`.
   - Reviewer use: the operational form of "documented == implemented" — it shows whether each rule the other docs claim is actually pinned by a test today, only proposed, or unverified.
   - Produced by `/derive-tests` (not `/document-app`), because it is derived from the other docs and the existing test suite rather than read off a subsystem.

## Conditional documents (include only when the capability exists)

6. **`emails.md`** — every notification the system sends. *Include only if the app sends transactional or automated email.*
   - Must capture: the queue → processor → provider path; templates and the variables they accept; retry/backoff behavior; where to look when a send fails.
   - Reviewer use: spotting unvalidated template inputs and PII exposure boundaries.

7. **`cron.md`** — all scheduled work and how to operate it safely. *Include only if scheduled or background jobs exist.*
   - Must capture: an inventory table (job → schedule → function → secrets → limits → retry); how each job stays idempotent; how internal calls authenticate; where to see last runs.
   - Reviewer use: finding forgeable triggers and unbounded background jobs.

8. **`seo.md`** — how a single-page app handles SEO and social previews. *Include only if there are public/indexable or bot-facing routes.*
   - Must capture: the preview approach (static meta / prerender / edge HTML); a route → needs-SEO → public-data-only table; how dynamic metadata is sanitized; bot-vs-human routing.
   - Reviewer use: catching public-data-only violations and metadata injection on bot routes.

9. **`automation.md`** — embedded agents and other automation paths. *Include only if the app embeds AI agents, LLM workflows, tool-calling, webhooks, or external automation.*
   - Must capture, per automation/agent: trigger + owner + whether it runs automatically or only after approval; the inputs it may read and the **exact tools/APIs it may call** (the tool surface is itself a hard guardrail); where **steering** lives (the prompt) vs. the **non-prompt hard guardrails**; the **output contract** back to the app (schema, validation, failure handling); **app-owned side effects vs. agent-owned suggestions**; and the controls — approval gates, audit/timeline logging, rate limits, retries, kill switch.
   - Reviewer use: makes hidden automation paths visible and draws the line between what an agent *proposes* and what the app *enforces* — the highest-risk surface in modern AI-built apps.

## Notes

- Each produced doc adds a reference to itself in `architecture.md` under a "Related Documents" section, so the set stays discoverable.
- Skip any conditional document that doesn't apply, and say so in one line rather than inventing content.
- Keep examples and finished templates out of these docs — they describe *this* system, not the general method.
- The agent operating-context file (`CLAUDE.md` / `AGENTS.md`) is a *different* artifact — instructions derived from these docs, not system documentation. It is produced at the handoff step by `/ship-check`, not here.
- `tests.md` is produced by `/derive-tests`; the rest are produced by `/document-app`.
- Do not include an "updated date" line; the file's history is the source of truth.

所有檔案

1 個檔案

安裝 shipping-artifacts

請下載並將技能檔案解壓縮至您的 .claude/skills/ 目錄中。

下載 ZIP

複製儲存庫並將技能檔案複製到您的專案中。

git clone https://github.com/phuryn/pm-skills/tree/main/pm-ai-shipping/skills/shipping-artifacts # Copy SKILL.md to your .claude/skills/ directory

複製 複製
快速設定: 將技能資料夾複製到 .claude/skills/ Claude 會自動偵測並使用該技能
儲存庫 phuryn/pm-skills

相關技能

tc-tracker
更新時間 2026-08-27
nuxthub
更新時間 2026-08-23
golang-dependency-injection
更新時間 2026-06-29
altimate-data-engineering-skills
更新時間 2026-08-23
OR