agentleFS
garagongaragon/nanostack/security/SKILL.md

security

Skill207 starsChanged 8 months agoApache-2.0View on GitHub

Use before shipping to production. Performs OWASP Top 10 audit and STRIDE threat modeling against the codebase. Supports --quick, --standard, --thorough modes. Also use when the user asks to check security, audit code, or review for vulnerabilities. Triggers on /security.

  • Reads credentials

78 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use cost-reducer, trigger-dev and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • daianepepes-labSkill

    cost-reducer

    Analyze and reduce costs across cloud infrastructure, code, and services. Use when asked to cut costs, optimize spending, reduce bills, or improve cost efficiency.

    Also in 5 projects that use this

  • xfstudioSkill

    trigger-dev

    Trigger.dev expert for background jobs, AI workflows, and reliable async execution with excellent developer experience and TypeScript-first design. Use when: trigger.dev, trigger dev, background task, ai background job, long running task.

    Also in 4 projects that use this

  • ffsshhttiikkSkill

    scalability

    Core foundational concepts and principles for Scalability

    Also in 4 projects that use this

  • daianepepes-labSkill

    self-healing

    Detect, diagnose, and automatically fix recurring errors, memory issues, and system degradation. Use when a system has recurring failures, memory leaks, performance degradation, or needs automatic recovery mechanisms.

    Also in 5 projects that use this

  • xfstudioSkill

    customer-support

    Elite AI-powered customer support specialist mastering

    Also in 4 projects that use this

  • ffsshhttiikkSkill

    cicd

    Continuous integration and delivery pipelines

    Also in 4 projects that use this

  • +1 more from daianepepes-lab

The file

Show its rules and text

We split this skill into the rules it gives an agent

21 rules. 0 are common, 12 are distinctive, and 9 are very specific to this project.

  • 0

    Common

    Most of the 56 edited versions we read keep these.

  • 12

    Distinctive

    This author's own choices. Worth a look.

  • 9

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Variant analysis: When a finding is VERIFIED, search the entire codebase for the same pattern.

    line 38
  2. Distinctive:

    If config already exists, read it and skip setup.

    line 84
  3. Distinctive:

    Check these rules during your audit.

    line 92
  4. Very specific:

    Read security/references/owasp-checklist.md for the OWASP A01-A10 framework.

    line 120
  5. Distinctive:

    Search for hardcoded credentials using regex patterns:

    line 124
  6. Distinctive:

    If results: secrets may be in history even if currently gitignored.

    line 142
  7. Very specific:

    IMPORTANT: Credential redaction: When reporting secrets, NEVER show the full value.

    line 144
  8. Very specific:

    Use security/templates/security-report.md for the full structure.

    line 185
  9. Distinctive:

    Always close with What's solid: 2-3 specific things the codebase does well on security.

    line 192
  10. Very specific:

    Always check for conflicts with prior /review findings.

    line 200
  11. Very specific:

    After completing the audit and conflict detection, save the artifact.

    line 210
  12. Very specific:

    Read profile, run_mode, autopilot, and plan_approval per reference/session-state-contract.md.

    line 248
  13. Distinctive:

    After the security audit is complete and the artifact is saved:

    line 252
  14. Distinctive:

    Otherwise: Read the next action from session state:

    line 258
  15. Very specific:

    Use .user_message for the prose and .next_phase for the phase name.

    line 264
  16. Very specific:

    When profile == "guided", the user-facing output follows the four-block skeleton in reference/plain-language-contract.md (Result / How to …

    line 266
  17. Distinctive:

    After the user-facing message above, print one summary line as the very last thing — useful for autopilot logs and quick scanning:

    line 288
  18. Very specific:

    Use WARN instead of OK if any critical or high findings exist.

    line 294
  19. Distinctive:

    When the caller returns a repaired build for verification, focus the new audit on changed code and affected trust boundaries:

    line 298
  20. Distinctive:

    MEDIUM/LOW fixes: Verify the specific fix by reading the changed code.

    line 301
  21. Distinctive:

    Zero findings is valid: Don't manufacture findings.

    line 319

“Common” is measured: kept by at least 6 in 10 of the 56 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

/security — Security Audit

You think like an attacker but report like a defender. The real attack surface is rarely the code you wrote. It is the secrets in git history, the dependency you forgot to update, the CI pipeline that leaks tokens, and the AI endpoint without rate limiting. Start there, not at the application logic.

Telemetry preamble

Defensive telemetry init. No-op if telemetry is disabled via NANOSTACK_NO_TELEMETRY=1, ~/.nanostack/.telemetry-disabled, or if the helpers are removed.

_P="$HOME/.claude/skills/nanostack/bin/lib/skill-preamble.sh"
[ -f "$_P" ] && . "$_P" security
unset _P

Intensity Mode

ModeFlagScopeConfidence gate
Quick--quickOWASP A01-A03 (top 3) + secrets scan + dependency check9/10 — only verified findings
Standard(default)Full OWASP A01-A10 + STRIDE per component + dependencies7/10 — report anything with evidence
Thorough--thoroughFull OWASP + STRIDE + variant analysis + conflict detection + LLM security check3/10 — flag tentative findings marked as TENTATIVE

Auto-suggest:

  • Pre-commit on small changes → suggest --quick
  • Pre-ship standard feature → --standard (default)
  • Pre-ship auth/payment/infra, or first audit of a codebase → suggest --thorough

Thorough-only features:

  • Variant analysis: When a finding is VERIFIED, search the entire codebase for the same pattern. One confirmed SQL injection means there may be more.
  • Conflict detection: Cross-reference with /review artifacts in .nanostack/review/ for contradictions.
  • TENTATIVE findings: Below confidence gate but worth noting. Mark as TENTATIVE: <description>.

Setup (first run per project)

Resolve context — load plan, review artifacts, matched solutions, and config:

~/.claude/skills/nanostack/bin/resolve.sh security --diff

The output is JSON with upstream_artifacts (plan and review paths), solutions (matched by file overlap and security tags), conflict_precedents (path to precedents doc), diarizations (module briefs), and config (intensity, detected stack, conflict precedence).

From the plan artifact (if present):

  • planned_files[] → focus your audit on these files and their dependencies. Deeper analysis on fewer files is better than shallow analysis on everything.
  • risks[] → treat each planned risk as a security hypothesis to verify. If the plan says "AWS SDK version compatibility" is a risk, check for insecure SDK usage patterns.

From config: use detected_stack to scope which checks to run (skip Python checks in a Go project). Use conflict_precedence for cross-skill conflicts.

Then check if security/config.json exists. If not, ask the user to classify the project:

What type of project is this?
1. Public-facing (users/customers on the internet)
2. Internal (employees/team only, no public access)
3. Compliance-driven (fintech, health, regulated)
4. Library/SDK (consumed by other developers)

Store the answer:

// security/config.json
{
  "project_type": "public_facing",
  "conflict_precedence": "security > review > qa",
  "configured_at": "2026-03-25"
}

This determines:

  • Conflict precedence: public_facing → security wins. internal → review wins. compliance → security wins hard.
  • Default intensity: public_facing/compliance → suggest --thorough on first audit. internal/library → --standard.
  • OWASP priority: public_facing → A01, A03, A07 first. internal → A02, A05, A09 first.

If config already exists, read it and skip setup.

Graduated Rules

<!-- Auto-maintained by bin/graduate.sh. Do not edit manually. --><!-- Each rule was promoted from a solution with 3+ applications and validation. --><!-- END GRADUATED RULES -->

Check these rules during your audit. Each one represents a proven security pattern from past sprints.

Process

1. Detect Stack

Auto-detect everything. Do NOT ask the user.

  • package.json → Node.js (check for next, express, fastify, hono)
  • requirements.txt / pyproject.toml → Python (flask, django, fastapi)
  • go.mod → Go (gin, echo, chi)
  • Database deps: prisma, drizzle, mongoose, sqlalchemy, gorm
  • BaaS: supabase, firebase, convex
  • Auth: next-auth, clerk, passport, lucia, jwt
  • AI/LLM: openai, anthropic, langchain, vercel ai sdk
  • Payments: stripe, paddle
  • Infra: Dockerfile, docker-compose.yml, .github/workflows/

Report one-line: Detected: Next.js 14 + Prisma + Stripe, Docker, GitHub Actions

2. Scan

CORE (always run): secrets, injection, auth, config, dependencies, data-exposure.

CONDITIONAL (only if detected): AI/LLM endpoints, payment webhook verification, Docker misconfig, CI/CD pipeline security, file upload handling.

For extended check patterns, reference the OWASP checklist at security/references/owasp-checklist.md.

Read security/references/owasp-checklist.md for the OWASP A01-A10 framework.

Secrets Scan (CRITICAL — always first)

Search for hardcoded credentials using regex patterns:

PatternWhat
AKIA[0-9A-Z]{16}AWS access key
sk_live_[a-zA-Z0-9]{24,}Stripe live key
sk-proj-[a-zA-Z0-9\-_]{20,}OpenAI project key
sk-ant-[a-zA-Z0-9\-_]{80,}Anthropic key
ghp_[a-zA-Z0-9]{36}GitHub PAT
-----BEGIN (RSA|EC|OPENSSH) PRIVATE KEYPrivate key in code
(postgres|mysql|mongodb\+srv):\/\/[^:\s]+:[^@\s]+@DB connection string with password

Context rules: In *.test.*, *.example, README*, or values containing xxx, TODO, placeholder → downgrade to INFO.

Git history check (mandatory):

git log --all --oneline -- '.env' '.env.local' '*.pem' '*.key' 2>/dev/null | head -10

If results: secrets may be in history even if currently gitignored. CRITICAL — credentials must be rotated.

IMPORTANT: Credential redaction. When reporting secrets, NEVER show the full value. First 4 chars + **** (e.g., sk-pr****).

CI/CD Pipeline Security (if .github/workflows/ exists)

CheckWhat to look for
Unpinned actionsuses: action@main instead of uses: action@sha256
pull_request_targetRuns with write access on fork PRs — code injection vector
Secrets in logsecho ${{ secrets.* }} or debug mode exposing secrets
Overpermissioned GITHUB_TOKENpermissions: write-all when only contents: read needed

AI/LLM Security (if AI deps detected)

CheckWhat to look for
API keys in client bundleNEXT_PUBLIC_OPENAI, NEXT_PUBLIC_ANTHROPIC
Prompt injectionUser input interpolated into system prompts (prompt + req.body)
Missing rate limitingAI endpoints without rate limiter — attacker runs up your bill
Unsanitized LLM outputLLM response rendered as HTML without escaping

3. False Positive/Negative Awareness

False positives (skip): .env.example, sk_test_ keys, UUIDs, React/Angular output (XSS-safe by default, only flag escape hatches like dangerouslySetInnerHTML), eval() in build configs, 0.0.0.0 in Docker, SQL in migrations.

False negatives (don't miss): Auth on route but not on query (IDOR), secrets in git history, rate limiting on login but not password reset, SSRF via URL params to 169.254.169.254, dangerouslySetInnerHTML without DOMPurify.

4. STRIDE per component

Spoofing (impersonation?), Tampering (data integrity?), Repudiation (audit trail?), Info Disclosure (leaks?), DoS (overwhelm?), Elevation (privilege escalation?).

4. Produce Report

Report findings progressively. Don't wait until the end. As each phase completes, output its findings immediately so the user sees work happening.

Open with a summary line:

Security: CRITICAL (0) HIGH (1) MEDIUM (2) LOW (1) = 4 findings. Score: B

Scoring: A = 0 critical, 0 high, ≤3 medium. B = 0 critical, 1-2 high. C = 3+ high. D = 1-2 critical. F = 3+ critical.

Use security/templates/security-report.md for the full structure. Every finding must include:

  • What the vulnerability is (specific, not vague)
  • Where it exists (file path and line number)
  • How to exploit it (proof of concept or clear scenario)
  • Fix with actual code, before and after (not "consider sanitizing input")
  • Severity using the classification below

Always close with What's solid: 2-3 specific things the codebase does well on security. Not filler. If the auth is well implemented, say so and say why.

Severity Classification

Severity: Critical (RCE, unauth admin, hardcoded creds), High (stored XSS, IDOR, privilege escalation), Medium (CSRF, info disclosure, missing rate limit), Low (headers, verbose errors, outdated non-vulnerable deps).

Conflict Detection

Always check for conflicts with prior /review findings. The resolver output from Setup includes upstream_artifacts.review (if a review artifact exists) and conflict_precedents (path to the precedents doc). When a conflict is detected, mark inline:

### SEC-005: Excessive error detail
**Conflicts with:** REV-003 → RESOLUTION: structured errors (code + generic msg to user, details to logs)

In --quick mode, apply default precedence (security > review) without documenting. In --standard mode, document conflicts inline. In --thorough mode, document conflicts AND flag as BLOCKING until user confirms.

After completing the audit and conflict detection, save the artifact. Run this command now — do not skip it. The save is validated against the per-phase schema (see reference/artifact-schema.md); a security artifact requires summary (object), findings (array), and context_checkpoint.

SEC_JSON=$(jq -n \
  --arg  mode              "$SEC_MODE" \
  --argjson summary        '{"total_findings":0,"critical":0,"high":0,"medium":0,"low":0}' \
  --argjson findings       '[]' \
  --argjson conflicts      '[]' \
  --arg  checkpoint_summary "Security audit found N findings across OWASP categories." \
  '{
     phase: "security",
     mode: $mode,
     summary: $summary,
     findings: $findings,
     conflicts: $conflicts,
     context_checkpoint: {
       summary: $checkpoint_summary,
       key_files: [],
       decisions_made: [],
       open_questions: []
     }
   }')
~/.claude/skills/nanostack/bin/save-artifact.sh security "$SEC_JSON"

Mode Summary

AspectQuickStandardThorough
OWASP scopeA01-A03 onlyFull A01-A10Full + variant analysis
STRIDESkipPer componentPer component + attack trees
Dependenciesnpm audit onlyFull scanFull + license check
Conflict detectionAuto-resolveDocument inlineBLOCKING until resolved
Tentative findingsSkipSkipReport as TENTATIVE
Confidence gate9/107/103/10

Session state

Read profile, run_mode, autopilot, and plan_approval per reference/session-state-contract.md. When run_mode == report_only, do not apply fixes; only report findings.

Next Step

After the security audit is complete and the artifact is saved:

If autopilot == true: Return the artifact and findings to the caller. Do not invoke another specialist. /feature owns continuation and waits for the whole verification batch.

If critical or high findings are found: Report them without repairing product files. The caller handles repairs in the build step after all verification readers have stopped.

Otherwise: Read the next action from session state:

~/.claude/skills/nanostack/bin/next-step.sh --json

Use .user_message for the prose and .next_phase for the phase name. The legacy positional form (next-step.sh security) is still supported.

When profile == "guided", the user-facing output follows the four-block skeleton in reference/plain-language-contract.md (Result / How to try / What was checked / What remains). Whether it is safe to try goes inside Result; do not add a separate block. Use plain words (no "vulnerability", "threat model", "STRIDE"). Example:

<!-- guided-output:start -->
Resultado: Es seguro para probar. No vi problemas que te expongan.

Como verlo:
1. Corre el comando que te indique mas arriba y segui las instrucciones.

Que revise:
- Nadie entra sin permiso a lo que deberia estar protegido.
- Los datos sensibles no quedan a la vista.
- Las entradas raras no rompen ni dejan escapar informacion.

Pendiente:
- No probe contra un ataque dirigido y sostenido.
- No revise servicios externos que no controlamos.
<!-- guided-output:end -->

Final Headline

After the user-facing message above, print one summary line as the very last thing — useful for autopilot logs and quick scanning:

[security] OK: grade <A-F>, <N critical, M high>. Next: <first pending skill or "/ship">.

Use WARN instead of OK if any critical or high findings exist.

After Fixes

When the caller returns a repaired build for verification, focus the new audit on changed code and affected trust boundaries:

  • CRITICAL/HIGH fixes: Re-audit only the affected files and the specific vulnerability class. Verify the fix resolves the finding. Save a new artifact.
  • MEDIUM/LOW fixes: Verify the specific fix by reading the changed code. Save a new artifact recording the current result and the narrower coverage; do not treat the original audit as evidence for a changed build.

Re-running the full OWASP scan after fixing a missing Content-Type header wastes time and tokens. Target the verification.

Telemetry finalize

Before returning control:

_F="$HOME/.claude/skills/nanostack/bin/lib/skill-finalize.sh"
[ -f "$_F" ] && . "$_F" security success
unset _F

Pass abort or error instead of success if the audit did not complete normally.

Gotchas

  • Zero findings is valid. Don't manufacture findings.
  • Don't inflate severity. Calibrate to actual exploitability.
  • Show evidence. Input path, sink, missing sanitization. Not "could be vulnerable."
  • Run dependency scanning. npm audit, pip audit, go vuln check.
  • Auth ≠ authz. Logged in ≠ has permission.
  • Check git history for secrets. git log -p --all -S 'password\|secret\|key\|token'
  • Variant analysis in --thorough. One finding = search for the pattern elsewhere.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.