From tour-dev-toolkit
This skill should be used when the user asks to "debug a production issue", "trace an error", "investigate a bug", "why is X broken", "500 error on", or needs systematic debugging across the multi-portal architecture.
npx claudepluginhub boburshoh122000/claude-plugins-bobur --plugin tour-dev-toolkitThis skill uses the workspace's default tool permissions.
Systematically investigate production issues across the tour-expense-tracker multi-portal architecture. This skill should be dispatched as a subagent to avoid polluting the main conversation context.
Verifies tests pass on completed feature branch, presents options to merge locally, create GitHub PR, keep as-is or discard; executes choice and cleans up worktree.
Guides root cause investigation for bugs, test failures, unexpected behavior, performance issues, and build failures before proposing fixes.
Writes implementation plans from specs for multi-step tasks, mapping files and breaking into TDD bite-sized steps before coding.
Systematically investigate production issues across the tour-expense-tracker multi-portal architecture. This skill should be dispatched as a subagent to avoid polluting the main conversation context.
Determine which portal the issue originates from based on authentication patterns and entry points:
| Portal | Auth mechanism | Key auth file | Typical symptoms |
|---|---|---|---|
| Guide | JWT token | src/lib/guide-auth.ts | Guide login fails, tour data not loading, expense submission errors |
| Driver | JWT token | src/lib/driver-auth.ts | Driver login fails, trip assignments not visible, location updates failing |
| Partner | Server actions | src/app/actions/partner-admin-actions.ts | Partner dashboard errors, hotel/activity management issues |
| Traveler | PIN code | src/lib/traveler-auth.ts | PIN login fails, itinerary not loading, booking status wrong |
| Dashboard | NextAuth | src/lib/auth.ts | Admin login fails, reports not generating, user management errors |
| Cron jobs | Cron guard | src/lib/cron-guard.ts | Scheduled tasks not running, stale data, missing notifications |
Trace the full request lifecycle:
/api/... or which page route)route.ts in src/app/api/src/app/actions/organizationId)Verify the authentication chain:
JWT_SECRET, NEXTAUTH_SECRET, CRON_SECRET, etc.)src/middleware.tsLook for these frequent issues in the affected files:
null/undefined returns from Prisma queries?prisma.expense vs prisma.expenses)organizationId? Missing scope = data leak or empty results.Review git history on the affected files:
git log -10 --oneline -- <affected-file>
git diff HEAD~5 -- <affected-file>
Identify if a recent commit introduced the regression.
Output your findings in this format:
## Production Issue Diagnosis
**Portal:** Guide
**Symptom:** 500 error on /api/guide/expenses
**Root cause:** Missing `await` on `prisma.expense.findMany()` at `src/app/api/guide/expenses/route.ts:34`
### Request trace
1. GET /api/guide/expenses
2. → src/app/api/guide/expenses/route.ts (GET handler)
3. → verifyGuideToken() from src/lib/guide-auth.ts ✓
4. → prisma.expense.findMany({ where: { organizationId, guideId } })
5. → ✗ Returns Promise instead of data (missing await)
### Affected file(s)
- `src/app/api/guide/expenses/route.ts:34` — missing `await`
### Suggested fix
Add `await` to the Prisma query on line 34:
```ts
const expenses = await prisma.expense.findMany({...})
## Tips
- Always check the Prisma schema (`prisma/schema.prisma`) to verify model names and relations.
- If the error is a 500 with no useful message, the bug is likely an unhandled exception — look for missing null checks or unvalidated input.
- For intermittent failures, check if the issue is related to expired tokens, rate limits, or database connection pooling.
- Multi-tenancy bugs (missing `organizationId`) often manifest as "no data found" rather than errors.