Logo Audit Flow

Audit Flow

Cộng đồngPhổ biến
zebbern
audit-flow

Theo dõi tương tác luồng hệ thống qua các lớp CODE, API, AUTH, DATA, NETWORK, lưu trữ bằng SQLite và xuất Mermaid. Dùng cho kiểm toán bảo mật, tài liệu tuân thủ, theo dõi luồng, lên ý tưởng tính năng, động não, gỡ lỗi, đánh giá kiến trúc hoặc họp rút kinh nghiệm sau sự cố. Kích hoạt với các yêu cầu kiểm toán, theo dõi luồng, lập tài liệu luồng, đánh giá bảo mật, gỡ lỗi luồng, động não, đánh giá kiến trúc, rút kinh nghiệm sau sự cố hoặc đánh giá sự cố.

Add to TypingMind

Tổng quan

Nhà phát hànhzebbern
Kho mãclaude-code-guide
Tên kỹ năngaudit-flow
Sao
4.6K
Bản fork
464
Tệp đi kèm
5
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 5 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được zebbern công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Audit Flow trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/zebbern/claude-code-guide/tree/main/skills/audit-flow
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/zebbern/claude-code-guide.git /tmp/claude-code-guide
mkdir -p .claude/skills
cp -r /tmp/claude-code-guide/skills/audit-flow .claude/skills/audit-flow
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Audit Flow trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Audit Flow ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Audit Flow với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

⚠️ MANDATORY ENTRY POINT — Execute Before ANY Other Action

Step 1: Read schema.sql

bash
# ALWAYS read the schema first to understand tables, constraints, views
cat .claude/skills/audit-flow/schema.sql

Step 2: Check if DB exists — NEVER recreate

bash
# Check for existing database
ls -la .audit/audit.db 2>/dev/null && echo "DB EXISTS - DO NOT RECREATE" || echo "No DB - safe to init"

Step 3: If DB exists, show current state

bash
python .claude/skills/audit-flow/scripts/audit.py list

🚫 FORBIDDEN ACTIONS

ActionWhy Forbidden
rm .audit/audit.dbDestroys audit history
audit.py init when DB existsOverwrites existing data
DROP TABLEDestroys audit history
sqlite3 .audit/audit.db < schema.sql when DB existsOverwrites existing data

Rule: If .audit/audit.db exists, ONLY use audit.py list, show, export, or INSERT operations. NEVER recreate.


Audit Flow

Interactive tracing of system flows with SQLite persistence. Supports multiple named flows per session, non-linear flows (branching/merging), and multi-format exports.

Organization Principles

Directory structure by purpose:

  • Audits/Documentation/Compliance: docs/audits/{name}-{YYYY-MM-DD}/
  • Ideation/Brainstorming: docs/ideation/{name}-{YYYY-MM-DD}.md (single file, no subdirectory unless artifacts needed)
  • Debugging/Incident Review: docs/audits/{name}-{YYYY-MM-DD}/ (same as audits — captures evidence)
  • Architecture Review: docs/audits/{name}-{YYYY-MM-DD}/ (same as audits — captures structural analysis)

Required files:

  • INDEX.md (manifest, entry point)
  • README.md (executive summary)
  • {name}-audit.md (flow trace)

Lazy initialization: Create subdirectories only when artifacts exist

  • screenshots/ network-traces/ diagrams/ code-samples/ test-results/ evidence/

Naming: {audit-name}-{type}.md

DB-First Discipline

Invariant: SQLite = sole source of truth. Context window: volatile, compacts without notice, hallucinates state.

🚨 CRITICAL: NEVER DESTROY EXISTING DATA

  • If .audit/audit.db exists → it contains irreplaceable audit history
  • NEVER run init when DB exists — use list to see what's there
  • NEVER delete, drop, or recreate — only append

Constraints:

OperationRuleBlocked rationalization
EntryRead schema.sql FIRST, check if DB exists SECOND"I'll just start working"
InitONLY if .audit/audit.db does NOT exist"Let me reinitialize to start fresh"
SchemaRead schema.sql BEFORE any SQLite command — understand tables, constraints, views first"I know the schema from context"
WriteINSERT each tuple/edge/finding before moving to the next code location"I'll batch-insert at the end"
ReadSELECT from DB before referencing tuple IDs, counts, or flow structure"I remember the flow so far"
Exportaudit.py export only — never generate mermaid/markdown from context"Let me generate mermaid directly"
Resumeaudit.py show <session> before any operation that references prior tuples"I have the full trace in context"
ReferenceQuery tuple IDs from DB — IDs are DB-assigned, never inferred"The tuple ID should be N"
DefaultWhen uncertain of flow state → query DB before proceeding(any unlisted rationalization)

Checkpoint: Every 5 tuples → audit.py show <session> <flow>


Interactive Workflow - ALWAYS ASK USER

1. Session Start - Ask:

Name: ___
Purpose: security-audit | documentation | compliance | ideation | brainstorming | debugging | architecture-review | incident-review
Description: ___ (optional)

Initialize directory immediately. Lazily create subdirectories when artifacts are generated.

2. Granularity - Ask:

[fine]   Function-level trace (~50-200 tuples)
         Use: Security audits, debugging

[coarse] Boundary-level trace (~10-30 tuples)
         Use: Documentation, high-level flows

Choose: fine / coarse

3. During Trace:

Ask at decision points: trace deeper? mark concern? add finding (severity)? note?

4. On Export:

Ask format: json | yaml | md | mermaid | all

Post-export: Generate INDEX.md manifest. Organize artifacts by type. Prune empty directories.

Quick Reference

CommandPurpose
/audit-flow startNew session (name, purpose, granularity)
/audit-flow flow {name}Add new flow to session
/audit-flow add {layer} {desc}Add tuple to current flow
/audit-flow link {from} {to} {rel}Create edge (supports conditions for branches)
/audit-flow finding {desc}Record finding
/audit-flow showView session/flow details
/audit-flow exportExport (json/yaml/md/mermaid)
/audit-flow git-setupConfigure git merge/diff drivers (once)

Layers: CODE | API | NETWORK | AUTH | DATA

Relations: TRIGGERS | READS | WRITES | VALIDATES | TRANSFORMS | BRANCHES | MERGES

Semantic Rules for Relations

RelationMeaningUse WhenNOT For
TRIGGERSA causes B to executeFunction calls, event handlers, HTTP requestsStatic observations
READSA consumes data from BCookie reads, DB queries, config lookupsMutations
WRITESA mutates data in BCookie writes, DB inserts, state updatesRead-only access
VALIDATESA checks/verifies BAuth checks, input validation, expiry checksChaining analyst observations
TRANSFORMSA converts/maps data for BToken exchange, response formattingUnrelated processing
BRANCHESA has conditional pathsif/else, switch, error vs successMust have condition label
MERGESMultiple paths converge at BParallel paths rejoin, error recoverySingle-path flow

CRITICAL: BRANCHES Must Have Conditions. Every BRANCHES edge requires a condition describing which path. Example: BRANCHES [token expired] vs BRANCHES [token valid].

Observations vs Flow Steps

Flow steps = things the SYSTEM DOES (function calls, data reads, network requests). Verified by tracing code.

Observations = things the ANALYST NOTES (missing features, potential risks). Record as findings, not tuples.

Wrong pattern:

T50 "NO cross-tab sync"       ← observation, not a system action
T51 "React state NOT shared"  ← observation
T50 --VALIDATES--> T51         ← chaining observations as flow

Correct pattern:

sql
-- Record as finding instead:
INSERT INTO findings (flow_id, session_id, severity, category, description)
VALUES (?, ?, 'medium', 'state-management',
        'No cross-tab sync: React state not shared across tabs');

Rule: NEVER chain observations with VALIDATES. If describing what the system DOESN'T do, use a finding.

Data Model

Session (audit container)
  └── Flow (named DAG with entry point)
       └── Tuple (node: layer + action + subject)
            └── Edge (relation + optional condition)

Storage & CLI

bash
# Core
python .claude/skills/audit-flow/scripts/audit.py init              # Initialize DB
python .claude/skills/audit-flow/scripts/audit.py list              # List sessions
python .claude/skills/audit-flow/scripts/audit.py show <session>    # Show flows
python .claude/skills/audit-flow/scripts/audit.py show <session> <flow>  # Show flow details
python .claude/skills/audit-flow/scripts/audit.py export <session>  # Export all
python .claude/skills/audit-flow/scripts/audit.py export <session> -f <flow>  # Export one flow
python .claude/skills/audit-flow/scripts/audit.py validate <session>         # Validate flows

# Git integration
python .claude/skills/audit-flow/scripts/audit.py git-setup         # Configure merge/diff drivers (once)
python .claude/skills/audit-flow/scripts/audit.py db-merge %O %A %B # Git merge driver (auto-called)

# CSV backup/portability (optional)
python .claude/skills/audit-flow/scripts/audit.py csv-export               # DB → .audit/csv/*.csv
python .claude/skills/audit-flow/scripts/audit.py csv-import               # .audit/csv/*.csv → DB
python .claude/skills/audit-flow/scripts/audit.py csv-merge <theirs_dir>   # Merge two CSV sets

Non-Linear Flows

Branching: One tuple → multiple outgoing edges with conditions

sql
INSERT INTO edges (from_tuple, to_tuple, relation, condition)
VALUES (5, 6, 'BRANCHES', 'token valid'),
       (5, 7, 'BRANCHES', 'token expired');

Merging: Multiple tuples → one tuple

sql
INSERT INTO edges (from_tuple, to_tuple, relation)
VALUES (6, 8, 'TRIGGERS'),
       (9, 8, 'MERGES');  -- refresh path merges back

Files

  • scripts/audit.py - CLI for all commands (init, list, show, export, validate, db-merge, git-setup, csv-*)
  • COMMANDS.md - Detailed SQL reference
  • EXAMPLES.md - Full examples with non-linear flows
  • schema.sql - Database schema
  • .gitattributes - Git merge/diff driver config for audit.db

Git Context

Capture on session start: commit hash, branch, working tree status. Include in all exports.

Mermaid Validation

Run python .claude/skills/audit-flow/scripts/audit.py validate <session> before export.

CheckSeverityDescription
BRANCHES without conditionERROREvery BRANCHES edge needs a condition label
Node count >= 60ERRORSplit into sub-flows
Node count >= 40WARNConsider splitting
Orphan nodesWARNNode with no edges (disconnected)
Duplicate labelsWARNSame action text without subject disambiguation
No entry pointWARNAll nodes have incoming edges

Post-export features (automatic):

  • Step numbers: BFS topological order from entry point (1. action, 2. action)
  • Entry point: Stadium shape with green styling
  • Edge arrows: --> solid (TRIGGERS/VALIDATES/TRANSFORMS/BRANCHES/MERGES), -.-> dotted (READS), ==> thick (WRITES)
  • Observations: Separated into dashed-border OBSERVATIONS subgraph
  • Direction: --direction LR flag for horizontal layouts

Diagram Readability Requirements

All diagrams MUST be produced by audit.py export. Never hand-craft mermaid. The exporter enforces:

  1. Entry point marker — Green stadium-shape node ([label]):::entryPoint
  2. Step numbers — BFS topological order: 1. action, 2. action, 3. action
  3. Legend block — classDef styles for entryPoint, concern, observation
  4. Observation separation — Concern-only chains go to OBSERVATIONS subgraph, not main flow
  5. Label safety — HTML entities for (), "", <>, |, [] characters (auto-sanitized)

Reading flow must be obvious. A reader opening the diagram cold must immediately see:

  • WHERE to start (green entry node)
  • WHAT ORDER to read (step numbers)
  • WHICH PATH is happy vs error (branch conditions on edges)
  • WHAT THE COLORS MEAN (legend)

Node label rules:

  • Use concrete nouns/verbs: handleCallback(), exchangeCodeForTokens()
  • NOT bare verbs: "Configure", "Select", "Enable"
  • Disambiguate duplicates: auto-suffixed with subject when action repeats

Size limits:

  • 40+ nodes → warning, consider splitting
  • 60+ nodes → error, MUST split into sub-flows
  • If flow has 5+ independent sub-flows → split by purpose

Git Workflow — Custom Merge Driver

Problem: SQLite is binary — git merge can't auto-resolve .audit/audit.db.

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.

One-Time Setup

bash
python .claude/skills/audit-flow/scripts/audit.py git-setup

This configures (in .git/config):

  • Merge driver: merge.sqlite-audit — calls audit.py db-merge %O %A %B on conflict
  • Diff driver: diff.sqlite — sqlite3 .dump for readable git diff output

Also requires .gitattributes (already in repo):

.audit/audit.db diff=sqlite merge=sqlite-audit

How It Works

  1. You commit audit.db normally — git add .audit/audit.db && git commit
  2. git diff shows SQL text (via textconv)
  3. On git merge with conflict → git calls the merge driver automatically
  4. Driver opens both DBs, merges sessions by name (later updated_at wins), remaps IDs
  5. Result written to ours — merge completes cleanly

Merge Strategy

TableMerge KeyConflict Resolution
sessionsname (unique)Keep later updated_at
flows(session_name, flow_name)Follow parent session winner
tuplesParent flowAll tuples from winning flow kept
edgesBoth endpoint tuplesKept if both endpoints survive
findings(session_name, category, description)Dedup by content

All INTEGER PKs remapped sequentially. Foreign keys updated.

CSV Backup (Optional)

CSV export/import still available for portability and backup:

bash
python .claude/skills/audit-flow/scripts/audit.py csv-export   # DB → .audit/csv/*.csv (QUOTE_ALL)
python .claude/skills/audit-flow/scripts/audit.py csv-import   # CSV → DB (recreates from scratch)

Output Quality

Principles:

  • ASCII sequence diagrams for complex flows
  • Side-by-side tables for alternatives
  • Real code from traced files with file:line references
  • What/Why/Example pattern
  • No generic templates

Completion Checklist

  • Directory exists with ISO date suffix
  • INDEX.md manifest generated
  • README.md (executive summary)
  • Naming convention: {name}-{type}.md
  • Artifacts in typed subdirectories (lazy init)
  • Git context captured
  • Git merge driver configured (audit.py git-setup)
  • No orphaned files
  • Diagrams pass audit.py validate

Anti-Patterns

Flat structure, empty directories, orphan nodes, unlabeled branches, generic identifiers, missing git context, no manifest, hand-crafted mermaid, bare-verb labels.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Audit Flow làm được gì?

Theo dõi tương tác luồng hệ thống qua các lớp CODE, API, AUTH, DATA, NETWORK, lưu trữ bằng SQLite và xuất Mermaid. Dùng cho kiểm toán bảo mật, tài liệu tuân thủ, theo dõi luồng, lên ý tưởng tính năng, động não, gỡ lỗi, đánh giá kiến trúc hoặc họp rút kinh nghiệm sau sự cố. Kích hoạt với các yêu cầu kiểm toán, theo dõi luồng, lập tài liệu luồng, đánh giá bảo mật, gỡ lỗi luồng, động não, đánh giá kiến trúc, rút kinh nghiệm sau sự cố hoặc đánh giá sự cố.

Vì sao nên dùng Audit Flow trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Audit Flow là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Audit Flow trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/zebbern/claude-code-guide/tree/main/skills/audit-flow. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Audit Flow?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Audit Flow với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Audit Flow với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Audit Flow có miễn phí không?

Có. Kỹ năng này được zebbern phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇