Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

backend-test-writer后端测试编写器

Agent Skill

用于辅助测试设计、自动化测试、用例整理和回归验证。它适合让 Agent 编写单元测试、端到端测试、测试计划或根据失败日志定位问题。使用时需要确认项目测试框架、运行命令和夹具数据,避免为了通过测试而改坏真实逻辑;涉及浏览器或外部服务时,应区分本地模拟、测试环境和生产环境。

总安装

212

周安装

9

GitHub Stars

7

下载量

74
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:backend-test-writer(后端测试编写器)
来源仓库:https://github.com/9tykeshav/mern-ninja-cc
仓库路径:skills/backend-test-writer
安装命令:
npx skills add https://github.com/9tykeshav/mern-ninja-cc --skill backend-test-writer
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/9tykeshav/mern-ninja-cc --skill backend-test-writer

简介

backend-test-writer 为 MERN 栈后端代码生成智能测试,自动检测项目约定并产出可执行测试。

  • 适合快速建立测试基础,支持 Jest + Supertest 和 MongoDB 内存服务器。
  • 通过 npx skills add 安装,会自动检查测试框架配置并提示缺失项。
  • 生成的测试需根据实际业务逻辑调整预期行为和错误处理。
  • 建议结合 E2E 测试验证接口完整性。

SKILL.md

Backend Test Writer

Generate comprehensive backend tests for MERN stack code. Analyzes file type, detects project conventions, produces tests that actually run.

Philosophy: Smart defaults, zero config. Detect everything from project.

Workflow

Copy and track progress:

  • Phase 0: Infrastructure check
  • Phase 1: Analyze target files
  • Phase 2: Generate tests
  • Phase 3: Report summary

Phase 0: Infrastructure Check

Before generating tests, verify setup:

  1. Check package.json for test framework (Jest/Vitest/Mocha)
  2. If none → prompt: "Set up Jest + Supertest?"
  3. Check for mongodb-memory-server (needed for integration tests)
  4. Detect test file convention (colocated vs __tests__/ vs tests/)

Stop if: No test framework and user declines setup.

Phase 1: Analyze Target Files

PatternTypeTest Approach
routes/, *.routes.jsRouteIntegration (Supertest + real DB)
controllers/ControllerIntegration
services/ServiceUnit (mocked deps)
models/, *.model.jsModelUnit (validation tests)
middleware/MiddlewareUnit (mock req/res/next)
utils/, helpers/UtilityUnit (pure functions)

Override: User can specify --unit or --integration.

Phase 2: Generate Tests

Process files sequentially with progress. User can stop anytime.

Each test includes:

  • Proper imports for detected framework
  • Setup/teardown (DB connection, cleanup)
  • Comprehensive coverage:

- Success cases (happy path) - Validation errors (400) - Not found (404) - Auth failures (401/403) if protected - Edge cases (duplicates, empty, null)

Reference: See test-patterns.md for complete code examples.

Phase 3: Report

Generated: X test files
Coverage: Y test cases total
Next: Run `npm test` to verify

Quick Reference

File TypeImportsDB Setup
Routesupertest, mongodb-memory-serverReal (in-memory)
ServicejestMocked
ModelmongooseMocked
MiddlewarejestNone

Test Structure Pattern

describe('[Resource] [Method]', () => {
  describe('success cases', () => {
    it('should [expected behavior]', async () => {});
  });
  describe('validation errors', () => {
    it('should return 400 for [invalid case]', async () => {});
  });
  describe('edge cases', () => {
    it('should handle [edge case]', async () => {});
  });
});

Checklists

Infrastructure (Check First)

  • Test framework in package.json
  • Test script defined ("test": "jest")
  • Supertest installed (integration tests)
  • mongodb-memory-server installed (DB tests)

Per-File Generation

  • Check for existing tests first (gap analysis if found)
  • Correct imports for file type
  • Setup/teardown included
  • Happy path tested
  • Error cases tested (400, 404, 401)
  • Edge cases tested (domain-specific: date→DST/timezone, money→precision, etc.)
  • No secrets in assertions
  • Async/await handled properly
  • Priority assigned to each test (P0=critical, P1=important, P2=nice-to-have)
  • Test helper factories suggested for complex inputs

Common Mistakes

MistakeFix
Starting server in testsImport app, let Supertest handle it
No DB cleanupAdd afterEach with deleteMany({})
Testing implementationTest behavior through HTTP interface
Missing async/awaitAwait async operations
Mocking in integration testsUse real DB for integration

Guidelines

  • Don't generate tests for unread code
  • Don't skip infrastructure check
  • Don't generate only happy paths
  • Don't forget cleanup between tests

Reference Files

Load when implementing specific patterns:

WhenReference
Writing any testtest-patterns.md
Setting up test infrastructuretest-setup.md

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

31.88%
按下载量换算24

Claude

31.2%
按下载量换算23

Cursor

17.43%
按下载量换算13

Gemini CLI

9.49%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills