Implementation workflow for SpecFlux projects. Enforces test-first development, one commit per task, and API status updates. This skill is always active when writing code in SpecFlux projects.
When implementing code in a SpecFlux project, you MUST follow this workflow exactly. No exceptions.
BEFORE writing any code, you MUST complete these checks. If any fail, STOP and inform the user.
# Check environment variables are set
echo $SPECFLUX_API_URL # Must not be empty
echo $SPECFLUX_API_KEY # Must not be empty, should start with "sfx_"
# Test API connectivity with authentication
curl -s -w "%{http_code}" -o /dev/null \
-H "Authorization: Bearer $SPECFLUX_API_KEY" \
"$SPECFLUX_API_URL/api/projects"
If SPECFLUX_API_URL or SPECFLUX_API_KEY is not set, or API is unreachable:
# Fetch task details
GET /api/projects/{projectRef}/tasks/{taskRef}
If task not found or API returns error:
PATCH /api/projects/{projectRef}/tasks/{taskRef}
{"status": "IN_PROGRESS"}
If status update fails:
You MUST follow these steps IN ORDER. Skipping steps is NOT allowed.
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā MANDATORY WORKFLOW ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā BEFORE CODING (all steps required): ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā” 1. Verify API access (STOP if fails) ā ā
ā ā ā” 2. Fetch task details from API ā ā
ā ā ā” 3. Mark task IN_PROGRESS via API ā ā
ā ā ā” 4. Read acceptance criteria from API ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā
ā DURING CODING: ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā” 5. Write tests for each acceptance criterion ā ā
ā ā ā” 6. Implement until ALL tests pass ā ā
ā ā ā” 7. Run full test suite ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā
ā AFTER CODING (all steps required): ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā” 8. Mark each acceptance criterion as met via API ā ā
ā ā ā” 9. Commit with task reference: "TASK-REF: description" ā ā
ā ā ā” 10. Mark task COMPLETED via API ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā
ā AFTER ALL TASKS IN EPIC: ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā ā” 11. Mark epic COMPLETED via API ā ā
ā ā ā” 12. Create PR with epic reference ā ā
ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
# 1. Check environment variables are set
echo $SPECFLUX_API_URL # Must not be empty
echo $SPECFLUX_API_KEY # Must not be empty, should start with "sfx_"
# 2. Fetch task
curl -s -H "Authorization: Bearer $SPECFLUX_API_KEY" \
"$SPECFLUX_API_URL/api/projects/{projectRef}/tasks/{taskRef}"
# 3. Mark IN_PROGRESS
curl -s -X PATCH -H "Authorization: Bearer $SPECFLUX_API_KEY" \
-H "Content-Type: application/json" \
"$SPECFLUX_API_URL/api/projects/{projectRef}/tasks/{taskRef}" \
-d '{"status": "IN_PROGRESS"}'
curl -s -H "Authorization: Bearer $SPECFLUX_API_KEY" \
"$SPECFLUX_API_URL/api/projects/{projectRef}/tasks/{taskRef}/acceptance-criteria"
Every acceptance criterion MUST have at least one corresponding test that verifies it.
Criterion: "Users can log in with email/password"
ā Test: testLoginWithValidCredentialsReturnsToken()
ā Test: testLoginWithInvalidPasswordReturns401()
Criterion: "API returns paginated results"
ā Test: testGetUsersReturnsPaginatedResponse()
ā Test: testPaginationCursorNavigatesCorrectly()
Rules:
Beyond acceptance criteria, add tests for:
| Component Type | What to Test |
|---|---|
| Core business logic | All code paths, transformations, calculations |
| Security-sensitive code | Auth, permissions, input validation |
| Data transformations | Serialization, parsing, conversions |
| Integration points | API calls, database operations, external services |
| Error paths | Exception handling, error messages, fallback behavior |
| Edge cases | Null handling, empty states, boundary conditions |
Guideline: More tests for risky/complex code. Use judgment - three lines of trivial code don't need three tests.
Criteria tagged with [manual] are skipped during automated verification:
Acceptance Criteria:
- User can log in with email/password ā test required, auto-verified
- Login form shows validation errors ā test required, auto-verified
- [manual] UI matches design mockup ā skipped, flagged for review
- [manual] Copy is reviewed by legal ā skipped, flagged for review
Handling [manual] criteria:
Example completion summary:
ā
Task SPEC-42 Complete
Automated Criteria (verified):
- [ā] Users can log in with email/password
- [ā] Login form shows validation errors
Manual Review Required:
- [ ] UI matches design mockup
- [ ] Copy is reviewed by legal
For EACH acceptance criterion:
curl -s -X PUT -H "Authorization: Bearer $SPECFLUX_API_KEY" \
-H "Content-Type: application/json" \
"$SPECFLUX_API_URL/api/projects/{projectRef}/tasks/{taskRef}/acceptance-criteria/{id}" \
-d '{"isMet": true}'
git add .
git commit -m "TASK-REF: brief description
Co-Authored-By: Claude <noreply@anthropic.com>"
curl -s -X PATCH -H "Authorization: Bearer $SPECFLUX_API_KEY" \
-H "Content-Type: application/json" \
"$SPECFLUX_API_URL/api/projects/{projectRef}/tasks/{taskRef}" \
-d '{"status": "COMPLETED"}'
If this fails, you MUST retry or inform the user. Do NOT leave tasks in IN_PROGRESS state.
After ALL tasks in an epic are done:
# Mark epic completed
curl -s -X PATCH -H "Authorization: Bearer $SPECFLUX_API_KEY" \
-H "Content-Type: application/json" \
"$SPECFLUX_API_URL/api/projects/{projectRef}/epics/{epicRef}" \
-d '{"status": "COMPLETED"}'
# Create PR
gh pr create --title "EPIC-REF: Epic title" --body "..."
You MUST NOT:
STOP. Inform user:
"SpecFlux API is not accessible. Please ensure:
1. SPECFLUX_API_URL environment variable is set
2. SPECFLUX_API_KEY environment variable is set (should start with 'sfx_')
3. API server is running
4. Network connectivity is available"
RETRY once. If still fails:
"Failed to update task/epic status via API. Please manually update:
- Task {taskRef} ā {status}
- Epic {epicRef} ā {status} (if applicable)"
Do NOT commit. Do NOT mark task complete.
Continue debugging until ALL tests pass.
# Task operations
GET /api/projects/{projectRef}/tasks/{taskRef}
PATCH /api/projects/{projectRef}/tasks/{taskRef} {"status": "IN_PROGRESS|COMPLETED|BLOCKED"}
# Acceptance criteria
GET /api/projects/{projectRef}/tasks/{taskRef}/acceptance-criteria
PUT /api/projects/{projectRef}/tasks/{taskRef}/acceptance-criteria/{id} {"isMet": true}
# Epic operations
GET /api/projects/{projectRef}/epics/{epicRef}
PATCH /api/projects/{projectRef}/epics/{epicRef} {"status": "IN_PROGRESS|COMPLETED"}
Before saying "task complete", verify: