- Home
- Skills
- Rshankras
- Claude Code Apple Skills
- Tdd Feature
tdd-feature_skill
- Swift
56
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
3 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill rshankras/claude-code-apple-skills --skill tdd-feature- SKILL.md9.3 KB
Overview
This skill provides a red‑green‑refactor scaffold for building new Swift features using Test-Driven Development. It guides you to write failing tests first, then generate the minimal implementation to pass them, and finally refactor safely. The workflow is designed to keep scope small and make AI-generated code verifiable by tests.
How this skill works
The skill helps you define the feature, design a public API surface, and write a focused suite of failing tests that express acceptance criteria. Use the failing tests as the prompt for the AI to implement the simplest code to pass each test one at a time. After all tests are green, the skill guides incremental refactoring and integration testing to ensure behavior remains correct.
When to use it
- When you want tests before code for a new Swift module or feature
- When adopting a red‑green‑refactor cadence with AI assistance
- When you need provable behavior via unit tests before shipping
- When building APIs, view models, repositories, or business logic from scratch
- When you want to minimize bugs by making tests the spec
Best practices
- Start by clearly defining inputs, outputs, edge cases and dependencies before writing tests
- Design the public API surface (protocols, method signatures) first and test against it
- Write one failing test at a time, make the smallest change to pass it, then repeat
- Keep tests behavior‑focused, not implementation‑specific, to allow safe refactor
- Run your test suite after every change and keep green cycles short (1–5 minutes)
Example use cases
- Implement a FavoriteManager: write tests for add/remove/isFavorite, then implement to satisfy them
- TDD a SearchViewModel: tests for loading, results, empty and error states, then implement debouncing and cancellation
- Build an ItemRepository: tests for remote fetch, caching, offline behavior and conflict resolution, then implement storage logic
- Create SubscriptionManager logic: tests for free/pro/expired paths and billing edge cases, then implement rules and state transitions
FAQ
No. Start with the API surface and the test suite; tests can fail because types do not exist yet. Use the tests as the contract for the implementation.
How many tests should I write before implementing?
Prefer 1–3 focused tests per green cycle. If GREEN takes longer than a few minutes, break the test into smaller steps.