Use this skill to generate comprehensive Vitest tests for all code examples in a concept documentation page. Tests verify that code examples in the documentation are accurate and work as described.
Works with
AI-first code editor with Composer
Before installing skills in Cursor, ensure your development environment meets these requirements:
node --versiontest-writerExecute the skills CLI command in your project's root directory to begin installation:
Fetches test-writer from leonardomso/33-js-concepts and configures it for Cursor.
The CLI shows a list of agents. Use arrow keys and space to select Cursor:
Confirm successful installation by checking the skill directory location:
Restart Cursor to activate test-writer. Access via /test-writer in your agent's command palette.
We perform automated surface-level scans (Gen AI Scanner, Socket, Snyk) during installation. These checks detect common vulnerabilities but do not guarantee complete security. Always review skill source code and verify the publisher's reputation before production use.
Skills execute code in your environment. Always review source, verify the publisher, and test in isolation before production.
Submit your Claude Code skill and start earning
Automate repetitive workflows and reduce manual effort
Example
Generate reports, summarize documents, draft communications
Save 3-5 hours per week on routine tasks
Learn new skills, understand complex topics, get expert guidance
Example
Explain concepts, provide examples, suggest learning resources
Accelerate learning and skill development by 2x
Enhance output quality through reviews, suggestions, and refinements
Example
Review drafts, suggest improvements, catch errors
Improve work quality by 30-40% with less effort
0
total installs
0
this week
66.3K
GitHub stars
0
upvotes
Run in your terminal
0
installs
0
this week
66.3K
stars
Use this skill to generate comprehensive Vitest tests for all code examples in a concept documentation page. Tests verify that code examples in the documentation are accurate and work as described.
Follow these four phases to create comprehensive tests for a concept page.
Scan the concept page for all code examples and categorize them:
| Category | Characteristics | Action |
|---|---|---|
| Testable | Has console.log with output comments, returns values |
Write tests |
| DOM-specific | Uses document, window, DOM APIs, event handlers |
Write DOM tests (separate file) |
| Error examples | Intentionally throws errors, demonstrates failures | Write tests with toThrow |
| Conceptual | ASCII diagrams, pseudo-code, incomplete snippets | Skip (document why) |
| Browser-only | Uses browser APIs not available in jsdom | Skip or mock |
tests/
├── fundamentals/ # Concepts 1-6
├── functions-execution/ # Concepts 7-8
├── web-platform/ # Concepts 9-10
├── object-oriented/ # Concepts 11-15
├── functional-programming/ # Concepts 16-19
├── async-javascript/ # Concepts 20-22
├── advanced-topics/ # Concepts 23-31
└── beyond/ # Extended concepts
└── {subcategory}/
File naming:
{concept-name}.test.js{concept-name}.dom.test.jsFor each testable code example:
console.log comments or documented behavior)expect assertionsdescribe blocks matching documentation sections| Case | Solution |
|---|---|
| Browser-only APIs | Use jsdom environment or skip with note |
| Timing-dependent code | Use vi.useFakeTimers() or test the logic, not timing |
| Side effects | Capture output or test mutations |
| Intentional errors | Use expect(() => {...}).toThrow() |
| Async code | Use async/await with proper assertions |
import { describe, it, expect } from 'vitest'
For DOM tests or tests needing mocks:
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
/**
* @vitest-environment jsdom
*/
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'
Match the structure of the documentation:
describe('Concept Name', () => {
describe('Section from Documentation', () => {
describe('Subsection if needed', () => {
it('should [specific behavior]', () => {
// Test
})
})
})
})
// Good
it('should return "object" for typeof null', () => {})
it('should throw TypeError when accessing property of undefined', () => {})
it('should resolve promises in order they were created', () => {})
// Bad
it('test typeof', () => {})
it('works correctly', () => {})
it('null test', () => {})
Always reference the documentation source:
// ============================================================
// SECTION NAME FROM DOCUMENTATION
// From {concept}.mdx lines XX-YY
// ============================================================
describe('Section Name', () => {
// From lines 45-52: Basic typeof examples
it('should return correct type strings', () => {
// Test
})
})
Documentation:
console.log(typeof "hello") // "string"
console.log(typeof 42) // "number"
Test:
// From lines XX-YY: typeof examples
it('should return correct type for primitives', () => {
expect(typeof "hello").toBe("string")
expect(typeof 42).toBe("number")
})
Documentation:
let a = "hello"
let b = "hello"
console.log(a === b) // true
let obj1 = { x: 1 }
let obj2 = { x: 1 }
console.log(obj1 === obj2) // false
Test:
// From lines XX-YY: Primitive vs object comparison
it('should compare primitives by value', () => {
let a = "hello"
let b = "hello"
expect(a === b).toBe(true)
})
it('should compare objects by reference', () => {
let obj1 = { x: 1 }
let obj2 = { x: 1 }
expect(obj1 === obj2).toBe(false)
})
Documentation:
function greet(name) {
return "Hello, " + name + "!"
}
console.log(greet("Alice")) // "Hello, Alice!"
Test:
// From lines XX-YY: greet function example
it('should return greeting with name', () => {
function greet(name) {
return "Hello, " + name + "!"
}
expect(greet("Alice")).toBe("Hello, Alice!")
})
Prerequisites
Time Estimate
15-45 minutes depending on use case complexity
Steps
Common Pitfalls
✓ Do
✗ Don't
💡 Pro Tips
✓ Use when
Use when skill capabilities match your task, clear ROI on time saved, and you can validate outputs. Best for repetitive tasks, learning, and quality improvement.
✗ Avoid when
Avoid when task requires deep expertise you can't validate, involves sensitive decisions, or when learning process is more valuable than speed of completion.
cexll/myclaude
github/awesome-copilot
yangsonhung/awesome-agent-skills
ailabs-393/ai-labs-claude-skills
pmprompt/claude-plugin-product-management
onewave-ai/claude-skills
test-writer is among the better-maintained entries we tried; worth keeping pinned for repeat workflows.
Useful defaults in test-writer — fewer surprises than typical one-off scripts, and it plays nicely with `npx skills` flows.
Registry listing for test-writer matched our evaluation — installs cleanly and behaves as described in the markdown.
test-writer reduced setup friction for our internal harness; good balance of opinion and flexibility.
test-writer fits our agent workflows well — practical, well scoped, and easy to wire into existing repos.
test-writer has been reliable in day-to-day use. Documentation quality is above average for community skills.
We added test-writer from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
Solid pick for teams standardizing on skills: test-writer is focused, and the summary matches what you get after install.
We added test-writer from the explainx registry; install was straightforward and the SKILL.md answered most questions upfront.
Registry listing for test-writer matched our evaluation — installs cleanly and behaves as described in the markdown.
showing 1-10 of 38