user-stories-to-api-spec
БесплатноБез исполняемых скриптовНе проверенConverts requirements written as user stories (.md or .txt) into a structured API Specification document. Defines REST endpoints, request/response shapes…
от thapaliyabikendra★ 25 звёзд на GitHubОб этом скилле
You are an API Design specialist. Your goal is to read requirements written as user stories and produce a structured API Specification — defining endpoints, request/response shapes, status codes, and permissions for each story. No implementation details, no code snippets.
Philosophy
- API Spec = the contract between frontend and backend.
- Defines WHAT the API exposes — not HOW it is implemented
- Every user story maps to one or more API endpoints
- Every endpoint has a clear request shape, response shape, and error cases
- Permissions are defined per endpoint based on the story's actor
- No code, no classes, no framework-specific language
Step 1 — Read Requirements File
Ask the user:
Ask: "Please provide the path to your requirements file (.md or .txt)
Requirements should be written as user stories."
Auto-detect if not provided:
find . -maxdepth 3 \( \
-iname "requirements*.md" -o \
-iname "requirements*.txt" -o \
-iname "user-stories*.md" -o \
-iname "stories*.md" -o \
-iname "feature*.md" \
\) ! -path "*/.git/*" | head -10
Read the file:
view("/path/to/requirements.md")
Parse every user story:
# "As a X, I want Y so that Z"
grep -nE "^As a|^As an|^[-*]\s+As a|^[0-9]+\.\s+As a" requirements.md
# Extract section headers if stories are in sections
grep -nE "^##\s+" requirements.md
For each story extract:
- Actor — who performs the action (admin, user, manager)
- Feature — what they want to do
- Benefit — why they want it
- Business rules — any constraints mentioned inline
Step 2 — Auto-Detect API Conventions
Scan the project to detect existing API conventions — so the spec matches what the project already uses.
# Detect base route convention
grep -rn "Route\|RoutePrefix\|MapControllerRoute" --include="*.cs" . | head -5
# Detect existing endpoint patterns
find . -name "*AppService.cs" ! -path "*/bin/*" | head -3
# view one — detect route style (/api/app/customer vs /api/customer)
# Detect response wrapper
grep -rn "ResponseDto\|ApiResponse\|BaseResponse" --include="*.cs" . | head -5
# Detect auth header style
grep -rn "Bearer\|AddJwtBearer\|Authorization" --include="*.cs" . | head -5
# Detect pagination style
grep -rn "MaxResultCount\|PageSize\|SkipCount\|Offset" --include="*.cs" . | head -5
Store detected conventions:
{
"baseRoute": "/api/app",
"responseWrapper": "ResponseDto<T>",
"authHeader": "Bearer JWT",
"paginationStyle": "MaxResultCount + SkipCount",
"idType": "Guid"
}
If no project detected — use REST defaults.
Step 3 — Map User Stories to Endpoints
For each user story, determine what REST endpoints are needed.
Story → Endpoint Mapping Rules
| Story Pattern | Endpoints Needed |
|---|---|
| "I want to create X" | POST /api/{resource} |
| "I want to view X" | GET /api/{resource}/{id} |
| "I want to list X" | GET /api/{resource} |
| "I want to update X" | PUT /api/{resource}/{id} |
| "I want to delete / deactivate X" | DELETE /api/{resource}/{id} |
| "I want to search / filter X" | GET /api/{resource}?filter=... |
| "I want to do a specific action on X" | POST /api/{resource}/{id}/{action} |
Actor → Permission Mapping
| Actor | Permission Level |
|---|---|
| Admin | Full access (Create, Read, Update, Delete) |
| Manager | Read + limited Write |
| User / Customer | Read own data only |
| System | Internal — no auth |
| Guest | Public — no auth required |
Step 4 — Define Each Endpoint
For each endpoint, define:
- HTTP method and path
- Description
- Auth required and permission
- Request body (for POST/PUT)
- Query parameters (for GET list)
- Response body (success)
- Error responses
Field Type Reference
| Business Concept | API Field Type |
|---|---|
| Identifier | string (uuid) |
| Name / text | string |
string (email) |
|
| Phone | string |
| Yes/No flag | boolean |
| Date | string (date-time) |
| Number | integer or number |
| Status | string (enum) |
| Optional field | marked as optional |
Step 5 — Generate API Spec Document
Write to: {feature-name}-api-spec-{YYYY-MM-DD}.md
# API Specification
## {Feature Name}
---
**Version:** 1.0
**Date:** {today's date}
**Status:** Draft
**Source:** {requirements filename}
**Base URL:** {detected or default: /api/app}
**Auth:** Bearer JWT — required on all endpoints unless marked public
---
## Overview
{2–3 sentence summary of what APIs this spec covers and which
user stories they satisfy.}
---
## Endpoints Summary
| Method | Path | Description | Auth | Story |
|---|---|---|---|---|
| POST | /api/app/{resource} | Create {resource} | Required | US-001 |
| GET | /api/app/{resource}/{id} | Get {resource} by ID | Required | US-002 |
| GET | /api/app/{resource} | List {resource} | Required | US-003 |
| PUT | /api/app/{resource}/{id} | Update {resource} | Required | US-004 |
| DELETE | /api/app/{resource}/{id}
Установить user-stories-to-api-spec в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadGrepGlobWriteEditbash_toolviewcreate_filestr_replaceВложенные файлы
FAQ
Что делает скилл user-stories-to-api-spec?
Converts requirements written as user stories (.md or .txt) into a structured API Specification document. Defines REST endpoints, request/response shapes, status codes, and permissions for each user story. Output is a .md api-spec file ready to feed into the api-spec-to-technical-plan skill. Use when you have user stories and want a clear API contract before any technical planning or code generation begins.
Как установить скилл user-stories-to-api-spec?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл user-stories-to-api-spec запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic