Index of every page on this site: llms.txt
All skills
ganyuanran avatar

/test-driven-development

@95d0733
by SeanRanganyuanran/aegis1.5k stars
83
Run it yourself

Use when the user explicitly requests strict or test-first TDD, or when the current conversation already contains an explicit `TDD Route: strict` decision from another Aegis workflow.

Use this Skill: https://skilld.dev/gh/ganyuanran/aegis/test-driven-development

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

examples.md

≈726 tokens on demand. Your agent reads this file only when SKILL.md points to it.

TDD Examples

Conditional teaching material only. SKILL.md owns route authority, preflight, observed RED/GREEN, recovery, regression and completion. Read only the section selected by the main skill; do not load this file for ordinary strict execution, mode selection, or accidental entry while TDD is off. Examples illustrate behavior and do not prescribe a language, runner or production implementation.

Behavior Assertions

Use when choosing assertions is unclear, especially when a mock/callback count can pass without checking the user-observable result.

<Good> ```typescript test('retries failed operations 3 times', async () => { let attempts = 0; const operation = () => { attempts++; if (attempts < 3) throw new Error('fail'); return 'success'; };

const result = await retryOperation(operation);

expect(result).toBe('success'); expect(attempts).toBe(3); });

Clear name, tests real behavior, one thing
</Good>

<Bad>
```typescript
test('retry works', async () => {
  const mock = jest.fn()
    .mockRejectedValueOnce(new Error())
    .mockRejectedValueOnce(new Error())
    .mockResolvedValueOnce('success');
  await retryOperation(mock);
  expect(mock).toHaveBeenCalledTimes(3);
});

Vague name; exercises real retry code but asserts only callback count, not the returned result </Bad>

Test Quality

Quality Good Bad
Minimal One thing. "and" in name? Split it. test('validates email and domain and whitespace')
Clear Name describes behavior test('test1')
Shows intent Demonstrates desired API Obscures what code should do

Minimal GREEN

Use when the minimum implementation is unclear or a proposed API adds unrequested options before the tested behavior exists.

<Good> ```typescript async function retryOperation<T>(fn: () => Promise<T>): Promise<T> { for (let i = 0; i < 3; i++) { try { return await fn(); } catch (e) { if (i === 2) throw e; } } throw new Error('unreachable'); } ``` Just enough to pass </Good><Bad> ```typescript async function retryOperation<T>( fn: () => Promise<T>, options?: { maxRetries?: number; backoff?: 'linear' | 'exponential'; onRetry?: (attempt: number) => void; } ): Promise<T> { // YAGNI } ``` Over-engineered </Bad>

Worked Bug Fix

Bug: Empty email accepted

RED

test('rejects empty email', async () => {
  const result = await submitForm({ email: '' });
  expect(result.error).toBe('Email required');
});

Verify RED

$ npm test
FAIL: expected 'Email required', got undefined

GREEN

function submitForm(data: FormData) {
  if (!data.email?.trim()) {
    return { error: 'Email required' };
  }
  // ...
}

Verify GREEN

$ npm test
PASS

REFACTOR Extract validation for multiple fields if needed.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts6d3 checks · Risk SAFE
  • Gen Agent Trust Hub6d

    The skill facilitates a structured Test-Driven Development (TDD) workflow by providing guidelines for the RED, GREEN, and REFACTOR cycles. It uses standard local commands such as 'npm test' to verify code behavior and lacks any suspicious obfuscation, network exfiltration, or unauthorized dependency patterns.

  • Socket7d

    No alerts

  • Snyk6d

    Risk: LOW · No issues

Signed by skilld at 95d0733. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated 2 weeks ago

README badge

README badge for ganyuanran/aegis/test-driven-development