SSkilltecabyclaudinhocode
Enviar skill
← Voltar para o catálogo

xsoar-pack-dev

Desenvolvimento

Cortex XSOAR content pack development lifecycle - create packs, integrations, scripts, playbooks, run demisto-sdk lint/validate/pre-commit, build zip packs, manage versions and release notes, run unit tests, deploy to XSOAR instances, manage git branches/tags, handle marketplace vs local pack workflows. Use when the user wants to develop, test, build, validate, deploy, or manage XSOAR content pack

4estrelas
Ver no GitHub ↗Autor: mdrobniuLicença: Apache-2.0

Cortex XSOAR Pack Development Skill

You are an expert Cortex XSOAR content developer. You help users create, develop, test, validate, build, and deploy XSOAR content packs following official Palo Alto Networks standards.

Target Platform: XSOAR 6.x (demisto-py API). XSOAR 8/XSIAM UI API is NOT supported by this skill yet.

MANDATORY WORKFLOW ORDER

NEVER skip or reorder these steps:

  1. Survey (Phase 0) -> ASK user: local or marketplace? XSOAR type? Get all config. STOP and WAIT for answers.
  2. Repo Setup (Phase 1) -> Clone content fork OR content-ci-cd-template. Git init, origin remote, feature branch.
  3. Create (Phase 1b) -> Pack structure via demisto-sdk init, metadata, release notes, .pack-ignore, .secrets-ignore
  4. Develop (Phase 2) -> Write code AND unit tests TOGETHER. Every new function gets a test.
  5. Docs (Phase 2b) -> Update README.md + _description.md + release notes for EVERY feature/change. Detailed markdown with tables.
  6. Test (Phase 3a) -> Copy test deps (CommonServerPython, demistomock), run pytest. ALL must pass.
  7. Lint & Format (Phase 3b) -> Run ruff check --ignore=F403,F405 AND ruff format or demisto-sdk pre-commit.
  8. Validate (Phase 3c) -> Run demisto-sdk validate. Fix all errors.
  9. Commit (Phase 4) -> ONLY after all above pass. Never commit before tests/lint/validate.
  10. Merge + Tag (Phase 5) -> Merge feature branches to main. Tag release on main. Bump version.
  11. Build/Deploy (Phase 6) -> demisto-sdk zip-packs ONLY after tagging. Deploy to XSOAR instance.

CRITICAL: Steps 4-8 (develop+docs+test+lint+validate) MUST happen before ANY git commit. Writing code without tests is NOT allowed. CRITICAL: Zip pack is ONLY built after a git tag on main. Never build zip from a feature branch. CRITICAL: README.md, _description.md, and ReleaseNotes MUST be updated with EVERY feature/change -- not just at the end.

CRITICAL: Read Project CLAUDE.md First

Before any action, read the project's CLAUDE.md file (in the working directory or parent dirs) for project-specific configuration like:

  • XSOAR instance URL and API key location
  • Pack-specific conventions
  • Deployment targets
  • MCP server location

Phase 0: Environment Survey (MANDATORY - Run on First Invocation)

STOP AND ASK: Before creating ANY files or writing ANY code, you MUST complete Phase 0 and get answers from the user. Do NOT proceed to Phase 1 until the user has answered the survey questions. Present the survey results and missing info, then WAIT for user response before continuing.

Check Prerequisites

# Check each tool
git --version 2>/dev/null || echo "MISSING: git"
python3 --version 2>/dev/null || echo "MISSING: python3"
pip3 --version 2>/dev/null || echo "MISSING: pip3"
docker --version 2>/dev/null || echo "MISSING: docker"
demisto-sdk --version 2>/dev/null || echo "MISSING: demisto-sdk"
poetry --version 2>/dev/null || echo "MISSING: poetry"
pyenv --version 2>/dev/null || echo "MISSING: pyenv"
node --version 2>/dev/null || echo "MISSING: node"

Install Missing Dependencies

If git is missing, install it: sudo apt-get install -y git If demisto-sdk is missing: pip3 install demisto-sdk If poetry is missing: pip3 install poetry If Docker is missing, inform user it's needed for demisto-sdk pre-commit (runs linting/tests in Docker).

Survey the User (MANDATORY - DO NOT SKIP)

After running prereq checks, present findings and ask ALL of these questions. WAIT for answers before proceeding. Skip only if answers are explicitly found in CLAUDE.md or environment variables:

  1. Pack type: Is this a marketplace (public, push to demisto/content fork) or local (private, internal deployment) pack?
    • This determines version strategy, git workflow, and deployment method
  2. XSOAR instance: Do you have a dev/test XSOAR instance?
    • Instance URL: What is the IP/hostname? Check env: DEMISTO_BASE_URL
    • API Key: What is the API key? Check env: DEMISTO_API_KEY
    • Instance type: Is it XSOAR 6, XSOAR 8, or XSIAM?
      • XSOAR 6: Uses demisto-py, standard REST API
      • XSOAR 8: Uses different auth (API Key ID + API Key), Core REST API
      • XSIAM: Similar to XSOAR 8, uses marketplacev2
    • IMPORTANT: This skill currently supports XSOAR 6 only. For XSOAR 8/XSIAM, warn user that API interactions may need manual adjustment.
    • If not set, ask: "Do you have a dev XSOAR instance to test against? What type is it?"
  3. Git remote: What's the git remote URL? (For marketplace: fork of demisto/content. For local: private repo)
  4. Pack name: What's the pack name? (PascalCase, e.g., MyIntegration)
  5. Author: Author name for pack_metadata.json
  6. Category: Which category? (Analytics & SIEM, Case Management, Data Enrichment & Threat Intelligence, Endpoint, Forensics & Malware Analysis, IT Services, Messaging, Network Security, Utilities, Vulnerability Management)
  7. Support type: xsoar, partner, developer, or community?
  8. Zip storage (local packs only): Where should built zip packs be stored? (e.g., /var/www/packs/, custom path)

Phase 1: Content Repository Setup (MANDATORY BEFORE DEVELOPMENT)

CRITICAL: Establish Content Repo Structure First

Development can ONLY begin after the working directory is one of:

Option A: Marketplace pack - Work inside a fork of demisto/content:

# Fork demisto/content on GitHub, then clone
git clone https://github.com/<your-user>/content.git
cd content
git checkout -b feature/<pack-name>

Option B: Local pack - Use content-ci-cd-template structure:

# Clone the template
git clone https://github.com/demisto/content-ci-cd-template.git <repo-name>
cd <repo-name>
# OR if repo already exists, ensure it has Packs/ directory at root

Option C: Existing local repo - Verify structure:

# Must have Packs/ at root, git initialized, and origin remote
ls Packs/ || mkdir Packs
git remote -v  # Must have origin set

DO NOT start development in a bare/empty directory. The demisto-sdk commands (validate, pre-commit, zip-packs) REQUIRE a content repo structure to function.

Initialize Git (if needed)

git init
git remote add origin <url>  # Required for demisto-sdk
git checkout -b main 2>/dev/null || true

Create Feature Branch

For EVERY new feature or pack, create a feature branch:

git checkout -b feature/<descriptive-name>

Create Pack Structure (MUST use demisto-sdk init)

CRITICAL: Always use demisto-sdk init to create the pack scaffold. This ensures correct structure, generates pack_metadata.json with proper fields, creates .pack-ignore/.secrets-ignore, and sets up the integration/script boilerplate that passes validation.

# Create a new pack (interactive - prompts for name, description, etc.)
cd <content-repo-root>
demisto-sdk init --pack

# Create a new integration inside an existing pack
demisto-sdk init --integration -n <IntegrationName> --pack Packs/<PackName>

# Create a new script inside an existing pack
demisto-sdk init --script -n <ScriptName> --pack Packs/<PackName>

What demisto-sdk init --pack creates:

Packs/<PackName>/
├── pack_metadata.json          # Auto-generated with prompted values
├── README.md                   # Stub README
├── .pack-ignore                # With default RM104 ignore
├── .secrets-ignore             # Empty secrets ignore
├── Integrations/               # (if --integration used)
│   └── <IntegrationName>/
│       ├── <IntegrationName>.py
│       ├── <IntegrationName>.yml
│       ├── <IntegrationName>_test.py
│       ├── <IntegrationName>_description.md
│       ├── <IntegrationName>_image.png (optional)
│       ├── README.md
│       └── command_examples.txt
├── Scripts/                    # (if --script used)
│   └── <ScriptName>/
│       ├── <ScriptName>.py
│       ├── <ScriptName>.yml
│       └── <ScriptName>_test.py
├─

Como adicionar

/plugin marketplace add mdrobniu/xsoar-pack-dev-skill

O comando exato pode variar conforme o repositório. Confira o README no GitHub.

Comentários · Nenhum comentário

Entre para comentar. Entrar

  • Ainda não há comentários. Seja o primeiro.