backend-testing
Backend testing guide — unit, integration, API contract, database, load testing
Skill by amas-nghia
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/amas-nghia-backend-testing
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: documents, backend, testing
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/backend-testing
What's inside
- Skill name
backend-testing- Description
- Backend testing guide — unit, integration, API contract, database, load testing
- License
- MIT
- Instructions
- 133 lines in SKILL.md · view on GitHub
Agent Skills spec issues
- name: "backend-testing" does not match folder "skill-backend-testing"
Files (2)
- SKILL.md
- package.json
SKILL.md (first lines)
# Backend Testing Skill
## Thứ tự ưu tiên test
1. **Integration tests** — API endpoint với real database (highest signal)
2. **Unit tests** — service logic, utilities, transformers
3. **Contract tests** — verify API shape khớp với client expectation
4. **Load tests** — endpoints chịu tải production estimate
## Integration Test (real database)
### Nguyên tắc
- Test với real database, không mock — mock database tạo false confidence
- Mỗi test tự seed data → chạy → cleanup
- Dùng transaction rollback để isolate test cases
```ts
beforeEach(async () => {
await db.delete(tasks) // clean slate
testTask = await db.insert(tasks).values(mockTask).returning()
})
test('PATCH /tasks/:id updates status', async () => {
const res = await request(app)
.patch(`/api/vault/tasks/${testTask.id}`)
.send({ status: 'done' })
expect(res.status).toBe(200)
expect(res.body.data.status).toBe('done')
// Verify DB was actually updated
const row = await db.query.tasks.findFirst({ where: eq(tasks.id, testTask.id) })
expect(row.status).toBe('done')
})
```
### Checklist endpoint test
- [ ] Happy path (200/201)
- [ ] Not found (404)
- [ ] Validation error (400) — test từng required field
- [ ] Auth error (401/403)
- [ ] Conflict nếu có (409)
- [ ] Edge cases (empty list, max pagination)
## Unit Test
### Cái gì nên unit test
- Pure transformation functions
- Validation logic
- Business rules phức tạp (không liên quan DB)
- Error mapping
### Cái gì KHÔNG unit test riêng
- Route handler (test via integration)
- Database queries (test via integration)
- External service calls (mock + integration riêng)
## Contract Test
Đặc biệt quan trọng với RelayHQ — server và web phải khớp:
```ts
// contract-alignment.test.ts pattern
test('GET /api/vault/read-model returns expected shape', async () => {
const res = await request(app).get('/api/vault/read-model')
expect(res.body).toMatchObject({
tasks: expect.arrayContaining([
expect.objectContaining({
id: expect.any(String),
status: expect.any(String),
title: expect.any(String),
})
])
})
})
```
Chạy contract tests sau mỗi thay đổi API response shape.
## Database Test
- Migration up/down phải idempotent
- Test constraint violations (unique, not null, foreign key)
- Test index effectiveness với `EXPLAIN ANALYZE`
- Seed scripts phải nhất quán và reproducible
## Load / Performance Test (k6 / autocannon)
```js
// k6 smoke test
export default function () {
const res = http.get('http://localhost:44210/api/vault/read-model')
check(res, { 'status 200': (r) => r.status === 200 })
sleep(1)
}
// Target: p95 < 200ms, no errors under 50 concurrent users
```
Chạy load test trước khi ship feature có query mới.
## Mocking External Services
```ts
// Mock HTTP calls, không mock database
vi.mock('../services/external-llm', () => ({
generateSummary: vi.fn().mockResolvedValue('mocked summary')
}))
```
- External APIs: mock ở service boundary
- File system: dùng temp directory thật
- Time: mock `Date.now()` cho time-dependent logic
## Coverage targets
| Layer | Minimum |
|---|---|From amas-nghia/relayhq, MIT.
More from amas-nghia/relayhq
- 0.497score
tech-writing
amas-nghia
Technical writing and documentation skill — specs, runbooks, changelogs, meeting notes, ADRs
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
backend-dev
amas-nghia
Backend development guide — API design, data modeling, business logic, security, performance
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
frontend-dev
amas-nghia
Frontend development guide — UI implementation, component architecture, state management, performance
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
project-management
amas-nghia
Project management skill — sprint planning, backlog grooming, risk management, reporting, stakeholder communication
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
frontend-testing
amas-nghia
Frontend testing guide — unit, integration, visual regression, accessibility, E2E for UI
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
codebase-brain
amas-nghia
Codebase second brain workflow for AI agents — use repo maps and capability maps before deep code reads
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
coordination
amas-nghia
Multi-agent coordination skill — task decomposition, dependency tracking, handoff protocol, conflict resolution
SkillCFreshness: C★ 2Claude Code +9 - 0.424score
bug-fix
amas-nghia
Root cause analysis and fix guide for bug tasks
SkillDFreshness: D★ 2Claude Code +9 - 0.424score
code-review
amas-nghia
Systematic code review guide for AI agents
SkillDFreshness: D★ 2Claude Code +9 - 0.424score
documentation
amas-nghia
Documentation writing guide for AI agents
SkillDFreshness: D★ 2Claude Code +9
Signals
- Stars
- 2
- Forks
- 0
- Open issues
- 1
- Last commit (this folder)
- May 5, 2026 (5 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/amas-nghia/relayhq
- Website
- amas.gitbook.io/relayhq
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from amas-nghia
- 0.497score
tech-writing
amas-nghia
Technical writing and documentation skill — specs, runbooks, changelogs, meeting notes, ADRs
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
backend-dev
amas-nghia
Backend development guide — API design, data modeling, business logic, security, performance
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
frontend-dev
amas-nghia
Frontend development guide — UI implementation, component architecture, state management, performance
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
project-management
amas-nghia
Project management skill — sprint planning, backlog grooming, risk management, reporting, stakeholder communication
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
frontend-testing
amas-nghia
Frontend testing guide — unit, integration, visual regression, accessibility, E2E for UI
SkillCFreshness: C★ 2Claude Code +9 - 0.497score
codebase-brain
amas-nghia
Codebase second brain workflow for AI agents — use repo maps and capability maps before deep code reads
SkillCFreshness: C★ 2Claude Code +9
Cite this page
backend-testing skill. Agent Mart. https://agentmart.dev/skills/amas-nghia-backend-testing (last updated 2026-10-24)