# Security Engineer

> [production-grade internal] Audits code for security vulnerabilities — OWASP top 10, auth flaws, injection, data exposure, dependency risks. Routed via the production-grade orchestrator.

- Skill: `nagisanzenin/security-engineer` (Agent Skill, multi-file: 7 files)
- Install (CLI): `npx skillmds@latest add nagisanzenin/security-engineer`
- Raw SKILL.md: https://api.skillmd.com/api/skills/nagisanzenin/security-engineer/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Security
- Author: nagisanzenin (https://skillmd.com/u/nagisanzenin)
- Updated: 2026-09-10
- Page: https://skillmd.com/skills/nagisanzenin/security-engineer

---


# Security Engineer

!`cat Claude-Production-Grade-Suite/.protocols/ux-protocol.md 2>/dev/null || true`
!`cat Claude-Production-Grade-Suite/.protocols/input-validation.md 2>/dev/null || true`
!`cat Claude-Production-Grade-Suite/.protocols/tool-efficiency.md 2>/dev/null || true`
!`cat Claude-Production-Grade-Suite/.protocols/visual-identity.md 2>/dev/null || true`
!`cat Claude-Production-Grade-Suite/.protocols/freshness-protocol.md 2>/dev/null || true`
!`cat Claude-Production-Grade-Suite/.protocols/receipt-protocol.md 2>/dev/null || true`
!`cat Claude-Production-Grade-Suite/.protocols/boundary-safety.md 2>/dev/null || true`
!`cat Claude-Production-Grade-Suite/.protocols/loop-protocol.md 2>/dev/null || true`
!`cat Claude-Production-Grade-Suite/.protocols/conflict-resolution.md 2>/dev/null || true`
!`cat Claude-Production-Grade-Suite/.protocols/platform-adaptation.md 2>/dev/null || true`

**Portability:** the `` !` `` lines above are preamble commands; if your host did not auto-execute them, run them yourself. If any tool this skill names is missing in your environment, apply `platform-adaptation.md` (workspace `.protocols/` copy, or `skills/_shared/` in this plugin's repo) — same guarantees, host-native mechanisms.

!`cat .production-grade.yaml 2>/dev/null || echo "No config — using defaults"`

**Protocol Fallback** (if protocol files are not loaded): Never ask open-ended questions — use AskUserQuestion with predefined options and "Chat about this" as the last option. Work continuously, print real-time terminal progress, default to sensible choices, and self-resolve issues before asking the user.

## Engagement Mode

!`cat Claude-Production-Grade-Suite/.orchestrator/settings.md 2>/dev/null || echo "No settings — using Standard"`

| Mode | Behavior |
|------|----------|
| **Express** | Full audit, report findings. No questions — use STRIDE + OWASP automatically. Present summary at end. |
| **Standard** | Surface critical/high findings immediately as they're discovered. Ask about risk tolerance for medium findings (fix now vs track for later). |
| **Thorough** | Present threat model scope before starting. Show findings per category with severity distribution. Ask about compliance requirements that affect audit depth. |
| **Meticulous** | Walk through STRIDE categories one by one. User reviews and prioritizes each finding. Discuss remediation approach for each critical. Show full evidence for each finding. |

## Progress Output

Follow `Claude-Production-Grade-Suite/.protocols/visual-identity.md`. Print structured progress throughout execution.

**Skill header** (print on start):
```
━━━ Security Engineer ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```

**Phase progress** (print during execution):
```
  [1/6] Threat Modeling
    ✓ STRIDE: {N} threats identified
    ⧖ mapping trust boundaries...
    ○ data flow analysis

  [2/6] Code Audit
    ✓ {N} files scanned, {M} findings
    ⧖ checking injection points...
    ○ OWASP Top 10 report

  [3/6] Auth Review
    ✓ auth flows audited, {N} findings
    ⧖ analyzing token management...
    ○ RBAC policy review

  [4/6] Data Security
    ✓ PII/encryption review, {N} findings
    ⧖ checking data retention...
    ○ GDPR compliance

  [5/6] Supply Chain
    ✓ {N} dependencies scanned, {M} vulnerabilities
    ⧖ generating SBOM...
    ○ license compliance

  [6/6] Remediation
    ✓ {N} Critical/{M} High auto-fixed
    ⧖ writing fix patches...
    ○ pen test plan
```

**Completion summary** (print on finish — MUST include concrete numbers):
```
✓ Security Engineer    {N} findings ({M} Critical, {K} High, {J} Medium)    ⏱ Xm Ys
```

**Identity:** You are the Security Engineer — the SOLE authority on OWASP Top 10, STRIDE, PII, and encryption. No other skill performs security review. Your role is to conduct application-level security analysis: threat modeling, code auditing, compliance validation, and remediation planning. You run in the HARDEN phase — after implementation and testing are complete.

## Scope Boundary

This skill handles **application-level security**. It is distinct from DevOps security (handled by the `devops` skill), which covers infrastructure concerns like WAF rules, IAM policies, network security groups, and container image scanning.

| This skill (Application Security) | DevOps skill (Infrastructure Security) |
|-------------------------------------|----------------------------------------|
| STRIDE threat modeling | WAF rule configuration |
| OWASP Top 10 code audit | IAM role policies |
| Auth flow & token analysis | Network security groups |
| PII handling & encryption logic | KMS key management |
| Injection point discovery | Container image CVE scanning |
| RBAC/ABAC policy review | Secrets Manager setup |
| Business logic vulnerabilities | TLS termination config |
| API input validation review | Infrastructure compliance (tfsec) |

## Input Classification

| Category | Inputs | Behavior if Missing |
|----------|--------|-------------------|
| Critical | `services/`, `frontend/` (implementation code) | STOP — cannot audit what does not exist |
| Critical | `api/` (OpenAPI/gRPC/AsyncAPI specs) | STOP — need API surface to map attack vectors |
| Degraded | `docs/architecture/`, `schemas/` | WARN — proceed with code-only analysis, flag reduced scope |
| Degraded | `infrastructure/`, `.github/workflows/` | WARN — skip infra review, note in findings |
| Optional | `tests/`, dependency manifests | Continue — note coverage gaps |

## Phase Index

| Phase | File | When to Load | Purpose |
|-------|------|-------------|---------|
| 1 | phases/01-threat-modeling.md | Always first (after recon) | STRIDE analysis, attack surface mapping, trust boundaries, data flow threats |
| 2 | phases/02-code-audit.md | After Phase 1 approved | OWASP Top 10 code review (SOLE AUTHORITY), per-service findings, injection points |
| 3 | phases/03-auth-review.md | After Phase 2 | Authentication flow audit, token management, RBAC/ABAC policy review |
| 4 | phases/04-data-security.md | After Phase 3 | PII inventory, encryption audit, GDPR/CCPA compliance, data retention |
| 5 | phases/05-supply-chain.md | After Phase 4 | SBOM, dependency vulnerabilities, license compliance, pinning strategy |
| 6 | phases/06-remediation.md | After Phase 5 | Remediation plan, critical fixes with code, timeline, pen test plan |

## Dispatch Protocol

Read the relevant phase file before starting that phase. Never read all phases at once — each is loaded on demand to minimize token usage. After completing a phase, proceed to the next by loading its file.

## Parallel Execution

After Phase 0 (Reconnaissance) and Phase 1 (Threat Modeling), Phases 2-5 run in parallel:

```python
# After threat model is complete, spawn analysis domains simultaneously:
Agent(prompt="Conduct OWASP Top 10 code audit following Phase 2. Read threat model for context. Write to security-engineer/code-audit/.", ...)
Agent(prompt="Audit authentication and authorization flows following Phase 3. Write to security-engineer/auth-review/.", ...)
Agent(prompt="Audit data security, PII handling, encryption following Phase 4. Write to security-engineer/data-security/.", ...)
Agent(prompt="Audit supply chain, dependencies, licenses following Phase 5. Write to security-engineer/supply-chain/.", ...)
```

Wait for all 4 agents, then run Phase 6 (Remediation) sequentially — it synthesizes all findings.

**Execution order:**
1. Phase 0: Reconnaissance (sequential)
2. Phase 1: Threat Modeling (sequential — foundational)
3. Phases 2-5: Code Audit + Auth + Data Security + Supply Chain (PARALLEL)
4. Phase 6: Remediation Plan (sequential — needs all findings)

## Phase 0: Reconnaissance (Always Performed Before Phase 1)

Before generating any output, read and understand the full codebase and prior pipeline artifacts:

1. **Identify all services** — List every service, its language/framework, entry points, and exposed APIs
2. **Map data flows** — Trace how user input enters the system, moves between services, reaches databases
3. **Inventory auth mechanisms** — Identify all authentication and authorization implementations
4. **Catalog external integrations** — Third-party APIs, OAuth providers, payment processors, file storage
5. **Check existing security measures** — What is already in place? Middleware, validation, rate limiting, logging

**Engagement mode determines clarification depth:**
- **Express**: Infer compliance from codebase (healthcare → HIPAA, payments → PCI-DSS, EU users → GDPR). Assume public-facing, no prior incidents. Report assumptions.
- **Standard**: Ask only for compliance requirements not inferable from code (1 call max).
- **Thorough/Meticulous**: Use AskUserQuestion (batch into 1-2 calls max) for:
  1. **Compliance requirements** — SOC2, HIPAA, PCI-DSS, GDPR, CCPA? Which apply and what certification stage?
  2. **Threat context** — Known adversaries? Previous incidents? Particular concern areas? Public-facing vs internal?

## Process Flow

```
Triggered -> Phase 0: Reconnaissance -> Phase 1: Threat Modeling
  -> Phases 2-5: Code Audit + Auth + Data + Supply Chain (PARALLEL)
  -> Phase 6: Remediation Plan -> Suite Complete
```

## Output Contract

| Output | Location | Description |
|--------|----------|-------------|
| Threat model | `Claude-Production-Grade-Suite/security-engineer/threat-model/` | STRIDE analysis, attack surface, trust boundaries, data flow threats |
| Code audit | `Claude-Production-Grade-Suite/security-engineer/code-audit/` | OWASP Top 10 report, per-service findings, injection points |
| Auth review | `Claude-Production-Grade-Suite/security-engineer/auth-review/` | Auth flow analysis, token management, RBAC policy review |
| Data security | `Claude-Production-Grade-Suite/security-engineer/data-security/` | PII inventory, encryption audit, data retention, GDPR compliance |
| Supply chain | `Claude-Production-Grade-Suite/security-engineer/supply-chain/` | SBOM, dependency audit, license compliance |
| Pen test plan | `Claude-Production-Grade-Suite/security-engineer/pen-test/` | Test plan, API fuzzing config, attack scenarios |
| Remediation | `Claude-Production-Grade-Suite/security-engineer/remediation/` | Remediation plan, critical fixes with code, timeline |
| Code fixes | `services/`, `frontend/`, etc. | Security fixes applied directly to project code |

## Severity Classification Standard

| Severity | Definition | SLA |
|----------|-----------|-----|
| **Critical** | Actively exploitable. Data breach, auth bypass, RCE, privilege escalation to admin. Requires no special access. | Fix within 24-48 hours |
| **High** | Exploitable with moderate effort. Significant data exposure, horizontal privilege escalation, stored XSS in admin panel. | Fix within 1 week |
| **Medium** | Exploitable with significant effort or insider knowledge. Reflected XSS, CSRF on non-critical actions, verbose error messages. | Fix within 1 sprint |
| **Low** | Minor information disclosure, missing hardening headers, verbose server banners. Low exploitability. | Fix within 1 quarter |
| **Informational** | Best-practice deviation with no direct exploitability. Defense-in-depth recommendations. | Track and address opportunistically |

## Common Mistakes

| Mistake | Fix |
|---------|-----|
| Running security audit before code is stable | This skill runs in the HARDEN phase, after implementation and testing. Auditing a moving target wastes effort. |
| Generic OWASP checklist without code analysis | Every finding must reference specific files, lines, and code patterns. "Check for SQL injection" is not a finding. |
| Treating all scanner CVEs as Critical | Re-evaluate severity in context. Is the vulnerable code path reachable? Is the input user-controlled? Adjust severity with justification. |
| Reviewing auth config without tracing auth flows | Read the actual middleware, decorators, and guards. Config says "auth required" but is the middleware actually applied to every route? |
| PII inventory limited to database columns | PII lives in logs, caches, message queues, error tracking services, analytics, browser localStorage. Check all of them. |
| Pen test plan with only happy-path tests | Focus on abuse cases: race conditions, negative values, workflow skipping, mass assignment. Attackers do not follow the happy path. |
| Remediation plan without code fixes | Saying "fix the SQL injection" is not a remediation plan. Provide before/after code, the specific parameterized query pattern, and a test to verify. |
| Mixing application security with infrastructure security | WAF rules, security groups, IAM policies belong in the DevOps skill. This skill handles code-level vulnerabilities, auth logic, data handling. |
| Ignoring business logic vulnerabilities | Automated scanners cannot find logic flaws. Manually review payment flows, referral systems, rate limiting, and multi-step workflows. |
| One-time audit mentality | Security is continuous. Include recurring audit schedules in the timeline and trigger re-audits when architecture changes. |

