原始内容
MERN Ninja
MERN stack mastery tools for Claude Code
A plugin that supercharges Claude Code with specialized skills for MongoDB, Express, React, and Node.js development.
Installation
# Step 1: Add the marketplace (one-time)
/plugin marketplace add 9tykeshav/mern-ninja-marketplace
# Step 2: Install the plugin
/plugin install mern-ninja@mern-ninja-marketplace
Skills
mern-ninja:backend-test-writer
Generates comprehensive backend tests with smart defaults and zero config.
Just ask:
Generate tests for my user routes
Write tests for the auth service
Create tests for my User model
What it does:
| File Type | Test Type | Approach |
|---|---|---|
| Routes/Controllers | Integration | Supertest + mongodb-memory-server |
| Services | Unit | Mocked dependencies |
| Models | Unit | Validation, methods, toJSON |
| Middleware | Unit | Mock req/res/next |
| Utilities | Unit | Pure function tests |
Features:
- Auto-detects test framework (Jest/Vitest/Mocha)
- Gap analysis on existing tests before generating new ones
- Priority levels (P0/P1/P2) for each test case
- Domain-specific edge cases (dates → DST/timezone, money → precision)
- Setup/teardown boilerplate included
mern-ninja:code-reviewer
Reviews MERN stack code for security, performance, and best practices.
Just ask:
Review my authentication code
Check this Express API for security issues
Audit this MongoDB schema
Review priorities:
| Priority | Focus |
|---|---|
| 1. Security | Injection, XSS, auth flaws, secrets, CORS |
| 2. Performance | N+1 queries, re-renders, blocking ops |
| 3. Best Practices | Error handling, async patterns, cleanup |
| 4. Architecture | API design, state sync, type safety |
Sample output:
# MERN Code Review
## Summary
- Files reviewed: 5
- Issues: 2 Critical, 3 Important, 5 Suggestions
## Critical (Must Fix)
### [C1] Security: NoSQL injection in login
**File:** `api/auth/login.js:24`
**Why:** User input passed directly to query
**Fix:** Use explicit field matching
## What's Good
- Proper JWT refresh flow
- Consistent error responses
mern-ninja:mongodb-query-patterns
Data-flow-first approach to writing MongoDB/Mongoose queries that scale.
Triggers automatically when you:
Write a new Mongoose query
Wire data between services
Build an endpoint that reads/writes to MongoDB
Pass an ID where a document could be passed instead
Core principle: The best query is the one you never make. Pass documents through the call stack — don't re-fetch what the caller already has.
Patterns covered:
| Pattern | What It Prevents |
|---|---|
| Pass data through services | Same document fetched 3-4x across service boundaries |
Batch with $in + Map |
N+1 loops that fire one query per item |
.select() + .lean() |
Full-document fetches with Mongoose overhead on read paths |
Avoid .populate() on lists |
Hidden N+1 queries behind a clean API |
Direct updateOne |
Fetch-modify-save round-trips for simple field updates |
bulkWrite |
Sequential update loops |
| Hoist common queries | Duplicate queries across if/else branches |
| Index filter fields | Full collection scans (COLLSCAN) |
Includes: Pre-commit checklist, common mistakes table, and the "every query must justify its existence" decision framework.
Reference Guides
The plugin includes ~1,500 lines of curated best practices:
| Guide | Coverage |
|---|---|
security.md |
OWASP Top 10, MERN-specific vulnerabilities |
react.md |
Hooks, re-renders, security, testing |
nodejs.md |
Async patterns, event loop, memory |
express.md |
Middleware, auth, error handling |
mongodb.md |
Schema design, indexing, queries |
fullstack.md |
API design, auth flows, state sync |
test-patterns.md |
Complete test examples by file type |
test-setup.md |
Jest config, fixtures, mocking |
Roadmap
-
mern-ninja:scaffolder– Generate MERN boilerplate -
mern-ninja:migrator– Database migration helper -
mern-ninja:frontend-test-writer– React component tests
License
MIT