Related Video:

https://www.instagram.com/p/DaBTJfPiPE9/

Update:

Instead of using this prompt, you can install anti-koshary-skill instead. Check here: Anti Koshary Skill

Description:

A practical, two-pass audit for any project. First it reports — security issues, vulnerable dependencies, duplicated logic, and obvious cleanups — as a prioritized list, without changing anything. Then, once you approve, it fixes in a safe order: security first, dependencies next, cleanups last, checking the app still runs after each step.

To use it: open your project in your AI coding tool, commit your work first (so you can roll back), paste the prompt, and review Pass 1 before approving. No tests? It'll tell you, and lean on "still runs" as the safety net. Built for results without over-engineering — nothing changes without your say-so.

Prompt:

Audit this codebase and fix what's safe to fix. I want a practical review: no new abstractions I didn't ask for, and no rewriting working code just to make it cleaner. The smallest change that solves the problem is the right one.

Work in two passes: report findings first, then fix only what I approve.

## Before you start
Read the README, the package manifest, the config and deployment files, and the entry points, then tell me:
- The stack you detect (language, framework, package manager).
- What the app does, in one or two sentences.
- How it's exposed: public internet, internal, or local only. Say what you based this on.
- What sensitive data it handles (payments, personal data, auth tokens, or none).
- The build, test, and lint commands you found in the project's scripts or config, and which ones you will use to verify changes.
- Whether tests exist and roughly what they cover. If there are none, don't describe any change as "safe" or "functionally equivalent". Instead, point out the riskiest changes and where a quick test would help before touching them.

Where you can't tell from the repo, state your assumption and carry on; I'll correct it if it's wrong. If unsure about exposure, assume public. Use this context to judge severity: an unauthenticated route matters more on a public app than on a local tool.

Skip generated, vendored, and build-output directories. If the repo is too large to review fully, tell me which directories you covered and which you skipped, and prioritize code that handles auth, user input, payments, and external calls.

## Pass 1: find and report (no code changes)

Number every finding (S1, S2, D1, ...) so I can approve them individually. For each one, give:
- **Where**: file and line
- **What and why it matters**: one or two sentences
- **Severity**: Critical (exploitable now, or data loss), High (exploitable under realistic conditions), Medium (weakness that needs other failures to matter), Low (hygiene)
- **Confidence**: Confirmed (you read the code path and traced how it is reached) or Suspected (it matches a risky pattern but you haven't verified it is reachable or exploitable)
- **Suggested fix**, and whether it changes behavior

Don't report a pattern match you haven't looked at. A `dangerouslySetInnerHTML` that renders a hardcoded string is not a finding.

Use one table per section, sorted by severity. If a section has no findings, say so in one line.

1. **Security** (the priority; spend most of your effort here)
   - Hardcoded secrets, API keys, tokens, or passwords in code or committed config. For any committed secret, also check whether it appears in git history, and tell me it needs rotating. Deleting the line doesn't fix a leaked key.
   - Missing input validation that leads to injection (SQL, command, XSS, path traversal).
   - Missing or broken auth and authorization checks on protected routes and actions, including whether one user can reach another user's data.
   - Sensitive data in logs, localStorage, URLs, or error responses.
   - Unsafe code execution (`eval`, `dangerouslySetInnerHTML` with untrusted input), overly open CORS, missing CSRF protection where it applies.

2. **Dependencies**
   - Run the vulnerability scan for the package manager (`npm audit`, `pip-audit`, or equivalent) and list what it finds, with severity and whether a fix is available.
   - List only the outdated packages, with current and latest versions, and mark which upgrades are major.

3. **Duplication and reuse**
   - Logic or UI copy-pasted in two or more places (validation, API calls, formatting, transforms, components) where the copies are likely to drift and cause bugs.
   - Skip coincidental similarity, and skip anything where extracting a shared piece would be a stretch.

4. **Obvious cleanups**
   - Dead code, unused imports and variables, functions that are clearly too long or doing several jobs, misleading names.
   - Obvious wins only. No architectural proposals.

5. **Health checks**
   - Missing error handling around network and IO calls.
   - Obvious performance problems (N+1 queries, unpaginated large lists).
   - Anything else risky you noticed along the way, briefly.

End Pass 1 with a short list of what you would fix first and why, then stop and wait for my approval.

## Pass 2: fix (only the findings I approve by number)

Create a new branch before changing anything. Make one commit per group below so each can be reverted on its own.

1. **Security fixes.** These may change behavior on purpose. For each one, state exactly what changes for users or callers.
2. **Dependencies.** Apply patch and minor updates. Do not apply major upgrades; list each one with a one-line migration note. Update the lockfile.
3. **Cleanups.** Only the approved ones. These must not change behavior.

After each group, run the build and tests and tell me the result, including the command you ran. If something fails, stop and show me the output before continuing. If you can't run a command in this environment, say so; don't assume it passes.

## Rules
- Don't change business logic without asking.
- If a fix needs a large rewrite or a breaking upgrade, flag it with a recommendation and leave it alone.
- If you find something Critical while fixing, stop and tell me; don't fold it in silently.

## Final summary
- Security issues fixed, by finding number, and what behavior changed
- Secrets that still need rotating (this is on me, not you)
- Packages updated (old → new) and major upgrades deferred
- Cleanups applied
- What you verified by running it, and what you couldn't verify
- Anything still needing my decision