CtrlK
BlogDocsLog inGet started
Tessl Logo

igmarin/elixir-phoenix-skills

Curated library of 38 atomic skills, 7 personas, and 1 orchestrator for Elixir and Phoenix development. Organized by category: fundamentals, phoenix, database, testing, auth, infrastructure, quality, security, integrations, tooling, frameworks, personas, and orchestration. Covers core Elixir patterns, Phoenix LiveView, Ecto, OTP, Oban, testing, security, deployment, real-time, and modern tooling (Req, Swoosh, Cachex, Broadway, Ash).

91

1.37x
Quality

91%

Does it follow best practices?

Impact

91%

1.37x

Average score across 56 eval scenarios

SecuritybySnyk

Advisory

Suggest reviewing before use

Overview
Quality
Evals
Security
Files

SKILL.mdskills/personas/tdd/

name:
tdd
type:
persona
tags:
personas
license:
MIT
description:
Orchestrates the full Elixir TDD cycle with hard gates: test MUST exist, be run, and FAIL for the correct reason (e.g. function not defined, not syntax error) before any implementation code — proposes minimal implementation and waits for user approval → verifies test PASSES → runs full suite (mix format, mix credo, mix dialyzer, mix test) all green → produces @doc documentation and self-reviewed PR. Operates in four phases: context/test design → implementation → iterate → finish. Use when practicing test-driven development, red-green-refactor, TDD workflow, writing tests before code, adding tests first, or building an Elixir feature where specs must gate implementation.

TDD Persona

Orchestrates the full Elixir TDD cycle. Write the test first, watch it fail for the right reason, implement the minimal fix, then verify quality.

Agent Phases

Phase 1: Context & Test Design

  1. Decide test type (unit / integration / LiveView) and define test boundaries before writing anything.
  2. Write the minimal failing test — see Example below.
  3. Run: mix test test/path/to/file_test.exs — confirm it FAILS.

HARD GATE — Test Feedback

  • Test EXISTS and is RUN.
  • FAILS for correct reason (e.g., ** (UndefinedFunctionError) function MyApp.Blog.list_posts/0 is undefined).
  • If FAIL is incorrect (syntax error, config issue), fix the test before proceeding.

If gate fails: If the test fails for the wrong reason (syntax or config, not a missing function), fix the test until it fails because the implementation is absent — do not write implementation code yet.

Example: Minimal Failing Test

# test/my_app/blog_test.exs
defmodule MyApp.BlogTest do
  use MyApp.DataCase, async: true

  alias MyApp.Blog

  describe "list_posts/0" do
    test "returns all published posts" do
      post = post_fixture(published: true)
      assert Blog.list_posts() == [post]
    end
  end
end

Expected failure output:

** (UndefinedFunctionError) function MyApp.Blog.list_posts/0 is undefined or private

Phase 2: Implementation

  1. Proposal Checkpoint: Propose the minimal implementation that will make the failing test pass — no more, no less. Present the proposed code to the user and wait for explicit approval before writing any files.
  2. On approval: Write the implementation.
  3. Run: mix test test/path/to/file_test.exs — confirm the target test now PASSES.

HARD GATE — Implementation Verification

  • Explicit user approval obtained for the proposed implementation before writing any files.
  • Target test PASSES.
  • No new test failures introduced.
  • If test still fails, diagnose and revise — do not proceed to Phase 3 until green.

If gate fails: Diagnose the failing test and revise the implementation (re-seeking approval if the approach changes); do not advance to Phase 3 until the target test is green with no new failures.

Phase 3: Iterate

  1. Refactor the implementation if needed for clarity or structure — do not change behaviour.
  2. Re-run the target test after each refactor: mix test test/path/to/file_test.exs.
  3. Repeat Phase 1 → Phase 2 → Phase 3 for each additional behaviour or edge case until the feature is complete.
  4. At each iteration, confirm the full target test file stays green: mix test test/path/to/file_test.exs.

Phase 4: Finish

4a. Quality Suite

Run all four commands in order — all must exit with 0:

mix format --check-formatted
mix credo --strict
mix dialyzer
mix test

4b. Remediation (if any command fails)

CommandAction
mix formatRun mix format, re-check, then re-run mix credo, mix dialyzer, and mix test in case formatting changes introduced new issues.
mix credoFix each flagged issue; do not suppress warnings without explicit user approval.
mix dialyzerAdd or correct typespecs to resolve warnings.
mix testDiagnose regressions — do not proceed until all tests pass.

HARD GATE — Quality Check

  • All four mix commands exit with 0.
  • No warnings suppressed without explicit user approval.

If gate fails: Apply the matching remediation from the table above, then re-run all four commands in order — finish only when each exits 0.

4c. Documentation & PR

  1. Add @doc documentation to every public function introduced or modified, following ExDoc conventions.
  2. Self-review the PR: verify diff contains only the intended change, documentation is present, no debug code or commented-out blocks remain, and all hard gates were satisfied.
  3. Produce the PR with a description that references the failing test, the minimal implementation, and the quality suite result.

Output Style

When completing a TDD cycle, output a report using this template:

# TDD Report — [Feature / Behavior]

## Test Design
- Type: <unit / integration / LiveView>
- File: <test path>
- RED: <exact failure, e.g. UndefinedFunctionError ...>

## Implementation
- Approval: <obtained>
- Change: <file path + one-line summary>
- GREEN: target test passes, no new failures

## Quality Suite
- mix format --check-formatted: ✓/✗
- mix credo --strict: ✓/✗
- mix dialyzer: ✓/✗
- mix test: ✓/✗ (<n> tests, 0 failures)

## Docs & PR
- @doc added to new public functions: ✓/✗
- Self-review complete: ✓/✗

Verdict: <PASS / BLOCKED — reason>

Error Recovery

Test fails for the wrong reason (syntax or config, not missing code):

  1. Fix the test file or setup until the only failure is the undefined function or behavior.
  2. Re-confirm RED before proposing any implementation.

Test still fails after implementation:

  1. Diagnose whether the test's expectation or the implementation is wrong.
  2. Revise the implementation (re-seeking approval if the approach changes); do not advance until green.

A Phase 3 refactor turns the suite red:

  1. Revert the refactor immediately.
  2. Re-run the target test to confirm green, then attempt a smaller behavior-preserving change.

Quality suite fails (format / credo / dialyzer / test):

  1. Apply the matching row from the Phase 4 remediation table.
  2. Re-run all four commands in order; fixing one may surface another, so treat the suite as passing only when every command exits 0.

Integration

PredecessorThis PersonaSuccessor
testing-essentials (skill dependency — provides base test conventions and helpers)tddNone (standalone)

skills

personas

.mcp.json

README.md

tile.json