agentleFS
strikersamstrikersam/autonomous-ai-agency/.agents/skills/test-first-executor/SKILL.md

test-first-executor

Skill9 starsChanged 3 months agoMITView on GitHub

Write or update tests before (or alongside) implementation. Ensures every code change is verifiably correct before merging.

The file

We split this skill into the rules it gives an agent

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

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Use this skill whenever:

    line 21
  2. Distinctive:

    All pre-existing tests must still pass.

    line 87
  3. Distinctive:

    Write a test that specifically exercises the security boundary.

    line 92

≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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

Skill: test-first-executor

When to Use

Use this skill whenever:

  • Adding a new function, class, or FastAPI endpoint
  • Fixing a bug (regression test required)
  • Adding a new agent tool or router capability
  • A reviewer asks "where are the tests?"

Instructions

Step 1 — Identify what needs testing

  • What is the expected input/output?
  • What are the failure modes?
  • Is there a risky edge case (empty input, auth bypass, model unavailability)?

Step 2 — Write the test first

For this repo, tests live in tests/. Match the pattern:

tests/test_<module>.py     # mirrors src module name

Test structure template:

"""Tests for <module>.<Class>."""
from __future__ import annotations

import pytest
# imports

# ── Fixtures ──────────────────────────────────────────────────────────────────

@pytest.fixture
def some_fixture():
    ...

# ── Happy path ────────────────────────────────────────────────────────────────

def test_<function>_<expected_outcome>():
    ...

# ── Edge cases ────────────────────────────────────────────────────────────────

def test_<function>_raises_on_<bad_input>():
    with pytest.raises(SomeError):
        ...

# ── Regression ────────────────────────────────────────────────────────────────

def test_regression_<issue_description>():
    # Previously this caused <symptom>. Fixed in <commit/version>.
    ...

Step 3 — Confirm the test FAILS before implementation

Run pytest -x tests/test_<module>.py::test_<name>. A test that passes immediately (before implementation) is not testing the right thing.

Step 4 — Implement until the test passes

Step 5 — Run the full suite

pytest -x

All pre-existing tests must still pass.

Step 6 — Check coverage of risky paths

For any change to admin_auth.py, key_store.py, agent/tools.py:

  • Write a test that specifically exercises the security boundary.
  • Confirm the test would catch a regression if the boundary were removed.

Acceptance Checks

  • Test file exists for the changed module
  • New test covers the new behaviour
  • Test was run and passed
  • No pre-existing test was broken
  • Regression test added for any bug fix
  • pytest -x exits 0

Test File Map

ModuleTest file
proxy.pytests/test_agent_api.py
agent/loop.pytests/test_agent_runner.py
agent/tools.pytests/test_agent_tools.py
router/tests/test_model_router.py
new modulestests/test_<module_name>.py

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.