Install any skill in seconds. Free to start, no credit card required.
Get Started Free →loulanyue/backend-patterns
Backend architecture patterns, API design, database optimization, and server-side best practices for Node.js, Express, and Next.js API routes.
Passed 19 of 22 test cases with the skill, and 17 of 22 without it.
and 1 more in the full report
2 fixed17 passed either way3 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 2 test cases the skill fixed. Same model, same prompt, with and without the skill.
Could you help me set up role-based endpoint protection in my API? I need a TypeScript higher-order function that extracts the authorization token from incoming requests, verifies the user payload, and restricts route execution based on defined permission levels for user roles.
| Checked | Without skill | With skill |
|---|---|---|
| Uses standard Web Request or Response handler signatures rather than Express req, res, and NextFunction middleware arguments. | Missed | Passed |
| Defines a role-to-permissions mapping dictionary that maps user roles to arrays of permitted actions. | Missed | Passed |
| Uses a higher-order function wrapper that passes the verified user context object to the wrapped route handler. | Missed | Passed |
The instructions your model reads when the skill loads.
用於可擴展伺服器端應用程式的後端架構模式和最佳實務。
// ✅ 基於資源的 URL
GET /api/markets # 列出資源
GET /api/markets/:id # 取得單一資源
POST /api/markets # 建立資源
PUT /api/markets/:id # 替換資源
PATCH /api/markets/:id # 更新資源
DELETE /api/markets/:id # 刪除資源
// ✅ 用於過濾、排序、分頁的查詢參數
GET /api/markets?status=active&sort=volume&limit=20&offset=0
// 抽象資料存取邏輯
interface MarketRepository {
findAll(filters?: MarketFilters): Promise<Market[]>
findById(id: string): Promise<Market | null>
create(data: CreateMarketDto): Promise<Market>
update(id: string, data: UpdateMarketDto): Promise<Market>
delete(id: string): Promise<void>
}
class SupabaseMarketRepository implements MarketRepository {
async findAll(filters?: MarketFilters): Promise<Market[]> {
let query = supabase.from('markets').select('*')
if (filters?.status) {
query = query.eq('status', filters.status)
}
test cases passed, vs 17 / 22 without
Published skills whose descriptions closely match this one, with their headline benchmark lift.
More skills from the same source and nearby in the registry, with their headline benchmark lift.