skills/implement/SKILL.md
Write code to pass all tests (TDD green phase). Expect 100% test pass rate. Use after tests are written to implement the actual functionality.
npx skillsauth add sofer/.agents implementInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Write the implementation code to make all tests pass. This is the "green" phase of TDD.
Implementation transforms stubs into working code:
Expect from orchestrator:
Understand what each test expects:
# Run tests to see current failures
npm test -- --verbose
Group tests by component and prioritise:
For each component, implement one method at a time:
Transform stubs into real implementations:
Before (stub):
async save(user: User): Promise<User> {
throw new Error('Not implemented: UserRepository.save');
}
After (implementation):
async save(user: User): Promise<User> {
const result = await this.db.collection('users').insertOne(user);
return { ...user, id: result.insertedId.toString() };
}
Implement according to the design document:
Implement error handling as specified in design:
async createUser(input: CreateUserInput): Promise<User> {
// Check for duplicate
const existing = await this.userRepository.findByEmail(input.email);
if (existing) {
throw new DuplicateEmailError(input.email);
}
// Create user
const user: User = {
id: generateId(),
email: input.email.toLowerCase(),
name: input.name,
createdAt: new Date(),
};
// Persist
const saved = await this.userRepository.save(user);
// Publish event
await this.eventPublisher.publish(new UserCreatedEvent(saved));
return saved;
}
After each change, run tests:
# Watch mode
npm test -- --watch
# Or run manually
npm test
Track progress: 0/12 → 3/12 → 7/12 → 12/12
Continue until all tests pass:
PASS tests/services/user.service.test.ts
UserService
createUser
✓ should return user with generated id (5ms)
✓ should persist user to repository (2ms)
✓ should throw DuplicateEmailError when email exists (3ms)
✓ should normalise email to lowercase (2ms)
...
Test Suites: 1 passed, 1 total
Tests: 12 passed, 12 total
If the feature requires schema changes to make tests pass:
Migrations are implementation detail — they exist to make tests pass. They are NOT a separate phase.
If migration fails:
Tests should cover edge cases; implementation should handle them:
// Normalise email
const normalisedEmail = input.email.toLowerCase().trim();
// Validate length
if (normalisedEmail.length > MAX_EMAIL_LENGTH) {
throw new ValidationError('Email too long');
}
implement:
story_id: "US-001"
files_modified:
- path: "src/repositories/user.repository.ts"
changes: "Full implementation of IUserRepository"
methods_implemented: ["save", "findById", "findByEmail"]
- path: "src/services/user.service.ts"
changes: "Full implementation of UserService"
methods_implemented: ["createUser", "findById"]
- path: "src/controllers/user.controller.ts"
changes: "Full implementation of UserController"
methods_implemented: ["createUser", "getUser"]
files_created:
- path: "src/errors/duplicate-email.error.ts"
reason: "Custom error type for duplicate email"
run_result:
command: "npm test"
total: 12
passed: 12
failed: 0
status: "green" # Required
migrations:
created: true # or false if no schema changes needed
files:
- path: "migrations/20240115_add_users_table.sql"
direction: "up"
- path: "migrations/20240115_add_users_table_down.sql"
direction: "down"
dev_db_verified: true
notes: ""
Update manifest:
stories:
US-001:
phase: "implement"
artifacts:
implementation: "src/services/user.service.ts"
Must pass before proceeding to refactor phase:
tools
Check whether Claude and Codex have equivalent access to shared agent resources, skills, hooks, plugins, MCP servers, permissions, startup behaviour, and provider-specific adapter config. Use when comparing agent environments, debugging missing capabilities after restart, or deciding whether to symlink a resource or configure a runtime.
testing
Record substantive skill use in an append-only local log. Use after choosing or invoking a non-system skill for real work, when a skill is inspected but not used, or when a skill fails to apply. Do not use for routine system skills or incidental file reads.
testing
Turn a vague or underspecified request into a self-contained problem statement. Use when the user has a rough idea, when a request would fail if handed directly to an agent, or before non-trivial work that needs shared understanding.
data-ai
Append a one-line learning to ~/.agents/learning-log.md. Use when the user types /learning, or when something genuinely worth remembering surfaced during work and the user confirms it should be captured.