Repository navigation
Closed
Labels
enhancementNew feature or request
Description
Summary
Add pattern-matching sanity checks to /qa that catch common anti-patterns and audit new dependencies without requiring deep analysis. Not a full audit—just "hey, this looks suspicious."
Problem
Non-expert developers (and sometimes Claude) introduce common issues that experts would catch immediately:
- N+1 queries in loops
- Unbounded iterations
- Missing error handling on async operations
- Hardcoded secrets
- SQL string concatenation
- Memory leaks (uncleared listeners/timers)
- Race conditions
- Missing accessibility attributes
- Sketchy new dependencies added without review
These aren't security vulnerabilities requiring deep review—they're patterns that can be detected with simple heuristics.
New Dependency Audit
When /exec adds packages, /qa should surface them for review:
## New Dependencies Added
| Package | Size | Downloads/wk | License | Last Update | Flags |
|---------|------|--------------|---------|-------------|-------|
| date-fns | 42kb | 18M | MIT | 1 month ago | ✓ |
| sketchy-lib | 12kb | 230 | UNLICENSED | 2 years ago | ⚠️ |
⚠️ **Dependency Flags:**
- `sketchy-lib`:
- Low weekly downloads (230) - prefer packages with >1k downloads
- No license specified - legal risk
- Last updated 2 years ago - potentially abandoned
**Action Required:** Review flagged dependencies before merge.Flag Criteria
| Flag | Threshold |
|---|---|
| Low downloads | < 1,000/week |
| Stale | No updates in 12+ months |
| License risk | UNLICENSED, GPL (in MIT project), or unknown |
| Size concern | > 100kb for a utility package |
| Security advisory | Package has known vulnerabilities |
Implementation
# Detect new deps by comparing package.json before/after exec
# For each new dep, fetch metadata:
npm view <package> --json # size, license, time.modified
# Or use bundlephobia API for sizeCode Sanity Checks
Performance
| Pattern | Detection | Suggestion |
|---|---|---|
| N+1 query | await inside for/forEach/map with DB call |
Use batch query or Promise.all |
| Unbounded loop | while(true) without clear exit |
Add iteration limit |
| Missing pagination | Fetching "all" records without limit | Add pagination |
| Sync file I/O | fs.readFileSync in request handler |
Use async variant |
Error Handling
| Pattern | Detection | Suggestion |
|---|---|---|
| Swallowed errors | Empty catch block |
Log or rethrow |
| Unhandled promise | .then() without .catch() |
Add error handling |
| Missing try/catch | await without surrounding try/catch |
Handle potential errors |
Security (Lightweight)
| Pattern | Detection | Suggestion |
|---|---|---|
| Hardcoded secret | password = "...", apiKey = "..." |
Use environment variable |
| SQL concatenation | query = "SELECT * FROM " + table |
Use parameterized query |
| Eval usage | eval(), new Function() |
Avoid or sanitize input |
Accessibility
| Pattern | Detection | Suggestion |
|---|---|---|
| Image without alt | <img> without alt attribute |
Add descriptive alt |
| Click without keyboard | onClick without onKeyDown |
Add keyboard handler |
| Missing form labels | <input> without associated <label> |
Add label |
Memory/Resources
| Pattern | Detection | Suggestion |
|---|---|---|
| Uncleared interval | setInterval without cleanup |
Clear in cleanup/unmount |
| Unremoved listener | addEventListener without removeEventListener |
Add cleanup |
Output Format
## Sanity Checks
### New Dependencies
[Dependency audit table as shown above]
### Code Patterns
- [x] No N+1 query patterns detected
- [x] Error handling present on async operations
- ⚠️ **Line 45**: `setInterval` without cleanup in useEffect
- Add cleanup: `return () => clearInterval(intervalId)`
- ⚠️ **Line 78**: SQL string concatenation detected
- Use parameterized query insteadAcceptance Criteria
- QA audits new dependencies added during exec
- Dependency flags: low downloads, stale, license issues, size, vulnerabilities
- Code sanity checks for common anti-patterns
- Each flag includes location and fix suggestion
- Checks can be disabled via settings if too noisy
- Stack-specific checks where relevant (React hooks, Node async, etc.)
Non-Goals
- Deep security audit (use /security-review for that)
- 100% accuracy (false positives acceptable, err on side of flagging)
- Blocking workflow (warnings, not errors)
Related
- feat: Package preference guidance to prevent NIH syndrome #90 - Exec guidance to prefer established packages (prevention)
- feat: Optional security review phase at end of run/fullsolve #95 - Security review phase for sensitive features (deep analysis)
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity
admarble commentedon Jan 21, 2026
Consolidated into #147 (Comprehensive QA improvements)
feat(#147): add comprehensive QA improvements
feat(#147): add comprehensive QA improvements (#148)