concept-workflow
End-to-end workflow for creating complete JavaScript concept documentation, orchestrating all skills from research to final review
Generate comprehensive Vitest tests for code examples in JavaScript concept documentation pages, following project conventions and referencing source lines
Claude Code
$ npx -y skills add leonardomso/33-js-concepts --skill test-writer --agent claude-code
Codex
$ npx skills add leonardomso/33-js-concepts --skill test-writer -a codex -y
Cursor
$ npx skills add leonardomso/33-js-concepts --skill test-writer -a cursor -y
Gemini CLI
$ npx skills add leonardomso/33-js-concepts --skill test-writer -a gemini-cli -y
GitHub Copilot
$ npx skills add leonardomso/33-js-concepts --skill test-writer -a github-copilot -y
OpenCode
$ npx skills add leonardomso/33-js-concepts --skill test-writer -a opencode -y
Windsurf
$ npx skills add leonardomso/33-js-concepts --skill test-writer -a windsurf -y
name: test-writer description: Generate comprehensive Vitest tests for code examples in JavaScript concept documentation pages, following project conventions and referencing source lines
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:**
For each testable code example:
1. Identify the expected output (from `console.log` comments or documented behavior) 2. Convert to `expect` assertions 3. Add source line reference in comments 4. Group related tests in `describe` 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!")
})---
**Documentation:**
// This throws an error! const obj = null console.log(obj.property) // TypeError: Cannot read property of null
**Test:**
// From lines XX-YY: Accessing property of null
it('should throw TypeError when accessing property of null', ()End-to-end workflow for creating complete JavaScript concept documentation, orchestrating all skills from research to final review
Verify technical accuracy of JavaScript concept pages by checking code examples, MDN/ECMAScript compliance, and external…
Find, evaluate, and maintain high-quality external resources for JavaScript concept documentation, including auditing for broken…
Perform a focused SEO audit on JavaScript concept pages to maximize search visibility, featured snippet optimization, and ranking…
Write or review JavaScript concept documentation pages for the 33 JavaScript Concepts project, following strict structure and…
Draws static SVG figures for lessons, READMEs and manuals in the AI Engineering from Scratch look: paper panel, blueprint accent,…
Test a learner on a single Claude Code tutorial lesson (01-10) with 10 questions, scoring answers and flagging weak spots. Use…
Build, audit, and improve harnesses that make AI coding agents reliable: AGENTS.md/CLAUDE.md instruction files, feature/state…