agentleFS
JLugagneJLugagne/agach/.claude/skills/doc-testing/SKILL.md

doc-testing

Skill0 starsChanged 8 months agoMITView on GitHub

Agach testing strategy: test contract pattern, mock structure, contract tests, testcontainers with postgres:17, security tests, QA seed data

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 2 are distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use testcontainers-go with postgres:17 for all PostgreSQL tests

    line 46
  2. Distinctive:

    Test auth enforcement, input validation, injection prevention

    line 52
  3. Distinctive:

    Add unit tests covering the fixed scenario to prevent regressions

    line 72
  4. Very specific:

    If the bug involves data/state that can be reproduced via seed data, add the use case to internal/server/qaseed/

    line 73
  5. Very specific:

    If the bug is reproducible through the web UI, add a Playwright test in playwright/

    line 74

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Agach Testing Strategy

Test Contract Pattern

Each repository interface has a companion test package:

/domain/repositories/<name>/<name>.go        - Interface definition
/domain/repositories/<name>/<name>test/
    contract.go - Mock<Name> + <Name>ContractTesting

Mock Structure

type Mock<Name> struct {
    <Method>Func func(...) ...
}

func (m *Mock<Name>) <Method>(...) ... {
    if m.<Method>Func == nil {
        panic("called not defined <Method>Func")
    }
    return m.<Method>Func(...)
}

Contract Test Structure

func <Name>ContractTesting(t *testing.T, repo <Name>) {
    ctx := context.Background()

    t.Run("Contract: <behavior>", func(t *testing.T) {
        // Test implementation
        require.NoError(t, err)
        assert.ErrorIs(t, err, domain.ErrExpected)
    })
}

Integration Tests

  • Use testcontainers-go with postgres:17 for all PostgreSQL tests
  • One shared container per test package — start in TestMain, never per test function
  • Pattern: newTestPool() → setupRepos() → contract testing

Security Tests

  • Located alongside handler tests (*_security_test.go, deep_security_test.go)
  • Test auth enforcement, input validation, injection prevention
  • Both command and query handlers have security test coverage

Service Mock + Contract

domain/service/servicetest/contract.go - MockCommands + MockQueries

Used by app layer unit tests and inbound handler tests.

QA Seed Data (internal/server/qaseed/seed.go)

Deterministic seed for E2E/Playwright tests. Wipes and recreates:

  • 3 roles: Backend (⚙️), Frontend (🖥️), QA (🧪) with tech stacks
  • 2 skills: Go Development, Playwright Testing
  • 1 Dockerfile: "go-service" (Go 1.24 template)
  • 2 projects: "QA Test Project" (main) + "QA Feature Branch" (feature)
  • 8 tasks in various states: todo, in_progress, blocked, done, won't-do, backlog, feature-linked, dependency pair
  • 2 comments: one on todo task, one human comment on blocked task
  • Outputs JSON with all entity IDs for Playwright test fixtures

Bug Fix Guidelines

  • Add unit tests covering the fixed scenario to prevent regressions
  • If the bug involves data/state that can be reproduced via seed data, add the use case to internal/server/qaseed/
  • If the bug is reproducible through the web UI, add a Playwright test in playwright/

Playwright Tests (playwright/)

playwright/tests/
  01-home.spec.ts            - Login, home, navigation
  02-kanban-board.spec.ts    - Board display
  03-task-management.spec.ts - Task CRUD
  04-roles-features.spec.ts  - Roles & features
  05-backlog-settings.spec.ts - Backlog & settings
  06-skills-stats-export.spec.ts - Skills, stats, export
  07-theme-comments-ws-health.spec.ts - Theme, comments, WebSocket
  helpers.ts                 - Shared test helpers

data-qa Attributes

Interactive elements use data-qa attributes for Playwright targeting: create-project-btn, login-email-input, search-input, nav-kanban-btn, task-open-btn, user-menu-btn, theme-toggle-btn, etc.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.