skills/doubleslashse/tdd-workflow/SKILL.md
Test-Driven Development methodology for Node.js/TypeScript projects.
npx skillsauth add aiskillstore/marketplace tdd-workflowInstall 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.
Test-Driven Development methodology for Node.js/TypeScript projects.
Write tests BEFORE implementation:
Make tests pass with minimal code:
Improve code while keeping tests green:
describe('Calculator', () => {
it('should add two numbers correctly', () => {
// Arrange - Set up test conditions
const calculator = createCalculator();
// Act - Execute the behavior
const result = calculator.add(2, 3);
// Assert - Verify the outcome
expect(result).toBe(5);
});
});
Format: should {expectedBehavior} when {scenario}
Examples:
it('should return empty array when input is empty', ...);
it('should throw ValidationError when email is invalid', ...);
it('should emit event when state changes', ...);
describe('validateEmail', () => {
it('should return true for valid email', () => {
expect(validateEmail('[email protected]')).toBe(true);
});
});
describe('UserService', () => {
it('should persist user to database', async () => {
const db = createTestDatabase();
const service = createUserService({ db });
await service.createUser({ email: '[email protected]' });
const user = await db.users.findFirst();
expect(user.email).toBe('[email protected]');
});
});
describe('API Contract', () => {
it('should return user with expected shape', async () => {
const response = await api.getUser('1');
expect(response).toMatchObject({
id: expect.any(String),
email: expect.any(String),
createdAt: expect.any(Date),
});
});
});
Returns canned data:
const stubApi = {
getUser: () => Promise.resolve({ id: '1', name: 'Test' }),
};
Verifies interactions:
const mockLogger = {
info: jest.fn(),
error: jest.fn(),
};
// Later: expect(mockLogger.info).toHaveBeenCalledWith('message');
Working implementation:
const createFakeDatabase = () => {
const store = new Map();
return {
save: (entity) => store.set(entity.id, entity),
findById: (id) => store.get(id),
};
};
Records calls:
const spy = jest.spyOn(service, 'notify');
await service.process();
expect(spy).toHaveBeenCalledTimes(1);
src/
services/
user-service.ts
user-service.test.ts # Co-located unit tests
api/
handlers.ts
handlers.test.ts
tests/
integration/ # Integration tests
user-flow.test.ts
fixtures/ # Shared test data
users.ts
helpers/ # Test utilities
test-context.ts
// Bad - testing internal state
expect(service._cache.size).toBe(1);
// Good - testing behavior
expect(service.getCachedValue('key')).toBe('value');
// Bad - brittle
expect(result).toEqual({
id: '123',
name: 'Test',
createdAt: new Date('2024-01-01'),
updatedAt: new Date('2024-01-01'),
});
// Good - flexible
expect(result).toMatchObject({
id: expect.any(String),
name: 'Test',
});
// Bad - tests depend on order
let user;
it('should create user', () => { user = createUser(); });
it('should update user', () => { updateUser(user); }); // Depends on previous
// Good - independent tests
it('should update user', () => {
const user = createUser();
updateUser(user);
});
development
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.