From fb818428252370aeb41c89af3262f61098b716fb Mon Sep 17 00:00:00 2001 From: Pierre Penhouet Date: Tue, 1 Dec 2026 14:48:50 +0100 Subject: [PATCH 1/5] docs: add instructions for AI agents working on playbook templates - AGENTS.md: what this public repository holds, rules for every change (no secrets or customer data, files that are live product content), and a pointer to the playbook template skill. CLAUDE.md links to it. - .agents/skills/playbook-template/SKILL.md: start from a playbook that ran and export it with the API key from the environment, remove every value of the user's environment, complete the file, run the check, review what no static check sees (trigger, event fields, events[0], append in loops, dead branches), then open the pull request. Also how to review a template pull request. .claude/skills links to .agents/skills, as in other Sekoia repositories. - playbooks/README.md: tell contributors that their agent finds these instructions. Co-Authored-By: Claude Opus 5.5 --- .agents/skills/playbook-template/SKILL.md | 83 +++++++++++++++++++++++ .claude/skills | 1 + AGENTS.md | 15 ++++ CLAUDE.md | 1 + playbooks/README.md | 2 + 5 files changed, 102 insertions(+) create mode 100644 .agents/skills/playbook-template/SKILL.md create mode 120000 .claude/skills create mode 100644 AGENTS.md create mode 120000 CLAUDE.md diff --git a/.agents/skills/playbook-template/SKILL.md b/.agents/skills/playbook-template/SKILL.md new file mode 100644 index 0000000..54889b5 --- /dev/null +++ b/.agents/skills/playbook-template/SKILL.md @@ -0,0 +1,83 @@ +--- +name: playbook-template +description: Use when adding, changing, exporting, checking or reviewing a Sekoia playbook template under playbooks/templates/ in SEKOIA-IO/Community, or when a user wants to share one of their Sekoia playbooks as a template. +--- + +# Sekoia playbook templates + +Every file in `playbooks/templates/` is published in the Sekoia playbook editor (**Start from a template** on a new playbook) for every customer, with the next release of the Sekoia playbook service. A template the platform refuses never appears, and an existing template that stops passing its validation is removed from the editor. Work as if each change ships to production. + +The human guide is [`playbooks/README.md`](../../../playbooks/README.md). This file adds what an agent must do and must not do. + +## 1. Start from a playbook that ran + +A template is a playbook that worked in a real Sekoia community. Do not write one from scratch. + +- Ask the user for the playbook UUID: the last part of its address in Sekoia, `.../playbooks/`. +- Ask which region their community is in. The API URL is in `playbooks/tools/export_template.py` (FRA1 is the default). +- Export it. The API key must come from the environment, with the "View playbooks" permission: + + ```bash + python playbooks/tools/export_template.py .json [--base-url ] + ``` + + Ask the user to set `SEKOIA_API_KEY` in their shell (`read -s SEKOIA_API_KEY && export SEKOIA_API_KEY`). Never write the key in a command, a file or a script. +- If the user only has an idea, do not invent a template: suggest an issue with the "Playbook template idea" form. +- If the user asks you to edit an existing template, keep its `uuid`: the platform updates the published template in place. A new template always gets a new `uuid` (the export script sets one). + +Never type an `action_uuid`, `trigger_uuid` or `module_uuid` from memory. They come from the export, or from the manifests of [automation-library](https://github.com/SEKOIA-IO/automation-library) (`/manifest.json`, `action_*.json`, `trigger_*.json`) on the `production` branch. + +## 2. Remove everything that belongs to the user's environment + +The export removes the accounts (module and trigger configurations). Look for the rest in the arguments, conditions and store operators, and replace each value with `_to_update_`: + +- URLs and host names (`atlassian.net`, `webhook.office.com`, `hooks.slack.com`, internal domains); +- identifiers of the community: IOC collection ids (`ioc-collection--...`), asset, rule, case or community UUIDs, project keys; +- email addresses, user or team names, customer or company names; +- anything that looks like a secret, even partly. + +Then say in the description which values the reader must change. Show the user every value you replaced. + +## 3. Complete the file + +- `name`: what the playbook does, e.g. "Enrich an alert with AbuseIPDB". Not "AbuseIPDB playbook". +- `description`: what it does, then what it needs (integration and its account, a licence if any, the event fields it reads, the values to change). +- `tags`: reuse the tags of the other templates, with the same spelling (they are case sensitive), plus the vendor name. +- File name: lower case with underscores, ending in `.json`. +- Do not create or edit `playbooks/templates/playbooks.json`: the platform does not read it any more. + +## 4. Check what the platform checks, and what it cannot + +Run the check from the repository root: + +```bash +pip install "jsonschema==4.26.0" "jinja2==3.1.6" +git clone --depth 1 --filter=blob:none --sparse --branch production \ + https://github.com/SEKOIA-IO/automation-library.git /tmp/automation-library +git -C /tmp/automation-library sparse-checkout set --no-cone '/*/manifest.json' '/*/action_*.json' '/*/trigger_*.json' +python playbooks/tools/check_templates.py --automation-library /tmp/automation-library --changed playbooks/templates/.json +``` + +- Fix every error (`x`). Each one is refused by the platform or makes every run fail. +- Read every warning (`!`). Fix it unless you can explain why it is wrong. A field that an action "does not declare in its result" may still be returned by the integration: check the action's documentation before changing it. +- Never silence the check, edit `playbooks/tools/` to make a template pass, or change other templates in the same pull request. + +Then review what no static check sees. Read the playbook as a run would: + +- **The trigger fits the use case.** A manual trigger for an analyst action, "Alert Created" for something that must run on every alert. An expensive step (sandbox, paid API) on every alert needs a condition before it. +- **The data exists.** Event fields must be fields of the Sekoia event taxonomy that the expected intakes produce (`source.ip`, `url.original`, `file.hash.sha256`...). A field no intake produces makes every run fail. +- **All the data is read.** `$.events[0]` reads the first event only. To use every value of a field across the alert's events, use the action "Get Event Field Common Values" and `jsonpath("$.fields[*].common_values[*]['name']", True)`, as the IOC collection templates do. +- **Loops keep their results.** A store operator inside a foreach must `append`; `set` keeps only the last value. +- **Every branch ends somewhere useful.** No placeholder node that does nothing, and no branch named after an output the action does not have. +- **The description matches the playbook.** + +## 5. Open the pull request + +- One template, or one coherent set for the same integration, per pull request. +- Fill in the pull request checklist. Ask the user for a screenshot of the playbook or of a successful run: you cannot produce it. +- Write the description for a reviewer: the use case, who it helps, what the reader must configure. +- Before committing, search the diff once more for secrets and environment values (section 2). + +## 6. When asked to review a template pull request + +Run the check on the changed files, then go through section 2 and the review list of section 4, and report each problem with the node id and name, what happens at run time, and the fix. Distinguish what blocks the merge (errors, secrets, environment values, wrong behaviour) from suggestions. diff --git a/.claude/skills b/.claude/skills new file mode 120000 index 0000000..2b7a412 --- /dev/null +++ b/.claude/skills @@ -0,0 +1 @@ +../.agents/skills \ No newline at end of file diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..dfe0097 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,15 @@ +# Instructions for AI agents working on SEKOIA-IO/Community + +This public repository holds content shared with the users of the Sekoia platform: playbook templates, detection rules (Sigma, YARA), hunting queries, IOCs, reports, dashboards and scripts. Anyone can read it and open a pull request. + +## Rules for every change + +- **It is public.** Never write an API key, a token, a password, a webhook URL, an internal host name, a customer name or customer data in a file, a commit, a pull request or an issue. Read secrets from environment variables (for Sekoia: `SEKOIA_API_KEY`) and never print them. If the user pastes a secret in the conversation, do not reuse it in a file or a command that is saved, and tell them to revoke it once done. +- **Some files are live product content.** Changing them changes what every Sekoia customer sees: + - `playbooks/templates/`: published in the playbook editor with the next release of the Sekoia playbook service; + - `events/lookups.json`: read by the Sekoia web app straight from `main`. +- **One topic per pull request**, with a description that says what changes and why. + +## Playbook templates + +Before adding, changing, exporting or reviewing anything under `playbooks/`, read and follow [`.agents/skills/playbook-template/SKILL.md`](.agents/skills/playbook-template/SKILL.md). The human guide is [`playbooks/README.md`](playbooks/README.md). diff --git a/CLAUDE.md b/CLAUDE.md new file mode 120000 index 0000000..47dc3e3 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/playbooks/README.md b/playbooks/README.md index 625b960..6b48f9b 100644 --- a/playbooks/README.md +++ b/playbooks/README.md @@ -26,6 +26,8 @@ A template merged on `main` is published with the next release of the Sekoia pla ``` 5. **Open a pull request** and fill in the checklist. The same check runs on the pull request. +Working with an AI coding agent? It finds its instructions in [`AGENTS.md`](../AGENTS.md) and [`.agents/skills/playbook-template`](../.agents/skills/playbook-template/SKILL.md): the same steps, plus what it must never do (write a secret, invent identifiers, silence the check). + Not ready to build it? [Open an idea](https://github.com/SEKOIA-IO/Community/issues/new?template=playbook-template-request.yml): someone else may pick it up. ## What makes a good template From 88b1410380c8572b9d1dbecc6f5b70a7de3a0f6a Mon Sep 17 00:00:00 2001 From: penhouetp <139768626+penhouetp@users.noreply.github.com> Date: Tue, 1 Dec 2026 17:30:16 +0100 Subject: [PATCH 2/5] Update .agents/skills/playbook-template/SKILL.md Co-authored-by: JBR --- .agents/skills/playbook-template/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/skills/playbook-template/SKILL.md b/.agents/skills/playbook-template/SKILL.md index 54889b5..c1237f2 100644 --- a/.agents/skills/playbook-template/SKILL.md +++ b/.agents/skills/playbook-template/SKILL.md @@ -67,7 +67,7 @@ Then review what no static check sees. Read the playbook as a run would: - **The trigger fits the use case.** A manual trigger for an analyst action, "Alert Created" for something that must run on every alert. An expensive step (sandbox, paid API) on every alert needs a condition before it. - **The data exists.** Event fields must be fields of the Sekoia event taxonomy that the expected intakes produce (`source.ip`, `url.original`, `file.hash.sha256`...). A field no intake produces makes every run fail. - **All the data is read.** `$.events[0]` reads the first event only. To use every value of a field across the alert's events, use the action "Get Event Field Common Values" and `jsonpath("$.fields[*].common_values[*]['name']", True)`, as the IOC collection templates do. -- **Loops keep their results.** A store operator inside a foreach must `append`; `set` keeps only the last value. +- **Loops keep their results.** A store operator that collects results across a foreach's iterations must `append`; `set` keeps only the last value. `set` stays right for a value used within one iteration. - **Every branch ends somewhere useful.** No placeholder node that does nothing, and no branch named after an output the action does not have. - **The description matches the playbook.** From 52f8e5444858564a4ff181a10b42c7c5b4ffb9be Mon Sep 17 00:00:00 2001 From: penhouetp <139768626+penhouetp@users.noreply.github.com> Date: Tue, 1 Dec 2026 17:30:24 +0100 Subject: [PATCH 3/5] Update .agents/skills/playbook-template/SKILL.md Co-authored-by: JBR --- .agents/skills/playbook-template/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/skills/playbook-template/SKILL.md b/.agents/skills/playbook-template/SKILL.md index c1237f2..b7a2c13 100644 --- a/.agents/skills/playbook-template/SKILL.md +++ b/.agents/skills/playbook-template/SKILL.md @@ -36,7 +36,7 @@ The export removes the accounts (module and trigger configurations). Look for th - email addresses, user or team names, customer or company names; - anything that looks like a secret, even partly. -Then say in the description which values the reader must change. Show the user every value you replaced. +Then say in the description which values the reader must change. Show the user every value you replaced, with its node and field; for a secret, give the node and field only, never the value. ## 3. Complete the file From 77148ca47382ece24c38d653087d5b7062f56ee4 Mon Sep 17 00:00:00 2001 From: penhouetp <139768626+penhouetp@users.noreply.github.com> Date: Tue, 1 Dec 2026 17:30:35 +0100 Subject: [PATCH 4/5] Update .agents/skills/playbook-template/SKILL.md Co-authored-by: JBR --- .agents/skills/playbook-template/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/skills/playbook-template/SKILL.md b/.agents/skills/playbook-template/SKILL.md index b7a2c13..1c2df1d 100644 --- a/.agents/skills/playbook-template/SKILL.md +++ b/.agents/skills/playbook-template/SKILL.md @@ -21,7 +21,7 @@ A template is a playbook that worked in a real Sekoia community. Do not write on python playbooks/tools/export_template.py .json [--base-url ] ``` - Ask the user to set `SEKOIA_API_KEY` in their shell (`read -s SEKOIA_API_KEY && export SEKOIA_API_KEY`). Never write the key in a command, a file or a script. + `SEKOIA_API_KEY` must already be set in the environment the agent was started from. If it is not, ask the user to run the export command above themselves in their terminal (`read -s SEKOIA_API_KEY && export SEKOIA_API_KEY` first), then continue from the exported file. Never write the key in a command, a file or a script, and never ask for it in the conversation. - If the user only has an idea, do not invent a template: suggest an issue with the "Playbook template idea" form. - If the user asks you to edit an existing template, keep its `uuid`: the platform updates the published template in place. A new template always gets a new `uuid` (the export script sets one). From e7698658dcfef87bd0811fa1b3cccba2aad6cb45 Mon Sep 17 00:00:00 2001 From: penhouetp <139768626+penhouetp@users.noreply.github.com> Date: Tue, 1 Dec 2026 17:30:45 +0100 Subject: [PATCH 5/5] Update .agents/skills/playbook-template/SKILL.md Co-authored-by: JBR --- .agents/skills/playbook-template/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.agents/skills/playbook-template/SKILL.md b/.agents/skills/playbook-template/SKILL.md index 1c2df1d..9bc4d88 100644 --- a/.agents/skills/playbook-template/SKILL.md +++ b/.agents/skills/playbook-template/SKILL.md @@ -29,7 +29,7 @@ Never type an `action_uuid`, `trigger_uuid` or `module_uuid` from memory. They c ## 2. Remove everything that belongs to the user's environment -The export removes the accounts (module and trigger configurations). Look for the rest in the arguments, conditions and store operators, and replace each value with `_to_update_`: +The export removes the accounts (module and trigger configurations) and nothing else: until this step is done, the exported file holds the playbook's arguments as they are, so do not commit it before. Look for the rest in the arguments, conditions and store operators, and replace each value with `_to_update_`: - URLs and host names (`atlassian.net`, `webhook.office.com`, `hooks.slack.com`, internal domains); - identifiers of the community: IOC collection ids (`ioc-collection--...`), asset, rule, case or community UUIDs, project keys;