AgentKit
DocsKitsCLI ReferenceDesktop App

Skills

Threat-model and remediate code with ak:security

Run a STRIDE and OWASP audit, optionally add red-team discovery, and apply bounded fixes with explicit local commit authority.

Use ak:security for a secret, dependency, and code-pattern scan plus STRIDE and OWASP threat modeling. Default invocation is that comprehensive pass. --secrets-only and --deps-only skip code patterns and threat modeling; combining them still skips code patterns. Optional red-team and fix modes add deeper discovery and local code changes.

Choose ak:security for threat-modelled review

Use ak:security when

  • Authentication, authorization, payments, personal data, or sensitive system boundaries have changed.
  • You want findings connected to attacker scenarios and source locations.
  • You need external, supply-chain, insider, and infrastructure perspectives.
  • You are preparing for a release or a focused compliance review.

Choose another workflow when

  • You only need a fast secret or dependency pass. Stay on ak:security and pass --secrets-only, --deps-only, or both.
  • The change is cosmetic and does not affect data or user-facing behavior.
  • You need a real penetration test against a running service; this Skill is a source-led audit and does not claim exploit execution.
  • You already have a confirmed defect and only need implementation. Use ak:fix with the evidence and acceptance boundary.

Prepare a bounded audit surface

Before you start:

  • Complete Onboarding, and confirm Engineer Kit is installed for the current runtime and scope.
  • Provide a file glob, directory, or the exact keyword full.
  • Make the relevant source, manifests, lockfiles, CI configuration, deployment files, and repository instructions available.
  • Install the stack's audit tool if you expect dependency evidence: npm audit, pip-audit, govulncheck, or bundle audit for the documented stacks.
  • Decide whether network-backed advisory lookups and local fix commits are allowed before selecting their modes.
RuntimeInvocationAvailability boundary
Claude Code/ak:security ...Native execution can use the available file, shell, testing, and editing tools.
Cursor/ak:security ...Slash invocation is user-verified; shell access, approvals, and tool availability depend on the Cursor session.
Codex$ak:security ...Native discovery is supported; equivalent audit binaries, approvals, and write tools are not implied.

Select depth and mutation separately

Input or optionResultEffects and limits
<scope>Comprehensive secrets, dependency, code-pattern, STRIDE, and OWASP auditOmitting scope scans the project root; dependency tools may use network and caches
fullExpands the audit to the projectHigher disk, context, process, and dependency-audit cost
--secrets-onlySecret and credential scan onlySkips dependency audit, code patterns, STRIDE, and red-team
--deps-onlyPackage-advisory audit onlySkips code patterns, STRIDE, and red-team
--red-teamAdds four attacker-persona phases before the final sweepAppends discovery evidence to security-audit-results.tsv; fast flags win if combined
--iterations NCaps red-team discovery or fix iterations for the selected modeN must be chosen by the user; no default numeric cap is documented
--fixApplies targeted fixes, runs a guard, and commits successful iterationsMutates source and Git history; stops when a guard fails
--red-team --fixDiscovers broadly, then fixes confirmed Critical and High findingsStill requires scoped authority and usable verification commands
/ak:security --secrets-only
/ak:security --deps-only
/ak:security src/auth/ --red-team --iterations 12

Start without --fix when you need to calibrate findings or obtain approval for risky remediations. A realistic request also names trusted test commands, files that must not change, and whether local commits are acceptable.

Understand the observable stages

  1. The Skill resolves scope. It expands the glob, directory, or full and reads every selected file before analysis.
  2. It maps threats. STRIDE covers spoofing, tampering, repudiation, information disclosure, denial of service, and elevation of privilege.
  3. It checks OWASP categories. Access control, cryptography, injection, design, configuration, components, authentication, integrity, logging, and SSRF receive an explicit pass.
  4. It audits dependencies and secrets. The detected stack selects a package auditor, while source is checked for credential patterns.
  5. Red-team mode iterates personas. External adversary, supply-chain, insider, and infrastructure phases select vectors, trace flows, validate evidence, and chain relevant findings.
  6. It consolidates evidence. Findings are deduplicated, assigned Critical, High, Medium, Low, or Info severity, and written into the report.
  7. Fix mode remediates iteratively. Each targeted change runs a test or lint guard and creates a security(fix-N): ... commit only after the guard passes.

Optional finding-triage experiment

Ordinary review is unchanged and makes no provider call. Only when you explicitly opt into a finding-triage experiment after candidate discovery does the Skill use ak eval triage, whose default mode is off. Shadow mode requires your provider consent, explicit review-triage consumer consent, and a credential. The Skill sends only compact, sanitized facts: it removes every discovered secret value from the batch and never submits raw scanner output, full source, credentials, or sensitive paths.

The shadow signals are compared with the original decisions and never replace them. Protected Critical or High signals, unknowns, and provider failures keep deep review, and duplicate or auto-fix signals never authorize suppressing a finding or editing code. To measure the experiment offline, use ak eval triage-benchmark with frozen shadow receipts and independently verified labels.

Protect credentials and repository state

An audit can expose sensitive evidence

Keep the scope away from unrelated secret stores. Findings must replace token, password, connection-string, and private-key values with an opaque marker such as &lt;REDACTED_PASSWORD&gt; before they are logged or returned. Keep only a public issuer prefix such as AKIA, ghp_, sk_, sk-, or xox when it aids triage. Never emit raw lengths or trailing characters. Name environment variables; redact the entire user:password@ segment in connection strings.

  • Dependency audit commands can contact advisory registries and update local caches. Their availability, data transfer, rate limits, and provider cost are properties of the selected tool and environment.
  • Static inspection does not authorize requests against production systems, credential use, exploit execution, data exfiltration, or destructive testing.
  • --fix authorizes local edits and one commit per successful fix iteration. It does not authorize push, pull request creation, merge, release, or deployment.
  • A failing guard stops the fix loop and remains visible; the Skill does not skip or weaken verification to continue.
  • Review generated changes before accepting broad security hardening. Some findings require a product, compliance, or compatibility decision that automation cannot make.

Verify the report and fixes

A complete audit should provide:

  • Number of files scanned and finding counts by severity.
  • Category, source location, description, attack scenario, impact, confidence, and a bounded fix recommendation for each finding.
  • Red-team persona and iteration evidence when that mode runs.
  • Dependency-audit command and result, or an explicit unavailable reason.
  • Redacted secret evidence as an opaque marker, never a partial live secret.
  • For fix mode, changed files, guard commands and results, commits created, stopped iterations, and unresolved findings.

The packaged evidence confirms installation coverage for the Skill; it does not provide an end-to-end test of the full audit, live advisory services, or fix quality.

Troubleshoot and interpret limits

SymptomSafe next step
The scope matches too muchReplace full or a broad glob with the smallest trust boundary that contains the relevant flow.
A dependency auditor is missingInstall the documented tool deliberately or mark dependency evidence unavailable; do not claim the dependency tree is clean.
The dependency audit cannot reach its registryPreserve the command and network error, then rerun in an approved connected environment.
A secret-like match is a fixtureConfirm it is a non-live placeholder, keep the value redacted, and record why it is not exploitable.
Red-team iterations stop before all personas finishReport partial persona, STRIDE, and OWASP coverage; do not present it as a full audit.
A fix guard failsStop at that commit boundary, inspect the regression, and hand the evidence to ak:fix or a human reviewer.
The runtime does not recognize the SkillConfirm target and scope, restart the runtime session, then follow Runtime cannot find a Skill or Agent.

The retired ak:security-scan invocation maps to ak:security. Continue with ak:plan to schedule findings that should not be fixed immediately.