Skip to content
Skills Library
Security · Analysis

security-detection

/security-detection

Detect infrastructure and security-critical file changes to trigger security agent review recommendations ensuring proper security oversight for sensitive modifications. Use when you ask "did I touch security-critical files", "should the security agent review this". Detection only. Do NOT use to scan source for injection patterns (use security-scan).

Repository
ai-agents ↗
Licence
MIT
Last repository change
25.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
2
Scripts
1
HTML comments
1
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 25.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.
  • SKILL.md zawiera komentarze HTML (1). Nie widać ich w podglądzie Markdown, a model je czyta.

Scripts: detect_infrastructure.py

What it does and when to use it

Detect infrastructure and security-critical file changes to trigger security agent review recommendations ensuring proper security oversight for sensitive modifications. Use when you ask "did I touch security-critical files", "should the security agent review this". Detection only. Do NOT use to scan source for injection patterns (use security-scan).

Triggers from the description

did I touch security-critical filesshould the security agent review this
Original author description

Detect infrastructure and security-critical file changes to trigger security agent review recommendations ensuring proper security oversight for sensitive modifications. Use when you ask "did I touch security-critical files", "should the security agent review this". Detection only. Do NOT use to scan source for injection patterns (use security-scan).

How it works

  1. Triggers
  2. When to Use
  3. Available Scripts
  4. Usage
  5. Output
  6. Risk Levels
  7. Detected Patterns
  8. Integration
  9. Exit Codes
  10. Customization
Original SKILL.md headings · 189 lines, 855 words
SKILL.md preview
---
name: security-detection
description: Detect infrastructure and security-critical file changes to trigger security agent review recommendations ensuring proper security oversight for sensitive modifications. Use when you ask "did I touch security-critical files", "should the security agent review this". Detection only. Do NOT use to scan source for injection patterns (use security-scan).
metadata:
  routing:
    role: front-door
    invoker: autoplan
    trigger: autoplan routes did-I-touch-security-critical-files questions to security-detection
    user-facing: false
---

# Security Detection Utility

## Triggers

| Trigger Phrase | Operation |
|----------------|-----------|
| `scan for security changes` | detect-infrastructure with staged files |
| `check security-critical files` | detect-infrastructure with file list |
| `run security scan on changes` | detect-infrastructure analysis |
| `do I need a security review` | Risk-level assessment of changed files |
| `check infrastructure changes` | Pattern matching against critical/high lists |

---

## When to Use

Use this skill when:

- Committing changes that may touch infrastructure or security files
- Pre-commit validation for security-sensitive paths
- Determining if a security agent review is needed
- CI pipeline security gate checks

Use the security agent directly instead when:

- You already know security review is needed
- Performing threat modeling or vulnerability assessment
- Reviewing authentication or authorization code in depth

---

## Available Scripts

| Script | Language | Usage |
|--------|----------|-------|
| `detect_infrastructure.py` | Python 3 | Cross-platform |

## Usage

```bash
# Analyze staged files
python detect_infrastructure.py --use-git-staged

# Analyze specific files
python detect_infrastructure.py --files .github/workflows/ci.yml src/auth/login.cs
```

## Output

When security-critical files are detected:

```text
=== Security Review Detection ===

CRITICAL: Security agent review REQUIRED

Matching files:
  [CRITICAL] .github/workflows/deploy.yml
  [HIGH] src/Controllers/AuthController.cs

Run security agent before implementation:
  Task(subagent_type="security", prompt="Review infrastructure changes")
```

When no matches:

```text
No infrastructure/security files detected.
```

## Risk Levels

| Level | Meaning | Action |
|-------|---------|--------|
| CRITICAL | Immediate security implications | Review REQUIRED |
| HIGH | Potential security impact | Review RECOMMENDED |

## Detected Patterns

### Critical (Review Required)

- CI/CD workflows (`.github/workflows/*`)
- Git hook configuration (`{lefthook,.lefthook,lefthook-local,.lefthook-local}.{yml,yaml,json,jsonc,toml}`, `.config/{lefthook,lefthook-local}.{yml,yaml,json,jsonc,toml}`, `.husky/*`)
- Git hook policy (`scripts/validation/git_hook_policy.py`)
- Authentication code (`**/Auth/**`, `**/Security/**`)
- Environment files (`*.env*`)
- Credentials and keys (`*.pem`, `*.key`, `*secret*`)

### High (Review Recommended)

- Build scripts (`build/**/*.ps1`, `scripts/**/*.sh`)
- Container configs (`Dockerfile*`, `docker-compose*`)
- API controllers (`**/Controllers/**`)
- App configuration (`appsettings*.json`)
- Infrastructure as Code (`*.tf`, `*.tfvars`, `*.bicep`)

## Integration

### Pre-commit Hook

Add a named validator job to `lefthook.yml`:

```bash
# Security detection (non-blocking warning)
python3 .claude/skills/security-detection/detect_infrastructure.py --use-git-staged
```

### CI Integration

On a Linux pull-request runner, pass the changed paths explicitly. CI checkouts
do not have a staged diff.

```yaml
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
  with:
    fetch-depth: 0

- name: Check security-critical files
  shell: bash
  env:
    BASE_SHA: ${{ github.event.pull_request.base.sha }}
    HEAD_SHA: ${{ github.sha }}
  run: >-
    git diff --no-renames --name-only -z "$BASE_SHA" "$HEAD_SHA"
    | python .claude/skills/security-detection/detect_infrastructure.py
    --files-from-stdin
```

## Exit Codes

| Code | Meaning |
|------|---------|
| 0 | Detection finished. Matches print a warning that does not block. With `--require-security-review`, also: no CRITICAL file, or every CRITICAL file has a valid security review marker. |
| 1 | `--require-security-review` is set and a CRITICAL file has no valid marker on the ref (BLOCKED). |
| 3 | `--require-security-review` is set and git could not answer while reading the staged index or the review marker (git missing, timed out, exited non-zero, returned undecodable output, or rejected the ref) (BLOCKED). An unanswered check never counts as a marker. |

Without `--require-security-review` the scripts always exit 0, so advisory use
in commits and CI stays non-blocking. The warning is informational only. Only
the flag turns a CRITICAL finding or a failed git read into a blocking exit.

## Customization

Edit the pattern lists in either script to add or modify detection patterns:

- `CRITICAL_PATTERNS` / `$CriticalPatterns` - Review required
- `HIGH_PATTERNS` / `$HighPatterns` - Review recommended

## Process

1. Gather the list of changed files (staged or explicit)
2. Run pattern matching against critical and high-risk file patterns
3. Report findings with risk level classification
4. Route to security agent if CRITICAL matches found

## Anti-Patterns

| Avoid | Why | Instead |
|-------|-----|---------|
| Skipping detection before commits | Security files slip through unreviewed | Run detection on every commit with infrastructure changes |
| Treating warnings as blocking | Scripts exit 0 intentionally | Use output to inform review decisions, not block commits |
| Hardcoding custom patterns inline | Drifts from canonical pattern lists | Edit CRITICAL_PATTERNS/HIGH_PATTERNS in the scripts |
| Ignoring HIGH-level matches | Potential security impact overlooked | Review HIGH matches, escalate to security agent when uncertain |
| Running only one language script | May miss platform-specific detection | Use whichever script matches your environment |

---

## Verification

After running security detection:

- [ ] Script exited with code 0, or with 1 or 3 only under `--require-security-review` (blocked)
- [ ] All CRITICAL matches reviewed
- [ ] Security agent routed for CRITICAL findings
- [ ] HIGH matches evaluated for review need
- [ ] Output captured in session log if security-relevant

---

## Related Documents

Backticked paths below are in the `rjmurillo/ai-agents` repository. They do not ship with this skill; a consumer install cannot resolve them.

- `.project-toolkit/security/infrastructure-file-patterns.md`. Infrastructure file patterns.
- `.project-toolkit/security/static-analysis-checklist.md`. Security agent capabilities.
- `docs/orchestrator-routing-algorithm.md`. Orchestrator routing algorithm.

<!-- vendor-portability: declared. This skill cites .project-toolkit/security/infrastructure-file-patterns.md, .project-toolkit/security/static-analysis-checklist.md, and docs/orchestrator-routing-algorithm.md as background reading. All three are citations only; the detection patterns documented here are self-contained, so a vendored install loses the further reading, not the capability. Issue #2050. -->
Files in this package (2)
  • SKILL.md 7 KB
  • detect_infrastructure.py 36 KB

Versions

RepositoryScoreLicence
This page · rjmurillo/ai-agents100MIT
rjmurillo/ai-agents100MIT
rjmurillo/ai-agents100MIT

Identical content appears in 2 other GitHub folders. We show one copy with the highest score.

Database snapshot: 13.11.2026 · package version a276d47e9b43 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100repo-security-scan
    Scans a repository for sensitive information and security vulnerabilities. Use when the user asks to "scan for security issues", "check for sensitive data", "repo security scan", "make sure this repo has no sensitive information", "security audit", "scan history for secrets", or…
  • 96security-review
    Use when the user asks for a security review or audit of code or changes (injection, secrets, unsafe input handling, permissions).
  • 100security-code-review
    Review FlashDreams changes for production, policy, and security risk. Use for security-sensitive changes, release-critical paths, or final merge approval.
  • 85pre-commit-scan
    Automatic security scan triggered before git commits. Runs the Opsera security scan tool against the entire repo, categorizes findings into new (staged) vs existing, and blocks commits only if staged changes have critical/high issues.
  • 90commit-security-scan
    Scan code changes for security vulnerabilities using Bug Hunter-native artifacts and STRIDE context. Use whenever the user asks for PR security review, commit-diff scanning, staged-change security checks, branch-comparison security review, or pre-merge security analysis of changed code.
  • 100security-scan
    Detect CWE-78 (command injection) regex patterns in Python, PowerShell, Bash, and C# files before PR submission. CWE-22 is delegated to CodeQL; see Scope. Use when you ask "scan for command injection", "CWE-78 check before PR". Do NOT use to decide whether security review is…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.