Skip to main content

audit rules

Browse, enable, disable, and customize audit rules.

skillshare audit rules                          # Interactive TUI rule browser
skillshare audit rules --no-tui # Plain text table
skillshare audit rules --pattern credential-access # Filter by pattern
skillshare audit rules --severity high # Filter by severity
skillshare audit rules --disabled # Show only disabled rules
skillshare audit rules --format json # JSON output

skillshare audit rules disable prompt-injection-0 # Disable single rule
skillshare audit rules disable --pattern credential-access # Disable entire group
skillshare audit rules enable prompt-injection-0 # Re-enable rule
skillshare audit rules enable --pattern credential-access # Re-enable group

skillshare audit rules severity destructive-commands-2 medium # Downgrade one rule
skillshare audit rules severity --pattern destructive-commands low # Downgrade entire group
skillshare audit rules reset # Remove all custom rules, restore defaults

skillshare audit rules init # Create starter audit-rules.yaml
skillshare audit rules init -p # Create project-level rules file

Pattern-Level Rules

You can disable or override entire pattern groups in audit-rules.yaml:

rules:
# Disable all credential-access rules
- pattern: credential-access
enabled: false

# But keep .env detection
- id: credential-access-env-file
enabled: true

# Downgrade all destructive-commands to MEDIUM
- pattern: destructive-commands
severity: MEDIUM

Pattern-level entries use pattern without id. Merge order: pattern-level rules apply first, then id-level rules can override individual entries within a disabled group.

Custom Rules

You can add, override, or disable audit rules using YAML files. Rules are merged in order: built-in → global user → project user.

Use --init-rules (or audit rules init) to create a starter file with commented examples:

skillshare audit --init-rules         # Create global rules file
skillshare audit -p --init-rules # Create project rules file

File Locations

ScopePath
Global~/.config/skillshare/audit-rules.yaml
Project.skillshare/audit-rules.yaml

Format

rules:
# Add a new rule
- id: my-custom-rule
severity: HIGH
pattern: custom-check
message: "Custom pattern detected"
regex: 'DANGEROUS_PATTERN'

# Add a rule with an exclude (suppress matches on certain lines)
- id: url-check
severity: MEDIUM
pattern: url-usage
message: "External URL detected"
regex: 'https?://\S+'
exclude: 'https?://(localhost|127\.0\.0\.1)'

# Override an existing built-in rule (match by id)
- id: destructive-commands-2
severity: MEDIUM
pattern: destructive-commands
message: "Sudo usage (downgraded to MEDIUM)"
regex: '(?i)\bsudo\s+'

# Disable a built-in rule
- id: insecure-http-0
enabled: false

# Disable the dangling-link structural check
- id: dangling-link
enabled: false

Fields

FieldRequiredDescription
idYesStable identifier. Matching IDs override built-in rules.
severityYes*CRITICAL, HIGH, MEDIUM, LOW, or INFO
patternYes*Rule category name (e.g., prompt-injection)
messageYes*Human-readable description shown in findings
regexYes*Regular expression to match against each line
excludeNoIf a line matches both regex and exclude, the finding is suppressed
enabledNoSet to false to disable a rule. Only id is required when disabling.

*Required unless enabled: false.

Merge Semantics

Each layer (global, then project) is applied on top of the previous:

  • Same id + enabled: false → disables the rule
  • Same id + other fields → replaces the entire rule
  • New id → appends as a custom rule
  • pattern only (no id) + enabled: false → disables all rules matching that pattern
  • pattern only + severity → overrides severity for all matching rules
  • Pattern then id → id-level entries can re-enable individual rules within a disabled pattern group

Practical Templates

Use this as a starting point for real-world policy tuning:

rules:
# Team policy: detect obvious hardcoded API tokens
- id: hardcoded-token-policy
severity: HIGH
pattern: hardcoded-token
message: "Potential hardcoded token detected"
regex: '(?i)\b(ghp_[A-Za-z0-9]{20,}|sk-[A-Za-z0-9]{20,})\b'

# Override built-in suspicious-fetch with internal allowlist
- id: suspicious-fetch-0
severity: MEDIUM
pattern: suspicious-fetch
message: "External URL used in command context"
regex: '(?i)(curl|wget|invoke-webrequest|iwr)\s+https?://'
exclude: '(?i)https?://(localhost|127\.0\.0\.1|artifacts\.company\.internal|registry\.company\.internal)'

# Governance exception: disable noisy insecure-http signal
- id: insecure-http-0
enabled: false

Getting Started with init

audit rules init (or audit --init-rules) creates a starter audit-rules.yaml with commented examples you can uncomment and adapt:

skillshare audit rules init          # → ~/.config/skillshare/audit-rules.yaml
skillshare audit rules init -p # → .skillshare/audit-rules.yaml

The generated file looks like this:

# Custom audit rules for skillshare.
# Rules are merged on top of built-in rules in order:
# built-in → global (~/.config/skillshare/audit-rules.yaml)
# → project (.skillshare/audit-rules.yaml)
#
# Each rule needs: id, severity, pattern, message, regex.
# Optional: exclude (suppress match), enabled (false to disable).

rules:
# Example: flag TODO comments as informational
# - id: flag-todo
# severity: MEDIUM
# pattern: todo-comment
# message: "TODO comment found"
# regex: '(?i)\bTODO\b'

# Example: disable a built-in rule by id
# - id: insecure-http-0
# enabled: false

# Example: disable the dangling-link structural check
# - id: dangling-link
# enabled: false

# Example: override a built-in rule (match by id, change severity)
# - id: destructive-commands-2
# severity: MEDIUM
# pattern: destructive-commands
# message: "Sudo usage (downgraded)"
# regex: '(?i)\bsudo\s+'

If the file already exists, init exits with an error — it never overwrites existing rules.

Workflow: Fixing a False Positive

A common reason to customize rules is when a legitimate skill triggers a built-in rule. Here's a step-by-step example:

1. Run audit and see the false positive:

$ skillshare audit ci-helper
[1/1] ! ci-helper 0.2s
└─ HIGH: Destructive command pattern (SKILL.md:42)
"sudo apt-get install -y jq"

2. Identify the rule ID from the built-in rules table:

The pattern destructive-commands with sudo matches rule destructive-commands-2.

3. Create a custom rules file (if you haven't already):

skillshare audit rules init

4. Add a rule override to suppress or downgrade:

# ~/.config/skillshare/audit-rules.yaml
rules:
# Downgrade sudo to MEDIUM for CI automation skills
- id: destructive-commands-2
severity: MEDIUM
pattern: destructive-commands
message: "Sudo usage (downgraded for CI automation)"
regex: '(?i)\bsudo\s+'

Or disable it entirely:

rules:
- id: destructive-commands-2
enabled: false

5. Re-run audit to confirm:

$ skillshare audit ci-helper
[1/1] ✓ ci-helper 0.1s # Now passes (or shows MEDIUM instead of HIGH)

Validate Changes

After editing rules, re-run audit to verify:

skillshare audit                     # Check all skills
skillshare audit <name> # Check a specific skill
skillshare audit --json | jq '.skills[].findings' # Inspect findings programmatically

Summary interpretation:

  • Failed counts skills with findings at or above the active threshold.
  • Warning counts skills with findings below threshold but above clean (for example HIGH/MEDIUM/LOW/INFO when threshold is CRITICAL).

Built-in Rule IDs

Use id values to override or disable specific built-in rules:

Source of truth for regex-based rules: internal/audit/rules.yaml

Structural, tier, and cross-skill checks

dangling-link, content-tampered, content-oversize, content-missing, and content-unexpected are structural checks (filesystem lookups and hash comparisons, not regex). low-analyzability is an analyzability finding generated from the Analyzability Score. tier-stealth, tier-destructive-network, tier-network-heavy, tier-interpreter, and tier-interpreter-network are tier combination findings generated from Command Safety Tiering profiles. cross-skill-* findings are generated from Cross-Skill Interaction Detection. All of these appear in the table below but are not defined in rules.yaml.

IDPatternSeverity
prompt-injection-0prompt-injectionCRITICAL
prompt-injection-1prompt-injectionCRITICAL
prompt-injection-2prompt-injectionHIGH
prompt-injection-3prompt-injectionCRITICAL
prompt-injection-4prompt-injectionCRITICAL
hidden-unicode-1invisible-payloadCRITICAL
data-exfiltration-0data-exfiltrationCRITICAL
data-exfiltration-1data-exfiltrationCRITICAL
data-exfiltration-2data-exfiltrationMEDIUM
data-exfiltration-3data-exfiltrationHIGH
credential-access-ssh-private-keycredential-accessCRITICAL
credential-access-env-filecredential-accessCRITICAL
credential-access-aws-credentialscredential-accessCRITICAL
credential-access-etc-shadowcredential-accessCRITICAL
credential-access-git-credentialscredential-accessCRITICAL
credential-access-netrccredential-accessCRITICAL
credential-access-gnupgcredential-accessCRITICAL
credential-access-kube-configcredential-accessCRITICAL
credential-access-vault-tokencredential-accessCRITICAL
credential-access-terraform-credscredential-accessCRITICAL
credential-access-gnome-keyringcredential-accessCRITICAL
credential-access-npmrccredential-accessCRITICAL
credential-access-pypirccredential-accessCRITICAL
credential-access-gem-credentialscredential-accessCRITICAL
credential-access-ssl-privatecredential-accessCRITICAL
credential-access-ssh-host-keycredential-accessCRITICAL
credential-access-pgpasscredential-accessCRITICAL
credential-access-mysql-cnfcredential-accessCRITICAL
credential-access-etc-passwdcredential-accessMEDIUM
credential-access-azure-credscredential-accessHIGH
credential-access-gcloud-credscredential-accessHIGH
credential-access-docker-configcredential-accessHIGH
credential-access-gh-cli-tokencredential-accessHIGH
credential-access-password-storecredential-accessHIGH
credential-access-macos-keychain-usercredential-accessHIGH
credential-access-macos-keychain-syscredential-accessHIGH
credential-access-terraformrccredential-accessHIGH
credential-access-cargo-credentialscredential-accessHIGH
credential-access-op-clicredential-accessHIGH
credential-access-age-keyscredential-accessHIGH
credential-access-shell-historycredential-accessLOW
credential-access-openvpncredential-accessLOW
credential-access-auth-logcredential-accessINFO
credential-access-unknown-dotdircredential-accessINFO

Note: Each credential entry above also generates variant IDs per access method: -copy, -redirect, -dd, -exfil (e.g., credential-access-ssh-private-key-copy). To disable a specific variant, use its full ID in your audit-rules.yaml.

IDPatternSeverity
hidden-unicode-0hidden-unicodeHIGH
hidden-unicode-2hidden-unicodeHIGH
config-manipulation-0config-manipulationHIGH
hidden-comment-injection-1hidden-comment-injectionHIGH
self-propagation-0self-propagationHIGH
destructive-commands-0destructive-commandsHIGH
destructive-commands-1destructive-commandsHIGH
destructive-commands-2destructive-commandsHIGH
destructive-commands-3destructive-commandsHIGH
destructive-commands-4destructive-commandsHIGH
dynamic-code-exec-0dynamic-code-execHIGH
dynamic-code-exec-1dynamic-code-execHIGH
shell-execution-0shell-executionHIGH
hidden-comment-injection-0hidden-comment-injectionHIGH
obfuscation-0obfuscationHIGH
fetch-with-pipe-0fetch-with-pipeHIGH
fetch-with-pipe-1fetch-with-pipeHIGH
fetch-with-pipe-2fetch-with-pipeHIGH
data-uri-0data-uriMEDIUM
escape-obfuscation-0escape-obfuscationMEDIUM
suspicious-fetch-0suspicious-fetchMEDIUM
ip-address-url-0ip-address-urlMEDIUM
hidden-unicode-3hidden-unicodeMEDIUM
untrusted-install-0untrusted-installMEDIUM
untrusted-install-1untrusted-installMEDIUM
insecure-http-0insecure-httpLOW
external-link-0external-linkLOW
dangling-linkdangling-linkLOW
content-tamperedcontent-tamperedMEDIUM
content-oversizecontent-oversizeMEDIUM
content-missingcontent-missingLOW
content-unexpectedcontent-unexpectedLOW
shell-chain-0shell-chainINFO
low-analyzabilitylow-analyzabilityINFO
tier-stealthtier-stealthCRITICAL
tier-destructive-networktier-destructive-networkHIGH
tier-network-heavytier-network-heavyMEDIUM
tier-interpretertier-interpreterINFO
tier-interpreter-networktier-interpreter-networkMEDIUM
cross-skill-exfiltrationcross-skill-exfiltrationHIGH
cross-skill-privilege-networkcross-skill-privilege-networkMEDIUM
cross-skill-stealthcross-skill-stealthHIGH
cross-skill-cred-interpretercross-skill-cred-interpreterMEDIUM

Subcommands

SubcommandDescription
rulesBrowse, enable, and disable audit rules
rules disable <id>Disable a single rule by ID
rules disable --pattern <p>Disable all rules matching a pattern
rules enable <id>Re-enable a single rule by ID
rules enable --pattern <p>Re-enable all rules matching a pattern
rules severity <id> <level>Override severity for a single rule
rules severity --pattern <p> <level>Override severity for all rules in a pattern group
rules resetRemove all custom rules (restore built-in defaults)
rules initCreate a starter audit-rules.yaml (same as audit --init-rules)

See Also