Prompt file imported from lucasmccomb/copilot-configs (
.github/prompts/audit.prompt.md). Copyright stays with the author.
Codebase Audit
Comprehensive codebase audit with fix capabilities. Finds issues across 8 categories, fixes what it can, and reports what needs human review.
Instructions
Phase 1: Pre-Flight
- Check git status - working directory must be clean for fix mode
- Create checkpoint branch:
git branch audit-checkpoint-$(date +%Y%m%d-%H%M%S) - If user wants read-only, skip fixes
Phase 2: Discovery
- Check for monorepo structure (
apps/,packages/,workspaces) - Identify tech stack (TypeScript, React, Node.js, package manager)
- Read CLAUDE.md or copilot-instructions.md for project rules
- Check ESLint/linter configs
Phase 3: Audit (8 Categories)
Audit each category sequentially:
- Security - hardcoded secrets, console.logs with sensitive data, injection risks
- Dependencies -
npm audit, outdated packages, unused deps - Code Quality - ESLint violations, unused imports, long methods, large files
- Architecture - circular deps, god objects, improper layering
- TypeScript/React - excessive
any, missing return types, Fast Refresh violations - Testing - missing test files, tests without assertions
- Documentation - missing JSDoc, stale comments
- Performance - N+1 queries, missing React.memo, large bundle imports
Phase 4: Fix (if not read-only)
For each auto-fixable finding:
- Apply fix
- Run
npm run lint && npm run type-check && npm run test:run - If passes:
git add . && git commit -m "audit: {category} - {title}" - If fails:
git checkout -- .and move to human review queue
Phase 5: Summary
Report findings by category, severity, and fixability. Show recovery instructions if fixes were made.
Phase 6: Issue Creation (optional)
Ask user if they want GitHub issues created for findings needing human review.