[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75P340TXR09J64T00PRWT0B":3,"skill-same:01M75P340TXR09J64T00PRWT0B":73},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":13,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":32,"install":33,"resources":46},"01M75P340TXR09J64T00PRWT0B","audit-flow",null,"Interactive system flow tracing across CODE, API, AUTH, DATA, NETWORK layers with SQLite persistence and Mermaid export. Use for security audits, compliance documentation, flow tracing, feature ideation, brainstorming, debugging, architecture reviews, or incident post-mortems. Triggers on audit, trace flow, document flow, security review, debug flow, brainstorm, architecture review, post-mortem, incident review.","NobleFatherCreations\u002FWookbook","NobleFatherCreations","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F293071470?v=4","01M75MK5GTGGTFASDP4VDSYNJ1","01M75MK5HARFP14YVRHXYXG49Y",0,"MIT","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Faudit-flow\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: audit-flow\ndescription: Interactive system flow tracing across CODE, API, AUTH, DATA, NETWORK layers with SQLite persistence and Mermaid export. Use for security audits, compliance documentation, flow tracing, feature ideation, brainstorming, debugging, architecture reviews, or incident post-mortems. Triggers on audit, trace flow, document flow, security review, debug flow, brainstorm, architecture review, post-mortem, incident review.\nlicense: MIT\ncompatibility: Requires Python 3.8+ (stdlib only, zero dependencies). Optional pyyaml for YAML export. Git for merge\u002Fdiff driver features.\nmetadata:\n  author: ArunJRK\n  version: \"1.0.0\"\n---\n\n## ⚠️ MANDATORY ENTRY POINT — Execute Before ANY Other Action\n\n**Step 1: Read schema.sql**\n\n```bash\n# ALWAYS read the schema first to understand tables, constraints, views\ncat .claude\u002Fskills\u002Faudit-flow\u002Fschema.sql\n```\n\n**Step 2: Check if DB exists — NEVER recreate**\n\n```bash\n# Check for existing database\nls -la .audit\u002Faudit.db 2>\u002Fdev\u002Fnull && echo \"DB EXISTS - DO NOT RECREATE\" || echo \"No DB - safe to init\"\n```\n\n**Step 3: If DB exists, show current state**\n\n```bash\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py list\n```\n\n### 🚫 FORBIDDEN ACTIONS\n\n| Action                                                | Why Forbidden            |\n| ----------------------------------------------------- | ------------------------ |\n| `rm .audit\u002Faudit.db`                                  | Destroys audit history   |\n| `audit.py init` when DB exists                        | Overwrites existing data |\n| `DROP TABLE`                                          | Destroys audit history   |\n| `sqlite3 .audit\u002Faudit.db \u003C schema.sql` when DB exists | Overwrites existing data |\n\n**Rule:** If `.audit\u002Faudit.db` exists, ONLY use `audit.py list`, `show`, `export`, or INSERT operations. NEVER recreate.\n\n---\n\n# Audit Flow\n\nInteractive tracing of system flows with SQLite persistence. Supports multiple named flows per session, non-linear flows (branching\u002Fmerging), and multi-format exports.\n\n## Organization Principles\n\n**Directory structure by purpose:**\n\n- **Audits\u002FDocumentation\u002FCompliance:** `docs\u002Faudits\u002F{name}-{YYYY-MM-DD}\u002F`\n- **Ideation\u002FBrainstorming:** `docs\u002Fideation\u002F{name}-{YYYY-MM-DD}.md` (single file, no subdirectory unless artifacts needed)\n- **Debugging\u002FIncident Review:** `docs\u002Faudits\u002F{name}-{YYYY-MM-DD}\u002F` (same as audits — captures evidence)\n- **Architecture Review:** `docs\u002Faudits\u002F{name}-{YYYY-MM-DD}\u002F` (same as audits — captures structural analysis)\n\n**Required files:**\n\n- INDEX.md (manifest, entry point)\n- README.md (executive summary)\n- {name}-audit.md (flow trace)\n\n**Lazy initialization:** Create subdirectories only when artifacts exist\n\n- `screenshots\u002F` `network-traces\u002F` `diagrams\u002F` `code-samples\u002F` `test-results\u002F` `evidence\u002F`\n\n**Naming:** `{audit-name}-{type}.md`\n\n## DB-First Discipline\n\n**Invariant:** SQLite = sole source of truth. Context window: volatile, compacts without notice, hallucinates state.\n\n**🚨 CRITICAL: NEVER DESTROY EXISTING DATA**\n\n- If `.audit\u002Faudit.db` exists → it contains irreplaceable audit history\n- NEVER run `init` when DB exists — use `list` to see what's there\n- NEVER delete, drop, or recreate — only append\n\n**Constraints:**\n\n| Operation   | Rule                                                                                      | Blocked rationalization              |\n| ----------- | ----------------------------------------------------------------------------------------- | ------------------------------------ |\n| **Entry**   | Read `schema.sql` FIRST, check if DB exists SECOND                                        | \"I'll just start working\"            |\n| **Init**    | ONLY if `.audit\u002Faudit.db` does NOT exist                                                  | \"Let me reinitialize to start fresh\" |\n| Schema      | Read `schema.sql` BEFORE any SQLite command — understand tables, constraints, views first | \"I know the schema from context\"     |\n| Write       | INSERT each tuple\u002Fedge\u002Ffinding before moving to the next code location                    | \"I'll batch-insert at the end\"       |\n| Read        | SELECT from DB before referencing tuple IDs, counts, or flow structure                    | \"I remember the flow so far\"         |\n| Export      | `audit.py export` only — never generate mermaid\u002Fmarkdown from context                     | \"Let me generate mermaid directly\"   |\n| Resume      | `audit.py show \u003Csession>` before any operation that references prior tuples               | \"I have the full trace in context\"   |\n| Reference   | Query tuple IDs from DB — IDs are DB-assigned, never inferred                             | \"The tuple ID should be N\"           |\n| **Default** | **When uncertain of flow state → query DB before proceeding**                             | _(any unlisted rationalization)_     |\n\n**Checkpoint:** Every 5 tuples → `audit.py show \u003Csession> \u003Cflow>`\n\n---\n\n## Interactive Workflow - ALWAYS ASK USER\n\n### 1. Session Start - Ask:\n\n```\nName: ___\nPurpose: security-audit | documentation | compliance | ideation | brainstorming | debugging | architecture-review | incident-review\nDescription: ___ (optional)\n```\n\nInitialize directory immediately. Lazily create subdirectories when artifacts are generated.\n\n### 2. Granularity - Ask:\n\n```\n[fine]   Function-level trace (~50-200 tuples)\n         Use: Security audits, debugging\n\n[coarse] Boundary-level trace (~10-30 tuples)\n         Use: Documentation, high-level flows\n\nChoose: fine \u002F coarse\n```\n\n### 3. During Trace:\n\nAsk at decision points: trace deeper? mark concern? add finding (severity)? note?\n\n### 4. On Export:\n\nAsk format: `json | yaml | md | mermaid | all`\n\nPost-export: Generate INDEX.md manifest. Organize artifacts by type. Prune empty directories.\n\n## Quick Reference\n\n| Command                              | Purpose                                        |\n| ------------------------------------ | ---------------------------------------------- |\n| `\u002Faudit-flow start`                  | New session (name, purpose, granularity)       |\n| `\u002Faudit-flow flow {name}`            | Add new flow to session                        |\n| `\u002Faudit-flow add {layer} {desc}`     | Add tuple to current flow                      |\n| `\u002Faudit-flow link {from} {to} {rel}` | Create edge (supports conditions for branches) |\n| `\u002Faudit-flow finding {desc}`         | Record finding                                 |\n| `\u002Faudit-flow show`                   | View session\u002Fflow details                      |\n| `\u002Faudit-flow export`                 | Export (json\u002Fyaml\u002Fmd\u002Fmermaid)                  |\n| `\u002Faudit-flow git-setup`              | Configure git merge\u002Fdiff drivers (once)        |\n\n**Layers:** `CODE` | `API` | `NETWORK` | `AUTH` | `DATA`\n\n**Relations:** `TRIGGERS` | `READS` | `WRITES` | `VALIDATES` | `TRANSFORMS` | `BRANCHES` | `MERGES`\n\n## Semantic Rules for Relations\n\n| Relation     | Meaning                      | Use When                                      | NOT For                       |\n| ------------ | ---------------------------- | --------------------------------------------- | ----------------------------- |\n| `TRIGGERS`   | A causes B to execute        | Function calls, event handlers, HTTP requests | Static observations           |\n| `READS`      | A consumes data from B       | Cookie reads, DB queries, config lookups      | Mutations                     |\n| `WRITES`     | A mutates data in B          | Cookie writes, DB inserts, state updates      | Read-only access              |\n| `VALIDATES`  | A checks\u002Fverifies B          | Auth checks, input validation, expiry checks  | Chaining analyst observations |\n| `TRANSFORMS` | A converts\u002Fmaps data for B   | Token exchange, response formatting           | Unrelated processing          |\n| `BRANCHES`   | A has conditional paths      | if\u002Felse, switch, error vs success             | **Must have condition label** |\n| `MERGES`     | Multiple paths converge at B | Parallel paths rejoin, error recovery         | Single-path flow              |\n\n**CRITICAL: BRANCHES Must Have Conditions.** Every BRANCHES edge requires a `condition` describing which path. Example: `BRANCHES [token expired]` vs `BRANCHES [token valid]`.\n\n## Observations vs Flow Steps\n\n**Flow steps** = things the SYSTEM DOES (function calls, data reads, network requests). Verified by tracing code.\n\n**Observations** = things the ANALYST NOTES (missing features, potential risks). Record as **findings**, not tuples.\n\n**Wrong pattern:**\n\n```\nT50 \"NO cross-tab sync\"       ← observation, not a system action\nT51 \"React state NOT shared\"  ← observation\nT50 --VALIDATES--> T51         ← chaining observations as flow\n```\n\n**Correct pattern:**\n\n```sql\n-- Record as finding instead:\nINSERT INTO findings (flow_id, session_id, severity, category, description)\nVALUES (?, ?, 'medium', 'state-management',\n        'No cross-tab sync: React state not shared across tabs');\n```\n\n**Rule:** NEVER chain observations with VALIDATES. If describing what the system DOESN'T do, use a finding.\n\n## Data Model\n\n```\nSession (audit container)\n  └── Flow (named DAG with entry point)\n       └── Tuple (node: layer + action + subject)\n            └── Edge (relation + optional condition)\n```\n\n## Storage & CLI\n\n```bash\n# Core\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py init              # Initialize DB\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py list              # List sessions\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py show \u003Csession>    # Show flows\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py show \u003Csession> \u003Cflow>  # Show flow details\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py export \u003Csession>  # Export all\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py export \u003Csession> -f \u003Cflow>  # Export one flow\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py validate \u003Csession>         # Validate flows\n\n# Git integration\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py git-setup         # Configure merge\u002Fdiff drivers (once)\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py db-merge %O %A %B # Git merge driver (auto-called)\n\n# CSV backup\u002Fportability (optional)\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py csv-export               # DB → .audit\u002Fcsv\u002F*.csv\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py csv-import               # .audit\u002Fcsv\u002F*.csv → DB\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py csv-merge \u003Ctheirs_dir>   # Merge two CSV sets\n```\n\n## Non-Linear Flows\n\n**Branching:** One tuple → multiple outgoing edges with conditions\n\n```sql\nINSERT INTO edges (from_tuple, to_tuple, relation, condition)\nVALUES (5, 6, 'BRANCHES', 'token valid'),\n       (5, 7, 'BRANCHES', 'token expired');\n```\n\n**Merging:** Multiple tuples → one tuple\n\n```sql\nINSERT INTO edges (from_tuple, to_tuple, relation)\nVALUES (6, 8, 'TRIGGERS'),\n       (9, 8, 'MERGES');  -- refresh path merges back\n```\n\n## Files\n\n- [scripts\u002Faudit.py](scripts\u002Faudit.py) - CLI for all commands (init, list, show, export, validate, db-merge, git-setup, csv-\\*)\n- [COMMANDS.md](COMMANDS.md) - Detailed SQL reference\n- [EXAMPLES.md](EXAMPLES.md) - Full examples with non-linear flows\n- [schema.sql](schema.sql) - Database schema\n- `.gitattributes` - Git merge\u002Fdiff driver config for audit.db\n\n## Git Context\n\nCapture on session start: commit hash, branch, working tree status. Include in all exports.\n\n## Mermaid Validation\n\nRun `python .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py validate \u003Csession>` before export.\n\n| Check                      | Severity | Description                                     |\n| -------------------------- | -------- | ----------------------------------------------- |\n| BRANCHES without condition | ERROR    | Every BRANCHES edge needs a condition label     |\n| Node count >= 60           | ERROR    | Split into sub-flows                            |\n| Node count >= 40           | WARN     | Consider splitting                              |\n| Orphan nodes               | WARN     | Node with no edges (disconnected)               |\n| Duplicate labels           | WARN     | Same action text without subject disambiguation |\n| No entry point             | WARN     | All nodes have incoming edges                   |\n\n**Post-export features (automatic):**\n\n- **Step numbers**: BFS topological order from entry point (`1. action`, `2. action`)\n- **Entry point**: Stadium shape with green styling\n- **Edge arrows**: `-->` solid (TRIGGERS\u002FVALIDATES\u002FTRANSFORMS\u002FBRANCHES\u002FMERGES), `-.->` dotted (READS), `==>` thick (WRITES)\n- **Observations**: Separated into dashed-border OBSERVATIONS subgraph\n- **Direction**: `--direction LR` flag for horizontal layouts\n\n## Diagram Readability Requirements\n\n**All diagrams MUST be produced by `audit.py export`.** Never hand-craft mermaid. The exporter enforces:\n\n1. **Entry point marker** — Green stadium-shape node `([label]):::entryPoint`\n2. **Step numbers** — BFS topological order: `1. action`, `2. action`, `3. action`\n3. **Legend block** — classDef styles for entryPoint, concern, observation\n4. **Observation separation** — Concern-only chains go to OBSERVATIONS subgraph, not main flow\n5. **Label safety** — HTML entities for `()`, `\"\"`, `\u003C>`, `|`, `[]` characters (auto-sanitized)\n\n**Reading flow must be obvious.** A reader opening the diagram cold must immediately see:\n\n- WHERE to start (green entry node)\n- WHAT ORDER to read (step numbers)\n- WHICH PATH is happy vs error (branch conditions on edges)\n- WHAT THE COLORS MEAN (legend)\n\n**Node label rules:**\n\n- Use concrete nouns\u002Fverbs: `handleCallback()`, `exchangeCodeForTokens()`\n- NOT bare verbs: ~~\"Configure\"~~, ~~\"Select\"~~, ~~\"Enable\"~~\n- Disambiguate duplicates: auto-suffixed with subject when action repeats\n\n**Size limits:**\n\n- 40+ nodes → warning, consider splitting\n- 60+ nodes → error, MUST split into sub-flows\n- If flow has 5+ independent sub-flows → split by purpose\n\n---\n\n## Git Workflow — Custom Merge Driver\n\n**Problem:** SQLite is binary — `git merge` can't auto-resolve `.audit\u002Faudit.db`.\n\n**Solution:** Custom git merge driver. `audit.db` stays in git (small, single file). On conflict, git calls `audit.py db-merge` to auto-merge using SQL.\n\n### One-Time Setup\n\n```bash\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py git-setup\n```\n\nThis configures (in `.git\u002Fconfig`):\n\n- **Merge driver:** `merge.sqlite-audit` — calls `audit.py db-merge %O %A %B` on conflict\n- **Diff driver:** `diff.sqlite` — `sqlite3 .dump` for readable `git diff` output\n\nAlso requires `.gitattributes` (already in repo):\n\n```\n.audit\u002Faudit.db diff=sqlite merge=sqlite-audit\n```\n\n### How It Works\n\n1. You commit `audit.db` normally — `git add .audit\u002Faudit.db && git commit`\n2. `git diff` shows SQL text (via textconv)\n3. On `git merge` with conflict → git calls the merge driver automatically\n4. Driver opens both DBs, merges sessions by name (later `updated_at` wins), remaps IDs\n5. Result written to ours — merge completes cleanly\n\n### Merge Strategy\n\n| Table    | Merge Key                               | Conflict Resolution               |\n| -------- | --------------------------------------- | --------------------------------- |\n| sessions | `name` (unique)                         | Keep later `updated_at`           |\n| flows    | `(session_name, flow_name)`             | Follow parent session winner      |\n| tuples   | Parent flow                             | All tuples from winning flow kept |\n| edges    | Both endpoint tuples                    | Kept if both endpoints survive    |\n| findings | `(session_name, category, description)` | Dedup by content                  |\n\nAll INTEGER PKs remapped sequentially. Foreign keys updated.\n\n### CSV Backup (Optional)\n\nCSV export\u002Fimport still available for portability and backup:\n\n```bash\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py csv-export   # DB → .audit\u002Fcsv\u002F*.csv (QUOTE_ALL)\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py csv-import   # CSV → DB (recreates from scratch)\n```\n\n---\n\n## Output Quality\n\n**Principles:**\n\n- ASCII sequence diagrams for complex flows\n- Side-by-side tables for alternatives\n- Real code from traced files with `file:line` references\n- What\u002FWhy\u002FExample pattern\n- No generic templates\n\n## Completion Checklist\n\n- [ ] Directory exists with ISO date suffix\n- [ ] INDEX.md manifest generated\n- [ ] README.md (executive summary)\n- [ ] Naming convention: `{name}-{type}.md`\n- [ ] Artifacts in typed subdirectories (lazy init)\n- [ ] Git context captured\n- [ ] Git merge driver configured (`audit.py git-setup`)\n- [ ] No orphaned files\n- [ ] Diagrams pass `audit.py validate`\n\n## Anti-Patterns\n\nFlat structure, empty directories, orphan nodes, unlabeled branches, generic identifiers, missing git context, no manifest, hand-crafted mermaid, bare-verb labels.\n","## ⚠️ MANDATORY ENTRY POINT — Execute Before ANY Other Action\n\n**Step 1: Read schema.sql**\n\n```bash\n# ALWAYS read the schema first to understand tables, constraints, views\ncat .claude\u002Fskills\u002Faudit-flow\u002Fschema.sql\n```\n\n**Step 2: Check if DB exists — NEVER recreate**\n\n```bash\n# Check for existing database\nls -la .audit\u002Faudit.db 2>\u002Fdev\u002Fnull && echo \"DB EXISTS - DO NOT RECREATE\" || echo \"No DB - safe to init\"\n```\n\n**Step 3: If DB exists, show current state**\n\n```bash\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py list\n```\n\n### 🚫 FORBIDDEN ACTIONS\n\n| Action                                                | Why Forbidden            |\n| ----------------------------------------------------- | ------------------------ |\n| `rm .audit\u002Faudit.db`                                  | Destroys audit history   |\n| `audit.py init` when DB exists                        | Overwrites existing data |\n| `DROP TABLE`                                          | Destroys audit history   |\n| `sqlite3 .audit\u002Faudit.db \u003C schema.sql` when DB exists | Overwrites existing data |\n\n**Rule:** If `.audit\u002Faudit.db` exists, ONLY use `audit.py list`, `show`, `export`, or INSERT operations. NEVER recreate.\n\n---\n\n# Audit Flow\n\nInteractive tracing of system flows with SQLite persistence. Supports multiple named flows per session, non-linear flows (branching\u002Fmerging), and multi-format exports.\n\n## Organization Principles\n\n**Directory structure by purpose:**\n\n- **Audits\u002FDocumentation\u002FCompliance:** `docs\u002Faudits\u002F{name}-{YYYY-MM-DD}\u002F`\n- **Ideation\u002FBrainstorming:** `docs\u002Fideation\u002F{name}-{YYYY-MM-DD}.md` (single file, no subdirectory unless artifacts needed)\n- **Debugging\u002FIncident Review:** `docs\u002Faudits\u002F{name}-{YYYY-MM-DD}\u002F` (same as audits — captures evidence)\n- **Architecture Review:** `docs\u002Faudits\u002F{name}-{YYYY-MM-DD}\u002F` (same as audits — captures structural analysis)\n\n**Required files:**\n\n- INDEX.md (manifest, entry point)\n- README.md (executive summary)\n- {name}-audit.md (flow trace)\n\n**Lazy initialization:** Create subdirectories only when artifacts exist\n\n- `screenshots\u002F` `network-traces\u002F` `diagrams\u002F` `code-samples\u002F` `test-results\u002F` `evidence\u002F`\n\n**Naming:** `{audit-name}-{type}.md`\n\n## DB-First Discipline\n\n**Invariant:** SQLite = sole source of truth. Context window: volatile, compacts without notice, hallucinates state.\n\n**🚨 CRITICAL: NEVER DESTROY EXISTING DATA**\n\n- If `.audit\u002Faudit.db` exists → it contains irreplaceable audit history\n- NEVER run `init` when DB exists — use `list` to see what's there\n- NEVER delete, drop, or recreate — only append\n\n**Constraints:**\n\n| Operation   | Rule                                                                                      | Blocked rationalization              |\n| ----------- | ----------------------------------------------------------------------------------------- | ------------------------------------ |\n| **Entry**   | Read `schema.sql` FIRST, check if DB exists SECOND                                        | \"I'll just start working\"            |\n| **Init**    | ONLY if `.audit\u002Faudit.db` does NOT exist                                                  | \"Let me reinitialize to start fresh\" |\n| Schema      | Read `schema.sql` BEFORE any SQLite command — understand tables, constraints, views first | \"I know the schema from context\"     |\n| Write       | INSERT each tuple\u002Fedge\u002Ffinding before moving to the next code location                    | \"I'll batch-insert at the end\"       |\n| Read        | SELECT from DB before referencing tuple IDs, counts, or flow structure                    | \"I remember the flow so far\"         |\n| Export      | `audit.py export` only — never generate mermaid\u002Fmarkdown from context                     | \"Let me generate mermaid directly\"   |\n| Resume      | `audit.py show \u003Csession>` before any operation that references prior tuples               | \"I have the full trace in context\"   |\n| Reference   | Query tuple IDs from DB — IDs are DB-assigned, never inferred                             | \"The tuple ID should be N\"           |\n| **Default** | **When uncertain of flow state → query DB before proceeding**                             | _(any unlisted rationalization)_     |\n\n**Checkpoint:** Every 5 tuples → `audit.py show \u003Csession> \u003Cflow>`\n\n---\n\n## Interactive Workflow - ALWAYS ASK USER\n\n### 1. Session Start - Ask:\n\n```\nName: ___\nPurpose: security-audit | documentation | compliance | ideation | brainstorming | debugging | architecture-review | incident-review\nDescription: ___ (optional)\n```\n\nInitialize directory immediately. Lazily create subdirectories when artifacts are generated.\n\n### 2. Granularity - Ask:\n\n```\n[fine]   Function-level trace (~50-200 tuples)\n         Use: Security audits, debugging\n\n[coarse] Boundary-level trace (~10-30 tuples)\n         Use: Documentation, high-level flows\n\nChoose: fine \u002F coarse\n```\n\n### 3. During Trace:\n\nAsk at decision points: trace deeper? mark concern? add finding (severity)? note?\n\n### 4. On Export:\n\nAsk format: `json | yaml | md | mermaid | all`\n\nPost-export: Generate INDEX.md manifest. Organize artifacts by type. Prune empty directories.\n\n## Quick Reference\n\n| Command                              | Purpose                                        |\n| ------------------------------------ | ---------------------------------------------- |\n| `\u002Faudit-flow start`                  | New session (name, purpose, granularity)       |\n| `\u002Faudit-flow flow {name}`            | Add new flow to session                        |\n| `\u002Faudit-flow add {layer} {desc}`     | Add tuple to current flow                      |\n| `\u002Faudit-flow link {from} {to} {rel}` | Create edge (supports conditions for branches) |\n| `\u002Faudit-flow finding {desc}`         | Record finding                                 |\n| `\u002Faudit-flow show`                   | View session\u002Fflow details                      |\n| `\u002Faudit-flow export`                 | Export (json\u002Fyaml\u002Fmd\u002Fmermaid)                  |\n| `\u002Faudit-flow git-setup`              | Configure git merge\u002Fdiff drivers (once)        |\n\n**Layers:** `CODE` | `API` | `NETWORK` | `AUTH` | `DATA`\n\n**Relations:** `TRIGGERS` | `READS` | `WRITES` | `VALIDATES` | `TRANSFORMS` | `BRANCHES` | `MERGES`\n\n## Semantic Rules for Relations\n\n| Relation     | Meaning                      | Use When                                      | NOT For                       |\n| ------------ | ---------------------------- | --------------------------------------------- | ----------------------------- |\n| `TRIGGERS`   | A causes B to execute        | Function calls, event handlers, HTTP requests | Static observations           |\n| `READS`      | A consumes data from B       | Cookie reads, DB queries, config lookups      | Mutations                     |\n| `WRITES`     | A mutates data in B          | Cookie writes, DB inserts, state updates      | Read-only access              |\n| `VALIDATES`  | A checks\u002Fverifies B          | Auth checks, input validation, expiry checks  | Chaining analyst observations |\n| `TRANSFORMS` | A converts\u002Fmaps data for B   | Token exchange, response formatting           | Unrelated processing          |\n| `BRANCHES`   | A has conditional paths      | if\u002Felse, switch, error vs success             | **Must have condition label** |\n| `MERGES`     | Multiple paths converge at B | Parallel paths rejoin, error recovery         | Single-path flow              |\n\n**CRITICAL: BRANCHES Must Have Conditions.** Every BRANCHES edge requires a `condition` describing which path. Example: `BRANCHES [token expired]` vs `BRANCHES [token valid]`.\n\n## Observations vs Flow Steps\n\n**Flow steps** = things the SYSTEM DOES (function calls, data reads, network requests). Verified by tracing code.\n\n**Observations** = things the ANALYST NOTES (missing features, potential risks). Record as **findings**, not tuples.\n\n**Wrong pattern:**\n\n```\nT50 \"NO cross-tab sync\"       ← observation, not a system action\nT51 \"React state NOT shared\"  ← observation\nT50 --VALIDATES--> T51         ← chaining observations as flow\n```\n\n**Correct pattern:**\n\n```sql\n-- Record as finding instead:\nINSERT INTO findings (flow_id, session_id, severity, category, description)\nVALUES (?, ?, 'medium', 'state-management',\n        'No cross-tab sync: React state not shared across tabs');\n```\n\n**Rule:** NEVER chain observations with VALIDATES. If describing what the system DOESN'T do, use a finding.\n\n## Data Model\n\n```\nSession (audit container)\n  └── Flow (named DAG with entry point)\n       └── Tuple (node: layer + action + subject)\n            └── Edge (relation + optional condition)\n```\n\n## Storage & CLI\n\n```bash\n# Core\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py init              # Initialize DB\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py list              # List sessions\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py show \u003Csession>    # Show flows\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py show \u003Csession> \u003Cflow>  # Show flow details\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py export \u003Csession>  # Export all\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py export \u003Csession> -f \u003Cflow>  # Export one flow\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py validate \u003Csession>         # Validate flows\n\n# Git integration\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py git-setup         # Configure merge\u002Fdiff drivers (once)\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py db-merge %O %A %B # Git merge driver (auto-called)\n\n# CSV backup\u002Fportability (optional)\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py csv-export               # DB → .audit\u002Fcsv\u002F*.csv\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py csv-import               # .audit\u002Fcsv\u002F*.csv → DB\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py csv-merge \u003Ctheirs_dir>   # Merge two CSV sets\n```\n\n## Non-Linear Flows\n\n**Branching:** One tuple → multiple outgoing edges with conditions\n\n```sql\nINSERT INTO edges (from_tuple, to_tuple, relation, condition)\nVALUES (5, 6, 'BRANCHES', 'token valid'),\n       (5, 7, 'BRANCHES', 'token expired');\n```\n\n**Merging:** Multiple tuples → one tuple\n\n```sql\nINSERT INTO edges (from_tuple, to_tuple, relation)\nVALUES (6, 8, 'TRIGGERS'),\n       (9, 8, 'MERGES');  -- refresh path merges back\n```\n\n## Files\n\n- [scripts\u002Faudit.py](scripts\u002Faudit.py) - CLI for all commands (init, list, show, export, validate, db-merge, git-setup, csv-\\*)\n- [COMMANDS.md](COMMANDS.md) - Detailed SQL reference\n- [EXAMPLES.md](EXAMPLES.md) - Full examples with non-linear flows\n- [schema.sql](schema.sql) - Database schema\n- `.gitattributes` - Git merge\u002Fdiff driver config for audit.db\n\n## Git Context\n\nCapture on session start: commit hash, branch, working tree status. Include in all exports.\n\n## Mermaid Validation\n\nRun `python .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py validate \u003Csession>` before export.\n\n| Check                      | Severity | Description                                     |\n| -------------------------- | -------- | ----------------------------------------------- |\n| BRANCHES without condition | ERROR    | Every BRANCHES edge needs a condition label     |\n| Node count >= 60           | ERROR    | Split into sub-flows                            |\n| Node count >= 40           | WARN     | Consider splitting                              |\n| Orphan nodes               | WARN     | Node with no edges (disconnected)               |\n| Duplicate labels           | WARN     | Same action text without subject disambiguation |\n| No entry point             | WARN     | All nodes have incoming edges                   |\n\n**Post-export features (automatic):**\n\n- **Step numbers**: BFS topological order from entry point (`1. action`, `2. action`)\n- **Entry point**: Stadium shape with green styling\n- **Edge arrows**: `-->` solid (TRIGGERS\u002FVALIDATES\u002FTRANSFORMS\u002FBRANCHES\u002FMERGES), `-.->` dotted (READS), `==>` thick (WRITES)\n- **Observations**: Separated into dashed-border OBSERVATIONS subgraph\n- **Direction**: `--direction LR` flag for horizontal layouts\n\n## Diagram Readability Requirements\n\n**All diagrams MUST be produced by `audit.py export`.** Never hand-craft mermaid. The exporter enforces:\n\n1. **Entry point marker** — Green stadium-shape node `([label]):::entryPoint`\n2. **Step numbers** — BFS topological order: `1. action`, `2. action`, `3. action`\n3. **Legend block** — classDef styles for entryPoint, concern, observation\n4. **Observation separation** — Concern-only chains go to OBSERVATIONS subgraph, not main flow\n5. **Label safety** — HTML entities for `()`, `\"\"`, `\u003C>`, `|`, `[]` characters (auto-sanitized)\n\n**Reading flow must be obvious.** A reader opening the diagram cold must immediately see:\n\n- WHERE to start (green entry node)\n- WHAT ORDER to read (step numbers)\n- WHICH PATH is happy vs error (branch conditions on edges)\n- WHAT THE COLORS MEAN (legend)\n\n**Node label rules:**\n\n- Use concrete nouns\u002Fverbs: `handleCallback()`, `exchangeCodeForTokens()`\n- NOT bare verbs: ~~\"Configure\"~~, ~~\"Select\"~~, ~~\"Enable\"~~\n- Disambiguate duplicates: auto-suffixed with subject when action repeats\n\n**Size limits:**\n\n- 40+ nodes → warning, consider splitting\n- 60+ nodes → error, MUST split into sub-flows\n- If flow has 5+ independent sub-flows → split by purpose\n\n---\n\n## Git Workflow — Custom Merge Driver\n\n**Problem:** SQLite is binary — `git merge` can't auto-resolve `.audit\u002Faudit.db`.\n\n**Solution:** Custom git merge driver. `audit.db` stays in git (small, single file). On conflict, git calls `audit.py db-merge` to auto-merge using SQL.\n\n### One-Time Setup\n\n```bash\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py git-setup\n```\n\nThis configures (in `.git\u002Fconfig`):\n\n- **Merge driver:** `merge.sqlite-audit` — calls `audit.py db-merge %O %A %B` on conflict\n- **Diff driver:** `diff.sqlite` — `sqlite3 .dump` for readable `git diff` output\n\nAlso requires `.gitattributes` (already in repo):\n\n```\n.audit\u002Faudit.db diff=sqlite merge=sqlite-audit\n```\n\n### How It Works\n\n1. You commit `audit.db` normally — `git add .audit\u002Faudit.db && git commit`\n2. `git diff` shows SQL text (via textconv)\n3. On `git merge` with conflict → git calls the merge driver automatically\n4. Driver opens both DBs, merges sessions by name (later `updated_at` wins), remaps IDs\n5. Result written to ours — merge completes cleanly\n\n### Merge Strategy\n\n| Table    | Merge Key                               | Conflict Resolution               |\n| -------- | --------------------------------------- | --------------------------------- |\n| sessions | `name` (unique)                         | Keep later `updated_at`           |\n| flows    | `(session_name, flow_name)`             | Follow parent session winner      |\n| tuples   | Parent flow                             | All tuples from winning flow kept |\n| edges    | Both endpoint tuples                    | Kept if both endpoints survive    |\n| findings | `(session_name, category, description)` | Dedup by content                  |\n\nAll INTEGER PKs remapped sequentially. Foreign keys updated.\n\n### CSV Backup (Optional)\n\nCSV export\u002Fimport still available for portability and backup:\n\n```bash\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py csv-export   # DB → .audit\u002Fcsv\u002F*.csv (QUOTE_ALL)\npython .claude\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py csv-import   # CSV → DB (recreates from scratch)\n```\n\n---\n\n## Output Quality\n\n**Principles:**\n\n- ASCII sequence diagrams for complex flows\n- Side-by-side tables for alternatives\n- Real code from traced files with `file:line` references\n- What\u002FWhy\u002FExample pattern\n- No generic templates\n\n## Completion Checklist\n\n- [ ] Directory exists with ISO date suffix\n- [ ] INDEX.md manifest generated\n- [ ] README.md (executive summary)\n- [ ] Naming convention: `{name}-{type}.md`\n- [ ] Artifacts in typed subdirectories (lazy init)\n- [ ] Git context captured\n- [ ] Git merge driver configured (`audit.py git-setup`)\n- [ ] No orphaned files\n- [ ] Diagrams pass `audit.py validate`\n\n## Anti-Patterns\n\nFlat structure, empty directories, orphan nodes, unlabeled branches, generic identifiers, missing git context, no manifest, hand-crafted mermaid, bare-verb labels.\n",{"name":5,"license":14,"metadata":23,"description":7,"compatibility":26},{"author":24,"version":25},"ArunJRK","1.0.0","Requires Python 3.8+ (stdlib only, zero dependencies). Optional pyyaml for YAML export. Git for merge\u002Fdiff driver features.","main","2054e69da4e24a9c2d4ea00a9dfaf7b82ecaad16","tools\u002Fzebbern-claude-code-guide\u002Fskills\u002Faudit-flow","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations","2026-10-27 22:28:45",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add NobleFatherCreations\u002FWookbook --skill audit-flow",{"tool":39,"command":40},"bunx","bunx skills add NobleFatherCreations\u002FWookbook --skill audit-flow",{"tool":42,"command":43},"pnpm","pnpm dlx skills add NobleFatherCreations\u002FWookbook --skill audit-flow","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Faudit-flow\u002FSKILL.md",true,[47,53,57,63,69],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"COMMANDS.md","REFERENCE","参考文档",9428,"https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Faudit-flow\u002FCOMMANDS.md",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"EXAMPLES.md",10382,"https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Faudit-flow\u002FEXAMPLES.md",{"path":58,"resourceType":59,"resourceTypeDesc":60,"sizeBytes":61,"sourceHtmlUrl":62},"schema.sql","OTHER","其他",6902,"https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Faudit-flow\u002Fschema.sql",{"path":64,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":67,"sourceHtmlUrl":68},"scripts\u002Faudit.py","SCRIPT","脚本",60322,"https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Faudit-flow\u002Fscripts\u002Faudit.py",{"path":70,"resourceType":65,"resourceTypeDesc":66,"sizeBytes":71,"sourceHtmlUrl":72},"setup.sh",2567,"https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Faudit-flow\u002Fsetup.sh",[74,81,89,97,104,112],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":18},"01M75PT3YZYRSXP9C3WSMGB8M5","typescript-pro","Use when building TypeScript applications requiring advanced type systems, generics, or full-stack type safety. Invoke for type guards, utility types, tRPC integration, monorepo setup.","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Ftypescript-pro\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":85,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M75PSYW9K37V0KSW2DQVD6GS","tos-clause-scanner","Audit Terms of Service, user agreements, and privacy policies for consumer risks, producing a structured report that flags unfair clauses, data traps, and liability issues. Trigger when a user asks to review, audit, or analyze a ToS, privacy policy, or user agreement, or mentions specific concerns like auto-renewal or data authorization.","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Ftos-clause-scanner\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Ftos-clause-scanner\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":93,"sourceHtmlUrl":94,"categories":95,"keywords":96,"publishedAt":18},"01M75PSM0B592091AD055VWBE8","timeline-builder","Generate beautiful interactive timeline HTML pages from JSON data, with vertical, horizontal, or dual-side layouts, collapsible details, and custom colors. Ideal for project milestones, company histories, or resumes. Triggered when a user mentions 'timeline', 'history of events', 'project milestones', 'release log', or asks to visualize a chronological sequence of data.","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Ftimeline-builder\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Ftimeline-builder\u002FSKILL.md",[],[],{"skillNo":98,"name":99,"nameZh":6,"description":100,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":18},"01M75PSC75EEQKNN9J622ADPV4","three-best-practices","Three.js performance optimization and best practices guidelines. Use when writing, reviewing, or optimizing Three.js code. Triggers on tasks involving 3D scenes, WebGL\u002FWebGPU rendering, geometries, materials, textures, lighting, shaders, or TSL.","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Fthree-best-practices\u002FSKILL.md",[],[],{"skillNo":105,"name":106,"nameZh":6,"description":107,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":108,"sourceHtmlUrl":109,"categories":110,"keywords":111,"publishedAt":18},"01M75PS6QF7WM17XMPW2BJKBTC","test-suite-architect","This skill should be used when establishing comprehensive QA testing processes for any software project. Use when creating test strategies, writing test cases following Google Testing Standards, executing test plans, tracking bugs with P0-P4 classification, calculating quality metrics, or generating progress reports. Includes autonomous execution capability via master prompts and complete documentation templates for third-party QA team handoffs. Implements OWASP security testing and achieves 90% coverage targets.","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Ftest-suite-architect\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Ftest-suite-architect\u002FSKILL.md",[],[],{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":116,"sourceHtmlUrl":117,"categories":118,"keywords":119,"publishedAt":18},"01M75PS409PK46W5QD9K3W6A2M","test-driven-dev","Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions \"red-green-refactor\", wants integration tests, or asks for test-first development.","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Ftest-driven-dev\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FNobleFatherCreations\u002FWookbook\u002Fblob\u002Fmain\u002Ftools\u002Fzebbern-claude-code-guide\u002Fskills\u002Ftest-driven-dev\u002FSKILL.md",[],[]]