plugins/claude-code-expert/skills/testing-workflows/SKILL.md
# Claude Code Testing Workflows Complete guide to testing patterns, TDD, and test execution within Claude Code. ## Test Execution ### Running Tests ```bash # Common test commands npm test pnpm test yarn test bun test pytest go test ./... cargo test # Single test file npm test -- path/to/test.ts pytest path/to/test.py # Pattern matching npm test -- --grep "authentication" pytest -k "test_auth" # Watch mode npm test -- --watch pytest --watch ``` ### Claude's Testing Protocol 1. **Before co
npx skillsauth add markus41/claude plugins/claude-code-expert/skills/testing-workflowsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Complete guide to testing patterns, TDD, and test execution within Claude Code.
# Common test commands
npm test
pnpm test
yarn test
bun test
pytest
go test ./...
cargo test
# Single test file
npm test -- path/to/test.ts
pytest path/to/test.py
# Pattern matching
npm test -- --grep "authentication"
pytest -k "test_auth"
# Watch mode
npm test -- --watch
pytest --watch
// auth.test.ts
describe('authenticateUser', () => {
it('should return user for valid credentials', async () => {
const result = await authenticateUser('[email protected]', 'password123');
expect(result).toMatchObject({
id: expect.any(String),
email: '[email protected]',
});
});
it('should throw for invalid credentials', async () => {
await expect(
authenticateUser('[email protected]', 'wrong')
).rejects.toThrow('Invalid credentials');
});
});
npm test -- auth.test.ts
# FAIL: authenticateUser is not defined
// auth.ts
export async function authenticateUser(email: string, password: string) {
const user = await db.user.findUnique({ where: { email } });
if (!user || !await bcrypt.compare(password, user.passwordHash)) {
throw new Error('Invalid credentials');
}
return { id: user.id, email: user.email };
}
npm test -- auth.test.ts
# PASS
Claude Code has a specialized test-writing agent:
Agent(
subagent_type="test-writer",
prompt="Write comprehensive tests for the authentication module in src/auth/",
description="Write auth tests"
)
The test-writer agent:
// Test individual functions in isolation
describe('calculateTotal', () => {
it('sums items correctly', () => {
expect(calculateTotal([10, 20, 30])).toBe(60);
});
it('handles empty array', () => {
expect(calculateTotal([])).toBe(0);
});
it('handles negative values', () => {
expect(calculateTotal([10, -5])).toBe(5);
});
});
// Test multiple components together
describe('POST /api/auth/login', () => {
it('returns JWT for valid login', async () => {
const res = await request(app)
.post('/api/auth/login')
.send({ email: '[email protected]', password: 'pass123' });
expect(res.status).toBe(200);
expect(res.body.token).toBeDefined();
});
});
// Test full user flows
describe('User Registration Flow', () => {
it('allows user to register and login', async () => {
// Register
await page.goto('/register');
await page.fill('#email', '[email protected]');
await page.fill('#password', 'secure123');
await page.click('button[type="submit"]');
// Verify redirect to dashboard
await expect(page).toHaveURL('/dashboard');
});
});
| Framework | Command | Config |
|-----------|---------|--------|
| Jest | npx jest | jest.config.js |
| Vitest | npx vitest | vitest.config.ts |
| Mocha | npx mocha | .mocharc.yml |
| Playwright | npx playwright test | playwright.config.ts |
| Cypress | npx cypress run | cypress.config.js |
| Framework | Command | Config |
|-----------|---------|--------|
| pytest | pytest | pytest.ini / pyproject.toml |
| unittest | python -m unittest | N/A |
| Language | Framework | Command |
|----------|-----------|---------|
| Go | testing | go test ./... |
| Rust | built-in | cargo test |
| Java | JUnit | mvn test / gradle test |
it('should return 404 for non-existent user') not it('test 1')# JavaScript/TypeScript
npx jest --coverage
npx vitest --coverage
npx c8 npm test
# Python
pytest --cov=src --cov-report=html
# Go
go test -coverprofile=coverage.out ./...
Claude's approach to test failures:
tools
Build Teams-native agents with the Teams SDK (formerly Teams AI Library v2) — App class, activity routing, adaptive cards, streaming, AI-generated labels, feedback, message extensions, Teams-as-MCP-server, and the bring-your-own-AI pattern with Agent Framework.
tools
Run agents on Microsoft Foundry (formerly Azure AI Foundry) Agent Service — prompt agents vs hosted agents, threads/runs and the Responses API, built-in tools (Bing grounding, code interpreter, file search, MCP, OpenAPI, A2A), connected agents, Entra agent identity, SDKs, and observability/evaluations.
tools
Build and host custom engine agents with the Microsoft 365 Agents SDK — AgentApplication, the Activity protocol, channel reach via Azure Bot Service, hosting Agent Framework or Semantic Kernel engines, and the Agents Toolkit/Playground workflow. Successor to the Bot Framework SDK.
tools
Design, govern, and extend Microsoft Copilot Studio agents — topics, generative orchestration, knowledge, tools and MCP, agent flows, autonomous triggers, publishing channels, Copilot Credits pricing, and solution-based ALM on Power Platform.