オプション
家家 Skill 安全 intended-vs-implemented

intended-vs-implemented

phuryn/pm-skills phuryn/pm-skills

コードベースにおいて、文書化された意図と実際の実装との間に存在するギャップを特定し、意図のモデルを持たないため一般的なスキャナーが見逃してしまうバグを検出します。

...すべて拡張します
0
更新された時間 2026年9月29日

「意図」と「実装」:そのギャップの検証

目的

リンターは孤立した状態でコードをスキャンします。コードが内部的に一貫しているかどうかは判断できますが、開発者の意図を反映したモデルを持っていないため、コードが意図した通りに動作しているかどうかは判断できません。 最も重大なセキュリティ上の問題や正しさに関するバグは、まさにそのギャップに潜んでいます。例えば、文書化されているが決して適用されていない権限、誰でも呼び出せる「cron専用」のエンドポイント、privateデータを漏洩させるpublic-onlyとマークされたフィールドなどです。

このスキルは、そのギャップを見つけるための手法です。これが他社との差別化要因となります。このスキルは、意図が事前に文書化されている場合にのみ機能します(「shipping-artifacts」スキルを参照)。まさにその理由から、汎用ツールではこれを再現できないのです。

背景

文書化された意図が存在する場合にこれを使用してください — permissions.md, architecture.md, variables.md、など。もしそれらのドキュメントが存在しない、あるいは古くなっている場合、その欠如自体が最初の発見となります。記録されていない意図を監査することはできないからです。まずドキュメントを作成し、その後で監査を行うことをお勧めします。

方法

  1. 意図を明確にする。 /documentation/*.md セットを「何が真実であるべきか」の唯一の基準として読み解く:誰が何にアクセスできるか、どの境界が信頼できるか、どのデータが公開されているか。ドキュメントは「検証すべき主張」として扱い、「証拠」として扱わない。

  2. 実装の証拠を収集する。各主張を強制している(あるいは強制できていない)コードを読み解く。証拠とは、参照されたファイルと行番号のことである――実際の認証チェック、実際のクエリフィルター、実際のサニタイザーなどだ。「おそらく上流で処理されている」という説明は証拠ではない。証拠となるのはコードパスそのものである。

  3. 主張とコードを、境界ごとに一つずつ照合する。文書化された各ルールについて、次の点を問う:そのルールは、サーバー上で、あらゆるパスにおいて、実際に適用ポイントで実装されているか?「内部専用」「管理者専用」「他の場所で検証済み」といったコメントは信用せず、コードで検証すること。

  4. 各不一致について、それが重要かどうかを分類する。不一致が重要となるのは、それを越えることで実際の攻撃者が、本来アクセスしてはならないデータ、資金、インフラ、または他のテナントに到達できてしまう場合である。影響を受けるのが攻撃者自身とその自身のデータのみである場合は重要ではない。表面的な逸脱は除外し、境界を越える逸脱のみを保持する。

  5. 曖昧な調査結果は避けましょう。すべての調査結果には、文書化された意図(ドキュメントを引用)、実装された実態(コードを引用)、攻撃者と被害者、そして具体的な修正策を明記します。ギャップの両側面を引用できない場合は、それは調査すべき問題であり、報告すべき調査結果ではありません。

重要な点

  • 意図:文書化されたルール、境界、範囲、またはパブリック/プライベートの分類。
  • 実装の証拠:コード内の引用された強制ポイント(またはその証明可能な欠如)。
  • 重要な不一致:ドキュメントにはある内容が記載されているが、コードでは別の処理が行われており、その違いが信頼、コスト、データ、またはテナントの境界を越えている場合。

注

  • 「文書化されているが適用されていない」という事実自体が問題となる — そのギャップによって何が露呈するかによって優先順位を付ける。
  • 「文書化されていないが適用されている」場合は通常問題ありませんが、フラグを立ててください。文書が古くなっているため、次回の監査の信頼性が低下します。
  • この手法は、セキュリティおよびパフォーマンス監査に情報を提供します。これらは、それらの監査における詳細な分析に取って代わるものではなく、それらに欠けている「意図」という軸を追加するものです。
  • ギャップを作り出すために意図をでっち上げてはなりません。ドキュメントに記述がない場合は、その旨を明記してください。
GitHubで見る
---
name: intended-vs-implemented
description: Finds gaps between documented intent and actual implementation in codebases, catching bugs that generic scanners miss because they lack a model of intent.
---

# Intended vs. Implemented: Auditing the Gap

## Purpose

A linter scans code in a vacuum. It can tell you the code is *internally* consistent; it cannot tell you the code does what you *meant*, because it has no model of your intent. The highest-value security and correctness bugs live in that gap — a permission documented but never enforced, a "cron-only" endpoint anyone can call, a field marked public-only that leaks private data.

This skill is the method for finding that gap. It is the differentiator: it only works when intent has been written down first (see the **shipping-artifacts** skill), and that's exactly why commodity tools can't replicate it.

## Context

Use this when documented intent exists — `permissions.md`, `architecture.md`, `variables.md`, etc. If those docs are absent or stale, that absence is itself the first finding: you cannot audit intent you never recorded. Recommend documenting first, then auditing.

## Method

1. **Establish intent.** Read the `/documentation/*.md` set as the source of truth for what *should* be true: who may access what, which boundaries are trusted, which data is public. Treat the docs as claims to verify, not as proof.

2. **Gather implementation evidence.** Read the code that enforces (or fails to enforce) each claim. Evidence is a cited file and line — the actual authorization check, the actual query filter, the actual sanitizer. "It's probably handled upstream" is not evidence; the code path is.

3. **Compare claim to code, one boundary at a time.** For each documented rule, ask: does an enforcement point actually implement it, on the server, on every path? Distrust comments like "internal only," "admin only," or "validated elsewhere" — verify them in code.

4. **Classify each mismatch by whether it matters.** A mismatch matters when crossing it lets a real actor reach data, money, infrastructure, or another tenant they shouldn't. It does not matter when the only person affected is the actor themselves on their own data. Drop cosmetic drift; keep boundary-crossing drift.

5. **Avoid hand-wavy findings.** Every finding names: the **documented intent** (quote the doc), the **implemented reality** (cite the code), the **attacker and victim**, and the **concrete fix**. If you cannot cite both sides of the gap, it is a question to investigate, not a finding to report.

## What counts

- **Intent:** a documented rule, boundary, scope, or public/private classification.
- **Implementation evidence:** a cited enforcement point (or its provable absence) in the code.
- **A mismatch that matters:** doc says one thing, code does another, and the difference crosses a trust, cost, data, or tenant boundary.

## Notes

- Documented-but-unenforced is a finding on its own — rank it by what crossing the gap exposes.
- Undocumented-but-enforced is usually fine, but flag it: the docs are now stale, which weakens the next audit.
- This method feeds the security and performance audits; it does not replace their sink-level analysis — it adds the intent axis they lack.
- Never fabricate intent to manufacture a gap. If the docs are silent, say the docs are silent.

すべてのファイル

1件のファイル

intended-vs-implementedをインストール

スキルファイルをダウンロードし、.claude/skills/ ディレクトリに解凍してください。

ZIPをダウンロード

リポジトリをクローンし、スキルファイルをプロジェクトにコピーしてください。

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

コピー コピー
クイックセットアップ: スキルフォルダを .claude/skills/ にコピーしてください。 Claude が自動的にそのスキルを検出して使用します。
リポジトリ phuryn/pm-skills

関連スキル

gmgn-portfolio
更新された時間 2026年7月1日
device-integrity
更新された時間 2026年6月29日
zeroize-audit
更新された時間 2026年7月1日
flutter-use-http-package
更新された時間 2026年6月30日
OR