بنقرة واحدة
debug-issue
Debug and troubleshoot issues in the OMS system with systematic approach
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Debug and troubleshoot issues in the OMS system with systematic approach
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Add a new API endpoint with controller, service, and DTOs following OMS patterns
Add a new database entity with migrations for all three databases (MySQL, MSSQL, PostgreSQL)
Add a new mobile page to frontend.h5 using Vant 4 components
Add a new frontend page with proper layout, table, and API integration following OMS UI standards
Audit backend code to ensure all queries properly filter by OrgId for multi-tenant security
Create database migration files for all three databases (MySQL, MSSQL, PostgreSQL) when schema changes are needed
| name | debug-issue |
| description | Debug and troubleshoot issues in the OMS system with systematic approach |
| disable-model-invocation | false |
| allowed-tools | Read, Grep, Glob, Bash |
Systematically debug and troubleshoot issues in the OMS system.
When the user reports an issue or error, follow this systematic debugging approach:
Ask the user for:
Determine which layer has the issue:
Most common issue in OMS - missing OrgId filtering:
# Search for queries without OrgId filter
grep -r "ToListAsync()" backend/omsapi/Services/ | grep -v "OrgId"
Check:
# Check JWT token handling
grep -r "GetCurrentUserId\|GetCurrentOrgId" backend/omsapi/
Check:
Check:
ApiResponse<T>Check:
Check Browser Console:
Check Component State:
Check API Integration:
// Add console.log to debug
const res = await api.getData()
console.log('API Response:', res)
Check Routing:
Check Logs:
# View backend logs
cd backend/omsapi
dotnet run
# Watch for errors in console
Check Service Layer:
Check Database Queries:
appsettings.json:"Logging": {
"LogLevel": {
"Microsoft.EntityFrameworkCore.Database.Command": "Information"
}
}
Check Authorization:
[Authorize] attributeCheck Migrations:
# List migration files
ls database/mysql/
ls database/mssql/
ls database/postgresql/
Check Connection:
appsettings.jsonCheck Schema:
Cause: OrgId mismatch Fix: Verify OrgId filtering in query
Cause: Null reference Fix: Add null checks, use nullable types
Cause: DbContext disposed too early
Fix: Ensure proper async/await, avoid .Result
Cause: Concurrent DbContext access Fix: Use proper async/await, avoid parallel queries on same context
Cause: Missing or invalid token Fix: Check token in request headers, verify token expiration
Cause: Insufficient permissions Fix: Check user roles and permissions
Cause: CORS not configured
Fix: Add CORS policy in Program.cs
Cause: Backend not running or wrong URL Fix: Verify backend is running, check proxy configuration
_logger.LogInformation() statementsAfter fixing, consider:
Issue: [Brief description]
Environment: [Frontend PC/H5/Backend/Database]
Error Message: [Exact error]
Investigation:
1. [ ] Checked logs
2. [ ] Verified OrgId filtering
3. [ ] Checked authentication
4. [ ] Tested API endpoint
5. [ ] Reviewed recent changes
Root Cause:
[What caused the issue]
Fix Applied:
[What was changed]
Verification:
[How it was tested]
Prevention:
[How to prevent in future]
Issue: "Product list is empty but products exist in database"
Investigation:
Root Cause:
// WRONG - no OrgId filter
var products = await _context.Products.ToListAsync();
Fix:
// CORRECT - with OrgId filter
var currentOrgId = _httpContextAccessor.HttpContext!.GetCurrentOrgId();
var products = await _context.Products
.Where(x => x.OrgId == currentOrgId)
.ToListAsync();
Verification: Product list now shows correct products for current organization.