---
name: to-functional-spec
description: "Produce a functional spec — a document that defines what a system does and how it behaves from the user's perspective, with no source code, types, or technology choices. Applies to any kind of system: CLI, API, library, web app, mobile app, embedded device, internal service, etc. Triggers include \"functional spec\", \"behavior spec\", \"product spec\", \"what should X do\"."
title: to-functional-spec
canonical_url: https://skilld.dev/gh/mohasarc/mo-skills/to-functional-spec
last_updated: 2026-09-27T06:22:23.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> If the user asked to install this Skill, run `npx skilld install mohasarc/mo-skills/to-functional-spec`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/to-functional-spec`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/mohasarc/mo-skills/to-functional-spec) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/to-functional-spec`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/to-functional-spec --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/to-functional-spec --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

A functional spec describes **what** the system does and **how it behaves from the user's perspective**. It defines product behavior only — no source code, no types, no interface signatures, no technology choices. Implementation lives elsewhere.

The spec is the source of truth for behavior.

This skill applies to any system regardless of its surface — CLI, HTTP API, library, web app, mobile app, embedded device, internal service. The structure below is universal; section names and examples should be adapted to the system at hand.

## Inputs to confirm before writing

Confirm from the conversation, project files, or one consolidated clarifying question:

1. **What the system is** — what it does, who it's for, what it replaces or competes with, what it explicitly is not.
2. **The primary consumer** — the first-class user. Their default experience.
3. **Invariants** — guarantees the system must always uphold.
4. **Scope** — what's in this version and what's explicitly excluded.
5. **Features** — the discrete user-visible capabilities the spec needs to cover (commands, endpoints, screens, methods, actions — whatever applies).

If any are missing, ask. Do not invent.

## Output location

Write to a numbered subfolder under `plans/`:

- Default: the **highest-numbered** existing subfolder.
- If no `plans/` directory exists, create `plans/000/`.
- Filename: `<project-or-feature>-functional-spec.md`, or `functional-spec.md` if there's no obvious project/feature name.

If it's ambiguous which folder this belongs to, ask.

## Document structure

Sections in this order. Include only those that apply — adapt names to the system. For example, the "Output / Response Format" section might be "Response Schema" for an API, "Visual Grammar" for a UI, "Return Contract" for a library, or omitted entirely if the system has no observable output beyond state changes.

### 1. Goal

One paragraph: what the system does, who it's for, what it replaces or competes with, what it explicitly is not. End with a sentence stating the spec defines product behavior only and avoids implementation choices.

### 2. Primary User

The first-class consumer. State their default experience and what alternative experiences exist behind explicit opt-in.

### 3. Core Guarantees

Invariants the system always upholds. Each guarantee is its own subsection containing:

- A plain statement of the rule.
- A precise, quotable restatement (a "functional rule"), often shown in a `text` code block so it can be lifted verbatim into tests or other documents.
- Examples of correct behavior, including correct **failure** behavior — what the system says or does when it can't satisfy a request.
- Explicit no-override clauses ("There is no stale-data override.") whenever the guarantee can't be relaxed by a flag, parameter, or special call.

### 4. Scope

What's included in this version; what's explicitly excluded. Both lists are flat and complete. The exclusion list is what prevents silent scope creep later.

### 5. Interaction Model

How users address the system. Covers whatever form interaction takes — command-line arguments, HTTP routes, library function calls, UI navigation, voice commands, message payloads. Define:

- The conventions for what the system accepts.
- What is **not** accepted, stated explicitly when a reader might assume otherwise.
- The canonical shape of any identifier or addressable concept, with examples.

### 6. Output / Response Format

The shape of what the system produces in response to interactions. The form depends on the system: text layout for a CLI, response bodies and status codes for an API, visual hierarchy for a UI, return values and side effects for a library. When the format itself is a contract, state it precisely and show examples that reflect what users literally observe.

### 7. Cross-cutting Concerns

Anything that applies across all features rather than to one in particular. Common examples: pagination, error reporting, throttling, idempotency, sort order, determinism, concurrency, accessibility, internationalization. State defaults as bare concrete values.

### 8. Per-feature Sections

One section per discrete user-visible feature (command, endpoint, screen, method, action — whatever applies). For each:

- **Purpose** — a one-line plain-language statement.
- **What it produces / does not produce** — explicit positive **and** negative space.
- **Examples** — concrete, faithful illustrations of what users experience.
- **Defaults** — concrete values for any parameter with a default.
- **Edge cases** — empty results, ambiguity, errors, boundary conditions.

### 9. Summary

At-a-glance recap of all features, one short description each.

## Hard rules

1. **No source code, no types, no interface signatures.** Code blocks are reserved for:
   - Examples of user-side interaction (invocations, requests, gestures, payloads).
   - Examples of system response (output, return values, payloads, screen states).
   - Quotable rules and defaults shown as bare values.
2. **No technology choices.** Don't name the database, framework, library, language, or platform unless the choice is itself a user-visible constraint.
3. **Behavior is described from the user's perspective.** What the user observes and does, not how the system computes it.
4. **Negative space is explicit.** State what the system does *not* do whenever readers might assume otherwise.
5. **Defaults are stated as bare concrete values**, not "reasonable defaults."
6. **No-override clauses are called out.** When a guarantee can't be relaxed, say so.
7. **Examples reflect what users actually observe.** When the form of an interaction or response is a contract, examples must show it precisely.
8. **Excluded scope is named.** Out-of-scope items appear in the scope section, not in implicit gaps.
