.claude/skills/pm-audit/SKILL.md
Proactive codebase audit that discovers code quality issues, security vulnerabilities, performance problems, and architectural debt using parallel analysis agents, then creates well-structured issues in PinkRooster from confirmed findings. Use this skill whenever the user wants to audit their code, find problems, scan for issues, do a code review of the whole project, or says things like "audit the codebase", "find issues", "scan for problems", "what's wrong with the code", "check for security issues", "find tech debt", "code health check", "quality scan", or "are there any bugs". Also triggers when the user asks to analyze code quality and wants actionable tracked issues created from the findings, not just a report.
npx skillsauth add pinkroosterai/PinkRoosterMcp pm-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.
Discover real problems in the codebase by running parallel analysis agents across multiple domains, then create tracked issues from confirmed findings. This goes beyond static reports — every finding becomes an actionable, prioritized issue in the project management system.
The key difference from a code review or analysis report: this skill produces tracked work items that can be scaffolded, assigned, and implemented.
Parse $ARGUMENTS for flags:
--focus <domain>: Limit analysis to one domain: quality, security,
performance, or architecture. Default: all four domains.--scope <path>: Limit analysis to a subdirectory (e.g., src/dashboard,
src/PinkRooster.Api). Default: entire project.--focus security --scope src/PinkRooster.Api.pwdmcp__pinkrooster__get_project_status with projectPath set to the directory aboveprojectIdLoad existing issues to avoid creating duplicates:
mcp__pinkrooster__get_issue_overview with projectId and stateFilter: "Active"mcp__pinkrooster__get_issue_overview with projectId and stateFilter: "Inactive"Compile a deduplication list of existing issue names and descriptions.
Spawn up to 4 Explore agents (one per domain) in parallel. Each agent gets a
focused analysis brief. If --focus was specified, only spawn that one domain.
The agents run in the background while you proceed to Step 3.
For each domain, spawn an Agent with subagent_type: "Explore" and the following
prompt template (adapted per domain):
Quality Agent:
Analyze the codebase at {project_path}{scope_suffix} for code quality issues.
Focus on:
- Code duplication (copy-pasted logic, duplicated components)
- Dead code (unused functions, unreachable branches, commented-out code)
- Inconsistent patterns (different approaches to the same problem across files)
- Missing error handling (unhandled promise rejections, empty catch blocks, missing null checks)
- Overly complex functions (deep nesting, long methods, high cyclomatic complexity)
- Naming inconsistencies (mixed conventions, unclear variable names)
For each finding, report:
1. File path and line number(s)
2. What the problem is (specific, not vague)
3. Severity: Critical (causes bugs), Major (maintainability risk), Minor (code smell), Trivial (style)
4. A concrete fix suggestion
Skip trivial style issues that a linter would catch. Focus on problems that
affect correctness, maintainability, or developer productivity.
Write findings to: {output_path}/quality_findings.md
Security Agent:
Analyze the codebase at {project_path}{scope_suffix} for security vulnerabilities.
Focus on:
- Input validation gaps (user input reaching DB queries, file paths, shell commands without sanitization)
- Authentication/authorization flaws (missing auth checks, privilege escalation paths, insecure token handling)
- Secrets in code (hardcoded API keys, passwords, connection strings outside config)
- Injection risks (SQL injection, XSS, command injection, path traversal)
- Insecure configurations (permissive CORS, missing security headers, debug mode in production configs)
- Dependency vulnerabilities (known CVEs in package versions if package files are present)
For each finding, report:
1. File path and line number(s)
2. The vulnerability type (OWASP category if applicable)
3. Severity: Critical (exploitable, data breach risk), Major (exploitable with conditions), Minor (defense-in-depth gap), Trivial (theoretical risk)
4. Attack scenario (how could this be exploited?)
5. Fix recommendation
Write findings to: {output_path}/security_findings.md
Performance Agent:
Analyze the codebase at {project_path}{scope_suffix} for performance issues.
Focus on:
- N+1 query patterns (database queries inside loops)
- Missing indexes (queries filtering/sorting on non-indexed columns, check EF configurations)
- Unbounded queries (no pagination, no limits on returned results)
- Memory leaks (event handlers not cleaned up, growing collections, unclosed resources)
- Expensive operations in hot paths (regex compilation in loops, repeated serialization, synchronous I/O)
- Missing caching (repeated expensive computations, redundant API calls)
- Frontend: unnecessary re-renders, large bundle imports, unoptimized images
For each finding, report:
1. File path and line number(s)
2. What the performance impact is (quantify if possible: "O(n^2) where n = number of entities")
3. Severity: Critical (user-visible latency), Major (scalability concern), Minor (optimization opportunity), Trivial (micro-optimization)
4. Fix recommendation
Write findings to: {output_path}/performance_findings.md
Architecture Agent:
Analyze the codebase at {project_path}{scope_suffix} for architectural issues.
Focus on:
- Layer violations (direct DB access from controllers, UI components calling repositories)
- Circular dependencies (projects/modules/classes referencing each other in cycles)
- Missing abstractions (concrete types where interfaces should be, tight coupling)
- Inconsistent patterns (some services use pattern A, others use pattern B for the same thing)
- Single responsibility violations (god classes, services doing too many things)
- Configuration drift (inconsistent settings across environments, hardcoded values that should be configurable)
- Missing or outdated documentation for critical architectural decisions
For each finding, report:
1. File path(s) and the architectural boundary being violated
2. What the structural problem is
3. Severity: Critical (blocks future development), Major (increases maintenance cost), Minor (inconsistency), Trivial (style preference)
4. Refactoring recommendation
Write findings to: {output_path}/architecture_findings.md
As agents complete, read their findings files. Merge all findings into a single list, then:
Remove duplicates — if multiple agents found the same issue (e.g., security and quality both flag missing input validation), keep the one with higher severity and richer description.
Cross-reference with existing issues — check each finding against the deduplication list from Step 1. If an existing issue already covers a finding, note it and skip.
Filter noise — remove findings that are:
To verify uncertain findings, read the actual code at the reported location and confirm the issue is real before including it.
Sort by severity — Critical first, then Major, Minor, Trivial.
Present the consolidated findings to the user. Group by domain for readability.
## Audit Results — {N} Finding(s)
**Scope**: {scope or "entire project"}
**Domains analyzed**: {list of domains}
**Agents completed**: {count}/{total}
### Critical ({count})
| # | Domain | Finding | File | Severity |
|---|--------|---------|------|----------|
| 1 | Security | {title} | {file:line} | Critical |
### Major ({count})
| # | Domain | Finding | File | Severity |
|---|--------|---------|------|----------|
### Minor ({count})
...
### Skipped ({count})
- {finding} — already tracked as {existingIssueId}
- {finding} — false positive (verified code is correct)
Use AskUserQuestion to let the user select which findings to create as issues:
If there are more than 4 findings to choose from, batch the options:
For each confirmed finding, call mcp__pinkrooster__create_or_update_issue with:
projectIdname: concise title, e.g., "Security: Missing input validation on project path parameter"description: comprehensive description including:
issueType: mapped from domain:
SecurityVulnerabilityPerformanceIssueBug (if causes incorrect behavior) or TechnicalDebt (if maintainability)TechnicalDebtseverity: mapped from finding severity (Critical/Major/Minor/Trivial)priority: derived from severity:
Critical priorityHigh priorityMedium priorityLow priorityaffectedComponent: extracted from the file path (e.g., "PinkRooster.Api",
"Dashboard", "PinkRooster.Mcp")## Created {count} Issue(s) from Audit
| # | Issue ID | Domain | Name | Severity | Priority |
|---|----------|--------|------|----------|----------|
| 1 | {issueId} | {domain} | {name} | {severity} | {priority} |
| ... |
### Audit Summary
- **Quality**: {count} finding(s), {created} issue(s) created
- **Security**: {count} finding(s), {created} issue(s) created
- **Performance**: {count} finding(s), {created} issue(s) created
- **Architecture**: {count} finding(s), {created} issue(s) created
- **Skipped**: {count} (duplicates or false positives)
### Next Steps
- Scaffold a fix: `/pm-scaffold {issueId}`
- Triage all issues: `/pm-triage`
- Re-audit after fixes: `/pm-audit`
- View project status: `/pm-status`
Use AskUserQuestion for follow-up:
--scope is set, agents must only analyze files within
that directory. Don't let findings bleed across boundaries.--focus to drill into specific domains.--focus for that domain.tools
Verify acceptance criteria for a phase or entire work package. Runs verification based on each criterion's method (AutomatedTest, Manual, AgentReview) and records results via the MCP tool.
development
Diagnose the root cause of a bug, error, crash, or unexpected behavior. Traces through code, logs, services, database state, and git history to find why something is broken. Researches error messages online for known issues. Produces a diagnosis with evidence and suggested fix. Use when the user reports a problem, error message, stack trace, test failure, or says things like "why is this happening", "this is broken", "I'm getting an error", "something's wrong with...", "debug this", or "figure out why...".
development
Review and prioritize open issues and feature requests. Analyzes severity, age, and codebase impact to recommend priority adjustments and next steps.
tools
Show project status dashboard with issue/FR/WP counts, active items, blocked items, and priority next actions. Use when the user asks about project status, progress, what's happening, what needs attention, or what to work on.