sensors-wrap-tool
Build a wrapper script that adapts any tool's output to the sensors CLI's default parser JSON schema, then wire it into a sensor config.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Build a wrapper script that adapts any tool's output to the sensors CLI's default parser JSON schema, then wire it into a sensor config.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Set up sensors (quality monitors) for a Python project. Detects which sensors are already configured, identifies missing ones from the supported list.
Set up basic sensors CLI configuration for a codebase. Asks user to identify an example tool or test in the codebase and configures it with the default parser.
Set up sensors (quality monitors) for a TypeScript/JavaScript/Node project. Detects which sensors are already configured, identifies missing ones from the supported list
Set up the live-dashboard project locally — install dashboard and sensor dependencies, and optionally install the sensors CLI as a global tool. Use when the user wants to get started, set up the project, or install dependencies.
| name | sensors_wrap-tool |
| description | Build a wrapper script that adapts any tool's output to the sensors CLI's default parser JSON schema, then wire it into a sensor config. |
Use this skill when the user wants to connect a tool to sensors that does not have a dedicated parser. The result is a script (wrapper or pipe filter) that emits JSON the default parser understands, plus a sensor config entry.
The parser looks for the first JSON object in stdout. Text before and after it is ignored, so print-statements and banner lines in the same output are fine.
{
"findings": [
{
"message": "Unused variable 'x'",
"severity": "error",
"file": "src/foo.py",
"line": 42,
"column": 9,
"rule": "F841",
"context": "variable is assigned but never used"
}
],
"metrics": [
{
"key": "errorCount",
"label": "Errors",
"value": 1,
"direction": "less"
}
],
"guidance": [
{
"rule": "F841",
"body": "Remove the variable or use it in your code."
}
],
"score": {
"value": 1,
"direction": "less",
"description": "Issues reported by tool"
},
"success": false,
"summary": "1 issue",
"extra": {}
}
All fields are optional. Missing ones are derived:
| Field | Derived as |
|---|---|
findings | [] |
metrics | [] |
guidance | [] |
extra | {} |
success | true when findings is empty |
label | "N issue(s)" / "No issues" |
score.value | len(findings) |
score.direction | "less" (lower is better) |
score.description | "Issues reported by tool" |
Each finding object: only message is required. Other fields (severity, file, line, column, rule, context) are optional and used for formatting and grouping. severity defaults to "error"; use "warning" or "info" for lower-severity items.
Use success, label, and score directly when the tool produces a single metric rather than a list of findings -- e.g. a coverage percentage:
{"success": false, "summary": "Coverage 72% (threshold 80%)", "score": {"value": 72, "direction": "more"}}
The metrics, guidance, and extra sections are optional and primarily useful when:
Ask the user:
If no sample is available, offer to run the command yourself (only if it is safe and read-only). You need real output before writing the parser.
Look at the sample output and determine:
extra)?Describe your reading to the user before writing any code, and confirm it is correct.
| Situation | Preferred language |
|---|---|
| Project has Python (pyproject.toml, .py files, uv/poetry) | Python |
| Project is JS/TS only, no Python available | Node.js (plain JS, no deps) |
| Simple line-count or grep transform | POSIX shell |
Use the simplest language that handles the parsing reliably. Avoid adding new runtime dependencies -- stick to the stdlib of the chosen language.
Pattern A -- Wrapper: the script calls the tool itself, captures its output, transforms it to JSON, and prints it.
command: python ./.sensors/scripts/my-tool-sensor.py
Use this when you need to capture both stdout and stderr, or when the tool exits non-zero on findings (which would otherwise confuse the runner).
Pattern B -- Pipe filter: the script reads from stdin and emits JSON.
command: my-tool --flags | python ./.sensors/scripts/my-tool-sensor.py
Use this when the tool's stdout is the only input and exit codes are not an issue.
When in doubt, prefer Pattern A -- it gives the script full control over exit codes and output capture.
Place the script in .sensors/scripts/ (create the directory if needed), and implement the parsing and creation of the JSON output.
chmod +x .sensors/scripts/<script-name>
Run it manually and confirm the JSON is valid:
# Pattern A
python ./.sensors/scripts/<script-name>.py | python -m json.tool
# Pattern B
<tool> <args> | python ./.sensors/scripts/<script-name>.py | python -m json.tool
Fix any issues before wiring it into the sensor config.
Add a runner to .sensors/<project-name>.sensors.yaml. If the file does not exist yet, check the project's .sensors/ directory for any *.sensors.yaml file and use that.
- name: <sensor-name>
parser: default
enabled: true
mode: interval
command: <full command including interpreter>
interval: <ms>
# prompt: Optional guidance for coding agents shown in sensor output
Interval guidance:
| Tool speed | Suggested interval |
|---|---|
| Fast (< 2s) | 10 000 ms |
| Medium (2-10s) | 15 000 -- 30 000 ms |
| Slow (> 10s) | 60 000 ms |
We want the intervals in the config file to be unevenly spread, so they don't frequently run at the same time.