Community寫作與編輯github.com

Jamie-BitFlight/data-exploration

在探索未知的結構化資料檔案時,使用 dasel v3 來發現 schema、列出鍵名、尋找巢狀值、對陣列取樣,並識別 JSON、YAML、TOML、XML、CSV、HCL、INI 等格式中的資料型別。

data-exploration 是什麼?

這個技能專為開發者與 AI 代理設計,用於探索未知的結構化資料檔案。它利用 dasel v3 這套強大的通用資料查詢工具,支援 JSON、YAML、TOML、XML、CSV、HCL 和 INI 等熱門格式。技能提供了一套分步驟的探索流程,從格式識別、頂層鍵列舉,到巢狀鍵發現、陣列取樣與型別檢查,讓使用者能系統性地了解任何文件的結構。此外,還包含了進階的搜尋、計數、去重與遞迴下降等模式,適合用於大型或複雜的設定檔與資料集。這個技能適用於 Claude Code、Cursor 或任何支援 shell 指令的 AI 代理環境,能顯著提升處理未知資料的效率與準確性。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Jamie-BitFlight/claude_skills/tree/main/plugins/dasel/skills/data-exploration

Installed? Explore more 寫作與編輯 skills: steipete/notion, langchain-ai/langchain, bytedance/podcast-generation · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

使用 Dasel v3 進行資料探索

<when_to_use>

當下列情況發生時,請啟用此技能:

  • 探索不熟悉的結構化資料檔案(設定檔、API 回應、資料集)
  • 在修改文件之前,先發現其 schema 或形狀
  • 調查巢狀的設定結構(Kubernetes 清單、CI 管線、套件檔案)
  • 對大型陣列或深度巢狀物件進行取樣,以瞭解內容
  • 在進行轉換或提取前,先識別資料型別

</when_to_use>

支援的格式

Dasel 會根據副檔名自動偵測格式。當從 stdin 讀取或副檔名不明確時,可使用 -i <format> 來覆寫。

格式識別碼:json、yaml、toml、xml、csv、hcl、ini

通用探索流程

遇到未知的結構化資料檔案時,請依以下順序進行。每個步驟都能縮小範圍。

步驟 1 — 格式偵測

Dasel 會根據副檔名推斷格式。對於 stdin 或非標準副檔名,請明確指定:

cat mystery_file | dasel -i json 'keys($this)'

步驟 2 — 頂層鍵

cat config.yaml | dasel -i yaml 'keys($this)'

輸出:頂層鍵名稱的陣列。這永遠是第一個探索指令。

步驟 3 — 結構預覽

對於小檔案(設定檔、清單),可直接輸出完整文件:

cat config.yaml | dasel -i yaml

對於大型檔案,請跳到步驟 4。

步驟 4 — 巢狀鍵發現

一層一層地深入:

cat config.yaml | dasel -i yaml 'server'
cat config.yaml | dasel -i yaml 'keys(server)'
cat config.yaml | dasel -i yaml 'keys(server.logging)'

跨所有深度的遞迴鍵發現:

cat config.yaml | dasel -i yaml '..keys($this)'

步驟 5 — 陣列取樣

預覽前幾個元素,不必載入整個陣列:

cat data.json | dasel -i json 'items[0:3]'

單一元素檢查:

cat data.json | dasel -i json 'items[0]'

步驟 6 — 型別檢查

判斷任何節點的型別:

cat data.json | dasel -i json 'typeOf(settings)'
cat data.json | dasel -i json 'typeOf(items[0].count)'

回傳值:"string"、"array"、"bool"、"null"、"int"、"float"

步驟 7 — 值提取

確定路徑後,提取特定值:

cat config.yaml | dasel -i yaml 'database.connection.host'
cat data.json | dasel -i json 'users[0].email'

探索模式

廣度優先探索

從根節點開始,在深入下一層之前,先列舉每一層的鍵:

cat file.json | dasel -i json 'keys($this)'           # 第 0 層
cat file.json | dasel -i json 'keys(metadata)'         # 第 1 層
cat file.json | dasel -i json 'keys(metadata.labels)'  # 第 2 層

基於搜尋的探索(大型檔案)

當檔案太大而不適合手動遍歷時,可使用帶條件的 search():

# 尋找所有包含特定鍵的物件
cat data.json | dasel -i json 'search(has("email"))'

# 尋找同時包含 "id" 與 "name" 鍵的物件
cat data.json | dasel -i json 'search(has("id") && has("name"))'

# 尋找值符合條件的節點
cat data.json | dasel -i json 'search($this == 42)'

計算元素數量

cat data.json | dasel -i json 'len(items)'
cat data.json | dasel -i json 'len(keys($this))'

唯一值發現

從所有陣列元素中提取某個欄位,然後在 shell 中進行去重:

cat data.json | dasel -i json 'items.map(category)' | dasel -i json '$this...' | sort -u

遞迴下降

在任意深度尋找特定鍵名的所有值:

cat data.json | dasel -i json '..name'

取得每個巢狀陣列的第一個元素:

cat data.json | dasel -i json '..[0]'

特定格式的食譜

如需針對各格式的詳細探索指令,請參閱 特定格式食譜。

參考資料

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

Jamie-BitFlight/agentskill-kaizen-meta-docs

Agentskill kaizen plugin documentation index. Load when needing to read about cross-platform notes, improvement plans, or DuckDB integration.

Jamie-BitFlight/bash-51-features

Bash 5.1 release features and improvements with practical examples. Use when working with Bash 5.1 features, epoch time variables, redirection enhancements, or when user asks about Bash 5.1 changes, new features, or version-specific capabilities.

Jamie-BitFlight/bash-52-features

Bash 5.2 release features and improvements with practical examples. Use when working with Bash 5.2 features, variable handling enhancements, readline improvements, or when user asks about Bash 5.2 changes, new features, or version-specific capabilities.

Jamie-BitFlight/bash-53-features

Bash 5.3 release features and improvements with practical examples. Use when working with Bash 5.3 features, new command substitution, GLOBSORT, loadable builtins, or when user asks about Bash 5.3 changes, new features, or version-specific capabilities.

Jamie-BitFlight/bash-development

This skill should be used when the user asks to "write a bash script", "create a shell script", "implement bash function", "parse arguments in bash", "handle errors in bash", or mentions bash development, shell scripting, script templates, or modern bash patterns.

Jamie-BitFlight/bash-lint

This skill should be used when the user asks to "lint bash script", "run shellcheck", "format shell script", "use shfmt", "fix shellcheck errors", or mentions shell script linting, formatting, code quality, or pre-commit hooks for bash.

Jamie-BitFlight/bash-logging

This skill should be used when the user asks to "add logging to bash script", "colorize output", "implement log levels", "CI/CD sections", "terminal colors in bash", or mentions logging functions, emoji output, collapsible CI sections, or shlocksmith.

Jamie-BitFlight/bash-portability

This skill should be used when the user asks about "POSIX compatibility", "portable shell scripts", "cross-shell compatibility", "bashisms", "shebang selection", or mentions writing scripts that work on different shells (bash, sh, dash, zsh) or different systems.

Jamie-BitFlight/bash-testing

This skill should be used when the user asks to "test bash script", "write shell tests", "use shunit2", "use shellspec", "create test suite for bash", or mentions unit testing, test frameworks, mocking, or test-driven development for shell scripts.

Jamie-BitFlight/brainstorming-skill

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or when users request help with ideation, marketing, and strategic planning. Explores user intent, requirements, and design before implementation using research-validated prompt patterns.

Jamie-BitFlight/clang-format

Configure clang-format code formatting. Use when: user mentions clang-format or .clang-format, analyzing code style/patterns, creating/modifying formatting config, troubleshooting formatting, brace styles/indentation/spacing/alignment/pointer alignment, or codifying conventions.

Jamie-BitFlight/commitlint

When setting up commit message validation for a project. When project has commitlint.config.js or .commitlintrc files. When configuring CI/CD to enforce commit format. When extracting commit rules for LLM prompt generation. When debugging commit message rejection errors.

Jamie-BitFlight/conventional-commits

When writing a git commit message. When task completes and changes need committing. When project uses semantic-release, commitizen, git-cliff. When choosing between feat/fix/chore/docs types. When indicating breaking changes. When generating changelogs from commit history.

Jamie-BitFlight/dasel-reference

Use when querying, modifying, or converting JSON, YAML, TOML, XML, CSV, HCL, or INI with dasel v3. Complete reference for selectors, functions, conditionals, variables, spread operator, type casting, and format-specific patterns.

Jamie-BitFlight/data-transformation

Use when modifying, converting, or transforming structured data with dasel v3 — in-place mutations, format conversion, batch operations, array manipulation, object construction, and merge patterns across JSON, YAML, TOML, XML, CSV, HCL, INI

Jamie-BitFlight/delegate

Decompose substantive work into phases, dispatch each phase to a sub-agent, and adjudicate what comes back. Use whenever a request asks for implementation, investigation, a fix, a review, or any change to files — including small ones — and whenever you are about to read source or run a diagnostic yourself instead of handing it off. Also use when a report from a sub-agent needs judging, when a phase needs re-dispatching, or when a user names one instance of a pattern. Does not apply when your own prompt begins "Your ROLE_TYPE is sub-agent." — then follow references/sub-agent-contract.md instead.

Jamie-BitFlight/enterprise-hibernate-hbm

Dasel v3 query patterns for Hibernate .hbm.xml mapping files — entity-table binding, Java property-to-column extraction, one-to-many set/list/bag relationship tracing, many-to-one foreign key discovery, batch scanning across 60+ HBM files. Use when querying Hibernate ORM class mappings, extracting schema metadata from Java persistence layer, or auditing entity-column relationships in enterprise legacy codebases.

Jamie-BitFlight/enterprise-installanywhere

Dasel v3 query patterns for InstallAnywhere .iap_xml installer definitions — use when querying action sequences, discovering variables, resolving platform conditions, navigating panels, or comparing installer variants. Files are 2.5+ MB, 65,000+ lines — too large for context reads, requires structural dasel queries.

Jamie-BitFlight/enterprise-maven-pom

Dasel v3 selector patterns for Maven POM XML files — use when querying dependency versions, filtering by groupId or scope, extracting module hierarchy from parent POMs, or detecting version conflicts across enterprise multi-module Java projects. Load this skill when working with pom.xml files using dasel.

Jamie-BitFlight/enterprise-spring-xml

Dasel v3 selectors for Spring bean factory XML — use when querying any Spring ApplicationContext XML for bean discovery, dependency wiring, JMS destination mapping, property injection extraction, or cross-bean reference tracing. Load this skill before writing dasel selectors against Spring bean XML files (applicationContext.xml, *_beans.xml, spring-*.xml).

相關技能