mcpField
N
ns-pm-unit-test-task-generator

ns-pm-unit-test-task-generator

github.com/nextstage-brasilTesting & quality043 installsUpdated 5d ago
Repository

About ns-pm-unit-test-task-generator

A planning skill that creates Markdown task files for backend unit and HTTP integration tests for a feature. It links test coverage to existing implementation tasks and emphasizes tenant isolation cases.

Key features

  1. 01Generate backend test task files
  2. 02Plan unit and HTTP integration tests
  3. 03Cover requests, services, models, and controllers
  4. 04Include cross-tenant scenarios
  5. 05Reference implementation task dependencies

Use cases

  1. 01Planning tests for a backend feature
  2. 02Adding tenant-isolation checks to test plans
  3. 03Preparing PHPUnit tasks before test implementation

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/nextstage-brasil/skills --skill ns-pm-unit-test-task-generator

After installing, type/ns-pm-unit-test-task-generatorin Claude Code to confirm it loaded.

Bundled filesevals/evals.json

Details

From the project README

Unit Test Task Generator

Create task-NNN-*.md for backend unit and HTTP integration tests covering a Feature.

Boundary

  • Planning: this skill (task markdown)
  • Execution: implement tests per task — use ns-code-backend-tests or implementation workflow

Harness discovery

Load {harness}/rules/backend-tests-rules.mdc and backend-rules.mdc when present.

Inputs

  • Feature to cover
  • List of backend implementation tasks already generated
  • requirements.md data model

Test pyramid (backend)

        [ E2E ]  ← ns-pm-e2e-test-task-generator
     [ Integration ]  ← Controller/HTTP tests
    [ Unit tests ]  ← Service, FormRequest, Model, Rules

What to test

ComponentTypeFocus
FormRequestUnitValid/invalid fields, tenant FK rules
ServiceUnitBusiness logic, mocks
ModelUnitScopes, casts, relations
ControllerIntegrationStatus, response shape, auth, 401/403
Tenant scopeIntegrationCross-tenant P0 — never 200 for other company

Output structure

See factory pattern in skill body — include:

  • Summary and detailed test plan (not duplicate)
  • Backend root — {product_root}/backend/ (monorepo) or detected brownfield path
  • Files under tests/Unit/ and tests/Feature/
  • Scenario checklists per component
  • Mandatory patterns: RefreshDatabase, factories, response shape, cross-tenant cases
  • Run command — vendor/bin/phpunit --testdox --stop-on-failure --stop-on-error in Docker with 120s timeout (see ns-code-backend-tests)
  • Bootstrap note when project has no tests/ yet: executor must run ns-code-backend-tests Phase 0 before test classes

Dependencies

Task must reference task-NNN.md of the backend implementation it covers.

Rules

  • Happy-path-only tasks for tenant-scoped CRUD are incomplete without cross-tenant P0
  • Do not point tests at production database
  • Match project's test runner commands — PHPUnit: vendor/bin/phpunit --testdox --stop-on-failure --stop-on-error in Docker, 120s timeout

Related skills

  • ns-sdd-task-generator — implementation tasks first
  • ns-code-backend-tests — execution and bootstrap
  • ns-pm-e2e-test-task-generator — UI coverage

Comments

Markdown supported