agentsclimarketplace

Follow test patterns

Skill eveld/claude/skills/follow-test-patterns

Use when writing tests to ensure they follow project conventions. References patterns from thoughts/notes/testing.md.From its SKILL.md

Install
npx -y skills add eveld/claude --skill follow-test-patterns

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 10 stars10 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

3.2 KB, as published. Nobody here has run it

Follow Test Patterns

Reference discovered test patterns when writing tests to ensure consistency with project conventions.

When to Use

  • Before writing any test file
  • When implementing test-related phases in plans
  • When user asks you to add tests

Workflow

1. Check for Pattern Document

if [ -f thoughts/notes/testing.md ]; then
  # Read and follow patterns
else
  # Prompt user to run discover-test-patterns first
  echo "No test patterns found. Run discover-test-patterns skill first."
fi

2. Read Pattern Document

Read thoughts/notes/testing.md fully to understand:

  • File naming conventions
  • Testing framework and imports
  • Test structure (table-driven, etc.)
  • Assertion style
  • Mocking approach

3. Apply Patterns to New Tests

Use the discovered patterns for:

File Naming:

  • Follow the pattern (e.g., *_test.go, *.test.ts)
  • Place alongside source or in test directory as per convention

Imports:

  • Use same testing framework (testify, jest, pytest)
  • Import same assertion libraries

Test Structure:

  • If codebase uses table-driven tests, use that pattern
  • If codebase uses describe/it blocks, use that pattern
  • Match indentation and formatting

Assertions:

  • Use same assertion style (require.Equal vs assert.Equal)
  • Follow error message conventions

Mocking:

  • Use same mocking library (mockery, jest.mock, unittest.mock)
  • Follow interface/class mocking patterns found in codebase

Alternative: Use Test-Writer Agent

For complex test generation, spawn the test-writer agent:

Task(subagent_type="workflows:test-writer",
     prompt="Generate tests for [functions] following patterns in testing.md.
     Expected behavior: [describe].
     Return test code only.")

Benefits:

  • Conserves main agent context (3k instead of 20k+)
  • Agent reads testing.md and examples in isolation
  • Returns only the test code you need
  • Follows project patterns automatically

When to use:

  • Generating multiple test files
  • Complex table-driven tests
  • During phased implementation (see spawn-implementation-agents)

4. Verify Consistency

After writing tests, verify:

  • File name matches convention
  • Framework imports are correct
  • Test structure matches examples
  • Assertions use same style
  • Tests are in correct location

Example

If thoughts/notes/testing.md shows:

## Go Test Patterns
- File: `*_test.go` alongside source
- Framework: testify/require
- Pattern: Table-driven tests

Then write:

package handlers

import (
    "testing"
    "github.com/stretchr/testify/require"
)

func TestNewFeature(t *testing.T) {
    tests := []struct {
        name string
        input FeatureInput
        want FeatureOutput
    }{
        {name: "valid case", input: ..., want: ...},
    }
    for _, tt := range tests {
        t.Run(tt.name, func(t *testing.T) {
            got := NewFeature(tt.input)
            require.Equal(t, tt.want, got)
        })
    }
}

Benefits

  • Tests automatically match project style
  • Reduces review feedback
  • Faster test writing with clear examples
  • Consistency across all new tests

Keep looking

Skills are one crate of 610,677. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.