[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C5KGJNER4XFH226SQQ74RE":3,"skill-same:01M6C5KGJNER4XFH226SQQ74RE":94},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":14,"repositoryHtmlUrl":56,"repositoryHomepageUrl":6,"ownerHtmlUrl":57,"ownerBlogUrl":58,"ownerDescription":6,"updatedAt":59,"install":60,"resources":73},"01M6C5KGJNER4XFH226SQQ74RE","sarif-parsing",null,"Parses and processes SARIF files from static analysis tools like CodeQL, Semgrep, or other scanners. Triggers on \"parse sarif\", \"read scan results\", \"aggregate findings\", \"deduplicate alerts\", or \"process sarif output\". Handles filtering, deduplication, format conversion, and CI\u002FCD integration of SARIF data. Does NOT run scans — use the Semgrep or CodeQL skills for that.","CoralShades\u002Facm-ai","CoralShades","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F220297585?v=4","01M6C5211QSJHZ8HXSDDWCR507","Coral Shades AI Agency","01M6C52161FNQDRQ0FRR8DAA9D",0,"MIT","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsarif-parsing\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000011","运维与部署","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"parsing","sarif parsing","Bash","run","use","process","filtering","results","read","grep","format","deduplicate","static analysis","analysis","semgrep","deduplication","data","codeql","ci","integration","2026-11-10 10:12:30",false,"---\nname: sarif-parsing\ndescription: >-\n  Parses and processes SARIF files from static analysis tools like CodeQL, Semgrep, or other\n  scanners. Triggers on \"parse sarif\", \"read scan results\", \"aggregate findings\", \"deduplicate\n  alerts\", or \"process sarif output\". Handles filtering, deduplication, format conversion, and\n  CI\u002FCD integration of SARIF data. Does NOT run scans — use the Semgrep or CodeQL skills for that.\nallowed-tools:\n  - Bash\n  - Read\n  - Glob\n  - Grep\n---\n\n# SARIF Parsing Best Practices\n\nYou are a SARIF parsing expert. Your role is to help users effectively read, analyze, and process SARIF files from static analysis tools.\n\n## When to Use\n\nUse this skill when:\n- Reading or interpreting static analysis scan results in SARIF format\n- Aggregating findings from multiple security tools\n- Deduplicating or filtering security alerts\n- Extracting specific vulnerabilities from SARIF files\n- Integrating SARIF data into CI\u002FCD pipelines\n- Converting SARIF output to other formats\n\n## When NOT to Use\n\nDo NOT use this skill for:\n- Running static analysis scans (use CodeQL or Semgrep skills instead)\n- Writing CodeQL or Semgrep rules (use their respective skills)\n- Analyzing source code directly (SARIF is for processing existing scan results)\n- Triaging findings without SARIF input (use variant-analysis or audit skills)\n\n## SARIF Structure Overview\n\nSARIF 2.1.0 is the current OASIS standard. Every SARIF file has this hierarchical structure:\n\n```\nsarifLog\n├── version: \"2.1.0\"\n├── $schema: (optional, enables IDE validation)\n└── runs[] (array of analysis runs)\n    ├── tool\n    │   ├── driver\n    │   │   ├── name (required)\n    │   │   ├── version\n    │   │   └── rules[] (rule definitions)\n    │   └── extensions[] (plugins)\n    ├── results[] (findings)\n    │   ├── ruleId\n    │   ├── level (error\u002Fwarning\u002Fnote)\n    │   ├── message.text\n    │   ├── locations[]\n    │   │   └── physicalLocation\n    │   │       ├── artifactLocation.uri\n    │   │       └── region (startLine, startColumn, etc.)\n    │   ├── fingerprints{}\n    │   └── partialFingerprints{}\n    └── artifacts[] (scanned files metadata)\n```\n\n### Why Fingerprinting Matters\n\nWithout stable fingerprints, you can't track findings across runs:\n\n- **Baseline comparison**: \"Is this a new finding or did we see it before?\"\n- **Regression detection**: \"Did this PR introduce new vulnerabilities?\"\n- **Suppression**: \"Ignore this known false positive in future runs\"\n\nTools report different paths (`\u002Fpath\u002Fto\u002Fproject\u002F` vs `\u002Fgithub\u002Fworkspace\u002F`), so path-based matching fails. Fingerprints hash the *content* (code snippet, rule ID, relative location) to create stable identifiers regardless of environment.\n\n## Tool Selection Guide\n\n| Use Case | Tool | Installation |\n|----------|------|--------------|\n| Quick CLI queries | jq | `brew install jq` \u002F `apt install jq` |\n| Python scripting (simple) | pysarif | `pip install pysarif` |\n| Python scripting (advanced) | sarif-tools | `pip install sarif-tools` |\n| .NET applications | SARIF SDK | NuGet package |\n| JavaScript\u002FNode.js | sarif-js | npm package |\n| Go applications | garif | `go get github.com\u002Fchavacava\u002Fgarif` |\n| Validation | SARIF Validator | sarifweb.azurewebsites.net |\n\n## Strategy 1: Quick Analysis with jq\n\nFor rapid exploration and one-off queries:\n\n```bash\n# Pretty print the file\njq '.' results.sarif\n\n# Count total findings\njq '[.runs[].results[]] | length' results.sarif\n\n# List all rule IDs triggered\njq '[.runs[].results[].ruleId] | unique' results.sarif\n\n# Extract errors only\njq '.runs[].results[] | select(.level == \"error\")' results.sarif\n\n# Get findings with file locations\njq '.runs[].results[] | {\n  rule: .ruleId,\n  message: .message.text,\n  file: .locations[0].physicalLocation.artifactLocation.uri,\n  line: .locations[0].physicalLocation.region.startLine\n}' results.sarif\n\n# Filter by severity and get count per rule\njq '[.runs[].results[] | select(.level == \"error\")] | group_by(.ruleId) | map({rule: .[0].ruleId, count: length})' results.sarif\n\n# Extract findings for a specific file\njq --arg file \"src\u002Fauth.py\" '.runs[].results[] | select(.locations[].physicalLocation.artifactLocation.uri | contains($file))' results.sarif\n```\n\n## Strategy 2: Python with pysarif\n\nFor programmatic access with full object model:\n\n```python\nfrom pysarif import load_from_file, save_to_file\n\n# Load SARIF file\nsarif = load_from_file(\"results.sarif\")\n\n# Iterate through runs and results\nfor run in sarif.runs:\n    tool_name = run.tool.driver.name\n    print(f\"Tool: {tool_name}\")\n\n    for result in run.results:\n        print(f\"  [{result.level}] {result.rule_id}: {result.message.text}\")\n\n        if result.locations:\n            loc = result.locations[0].physical_location\n            if loc and loc.artifact_location:\n                print(f\"    File: {loc.artifact_location.uri}\")\n                if loc.region:\n                    print(f\"    Line: {loc.region.start_line}\")\n\n# Save modified SARIF\nsave_to_file(sarif, \"modified.sarif\")\n```\n\n## Strategy 3: Python with sarif-tools\n\nFor aggregation, reporting, and CI\u002FCD integration:\n\n```python\nfrom sarif import loader\n\n# Load single file\nsarif_data = loader.load_sarif_file(\"results.sarif\")\n\n# Or load multiple files\nsarif_set = loader.load_sarif_files([\"tool1.sarif\", \"tool2.sarif\"])\n\n# Get summary report\nreport = sarif_data.get_report()\n\n# Get histogram by severity\nerrors = report.get_issue_type_histogram_for_severity(\"error\")\nwarnings = report.get_issue_type_histogram_for_severity(\"warning\")\n\n# Filter results\nhigh_severity = [r for r in sarif_data.get_results()\n                 if r.get(\"level\") == \"error\"]\n```\n\n**sarif-tools CLI commands:**\n\n```bash\n# Summary of findings\nsarif summary results.sarif\n\n# List all results with details\nsarif ls results.sarif\n\n# Get results by severity\nsarif ls --level error results.sarif\n\n# Diff two SARIF files (find new\u002Ffixed issues)\nsarif diff baseline.sarif current.sarif\n\n# Convert to other formats\nsarif csv results.sarif > results.csv\nsarif html results.sarif > report.html\n```\n\n## Strategy 4: Aggregating Multiple SARIF Files\n\nWhen combining results from multiple tools:\n\n```python\nimport json\nfrom pathlib import Path\n\ndef aggregate_sarif_files(sarif_paths: list[str]) -> dict:\n    \"\"\"Combine multiple SARIF files into one.\"\"\"\n    aggregated = {\n        \"version\": \"2.1.0\",\n        \"$schema\": \"https:\u002F\u002Fjson.schemastore.org\u002Fsarif-2.1.0.json\",\n        \"runs\": []\n    }\n\n    for path in sarif_paths:\n        with open(path) as f:\n            sarif = json.load(f)\n            aggregated[\"runs\"].extend(sarif.get(\"runs\", []))\n\n    return aggregated\n\ndef deduplicate_results(sarif: dict) -> dict:\n    \"\"\"Remove duplicate findings based on fingerprints.\"\"\"\n    seen_fingerprints = set()\n\n    for run in sarif[\"runs\"]:\n        unique_results = []\n        for result in run.get(\"results\", []):\n            # Use partialFingerprints or create key from location\n            fp = None\n            if result.get(\"partialFingerprints\"):\n                fp = tuple(sorted(result[\"partialFingerprints\"].items()))\n            elif result.get(\"fingerprints\"):\n                fp = tuple(sorted(result[\"fingerprints\"].items()))\n            else:\n                # Fallback: create fingerprint from rule + location\n                loc = result.get(\"locations\", [{}])[0]\n                phys = loc.get(\"physicalLocation\", {})\n                fp = (\n                    result.get(\"ruleId\"),\n                    phys.get(\"artifactLocation\", {}).get(\"uri\"),\n                    phys.get(\"region\", {}).get(\"startLine\")\n                )\n\n            if fp not in seen_fingerprints:\n                seen_fingerprints.add(fp)\n                unique_results.append(result)\n\n        run[\"results\"] = unique_results\n\n    return sarif\n```\n\n## Strategy 5: Extracting Actionable Data\n\n```python\nimport json\nfrom dataclasses import dataclass\nfrom typing import Optional\n\n@dataclass\nclass Finding:\n    rule_id: str\n    level: str\n    message: str\n    file_path: Optional[str]\n    start_line: Optional[int]\n    end_line: Optional[int]\n    fingerprint: Optional[str]\n\ndef extract_findings(sarif_path: str) -> list[Finding]:\n    \"\"\"Extract structured findings from SARIF file.\"\"\"\n    with open(sarif_path) as f:\n        sarif = json.load(f)\n\n    findings = []\n    for run in sarif.get(\"runs\", []):\n        for result in run.get(\"results\", []):\n            loc = result.get(\"locations\", [{}])[0]\n            phys = loc.get(\"physicalLocation\", {})\n            region = phys.get(\"region\", {})\n\n            findings.append(Finding(\n                rule_id=result.get(\"ruleId\", \"unknown\"),\n                level=result.get(\"level\", \"warning\"),\n                message=result.get(\"message\", {}).get(\"text\", \"\"),\n                file_path=phys.get(\"artifactLocation\", {}).get(\"uri\"),\n                start_line=region.get(\"startLine\"),\n                end_line=region.get(\"endLine\"),\n                fingerprint=next(iter(result.get(\"partialFingerprints\", {}).values()), None)\n            ))\n\n    return findings\n\n# Filter and prioritize\ndef prioritize_findings(findings: list[Finding]) -> list[Finding]:\n    \"\"\"Sort findings by severity.\"\"\"\n    severity_order = {\"error\": 0, \"warning\": 1, \"note\": 2, \"none\": 3}\n    return sorted(findings, key=lambda f: severity_order.get(f.level, 99))\n```\n\n## Common Pitfalls and Solutions\n\n### 1. Path Normalization Issues\n\nDifferent tools report paths differently (absolute, relative, URI-encoded):\n\n```python\nfrom urllib.parse import unquote\nfrom pathlib import Path\n\ndef normalize_path(uri: str, base_path: str = \"\") -> str:\n    \"\"\"Normalize SARIF artifact URI to consistent path.\"\"\"\n    # Remove file:\u002F\u002F prefix if present\n    if uri.startswith(\"file:\u002F\u002F\"):\n        uri = uri[7:]\n\n    # URL decode\n    uri = unquote(uri)\n\n    # Handle relative paths\n    if not Path(uri).is_absolute() and base_path:\n        uri = str(Path(base_path) \u002F uri)\n\n    # Normalize separators\n    return str(Path(uri))\n```\n\n### 2. Fingerprint Mismatch Across Runs\n\nFingerprints may not match if:\n- File paths differ between environments\n- Tool versions changed fingerprinting algorithm\n- Code was reformatted (changing line numbers)\n\n**Solution:** Use multiple fingerprint strategies:\n\n```python\ndef compute_stable_fingerprint(result: dict, file_content: str = None) -> str:\n    \"\"\"Compute environment-independent fingerprint.\"\"\"\n    import hashlib\n\n    components = [\n        result.get(\"ruleId\", \"\"),\n        result.get(\"message\", {}).get(\"text\", \"\")[:100],  # First 100 chars\n    ]\n\n    # Add code snippet if available\n    if file_content and result.get(\"locations\"):\n        region = result[\"locations\"][0].get(\"physicalLocation\", {}).get(\"region\", {})\n        if region.get(\"startLine\"):\n            lines = file_content.split(\"\\n\")\n            line_idx = region[\"startLine\"] - 1\n            if 0 \u003C= line_idx \u003C len(lines):\n                # Normalize whitespace\n                components.append(lines[line_idx].strip())\n\n    return hashlib.sha256(\"\".join(components).encode()).hexdigest()[:16]\n```\n\n### 3. Missing or Incomplete Data\n\nSARIF allows many optional fields. Always use defensive access:\n\n```python\ndef safe_get_location(result: dict) -> tuple[str, int]:\n    \"\"\"Safely extract file and line from result.\"\"\"\n    try:\n        loc = result.get(\"locations\", [{}])[0]\n        phys = loc.get(\"physicalLocation\", {})\n        file_path = phys.get(\"artifactLocation\", {}).get(\"uri\", \"unknown\")\n        line = phys.get(\"region\", {}).get(\"startLine\", 0)\n        return file_path, line\n    except (IndexError, KeyError, TypeError):\n        return \"unknown\", 0\n```\n\n### 4. Large File Performance\n\nFor very large SARIF files (100MB+):\n\n```python\nimport ijson  # pip install ijson\n\ndef stream_results(sarif_path: str):\n    \"\"\"Stream results without loading entire file.\"\"\"\n    with open(sarif_path, \"rb\") as f:\n        # Stream through results arrays\n        for result in ijson.items(f, \"runs.item.results.item\"):\n            yield result\n```\n\n### 5. Schema Validation\n\nValidate before processing to catch malformed files:\n\n```bash\n# Using ajv-cli\nnpm install -g ajv-cli\najv validate -s sarif-schema-2.1.0.json -d results.sarif\n\n# Using Python jsonschema\npip install jsonschema\n```\n\n```python\nfrom jsonschema import validate, ValidationError\nimport json\n\ndef validate_sarif(sarif_path: str, schema_path: str) -> bool:\n    \"\"\"Validate SARIF file against schema.\"\"\"\n    with open(sarif_path) as f:\n        sarif = json.load(f)\n    with open(schema_path) as f:\n        schema = json.load(f)\n\n    try:\n        validate(sarif, schema)\n        return True\n    except ValidationError as e:\n        print(f\"Validation error: {e.message}\")\n        return False\n```\n\n## CI\u002FCD Integration Patterns\n\n### GitHub Actions\n\n```yaml\n- name: Upload SARIF\n  uses: github\u002Fcodeql-action\u002Fupload-sarif@v3\n  with:\n    sarif_file: results.sarif\n\n- name: Check for high severity\n  run: |\n    HIGH_COUNT=$(jq '[.runs[].results[] | select(.level == \"error\")] | length' results.sarif)\n    if [ \"$HIGH_COUNT\" -gt 0 ]; then\n      echo \"Found $HIGH_COUNT high severity issues\"\n      exit 1\n    fi\n```\n\n### Fail on New Issues\n\n```python\nfrom sarif import loader\n\ndef check_for_regressions(baseline: str, current: str) -> int:\n    \"\"\"Return count of new issues not in baseline.\"\"\"\n    baseline_data = loader.load_sarif_file(baseline)\n    current_data = loader.load_sarif_file(current)\n\n    baseline_fps = {get_fingerprint(r) for r in baseline_data.get_results()}\n    new_issues = [r for r in current_data.get_results()\n                  if get_fingerprint(r) not in baseline_fps]\n\n    return len(new_issues)\n```\n\n## Key Principles\n\n1. **Validate first**: Check SARIF structure before processing\n2. **Handle optionals**: Many fields are optional; use defensive access\n3. **Normalize paths**: Tools report paths differently; normalize early\n4. **Fingerprint wisely**: Combine multiple strategies for stable deduplication\n5. **Stream large files**: Use ijson or similar for 100MB+ files\n6. **Aggregate thoughtfully**: Preserve tool metadata when combining files\n\n## Skill Resources\n\nFor ready-to-use query templates, see [{baseDir}\u002Fresources\u002Fjq-queries.md]({baseDir}\u002Fresources\u002Fjq-queries.md):\n- 40+ jq queries for common SARIF operations\n- Severity filtering, rule extraction, aggregation patterns\n\nFor Python utilities, see [{baseDir}\u002Fresources\u002Fsarif_helpers.py]({baseDir}\u002Fresources\u002Fsarif_helpers.py):\n- `normalize_path()` - Handle tool-specific path formats\n- `compute_fingerprint()` - Stable fingerprinting ignoring paths\n- `deduplicate_results()` - Remove duplicates across runs\n\n## Reference Links\n\n- [OASIS SARIF 2.1.0 Specification](https:\u002F\u002Fdocs.oasis-open.org\u002Fsarif\u002Fsarif\u002Fv2.1.0\u002Fsarif-v2.1.0.html)\n- [Microsoft SARIF Tutorials](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fsarif-tutorials)\n- [SARIF SDK (.NET)](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fsarif-sdk)\n- [sarif-tools (Python)](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fsarif-tools)\n- [pysarif (Python)](https:\u002F\u002Fgithub.com\u002FKjeld-P\u002Fpysarif)\n- [GitHub SARIF Support](https:\u002F\u002Fdocs.github.com\u002Fen\u002Fcode-security\u002Fcode-scanning\u002Fintegrating-with-code-scanning\u002Fsarif-support-for-code-scanning)\n- [SARIF Validator](https:\u002F\u002Fsarifweb.azurewebsites.net\u002F)\n","# SARIF Parsing Best Practices\n\nYou are a SARIF parsing expert. Your role is to help users effectively read, analyze, and process SARIF files from static analysis tools.\n\n## When to Use\n\nUse this skill when:\n- Reading or interpreting static analysis scan results in SARIF format\n- Aggregating findings from multiple security tools\n- Deduplicating or filtering security alerts\n- Extracting specific vulnerabilities from SARIF files\n- Integrating SARIF data into CI\u002FCD pipelines\n- Converting SARIF output to other formats\n\n## When NOT to Use\n\nDo NOT use this skill for:\n- Running static analysis scans (use CodeQL or Semgrep skills instead)\n- Writing CodeQL or Semgrep rules (use their respective skills)\n- Analyzing source code directly (SARIF is for processing existing scan results)\n- Triaging findings without SARIF input (use variant-analysis or audit skills)\n\n## SARIF Structure Overview\n\nSARIF 2.1.0 is the current OASIS standard. Every SARIF file has this hierarchical structure:\n\n```\nsarifLog\n├── version: \"2.1.0\"\n├── $schema: (optional, enables IDE validation)\n└── runs[] (array of analysis runs)\n    ├── tool\n    │   ├── driver\n    │   │   ├── name (required)\n    │   │   ├── version\n    │   │   └── rules[] (rule definitions)\n    │   └── extensions[] (plugins)\n    ├── results[] (findings)\n    │   ├── ruleId\n    │   ├── level (error\u002Fwarning\u002Fnote)\n    │   ├── message.text\n    │   ├── locations[]\n    │   │   └── physicalLocation\n    │   │       ├── artifactLocation.uri\n    │   │       └── region (startLine, startColumn, etc.)\n    │   ├── fingerprints{}\n    │   └── partialFingerprints{}\n    └── artifacts[] (scanned files metadata)\n```\n\n### Why Fingerprinting Matters\n\nWithout stable fingerprints, you can't track findings across runs:\n\n- **Baseline comparison**: \"Is this a new finding or did we see it before?\"\n- **Regression detection**: \"Did this PR introduce new vulnerabilities?\"\n- **Suppression**: \"Ignore this known false positive in future runs\"\n\nTools report different paths (`\u002Fpath\u002Fto\u002Fproject\u002F` vs `\u002Fgithub\u002Fworkspace\u002F`), so path-based matching fails. Fingerprints hash the *content* (code snippet, rule ID, relative location) to create stable identifiers regardless of environment.\n\n## Tool Selection Guide\n\n| Use Case | Tool | Installation |\n|----------|------|--------------|\n| Quick CLI queries | jq | `brew install jq` \u002F `apt install jq` |\n| Python scripting (simple) | pysarif | `pip install pysarif` |\n| Python scripting (advanced) | sarif-tools | `pip install sarif-tools` |\n| .NET applications | SARIF SDK | NuGet package |\n| JavaScript\u002FNode.js | sarif-js | npm package |\n| Go applications | garif | `go get github.com\u002Fchavacava\u002Fgarif` |\n| Validation | SARIF Validator | sarifweb.azurewebsites.net |\n\n## Strategy 1: Quick Analysis with jq\n\nFor rapid exploration and one-off queries:\n\n```bash\n# Pretty print the file\njq '.' results.sarif\n\n# Count total findings\njq '[.runs[].results[]] | length' results.sarif\n\n# List all rule IDs triggered\njq '[.runs[].results[].ruleId] | unique' results.sarif\n\n# Extract errors only\njq '.runs[].results[] | select(.level == \"error\")' results.sarif\n\n# Get findings with file locations\njq '.runs[].results[] | {\n  rule: .ruleId,\n  message: .message.text,\n  file: .locations[0].physicalLocation.artifactLocation.uri,\n  line: .locations[0].physicalLocation.region.startLine\n}' results.sarif\n\n# Filter by severity and get count per rule\njq '[.runs[].results[] | select(.level == \"error\")] | group_by(.ruleId) | map({rule: .[0].ruleId, count: length})' results.sarif\n\n# Extract findings for a specific file\njq --arg file \"src\u002Fauth.py\" '.runs[].results[] | select(.locations[].physicalLocation.artifactLocation.uri | contains($file))' results.sarif\n```\n\n## Strategy 2: Python with pysarif\n\nFor programmatic access with full object model:\n\n```python\nfrom pysarif import load_from_file, save_to_file\n\n# Load SARIF file\nsarif = load_from_file(\"results.sarif\")\n\n# Iterate through runs and results\nfor run in sarif.runs:\n    tool_name = run.tool.driver.name\n    print(f\"Tool: {tool_name}\")\n\n    for result in run.results:\n        print(f\"  [{result.level}] {result.rule_id}: {result.message.text}\")\n\n        if result.locations:\n            loc = result.locations[0].physical_location\n            if loc and loc.artifact_location:\n                print(f\"    File: {loc.artifact_location.uri}\")\n                if loc.region:\n                    print(f\"    Line: {loc.region.start_line}\")\n\n# Save modified SARIF\nsave_to_file(sarif, \"modified.sarif\")\n```\n\n## Strategy 3: Python with sarif-tools\n\nFor aggregation, reporting, and CI\u002FCD integration:\n\n```python\nfrom sarif import loader\n\n# Load single file\nsarif_data = loader.load_sarif_file(\"results.sarif\")\n\n# Or load multiple files\nsarif_set = loader.load_sarif_files([\"tool1.sarif\", \"tool2.sarif\"])\n\n# Get summary report\nreport = sarif_data.get_report()\n\n# Get histogram by severity\nerrors = report.get_issue_type_histogram_for_severity(\"error\")\nwarnings = report.get_issue_type_histogram_for_severity(\"warning\")\n\n# Filter results\nhigh_severity = [r for r in sarif_data.get_results()\n                 if r.get(\"level\") == \"error\"]\n```\n\n**sarif-tools CLI commands:**\n\n```bash\n# Summary of findings\nsarif summary results.sarif\n\n# List all results with details\nsarif ls results.sarif\n\n# Get results by severity\nsarif ls --level error results.sarif\n\n# Diff two SARIF files (find new\u002Ffixed issues)\nsarif diff baseline.sarif current.sarif\n\n# Convert to other formats\nsarif csv results.sarif > results.csv\nsarif html results.sarif > report.html\n```\n\n## Strategy 4: Aggregating Multiple SARIF Files\n\nWhen combining results from multiple tools:\n\n```python\nimport json\nfrom pathlib import Path\n\ndef aggregate_sarif_files(sarif_paths: list[str]) -> dict:\n    \"\"\"Combine multiple SARIF files into one.\"\"\"\n    aggregated = {\n        \"version\": \"2.1.0\",\n        \"$schema\": \"https:\u002F\u002Fjson.schemastore.org\u002Fsarif-2.1.0.json\",\n        \"runs\": []\n    }\n\n    for path in sarif_paths:\n        with open(path) as f:\n            sarif = json.load(f)\n            aggregated[\"runs\"].extend(sarif.get(\"runs\", []))\n\n    return aggregated\n\ndef deduplicate_results(sarif: dict) -> dict:\n    \"\"\"Remove duplicate findings based on fingerprints.\"\"\"\n    seen_fingerprints = set()\n\n    for run in sarif[\"runs\"]:\n        unique_results = []\n        for result in run.get(\"results\", []):\n            # Use partialFingerprints or create key from location\n            fp = None\n            if result.get(\"partialFingerprints\"):\n                fp = tuple(sorted(result[\"partialFingerprints\"].items()))\n            elif result.get(\"fingerprints\"):\n                fp = tuple(sorted(result[\"fingerprints\"].items()))\n            else:\n                # Fallback: create fingerprint from rule + location\n                loc = result.get(\"locations\", [{}])[0]\n                phys = loc.get(\"physicalLocation\", {})\n                fp = (\n                    result.get(\"ruleId\"),\n                    phys.get(\"artifactLocation\", {}).get(\"uri\"),\n                    phys.get(\"region\", {}).get(\"startLine\")\n                )\n\n            if fp not in seen_fingerprints:\n                seen_fingerprints.add(fp)\n                unique_results.append(result)\n\n        run[\"results\"] = unique_results\n\n    return sarif\n```\n\n## Strategy 5: Extracting Actionable Data\n\n```python\nimport json\nfrom dataclasses import dataclass\nfrom typing import Optional\n\n@dataclass\nclass Finding:\n    rule_id: str\n    level: str\n    message: str\n    file_path: Optional[str]\n    start_line: Optional[int]\n    end_line: Optional[int]\n    fingerprint: Optional[str]\n\ndef extract_findings(sarif_path: str) -> list[Finding]:\n    \"\"\"Extract structured findings from SARIF file.\"\"\"\n    with open(sarif_path) as f:\n        sarif = json.load(f)\n\n    findings = []\n    for run in sarif.get(\"runs\", []):\n        for result in run.get(\"results\", []):\n            loc = result.get(\"locations\", [{}])[0]\n            phys = loc.get(\"physicalLocation\", {})\n            region = phys.get(\"region\", {})\n\n            findings.append(Finding(\n                rule_id=result.get(\"ruleId\", \"unknown\"),\n                level=result.get(\"level\", \"warning\"),\n                message=result.get(\"message\", {}).get(\"text\", \"\"),\n                file_path=phys.get(\"artifactLocation\", {}).get(\"uri\"),\n                start_line=region.get(\"startLine\"),\n                end_line=region.get(\"endLine\"),\n                fingerprint=next(iter(result.get(\"partialFingerprints\", {}).values()), None)\n            ))\n\n    return findings\n\n# Filter and prioritize\ndef prioritize_findings(findings: list[Finding]) -> list[Finding]:\n    \"\"\"Sort findings by severity.\"\"\"\n    severity_order = {\"error\": 0, \"warning\": 1, \"note\": 2, \"none\": 3}\n    return sorted(findings, key=lambda f: severity_order.get(f.level, 99))\n```\n\n## Common Pitfalls and Solutions\n\n### 1. Path Normalization Issues\n\nDifferent tools report paths differently (absolute, relative, URI-encoded):\n\n```python\nfrom urllib.parse import unquote\nfrom pathlib import Path\n\ndef normalize_path(uri: str, base_path: str = \"\") -> str:\n    \"\"\"Normalize SARIF artifact URI to consistent path.\"\"\"\n    # Remove file:\u002F\u002F prefix if present\n    if uri.startswith(\"file:\u002F\u002F\"):\n        uri = uri[7:]\n\n    # URL decode\n    uri = unquote(uri)\n\n    # Handle relative paths\n    if not Path(uri).is_absolute() and base_path:\n        uri = str(Path(base_path) \u002F uri)\n\n    # Normalize separators\n    return str(Path(uri))\n```\n\n### 2. Fingerprint Mismatch Across Runs\n\nFingerprints may not match if:\n- File paths differ between environments\n- Tool versions changed fingerprinting algorithm\n- Code was reformatted (changing line numbers)\n\n**Solution:** Use multiple fingerprint strategies:\n\n```python\ndef compute_stable_fingerprint(result: dict, file_content: str = None) -> str:\n    \"\"\"Compute environment-independent fingerprint.\"\"\"\n    import hashlib\n\n    components = [\n        result.get(\"ruleId\", \"\"),\n        result.get(\"message\", {}).get(\"text\", \"\")[:100],  # First 100 chars\n    ]\n\n    # Add code snippet if available\n    if file_content and result.get(\"locations\"):\n        region = result[\"locations\"][0].get(\"physicalLocation\", {}).get(\"region\", {})\n        if region.get(\"startLine\"):\n            lines = file_content.split(\"\\n\")\n            line_idx = region[\"startLine\"] - 1\n            if 0 \u003C= line_idx \u003C len(lines):\n                # Normalize whitespace\n                components.append(lines[line_idx].strip())\n\n    return hashlib.sha256(\"\".join(components).encode()).hexdigest()[:16]\n```\n\n### 3. Missing or Incomplete Data\n\nSARIF allows many optional fields. Always use defensive access:\n\n```python\ndef safe_get_location(result: dict) -> tuple[str, int]:\n    \"\"\"Safely extract file and line from result.\"\"\"\n    try:\n        loc = result.get(\"locations\", [{}])[0]\n        phys = loc.get(\"physicalLocation\", {})\n        file_path = phys.get(\"artifactLocation\", {}).get(\"uri\", \"unknown\")\n        line = phys.get(\"region\", {}).get(\"startLine\", 0)\n        return file_path, line\n    except (IndexError, KeyError, TypeError):\n        return \"unknown\", 0\n```\n\n### 4. Large File Performance\n\nFor very large SARIF files (100MB+):\n\n```python\nimport ijson  # pip install ijson\n\ndef stream_results(sarif_path: str):\n    \"\"\"Stream results without loading entire file.\"\"\"\n    with open(sarif_path, \"rb\") as f:\n        # Stream through results arrays\n        for result in ijson.items(f, \"runs.item.results.item\"):\n            yield result\n```\n\n### 5. Schema Validation\n\nValidate before processing to catch malformed files:\n\n```bash\n# Using ajv-cli\nnpm install -g ajv-cli\najv validate -s sarif-schema-2.1.0.json -d results.sarif\n\n# Using Python jsonschema\npip install jsonschema\n```\n\n```python\nfrom jsonschema import validate, ValidationError\nimport json\n\ndef validate_sarif(sarif_path: str, schema_path: str) -> bool:\n    \"\"\"Validate SARIF file against schema.\"\"\"\n    with open(sarif_path) as f:\n        sarif = json.load(f)\n    with open(schema_path) as f:\n        schema = json.load(f)\n\n    try:\n        validate(sarif, schema)\n        return True\n    except ValidationError as e:\n        print(f\"Validation error: {e.message}\")\n        return False\n```\n\n## CI\u002FCD Integration Patterns\n\n### GitHub Actions\n\n```yaml\n- name: Upload SARIF\n  uses: github\u002Fcodeql-action\u002Fupload-sarif@v3\n  with:\n    sarif_file: results.sarif\n\n- name: Check for high severity\n  run: |\n    HIGH_COUNT=$(jq '[.runs[].results[] | select(.level == \"error\")] | length' results.sarif)\n    if [ \"$HIGH_COUNT\" -gt 0 ]; then\n      echo \"Found $HIGH_COUNT high severity issues\"\n      exit 1\n    fi\n```\n\n### Fail on New Issues\n\n```python\nfrom sarif import loader\n\ndef check_for_regressions(baseline: str, current: str) -> int:\n    \"\"\"Return count of new issues not in baseline.\"\"\"\n    baseline_data = loader.load_sarif_file(baseline)\n    current_data = loader.load_sarif_file(current)\n\n    baseline_fps = {get_fingerprint(r) for r in baseline_data.get_results()}\n    new_issues = [r for r in current_data.get_results()\n                  if get_fingerprint(r) not in baseline_fps]\n\n    return len(new_issues)\n```\n\n## Key Principles\n\n1. **Validate first**: Check SARIF structure before processing\n2. **Handle optionals**: Many fields are optional; use defensive access\n3. **Normalize paths**: Tools report paths differently; normalize early\n4. **Fingerprint wisely**: Combine multiple strategies for stable deduplication\n5. **Stream large files**: Use ijson or similar for 100MB+ files\n6. **Aggregate thoughtfully**: Preserve tool metadata when combining files\n\n## Skill Resources\n\nFor ready-to-use query templates, see [{baseDir}\u002Fresources\u002Fjq-queries.md]({baseDir}\u002Fresources\u002Fjq-queries.md):\n- 40+ jq queries for common SARIF operations\n- Severity filtering, rule extraction, aggregation patterns\n\nFor Python utilities, see [{baseDir}\u002Fresources\u002Fsarif_helpers.py]({baseDir}\u002Fresources\u002Fsarif_helpers.py):\n- `normalize_path()` - Handle tool-specific path formats\n- `compute_fingerprint()` - Stable fingerprinting ignoring paths\n- `deduplicate_results()` - Remove duplicates across runs\n\n## Reference Links\n\n- [OASIS SARIF 2.1.0 Specification](https:\u002F\u002Fdocs.oasis-open.org\u002Fsarif\u002Fsarif\u002Fv2.1.0\u002Fsarif-v2.1.0.html)\n- [Microsoft SARIF Tutorials](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fsarif-tutorials)\n- [SARIF SDK (.NET)](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fsarif-sdk)\n- [sarif-tools (Python)](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002Fsarif-tools)\n- [pysarif (Python)](https:\u002F\u002Fgithub.com\u002FKjeld-P\u002Fpysarif)\n- [GitHub SARIF Support](https:\u002F\u002Fdocs.github.com\u002Fen\u002Fcode-security\u002Fcode-scanning\u002Fintegrating-with-code-scanning\u002Fsarif-support-for-code-scanning)\n- [SARIF Validator](https:\u002F\u002Fsarifweb.azurewebsites.net\u002F)\n",{"name":5,"description":7,"allowed-tools":49},[26,50,51,52],"Read","Glob","Grep","main","1ca81b0a7de199942400f965edd4d7544077ac5d",".claude\u002Fskills\u002Fsarif-parsing","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai","https:\u002F\u002Fgithub.com\u002FCoralShades","coralshades.com.au","2026-04-18 00:45:07",{"source":8,"skillName":5,"commands":61,"prompt":71,"zipAvailable":72},[62,65,68],{"tool":63,"command":64},"npx","npx skills add CoralShades\u002Facm-ai --skill sarif-parsing",{"tool":66,"command":67},"bunx","bunx skills add CoralShades\u002Facm-ai --skill sarif-parsing",{"tool":69,"command":70},"pnpm","pnpm dlx skills add CoralShades\u002Facm-ai --skill sarif-parsing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsarif-parsing\u002FSKILL.md",true,[74,80,84,88],{"path":75,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fadvanced-usage.md","REFERENCE","参考文档",10887,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fai-research\u002Foptimization-gguf\u002Freferences\u002Fadvanced-usage.md",{"path":81,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Ftroubleshooting.md",8904,"https:\u002F\u002Fgithub.com\u002FDicklesworthstone\u002Fpi_agent_rust\u002Fblob\u002Fmain\u002Ftests\u002Fext_conformance\u002Fartifacts\u002Ftemplates-davila7\u002Fcli-tool\u002Fcomponents\u002Fskills\u002Fai-research\u002Foptimization-gguf\u002Freferences\u002Ftroubleshooting.md",{"path":85,"resourceType":76,"resourceTypeDesc":77,"sizeBytes":86,"sourceHtmlUrl":87},"resources\u002Fjq-queries.md",5267,"https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsarif-parsing\u002Fresources\u002Fjq-queries.md",{"path":89,"resourceType":90,"resourceTypeDesc":91,"sizeBytes":92,"sourceHtmlUrl":93},"resources\u002Fsarif_helpers.py","SCRIPT","脚本",10183,"https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fsarif-parsing\u002Fresources\u002Fsarif_helpers.py",[95,116,128,144,166,176],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":104,"publishedAt":44},"01M6C63HKXA890HHV47WBAX0TB","uncodixfy","Prevents generic AI\u002FCodex UI patterns when generating frontend code. Use this skill whenever generating HTML, CSS, React, Vue, Svelte, or any frontend UI code to enforce clean, human-designed aesthetics inspired by Linear, Raycast, Stripe, and GitHub instead of typical AI-generated UI.","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Funcodixfy\u002FSKILL.md",[101],{"categoryNo":102,"categoryName":103,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[97,105,106,107,108,109,110,111,112,113,114,28,115],"github","frontend","css","codex","react","code","linear","ui","vue","generated","html",{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":120,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":123,"publishedAt":44},"01M6C63FJ2GEBBGZ5XSMV40KXB","runpodctl","Runpod CLI to manage your GPU workloads.","Apache-2.0","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Frunpodctl\u002FSKILL.md",[],[118,124,125,126,127,26],"macos","cli","linux","gpu",{"skillNo":129,"name":130,"nameZh":6,"description":131,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":44},"01M6C63DPAV46TFVQ01SFYPJ7X","langgraph-persistence","INVOKE THIS SKILL when your LangGraph needs to persist state, remember conversations, travel through history, or configure subgraph checkpointer scoping. Covers checkpointers, thread_id, time travel, Store, and subgraph persistence modes.","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Flanggraph-persistence\u002FSKILL.md",[],[135,136,137,138,139,140,141,142,143],"langgraph persistence","langgraph","persistence","travel","history","scoping","remember","state","configure",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":155,"publishedAt":44},"01M6C63BNS9CQEBTB8RNSSBFPA","langgraph-human-in-the-loop","INVOKE THIS SKILL when implementing human-in-the-loop patterns, pausing for approval, or handling errors in LangGraph. Covers interrupt(), Command(resume=...), approval\u002Fvalidation workflows, and the 4-tier error handling strategy.","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Flanggraph-human-in-the-loop\u002FSKILL.md",[150],{"categoryNo":151,"categoryName":152,"taxonomyType":153,"taxonomyTypeDesc":154},"01JBSEEDCAT000000000000038","人力资源","PROFESSION","适用职业",[156,157,136,158,159,160,161,162,163,164,165],"langgraph human in the loop","loop","workflows","error handling","validation","human-in-the-loop","command","strategy","approval","resume",{"skillNo":167,"name":168,"nameZh":6,"description":169,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":170,"categories":171,"keywords":172,"publishedAt":44},"01M6C639GVYZFX3NFPV5FBDR4F","langgraph-fundamentals","INVOKE THIS SKILL when writing ANY LangGraph code. Covers StateGraph, state schemas, nodes, edges, Command, Send, invoke, streaming, and error handling.","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Flanggraph-fundamentals\u002FSKILL.md",[],[173,136,159,142,174,175,162,110],"langgraph fundamentals","streaming","writing",{"skillNo":177,"name":178,"nameZh":6,"description":179,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":180,"categories":181,"keywords":182,"publishedAt":44},"01M6C6375N34YX2GZ3SD3R7XR2","langchain-rag","INVOKE THIS SKILL when building ANY retrieval-augmented generation (RAG) system. Covers document loaders, RecursiveCharacterTextSplitter, embeddings (OpenAI), and vector stores (Chroma, FAISS, Pinecone).","https:\u002F\u002Fgithub.com\u002FCoralShades\u002Facm-ai\u002Fblob\u002Fmain\u002F.qwen\u002Fskills\u002Flangchain-rag\u002FSKILL.md",[],[183,184,185,186,187,188,189,190,191,192],"rag","langchain rag","langchain","embeddings","vector","openai","chroma","faiss","vector stores","system"]