RED-GREEN-REFACTOR cycle enforcement — write failing test, minimal code, refactor with safety net
Enforces the TDD red-green-refactor cycle to write tests, implement minimal code, and safely refactor.
npx claudepluginhub jugrajsingh/skillgardenThis skill is limited to using the following tools:
Execute a single RED-GREEN-REFACTOR cycle for a task.
$ARGUMENTS = task description with test name and assertion.
If $ARGUMENTS is missing test details, ask via AskUserQuestion for:
Goal: Write a failing test that defines the desired behavior.
Write the test:
Run the test:
# Detect runner and execute
# Python: pytest {test_file}::{test_name} -v
# JavaScript: npx jest {test_file} -t "{test_name}"
# Go: go test -run {test_name} ./...
Verify the failure:
Record RED state:
Goal: Write the MINIMAL code to make the test pass.
Write implementation:
Run the test:
# Same command as RED phase
Verify the pass:
Run broader test suite:
# Python: pytest --tb=short
# JavaScript: npx jest
# Go: go test ./...
Record GREEN state:
Goal: Improve code quality while keeping all tests green.
Review the code written in GREEN phase. Look for:
Apply improvements one at a time:
What NOT to do during REFACTOR:
Record REFACTOR state:
Stage files explicitly (never wildcards, never git add -A):
git add {test_file_path} {implementation_file_path}
Commit options:
If test and implementation are tightly coupled (single feature):
feat(scope): add {feature_description}
If they should be separate commits:
test(scope): add {test_name}
then
feat(scope): implement {feature_description}
No AI footers. Conventional format only.
Present the cycle results:
## TDD Cycle Complete
### RED
- Test: {test_name}
- File: {test_file}:{line_number}
- Failure: {expected failure message}
### GREEN
- Implementation: {impl_file}:{line_range}
- Tests: {passed}/{total}
### REFACTOR
- Changes: {description of refactoring applied}
- Tests: {passed}/{total} (still green)
### Commit
- {commit_hash} {commit_message}
Expert guidance for Next.js Cache Components and Partial Prerendering (PPR). **PROACTIVE ACTIVATION**: Use this skill automatically when working in Next.js projects that have `cacheComponents: true` in their next.config.ts/next.config.js. When this config is detected, proactively apply Cache Components patterns and best practices to all React Server Component implementations. **DETECTION**: At the start of a session in a Next.js project, check for `cacheComponents: true` in next.config. If enabled, this skill's patterns should guide all component authoring, data fetching, and caching decisions. **USE CASES**: Implementing 'use cache' directive, configuring cache lifetimes with cacheLife(), tagging cached data with cacheTag(), invalidating caches with updateTag()/revalidateTag(), optimizing static vs dynamic content boundaries, debugging cache issues, and reviewing Cache Component implementations.
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.