This skill helps you write, validate, and troubleshoot osquery queries against platform schemas to improve accuracy and performance.
npx playbooks add skill tsale/awesome-dfir-skills --skill osquery-helper
Help users with all aspects of osquery query work:
All work is grounded in the tables and columns defined in the provided schema files for the specified EDR platform.
---
Schema files are located in resources/ and named by EDR platform: <platform>_osquery_schema.spec
standard_osquery_schema.spec — Baseline vanilla osquery (default when no platform specified)bitdefender_, kolide_, crowdstrike_, sentinelone_, carbonblack_To discover available platforms:
ls resources/*_osquery_schema.spec 2>/dev/null || ls resources/*.spec
Schema files use one of two formats to indicate OS compatibility:
platforms([...]) fieldtable_name("<table_name>")
description("Brief description.")
schema([
Column("column_name", TYPE, "Column description")
])
implementation("<table_name>@genTable")
platforms(["darwin", "linux", "windows"])
#platform marker before table definitionsA platform marker on its own line applies to all tables until the next marker:
#darwin
table_name("<mac_only_table>")
...
#linwin
table_name("<linux_windows_table>")
...
| Marker | Platforms |
|--------|-----------|
| #darwin | macOS only |
| #linux | Linux only |
| #windows | Windows only |
| #linwin | Linux and Windows |
| #macwin | macOS and Windows |
| #posix | macOS, Linux, FreeBSD |
| #sleuthkit | macOS, Linux (requires The Sleuth Kit) |
| #utility | Cross-platform utility tables |
| #cross-platform | All supported platforms |
---
The schema files are large. Always follow the workflow below to extract table definitions.
Helper scripts are provided in scripts/ to simplify complex operations:
scripts/detect-format.sh - Determines schema formatscripts/extract-table.sh - Extracts complete table definitions# Search by table name keyword
grep -i 'table_name(".*<keyword>' "$SCHEMA_FILE"
# Search descriptions for concepts
grep -i 'description(".*<concept>' "$SCHEMA_FILE"
Use the extraction script to get the complete table definition:
bash scripts/extract-table.sh <schema_file> <table_name>
Example:
bash scripts/extract-table.sh resources/standard_osquery_schema.spec processes
The script automatically:
#platform marker for Format 2 schemasIf you need to check the format manually:
bash scripts/detect-format.sh <schema_file>
# Returns: "platforms_array" or "platform_markers"
schema([...]) blockplatforms([...]) field or preceding #platform marker---
WHERE clauses, use LIMIT for exploration, avoid SELECT *, minimize JOINs'<path_to_file>', '<username>', '<timestamp>', '<ip_address>'---
Ask user or check context. Default to standard_osquery_schema.spec if unspecified.
Writing new query? Validating? Troubleshooting? What data is needed?
Use grep to find tables, then bash scripts/extract-table.sh to get full definitions. Verify columns and OS compatibility from the extracted output.
Use only verified tables/columns. Add WHERE clauses and LIMIT for performance.
Include:
Weekly roundup of top Claude Code skills, MCP servers, and AI coding tips.