skills/cleanexpo/test-infrastructure/SKILL.md
When invoked:
npx skillsauth add aiskillstore/marketplace test-infrastructureInstall 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.
Purpose: Creates and maintains comprehensive test coverage. No stubs, no fakes, no empty files.
Core Principle: Tests are executable specifications. If a test is empty, the feature is incomplete.
When invoked:
ASSESS CURRENT STATE
├─ Count actual test lines (not file count)
├─ Identify stub/empty test files
├─ Find untested critical paths
├─ Measure real coverage (not percentage games)
└─ Create priority list for new tests
REPORT
├─ Tests with real coverage: X
├─ Empty test files: Y
├─ Critical gaps: Z
└─ Estimated work: T hours
Standards:
Test Hierarchy (in order of priority):
Every test must pass:
// Step 1: Identify test files
Find all **/*.test.ts, **/*.test.tsx, **/*.spec.ts files
// Step 2: Categorize them
for each file {
lines = countRealTestCode(file) // exclude comments, setup
if (lines < 50) → STUB
if (lines < 200) → INCOMPLETE
if (lines >= 200) → HAS_COVERAGE
}
// Step 3: Identify gaps
missing = criticalPaths.filter(p => !hasTest(p))
CRITICAL (write first)
├─ Authentication flow
├─ API auth + RLS enforcement
├─ Email processing
├─ Content generation
├─ Campaign execution
└─ Database operations
IMPORTANT (write next)
├─ UI rendering
├─ Form submission
├─ Navigation
├─ Error handling
└─ Edge cases
NICE-TO-HAVE (write if time)
├─ Performance
├─ Accessibility
└─ Analytics
For each critical path:
1. UNDERSTAND THE FLOW
- What does this feature do?
- What are inputs/outputs?
- What can go wrong?
2. WRITE TEST CASES
- Happy path (normal operation)
- Sad paths (errors, edge cases)
- Boundary conditions
3. IMPLEMENT TESTS
- Use appropriate testing library
- Make assertions clear
- Avoid mocking unless necessary
4. RUN & VERIFY
- Test runs without errors
- Breaks when code breaks
- Clear failure messages
describe('contactScoringEngine', () => {
// GOOD: Tests specific behavior
it('calculates score of 85 for high engagement contact', () => {
const contact = {
emailOpenRate: 0.8,
emailClickRate: 0.6,
sentiment: 'positive'
};
const score = scoreContact(contact);
expect(score).toBe(85);
});
// BAD: Doesn't assert anything meaningful
it('works', () => {
scoreContact({...});
});
// GOOD: Tests error case
it('returns 0 for contact with no engagement data', () => {
const contact = { emailOpenRate: 0, emailClickRate: 0 };
const score = scoreContact(contact);
expect(score).toBe(0);
});
});
describe('POST /api/contacts', () => {
// GOOD: Tests full flow with database
it('creates contact and returns assigned ID', async () => {
const response = await fetch('/api/contacts', {
method: 'POST',
headers: { Authorization: 'Bearer token' },
body: JSON.stringify({
email: '[email protected]',
name: 'Test User'
})
});
expect(response.status).toBe(201);
const data = await response.json();
expect(data.id).toBeDefined();
// Verify it was actually saved
const saved = await db.contacts.findById(data.id);
expect(saved.email).toBe('[email protected]');
});
// GOOD: Tests authorization
it('rejects request without valid auth token', async () => {
const response = await fetch('/api/contacts', {
method: 'POST',
body: JSON.stringify({ email: '[email protected]' })
});
expect(response.status).toBe(401);
});
});
describe('HotLeadsPanel', () => {
// GOOD: Tests rendering and interaction
it('displays hot leads and allows filtering', async () => {
const { getByText, getByRole } = render(
<HotLeadsPanel leads={mockLeads} />
);
expect(getByText('Hot Leads')).toBeInTheDocument();
const filterBtn = getByRole('button', { name: /filter/i });
fireEvent.click(filterBtn);
expect(getByText('Filter options')).toBeInTheDocument();
});
// BAD: Just checks it renders without error
it('renders', () => {
render(<HotLeadsPanel leads={mockLeads} />);
});
});
API Routes
├─ Auth routes: 100% (critical security)
├─ CRUD operations: 95% (core functionality)
├─ Integration routes: 80% (complex flows)
└─ Utility routes: 70% (less critical)
Services
├─ Email service: 100% (revenue critical)
├─ Agent logic: 95% (core feature)
├─ Database queries: 90% (data integrity)
└─ Utilities: 70%
Components
├─ Critical path components: 90%
├─ UI components: 70%
└─ Utilities: 50%
Overall: Target 75%+ real coverage
# Run all tests
npm test
# Run specific suite
npm test -- auth
# Run with coverage report
npm run test:coverage
# Watch mode for development
npm test -- --watch
# Generate coverage report
npm run test:coverage -- --reporter=html
If something is hard to test, that's a design problem.
Red flags:
Solutions:
Monthly tasks:
├─ Update tests when features change
├─ Remove obsolete tests
├─ Review test performance (slow tests?)
├─ Check coverage hasn't dropped
└─ Refactor duplicated test code
Track these:
✅ All critical paths have real tests ✅ Tests are fast (<5 seconds) ✅ Tests catch bugs (coverage > 75%) ✅ No empty test files ✅ All tests pass on main branch ✅ Coverage trend is increasing
❌ Empty test files that "count" toward coverage ❌ Stub tests with no assertions ❌ Mocking the thing you're testing ❌ Tests that pass whether code works or not ❌ Copy-paste tests (unmaintainable) ❌ One giant test file (hard to find issues) ❌ Writing tests after code (finds nothing)
Key Mantra:
"An empty test file is admitting we don't know if it works. Real tests are how we earn the right to claim features are done."
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.