cfn-spec
SPARC Specification phase. Generate testable acceptance criteria, enumerate edge cases, define pre/post conditions and invariants BEFORE planning implementation. Use when starting any non-trivial task to lock intent and surface ambiguity early.
Best use case
cfn-spec is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
SPARC Specification phase. Generate testable acceptance criteria, enumerate edge cases, define pre/post conditions and invariants BEFORE planning implementation. Use when starting any non-trivial task to lock intent and surface ambiguity early.
Teams using cfn-spec should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/cfn-spec/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How cfn-spec Compares
| Feature / Agent | cfn-spec | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
SPARC Specification phase. Generate testable acceptance criteria, enumerate edge cases, define pre/post conditions and invariants BEFORE planning implementation. Use when starting any non-trivial task to lock intent and surface ambiguity early.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# CFN Spec Skill (SPARC Phase 1)
**Purpose:** Convert vague task descriptions into testable, unambiguous specifications. Force explicit enumeration of edge cases and acceptance criteria before any code or pseudocode exists.
**Phase:** Specification (SPARC step 1 of 3 used by `/cfn-spa-plan`).
## When to Use
- Any task touching 2+ files, shared state, or external APIs
- Any task where the user's words leave room for interpretation
- Before `/write-plan`, `/cfn-loop-cli`, or plan mode for non-trivial work
- Auto-invoked by `/cfn-spa-plan` orchestrator (preferred entry point)
Skip only for: single-line fixes, rename refactors with no logic change, obvious bug fixes with reproducing test.
## Protocol
### Step 0: Scope Challenge
Before writing the spec, answer:
- Minimum viable interpretation of this task?
- Does similar capability already exist in the codebase? (Run `/codebase-search` first.)
- If scope spans 8+ files, stop. Negotiate scope with user before continuing.
### Step 1: Functional Requirements
Numbered list. Each requirement = one observable behavior. No implementation hints.
Format:
```
FR-1: System SHALL <behavior> WHEN <trigger> GIVEN <preconditions>.
FR-2: ...
```
### Step 2: Non-Functional Requirements
Performance, security, accessibility, observability. Each NFR must include a measurable threshold.
Format:
```
NFR-1: Response p95 latency < 200ms under 100 RPS load.
NFR-2: All endpoints require authenticated session; 401 on missing/invalid token.
```
### Step 3: Acceptance Criteria (Gherkin)
For every FR, write at least one Given/When/Then. These become test cases in `/write-plan`.
```
Scenario: <name>
Given <precondition>
When <action>
Then <observable outcome>
And <secondary outcome>
```
### Step 4: Edge Case Enumeration (MANDATORY, ≥5)
The point of this skill. List every boundary condition. Force at least five entries even for simple tasks — if fewer than 5 surface, you have not thought hard enough.
Categories to walk through:
- **Empty inputs:** null, undefined, empty string, empty array, zero
- **Boundary values:** min, max, off-by-one, integer overflow
- **Concurrency:** race conditions, duplicate submissions, stale reads
- **Failure modes:** network timeout, DB down, partial write, retry semantics
- **Auth/permission:** unauthenticated, unauthorized, expired token, role mismatch
- **Data quality:** malformed input, encoding issues, injection, oversized payload
- **State transitions:** invalid state for operation, already-completed, deleted entity
- **Time:** clock skew, timezone, DST, leap second, future/past dates
- **Locale/i18n:** Unicode, RTL, surrogate pairs, normalization
- **Resource limits:** rate limit hit, quota exceeded, disk full, OOM
For each edge case, state the expected behavior. "Returns 400 with error code INVALID_X" not "handles gracefully".
### Step 5: Pre/Post Conditions and Invariants
For each operation in scope:
```
Operation: <name>
Preconditions: <what must be true to invoke>
Postconditions (success): <what is true after success>
Postconditions (failure): <what is true after failure, including rollback semantics>
Invariants: <what NEVER changes regardless of outcome>
```
### Step 6: Out of Scope
Explicit list of things NOT covered by this spec. Forces the implementer to escalate scope creep instead of silently expanding.
### Step 7: Open Questions
If any spec section depends on a decision the user has not made, list it as an open question with options. Do not assume.
## Output
Write to: `planning/SPEC_<sanitized-task-name>.md`
Template:
```markdown
# Specification: <task>
**Date:** <YYYY-MM-DD>
**Author:** spec phase (cfn-spec)
**Status:** draft | reviewed | locked
## 1. Functional Requirements
FR-1: ...
## 2. Non-Functional Requirements
NFR-1: ...
## 3. Acceptance Criteria
Scenario: ...
## 4. Edge Cases
EC-1: <case> -> <expected behavior>
EC-2: ...
(minimum 5)
## 5. Pre/Post Conditions
Operation: ...
## 6. Out of Scope
- ...
## 7. Open Questions
- Q-1: ...
```
## Handoff
This artifact is the input to `cfn-pseudo`. Do not advance to pseudocode phase until all `[OPEN]` questions are resolved or accepted as parking-lot items.
## Anti-Patterns
- Writing implementation hints in FRs ("uses Redis to cache...")
- "Handles errors gracefully" without specifying behavior
- Fewer than 5 edge cases (signals shallow thinking)
- Acceptance criteria that don't map to a testable observable
- Assuming missing information instead of recording as Open Question
## Related
- Next phase: `cfn-pseudo` (algorithm trace)
- Then: `cfn-arch` (component contracts)
- Orchestrator: `cfn-spa-plan` (auto-chains all three)
- Downstream: `/write-plan` consumes SPEC artifactRelated Skills
Specialist Injection Skill
## Purpose
Retrospective Report Generator Skill
## Purpose
supabase-schema-sync
Introspects Supabase DB after migrations and updates project db-query skill with current schema. Run after any migration to keep agent context accurate.
commit
Stage, commit, and push changes using a background github-commit-agent. Accepts optional args for message override or push control.
cfn-vote-implement
MUST BE USED after cfn-dry-review or cfn-alpha-launch:manifest produces a manifest. Also the verification phase of /cfn-loop-task. Do not manually implement code review suggestions - always route through this skill. 3-agent specialized voting. Unanimous (3/3) auto-implemented with TDD. 2/3 routed to product-owner agent. 1/3 surfaced to user via AskUserQuestion (batched 4 per call, at end).
cfn-utilities
Reusable bash utility functions for CFN Loop - logging, error handling, retry, file operations. Use when you need structured logging, atomic file operations, retry logic with exponential backoff, or standardized error handling in bash scripts.
CFN Test Runner Skill
**Version:** 1.0.0
cfn-test-framework
Test execution, running, and webapp testing for CFN
cfn-task-planning
Classify tasks, initialize structured configs with scope boundaries, decompose complex tasks
!/bin/bash
# cfn-task-intelligence.sh
Task Complexity Estimator
**Version:** 1.0.0
task-classifier
Analyzes task descriptions and classifies them into categories for agent selection