skills/spec/SKILL.md
Define contracts, schemas, and behaviours for a single user story. Use after a story is selected from the backlog to create a detailed specification before design. Produces testable specifications.
npx skillsauth add sofer/.agents specInstall 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.
Define the contracts, schemas, and behaviours for a single user story before design begins.
Expect from orchestrator:
Review the user story and acceptance criteria:
Identify all interfaces this story requires:
API contracts (if applicable):
contracts:
- name: "CreateUser"
type: "api"
method: "POST"
path: "/users"
request:
body:
email: "string (required)"
name: "string (required)"
response:
success:
status: 201
body:
id: "string"
email: "string"
name: "string"
created_at: "datetime"
errors:
- status: 400
condition: "Invalid email format"
- status: 409
condition: "Email already exists"
Event contracts (if applicable):
- name: "UserCreated"
type: "event"
payload:
user_id: "string"
email: "string"
timestamp: "datetime"
producer: "UserService"
consumers: ["NotificationService", "AnalyticsService"]
Internal contracts (service boundaries):
- name: "UserRepository"
type: "internal"
methods:
- name: "save"
input: "User"
output: "User"
errors: ["DuplicateEmail", "ValidationError"]
- name: "findByEmail"
input: "string"
output: "User | null"
Specify all data structures:
data_schemas:
- name: "User"
fields:
- name: "id"
type: "string (UUID)"
required: true
generated: true
- name: "email"
type: "string"
required: true
validation: "RFC 5322 email format"
unique: true
- name: "name"
type: "string"
required: true
validation: "1-100 characters"
- name: "created_at"
type: "datetime (UTC)"
required: true
generated: true
invariants:
- "email must be lowercase"
- "id is immutable after creation"
Transform acceptance criteria into detailed behaviour specifications:
behaviours:
- scenario: "Successful user creation"
given:
- "No user exists with email '[email protected]'"
when:
- "POST /users with valid email and name"
then:
- "Returns 201 with user object"
- "User is persisted to database"
- "UserCreated event is published"
- "Response includes generated id and created_at"
- scenario: "Duplicate email rejection"
given:
- "User exists with email '[email protected]'"
when:
- "POST /users with email '[email protected]'"
then:
- "Returns 409 Conflict"
- "No new user is created"
- "No event is published"
- "Error message indicates email is taken"
Document edge cases and expected handling:
edge_cases:
- case: "Email with uppercase letters"
input: "[email protected]"
expected: "Normalise to lowercase before validation and storage"
- case: "Very long name at boundary"
input: "100 character name..."
expected: "Accept and store successfully"
- case: "Name exceeds maximum"
input: "101 character name..."
expected: "Reject with 400 and validation error"
- case: "Concurrent creation with same email"
scenario: "Two requests arrive simultaneously"
expected: "One succeeds, one fails with 409 (database constraint)"
assumptions:
- "Email verification is handled by a separate story"
- "Password/authentication is out of scope for this story"
open_questions:
- question: "Should we support bulk user creation?"
recommendation: "Defer to separate story if needed"
- question: "What is the retention policy for user data?"
recommendation: "Clarify with stakeholder"
Save specification to .sdlc/stories/{story-id}/spec.md:
# Specification: US-001 - User Registration
## Story
As a new user, I want to create an account so that I can access the system.
## Contracts
[contracts as defined above]
## Data schemas
[schemas as defined above]
## Behaviours
[behaviours as defined above]
## Edge cases
[edge cases as defined above]
## Assumptions
[assumptions]
## Open questions
[questions requiring resolution]
Also update manifest:
stories:
US-001:
artifacts:
spec: ".sdlc/stories/US-001/spec.md"
Before completing:
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.