api-testing-verification/SKILL.md
Enforce thorough API endpoint testing before any API-dependent feature is complete. Use before merging features with API calls, DTOs, or new backend endpoints.
npx skillsauth add peterbamuhigire/skills-web-dev api-testing-verificationInstall 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.
api-testing-verification or would be better handled by a more specific companion skill.SKILL.md first, then load only the referenced deep-dive files that are necessary for the task.Enforce thorough API endpoint testing before declaring any API-dependent feature complete. Prevent backend-frontend mismatches that only surface during manual testing.
✅ Before declaring any feature "complete" that involves API calls ✅ After implementing new DTOs or API services ✅ After creating new backend endpoints ✅ Before committing and pushing API-dependent features ✅ When integrating frontend with existing backend APIs
❌ Don't use for pure UI-only features with no backend ❌ Don't use for unit tests that mock API responses
Real example from Phase 3 Reports:
Discovered after user manual testing:
Root cause: Unit tests with mocked responses hide real API integration issues.
Before declaring ANY feature with API calls "complete", you MUST verify:
# Check backend routing file or controller
# Verify the endpoint actually exists in code
# For PHP:
grep -r "sales-agent-portal.php" C:\wamp64\www\birdc_erp\public\api\
# For action-based APIs:
# Open the PHP file and verify the action exists in the switch/match statement
Checklist:
Test with curl or Postman/Insomnia:
# Example: Test with curl using actual auth token
curl -H "Authorization: Bearer <actual_jwt_token>" \
"https://10.0.2.2/birdc_erp/public/api/sales-agent-portal.php?action=sales_by_product&page=1&per_page=20"
Verify:
Backend typically uses snake_case:
{
"item_name": "Product A",
"total_revenue": 50000,
"avg_price": 5000
}
Android DTOs MUST use @Json annotations:
data class ProductSalesDto(
@Json(name = "item_name") val itemName: String,
@Json(name = "total_revenue") val totalRevenue: Double,
@Json(name = "avg_price") val averagePrice: Double
)
Checklist:
Verify backend pagination matches expectations:
Backend returns:
{
"success": true,
"data": {
"items": [...],
"pagination": {
"page": 1,
"per_page": 20,
"total": 100,
"total_pages": 5
}
}
}
Android expects:
data class PaginatedData<T>(
val items: List<T>,
val pagination: PaginationMeta
)
data class PaginationMeta(
val page: Int,
@Json(name = "per_page") val perPage: Int,
val total: Int,
@Json(name = "total_pages") val totalPages: Int
)
Checklist:
Test failure cases:
# Invalid auth token (should return 401)
curl -H "Authorization: Bearer invalid_token" <endpoint>
# Missing required param (should return 400)
curl <endpoint>?page=abc
# Non-existent resource (should return 404)
curl <endpoint>?agent_id=99999
Checklist:
Run the actual app on emulator with real backend:
Checklist:
1. Write domain models (data classes)
2. Write DTOs with @Json annotations (check backend response structure first!)
3. Write API service interface
4. Write repository implementation
5. Write unit tests (with mocked responses)
6. ⚠️ BEFORE DECLARING COMPLETE:
- Run through Pre-Completion Checklist above
- Test with actual backend
- Fix any mismatches
- Re-test until all API calls work
7. NOW you can commit as "complete"
🚩 "All unit tests pass" is NOT sufficient - unit tests mock API responses 🚩 "Build successful" is NOT sufficient - build doesn't test actual APIs 🚩 Never assume field names - always verify backend response JSON 🚩 Never assume endpoint exists - check backend routing first 🚩 Never skip manual testing - run the app with real backend before committing
Backend: total_revenue
Android without @Json: totalRevenue ❌ (won't match)
Android with @Json: @Json(name = "total_revenue") val totalRevenue ✅
Backend returns: total_sales
Android expects: totalRevenue ❌
Fix: Update DTO to expect total_sales OR fix backend
Android calls: agent-commissions.php?action=get_commissions
Backend: Endpoint doesn't exist ❌
Fix: Add the action to backend routing
Backend returns: { items: [...], page: 1, total: 100 }
Android expects: { items: [...], pagination: { page: 1, total: 100 } } ❌
Fix: Normalize one or the other
Backend returns: phone_number: null
Android DTO: val phoneNumber: String ❌ (should be String?)
Fix: Make DTO field nullable: String?
Test endpoint with curl:
# Get JWT token from app first (check Logcat or use /v1/auth/login)
export TOKEN="your_jwt_token_here"
# Test endpoint
curl -H "Authorization: Bearer $TOKEN" \
"https://10.0.2.2/birdc_erp/public/api/sales-agent-portal.php?action=sales_by_product&page=1&per_page=20" \
| jq .
Check backend endpoint exists:
# Search for endpoint definition
grep -n "sales_by_product" C:\wamp64\www\birdc_erp\public\api\sales-agent-portal.php
# Check service method exists
grep -n "getSalesByProduct" C:\wamp64\www\birdc_erp\src\Services\Sales\*.php
Check Android DTO field names:
# Search for DTO definition
grep -A 10 "data class ProductSalesDto" app/src/main/java/**/*.kt
View Logcat for JSON errors:
adb logcat | grep -i "json\|moshi\|retrofit\|http"
feature-planning → Define API contract (request/response structure)
↓
android-development → Implement DTOs, API services, repositories
↓
android-tdd → Write unit tests (with mocked responses)
↓
api-testing-verification → MANDATORY: Test with real backend (THIS SKILL)
↓
update-claude-documentation → Document API contract in completion report
The Golden Rule:
"All unit tests passing" + "Build successful" ≠ Feature complete
You MUST test with actual backend before declaring completion.
Time Budget:
Remember: Unit tests can't catch backend-frontend mismatches. Always verify with real API calls before committing.
data-ai
Use when adding AI-powered analytics to a SaaS platform — semantic search over business data, natural language queries, trend detection, anomaly alerts, and AI-generated insights for dashboards. Covers embeddings, NL2SQL, and per-tenant analytics...
data-ai
Design AI-powered analytics dashboards — what metrics to show, how to display AI predictions and confidence, drill-down patterns, KPI cards, trend visualisation, AI Insights panels, export design, and role-based dashboard variants. Invoke when...
development
Use when designing, building, reviewing, or upgrading production software systems that must be secure, performant, maintainable, scalable, and user-centered. Apply before writing specs, code, architecture, APIs, databases, mobile apps, SaaS platforms, or ERP systems.
development
Professional web app UI using commercial templates (Tabler/Bootstrap 5) with strong frontend design direction when needed. Use for CRUD interfaces, dashboards, admin panels with SweetAlert2, DataTables, Flatpickr. Clone seeder-page.php, use...