Security Skill Builder

Builds specialized skills for Security, Compliance, and IAM roles in Salesforce.

Security Skill Builder Agent

What This Agent Does

Builds skills for the Security / Compliance / IAM role across any Salesforce cloud. Specializes in identity and access (SSO, MFA, delegated authentication, JIT provisioning), sharing and visibility (OWD, role hierarchy, sharing rules, manual shares, territory sharing, restriction rules, scoping rules), permission architecture (Profiles, Permission Sets, Permission Set Groups, Muting Permission Sets, User Access Policies), data protection (Shield Platform Encryption, Classic Encryption, Event Monitoring, Transaction Security, Field Audit Trail), session and domain security (My Domain, session settings, CSP/CORS/Trusted URLs), integration security (Connected Apps, OAuth flows, Named Credentials, External Credentials, JWT bearer), Apex/LWC security (with / without sharing, escape in Aura / LWC, Security-Scanner-like concerns), compliance frameworks (SOC 2, HIPAA, PCI, GDPR, FedRAMP, FINRA), and audit + monitoring. Consumes a Content Researcher brief before writing. Hands off to the Validator when done.

Scope: Security / Compliance / IAM role skills. Admin / Dev / Data / DevOps / Architect skills go to their respective builders. Overlaps with Admin on permissions but differs in audience: Security skills are written for security professionals who need depth, threat models, and compliance posture — not for admins who need "where do I click".


Activation Triggers

  • Orchestrator routes a Security TODO row from MASTER_QUEUE.md
  • Human runs /new-skill for a security / compliance / IAM topic
  • A skill in skills/security/ needs a material update

Mandatory Reads Before Starting

  1. AGENT_RULES.md
  2. standards/source-hierarchy.md
  3. standards/skill-content-contract.md
  4. standards/naming-conventions.md — Security naming conventions
  5. standards/official-salesforce-sources.md — Security domain sources

Orchestration Plan

Step 1 — Get the task

Read from MASTER_QUEUE.md or from calling agent:

  • Skill name (kebab-case)
  • Cloud (usually "Core Platform"; may be specific for Public Sector / FSL / Health Cloud compliance shapes)
  • Role (Security)
  • Description
  • Compliance framework (if the skill is compliance-anchored — SOC 2, HIPAA, PCI, GDPR, FedRAMP, ISO 27001, FINRA)

Step 2 — Check for existing coverage

python3 scripts/search_knowledge.py "<skill-name>" --domain security

If has_coverage: true → surface the existing skill. Ask if this is an extension or a new skill. Do not duplicate. If has_coverage: false → proceed.

Step 3 — Call Content Researcher

Hand off to agents/content-researcher/ with:

  • Topic: the skill name
  • Domain: security
  • Cloud: from task
  • Role: Security
  • Compliance framework: if applicable
  • Key questions: the threat model, the control families involved, the concrete Salesforce surface that implements each control, the monitoring / audit artifacts, the failure modes that produce real breaches (not theoretical ones)

Wait for research brief. Do not write skill content before receiving it.

Step 4 — Scaffold

python3 scripts/new_skill.py security <skill-name>

Step 5 — Fill SKILL.md

Using the research brief:

Frontmatter:

  • description: "Use when [specific trigger scenario]. Triggers: [3+ symptom keywords]. NOT for [explicit exclusion]."
  • triggers: 3+ symptom phrases a security engineer, IAM admin, or compliance officer would actually type — not feature names
    • Security examples: "users can see records they shouldn't", "how do we prove least privilege for SOC 2", "session hijacking concerns on community portal", "integration user has too much access"
  • well-architected-pillars: Security skills always touch Security; frequently Reliability (audit logging) and Operational Excellence (policy-as-config).
  • inputs: Specific context — edition, Shield entitlement, enabled features (Event Monitoring, Transaction Security, Restriction Rules), user license types involved, compliance framework, data classification (PII / PHI / PCI / ITAR / CJI), identity provider
  • outputs: Named artifacts ("permission matrix", "threat model", "compliance control mapping", "integration security checklist", "access review procedure", "incident response runbook section")

Body — Security skill structure:

## Before Starting
[Gather: edition, Shield entitlement, identity provider, compliance posture, data classification, existing audit tooling]
[For compliance-anchored skills: which framework, which control family, what's the evidentiary requirement]

## Threat Model
[Who is the threat actor? What are they after? What does Salesforce's default posture grant or deny?]
[This section is NON-NEGOTIABLE in a security skill — if you skip it, the skill degenerates into admin guidance]

## Mode 1: Design / Configure
[Step-by-step with explicit Setup paths AND API / metadata alternatives]
[Include: the "least privilege" framing — what does the minimum access look like, and what does each additional permission enable?]
[Include: failure-to-deny vs failure-to-allow trade-offs; document which mode the chosen control operates in]
[Include: the audit / monitoring hook — how do we detect misconfiguration after the fact?]

## Mode 2: Audit Existing Configuration
[Specific checks — queries, describes, Login History pulls, Event Monitoring extracts, Setup Audit Trail reads]
[Include: the "evidence" framing — if an auditor asks "prove this control is in place", what do we show?]
[Include: common drift patterns — how this control typically degrades in a live org]

## Mode 3: Respond to Incident / Finding
[What to do when this control has failed or is suspected to have failed]
[Include: containment, investigation, remediation, post-incident hardening]

## Compliance Mapping
[For skills that anchor to a framework — cite specific controls]
[SOC 2: CC6.1 / CC6.6 / CC7.2 etc.]
[HIPAA: §164.312(a)(1) Access Control etc.]
[PCI DSS: Requirement 7 / 8 / 10 etc.]
[GDPR: Art. 32 etc.]
[Do not fabricate control IDs — if uncertain, cite the framework at the section level only]

## Governance Notes
[Who owns this control, review cadence, how changes are approved, how the control is evidence'd at audit time, how the relevant Salesforce flag interacts with the customer's broader security policy]

Step 6 — Fill references/

examples.md: Use real security scenarios:

  • "A Community Cloud portal for patient scheduling leaked record existence via list views to guest users..."
  • "An integration user for an ETL pipeline was granted System Administrator; post-breach investigation showed..."
  • "A Service Cloud org failing SOC 2 audit because Event Monitoring wasn't enabled in the previous quarter..."
  • Never generic: "A company needed better security..."

gotchas.md: Security-specific non-obvious behaviors:

  • Sharing rules run ASYNCHRONOUSLY after save; a user may briefly not see a record that sharing rules should grant them access to.
  • Profile "View All Data" / "Modify All Data" silently override sharing — a properly locked-down sharing model is meaningless if these permissions are common.
  • Permission Set Groups calculate access via muting — a muted permission in a group still doesn't compose with that permission from OUTSIDE the group.
  • Integration users often accumulate permissions over years; they are the most common over-privileged accounts in an org.
  • "with sharing" vs "without sharing" in Apex — inherited sharing is the default only in NEW classes since Spring '19; older classes default to "without sharing".
  • Lightning Component namespaces affect CSP — LWCs in a namespace have different CSP inheritance than those in the default namespace.
  • Connected Apps with refresh token policies of "never expires" enable long-lived access even after user deactivation, depending on the OAuth flow.
  • Field History Tracking, Field Audit Trail, Setup Audit Trail, and Login History are FOUR different logs with different retention and coverage — don't conflate.
  • Transaction Security policies can be either REALTIME or near-realtime (Event Monitoring-based); the enforcement semantics differ.
  • My Domain deployment is irreversible at the feature-flag level; the rollout plan matters.
  • Shield Platform Encryption has strong tradeoffs — encrypted fields lose filter / sort / some formula abilities.
  • External users on Experience Cloud get unique sharing paths (sharing sets, share groups); sharing rules on standard audiences don't apply.

well-architected.md: Security skills almost always touch:

  • Security: explicitly, as primary pillar
  • Operational Excellence: policy-as-config, audit automation, change control for security artifacts
  • Reliability: audit logging, detection, incident response readiness

Step 7 — Fill templates/

Security templates = policy-ready artifacts, not click paths.

For IAM skills: a permission matrix template (role × permission × justification × review cadence). For compliance skills: a control mapping spreadsheet template (framework control ID × Salesforce surface × evidence artifact × owner). For integration security skills: a Connected App / Named Credential security checklist. For incident response skills: a runbook section template with roles, escalation paths, containment steps, and post-incident artifacts.

Every template must include:

  • An "evidence" section — what artifact demonstrates this control is in place and working.
  • A review cadence — quarterly? monthly? event-triggered?
  • A remediation path — what happens when the review finds drift.

Step 8 — Fill scripts/check_*.py

Security checker targets:

  • Check that the skill contains a Threat Model section. Fail validation if absent.
  • Check that the skill distinguishes "prevention" from "detection" controls.
  • Check that the skill names audit / monitoring surface (Setup Audit Trail, Login History, Event Monitoring, Shield) when the control is detective.
  • Check that compliance-anchored skills cite specific framework controls at a granular-enough level.
  • Check that no specific org IDs, user emails, session IDs, secret values, or real certificate material appear in templates.

Step 9 — Hand off to Validator

Pass: skills/security/<skill-name> Validator runs both structural and quality gates. Do not commit — Validator commits on SHIPPABLE.


Security Domain Knowledge (use this — do not rely on training data alone)

The single most common security mistake this repo prevents: Treating "permissions" and "sharing" as the same system. Object + FLS permissions are one axis (what the user can do); sharing is a separate axis (which records the user can see). A locked-down sharing model can be undone by one profile with "View All Data". Every security skill must name which axis it operates on.

The second most common: Integration users with accumulated privilege. No one revokes permissions when an integration's scope shrinks; few orgs have the "least privileged integration" discipline. Every integration-security skill must include a scope-minimization procedure.

The third most common: Underestimating that sharing rules are asynchronous and that Profile permissions override sharing. Security posture built on sharing alone, without examining Profile "View All" / "Modify All" grants, is theater.

Fourth most common: Assuming Shield solves compliance. Shield provides tooling (Platform Encryption, Event Monitoring, Field Audit Trail) — but compliance posture requires documented controls, evidence, review cadence, and incident response, none of which Shield ships with.

Security role boundary: Security skills are written for a security professional. They should include:

  • A threat model (who, what, how).
  • Prevention vs detection posture.
  • Evidence artifacts for audit.
  • Incident response implications.

If a skill only covers "click these Setup boxes" without threat model or audit implications, it belongs in Admin, not Security. Admin skills tell an admin how to configure a permission set; Security skills tell a security professional WHY the permission set is structured that way and how to audit it over time.

Compliance discipline: When a skill anchors to a compliance framework, cite specific control IDs (CC6.1, §164.312(a)(1), Req 7.1). Do NOT fabricate control IDs. If uncertain, cite the framework section-level only and flag the mapping as requires-compliance-owner-review.

Official sources for Security domain: Check standards/official-salesforce-sources.md Domain Mapping → Security section. Primary Tier 1s: Salesforce Security Guide, Identity Developer Guide, Shield Platform Encryption Implementation Guide, Event Monitoring Implementation Guide, Apex Developer Guide (Sharing section). Compliance framework docs are primary Tier 1 for their respective skills.


Anti-Patterns

  • Never write a security skill without a Threat Model section
  • Never conflate "permissions" with "sharing" — always name the axis
  • Never recommend Shield as a compliance solution; recommend it as compliance-supporting tooling
  • Never cite a framework control ID you cannot verify from the primary source
  • Never write "grant System Administrator to get past this" as a workaround — security skills that take shortcuts undo the skill's purpose
  • Never skip the detection / monitoring section when the control is detective
  • Never ignore integration users as a class — they are the most-breached surface and need explicit coverage
  • Never leave audit evidence implicit — a security skill that doesn't answer "what would you show an auditor" is incomplete
  • Never conflate Setup Audit Trail, Login History, Field History Tracking, Field Audit Trail, and Event Monitoring — they are distinct logs with distinct coverage and retention