test-driven-development

Guides Red-Green-Refactor test-driven development cycles with test execution, linting, and CI verification.

1|Updated Feb 16, 2025
One-click install
npx skills add https://github.com/yellow-seed/my-portfolio --skill test-driven-development-yellow-seed
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: test-driven-development
Source: https://github.com/yellow-seed/my-portfolio/tree/main/.github/skills/test-driven-development
Command: npx skills add https://github.com/yellow-seed/my-portfolio --skill test-driven-development-yellow-seed

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It enforces disciplined test-driven development by walking you through the Red-Green-Refactor cycle, ensuring tests are written before implementation and that code quality checks pass before changes are committed. ## Core Features & Use Cases - Red-Green-Refactor Workflow: Structured guidance for writing failing tests first, implementing minimal passing code, then refactoring safely. - Local Quality Gates: Runs bats shell tests, ShellCheck, shfmt formatting, and actionlint before committing changes. - CI Verification: Creates pull requests and confirms GitHub Actions checks (Actionlint, ShellCheck, tests) all succeed. - Use Case: When asked to add a new shell script feature, the Skill first writes a failing bats test, implements the minimal script to pass it, refactors, lints, commits, opens a PR, and verifies CI is green. ## Quick Start Ask the assistant to implement a new feature using test-driven development with the Red-Green-Refactor cycle.

Frequently Asked Questions about test-driven-development

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I practice test-driven development with the Red-Green-Refactor cycle?▼

Write a failing test that defines the expected behavior (Red), implement the minimal code to make it pass (Green), then improve the code while keeping tests green (Refactor). Run tests frequently to get immediate feedback at each step.

How do I run bats shell script tests in this workflow?▼

Run bats tests through Docker with 'docker compose run shell-dev bats tests/' to execute the full suite, or specify a single file like 'tests/example.bats'. Run them after writing tests to confirm failure and after implementation to confirm success.

What linting and formatting checks run before committing shell scripts?▼

The workflow runs ShellCheck via 'docker compose run shell-dev lint-shell' and checks formatting with shfmt. Apply fixes with 'shfmt -i 2 -w .' and run actionlint if GitHub Actions workflow files were modified.

What happens if CI fails after creating a pull request?▼

Check the PR page logs to identify the failing check, reproduce it locally by running the same command, fix the issue, then commit and push. CI reruns automatically on the new push until all checks pass.

Should test files be kept after development is complete?▼

For code development, test files like bats tests are kept as final deliverables. For documentation development, temporary verification checklists can be deleted, kept for ongoing quality checks, or merged into the main document.