template/.agent/skills/spectra-audit/SKILL.md
Audit changed code for security sharp edges — dangerous defaults, type confusion, and silent failures
npx skillsauth add charles5277/nuxt-supabase-starter spectra-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Audit changed code for security sharp edges — API design traps, dangerous defaults, and interfaces that make it easy to do the wrong thing.
Good APIs don't require developers to "be careful" to stay secure. If the correct usage requires reading docs, remembering rules, or understanding cryptography, the API has failed.
Core principle: Security should be the path of least resistance. Insecure usage should be harder than secure usage.
This skill operates in two modes depending on how it's invoked:
/spectra-audit): Full 3-agent parallel analysis on current git diff. See Standalone Mode./spectra-apply when audit: true): Condensed checklist applied during implementation. See Discipline Mode.Both modes share the same Core Framework.
When invoked directly as /spectra-audit:
Run git diff HEAD to get the full diff of current modifications.
If there are no changes, report "No changes to audit" and stop.
Launch 3 agents in parallel (one message, 3 tool calls). Each agent receives the full diff and analyzes it through one adversary lens.
Agent 1 — The Scoundrel (壞蛋)
A malicious developer or attacker deliberately manipulating configuration.
Search the diff for:
"none", "md5")auth_required: true + bypass_auth_for_health: true + health_check_path: "/")Agent 2 — The Lazy Developer (懶惰的開發者)
A developer who copy-pastes examples and skips documentation.
Search the diff for:
verify: false, timeout: 0, empty strings as keystimeout=0, max_attempts=0, key="" mean?Agent 3 — The Confused Developer (搞混的開發者)
A developer who misunderstands API usage.
Search the diff for:
encrypt(msg, key, nonce) — key and nonce are both strings)verify_ssl: fasle)Merge findings from all 3 agents. For each finding:
End with a brief summary of what was fixed (or confirm the code is clean).
When referenced by /spectra-apply (via spectra instructions --skill audit), do NOT launch the 3-agent workflow above. Instead, apply this condensed checklist continuously during implementation.
Before finalizing any code that involves APIs, configuration, parameters, or security-related logic, ask:
Stop and fix immediately if you notice:
false → is the "off" state safe?if value == 0 or if key.nil? → what does zero/nil MEAN in this context?Not every line of code needs audit scrutiny. Focus on:
| Role | Mindset | Key Questions | | ---------------------- | ----------------------------------------- | --------------------------------------------------------------------------------- | | Scoundrel | Malicious, deliberate exploitation | Can I disable security via config? Downgrade algorithms? Inject values? | | Lazy Developer | Copy-paste, skips docs, deadline pressure | Is the first example safe? Is the default secure? Do errors guide me right? | | Confused Developer | Misunderstands usage | Can I swap params silently? Will mistakes fail loudly? Are types distinguishable? |
Letting developers choose algorithms = inviting them to choose wrong.
# Dangerous: accepts arbitrary algorithm
OpenSSL::Digest.new(algorithm).hexdigest(password) # algorithm = "md5"?
# Safe: no choice
BCrypt::Password.create(password) # can't pick wrong
Defaults that are insecure, or zero/empty values that disable security.
# What does timeout=0 mean? Never expire? Expire immediately?
def verify_token(token, timeout: 300)
return true if timeout == 0 # 0 = skip verification?!
end
Key question: What do timeout=0, max_attempts=0, key="", nil each mean?
Using raw bytes/strings instead of meaningful types invites type confusion.
# Dangerous: both params are strings, swappable
encrypt(message, key, nonce)
# Safe: types protect against swapping
encrypt(message, Key.new(k), Nonce.new(n))
One wrong config value = disaster, with no warning.
# A typo = security mechanism disappears
verify_ssl: fasle # not "false", might be treated as truthy?
# Dangerous combination
auth_required: true
bypass_auth_for_health: true
health_check_path: '/' # oops, entire site bypasses auth
Security errors that don't surface, or "success" masking failure.
# Silent bypass
def verify_signature(sig, data, key)
return true if key.nil? # no key = skip verification?!
end
# Return value ignored
result = crypto.verify(data, sig) # returns false but nobody checks
Security-critical values as plain strings = open door for injection and confusion.
# Dangerous: string concatenation
permissions = "read,write"
permissions += ",admin" # too easy to escalate
# Safe: use enums
permissions = Set[Permission::READ, Permission::WRITE]
| Severity | Condition | Example |
| -------- | ----------------------------------------- | --------------------------------------------------- |
| Critical | Default or most obvious usage is insecure | verify: false is default, empty password accepted |
| High | Easy misconfiguration breaks security | Algorithm param accepts "none" |
| Medium | Uncommon but possible misconfiguration | Negative timeout has unexpected behavior |
| Low | Requires deliberate misuse | Obscure parameter combination |
| Excuse | Why It's Wrong | What To Do | | ------------------------------------- | ------------------------------------------ | ------------------------------------------------------ | | "Docs explain it" | Devs skip docs under deadlines | Make the safe option the default or only option | | "Advanced users need flexibility" | Flexibility = foot-gun opportunity | Provide safe high-level API, hide low-level primitives | | "It's the developer's responsibility" | You designed the trap | Remove the trap or make it impossible to misuse | | "Nobody would do that" | Devs under pressure do everything | Assume maximum developer chaos | | "It's just a config option" | Config is code; wrong config ships to prod | Validate config, reject dangerous combinations | | "Backwards compatibility" | Insecure defaults can't be grandfathered | Deprecate loudly, force migration |
development
Pinia official Vue state management library, type-safe and extensible. Use when defining stores, working with state/getters/actions, or implementing store patterns in Vue apps.
development
Pinia Store 架構規範。Use when creating app/stores/**/*.ts files, working with defineStore, managing global state, or building Pinia stores. Always use this skill for store design patterns, naming conventions, and state management architecture.
tools
Push interfaces past conventional limits with technically ambitious implementations. Whether that's a shader, a 60fps virtual table, spring physics on a dialog, or scroll-driven reveals — make users ask "how did they do that?"
content-media
Improve interface performance across loading speed, rendering, animations, images, and bundle size. Makes experiences faster and smoother.