speckit-baseline
$
npx mdskill add partme-ai/full-stack-skills/speckit-baselineGenerates feature specifications by analyzing source code to extract user stories and requirements for documentation or refactoring.
- Helps document legacy codebases or create specs before refactoring without written requirements.
- Integrates with repo context using .specify/ scripts and templates for standard workflows.
- Decides by parsing target inputs, analyzing code structure, and extracting patterns from file contents.
- Presents results by creating technology-agnostic spec files in feature branches using templates.
SKILL.md
.github/skills/speckit-baselineView on GitHub ↗
---
name: speckit-baseline
description: "Generate a technology-agnostic feature specification by analyzing existing source code, extracting user stories, functional requirements, and acceptance criteria from code patterns. Use when the user needs to document an existing or legacy codebase, create a spec before refactoring, or reverse-engineer requirements from source files."
---
# Spec Kit Baseline Skill
## When to Use
- You need a spec for existing or legacy code.
- You want to document a feature before refactoring.
- You inherited a codebase without written requirements.
## Inputs
- A target path, file list, or glob pattern describing the code to analyze.
- Repo context with `.specify/` scripts and templates.
If the target is missing or ambiguous, ask a focused question before continuing.
## Goal
Generate a technology-agnostic spec for existing code, then create the feature branch/spec file using the standard Spec Kit templates.
## Workflow
1. **Parse target input**: Identify files, directories, or patterns to analyze.
- Accept file paths, glob patterns, or directory paths.
- If empty: stop and ask for a concrete target.
2. **Discover and read source files**:
- Expand globs to a file list.
- Read file contents for analysis.
- Identify primary language(s) and frameworks.
- Map key file relationships and dependencies.
3. **Analyze code structure**:
- Identify entry points and public interfaces.
- Extract function/method signatures and behaviors.
- Find data models and entities.
- Detect API endpoints and routes.
- Identify user-facing functionality.
4. **Generate a short name** (2-4 words) from the analyzed code:
- Use action-noun format (e.g., "user-auth", "payment-processing").
- Base on primary functionality discovered.
- Preserve technical terms where meaningful.
5. **Create the feature branch and spec file**:
- Find the highest existing feature number for this short name (branches/specs).
- Run `.specify/scripts/bash/create-new-feature.sh --json` with the calculated number and short name.
- Read BRANCH_NAME, FEATURE_DIR, and SPEC_FILE paths from the script JSON output.
- For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
6. **Load the spec template** from `.specify/templates/spec-template.md`.
7. **Draft the specification** using the template structure:
- **User Stories**: Infer from user-facing code paths and interactions.
- **Acceptance Scenarios**: Derive from validation logic, error handling, and tests.
- **Functional Requirements**: Extract from business rules and constraints.
- **Key Entities**: Identify from data models and schemas.
- **Success Criteria**: Infer from metrics, logging, or performance-related code.
- **Assumptions**: Document inferences made during analysis.
8. **Abstract implementation details**:
- Convert technical patterns to user-focused requirements.
- Remove framework-specific terminology.
- Focus on WHAT the code does, not HOW it does it.
9. **Create spec quality checklist** at `FEATURE_DIR/checklists/requirements.md`.
10. **Report completion** with:
- Branch name and spec file path.
- Summary of analyzed files.
- Key features discovered.
- Areas needing clarification or review.
## Outputs
- `specs/<feature>/spec.md`
- `specs/<feature>/checklists/requirements.md`
## Key rules
- Focus on extracting WHAT and WHY from HOW.
- Abstract away implementation details in the generated spec.
- Document assumptions made during code analysis.
- Flag areas where code behavior is unclear.
- Preserve discovered business rules and constraints.
- Use `[NEEDS CLARIFICATION]` for ambiguous code sections (max 3).
- Generated specs should be validated by someone who knows the feature.
## Examples
**Code Pattern → Spec Requirement**:
- `if (user.role === 'admin')` → "System MUST restrict action to administrator users"
- `password.length >= 8` → "Passwords MUST be at least 8 characters"
- `cache.set(key, value, 3600)` → "System MUST cache results for improved performance"
- `try { ... } catch (e) { notify(e) }` → "System MUST notify users when errors occur"
**Code Pattern → User Story**:
- Login endpoint with OAuth → "As a user, I can sign in using my social account"
- Shopping cart logic → "As a customer, I can add items to my cart for later purchase"
- Report generation → "As an analyst, I can generate reports on system activity"
## Next Steps
After generating spec.md:
- **Clarify** with domain experts using speckit-clarify.
- **Plan** modernization/refactoring with speckit-plan.
- **Compare** the generated spec with actual requirements to identify gaps.
More from partme-ai/full-stack-skills
- adobe-xd"Guides creation of UI/UX designs, interactive prototypes, reusable components, and design specs in Adobe XD. Use when the user asks about Adobe XD artboards, prototype links, repeat grids, component states, design tokens export, or developer handoff."
- angular"Provides comprehensive guidance for Angular framework including components, modules, services, dependency injection, routing, forms, and TypeScript integration. Use when the user asks about Angular, needs to create Angular applications, implement Angular components, or work with Angular features."
- ansible"Provides comprehensive guidance for Ansible automation including playbooks, roles, inventory, and module usage. Use when the user asks about Ansible, needs to automate IT tasks, create Ansible playbooks, or manage infrastructure with Ansible."
- ant-design-mini"Builds mini-program UIs with Ant Design Mini components for Alipay and WeChat mini-programs. Covers Button, Form, List, Modal, Tabs, NavBar, and 60+ components with theme customization and CSS variable theming. Use when the user needs to create mini-program interfaces with Ant Design Mini, configure themes, or implement mini-program-specific UI patterns."
- ant-design-mobile"Builds React mobile UIs with Ant Design Mobile (antd-mobile) components including Button, Form, List, Modal, Picker, Tabs, PullToRefresh, InfiniteScroll, and 50+ mobile-optimized components. Use when the user needs to create mobile-first React interfaces, implement mobile navigation, forms, or data display with Ant Design Mobile."
- ant-design-react"Builds enterprise React UIs with Ant Design (antd) including 60+ components (Button, Form, Table, Select, Modal, Message), design tokens, TypeScript support, and ConfigProvider theming. Use when the user needs to create React applications with Ant Design, build forms with validation, display data tables, or customize the Ant Design theme."
- ant-design-vueProvides comprehensive guidance for Ant Design Vue (AntDV) component library for Vue 3. Covers installation, usage, API reference, templates, and all component categories. Use when building enterprise-class UI with Vue 3 and Ant Design.
- api-doc-generator"Generate API documentation by scanning Controller classes, extracting endpoint URLs, HTTP methods, parameters, and response structures, then producing standardized docs from templates. Use when the user explicitly mentions generating API documentation, creating API docs, scanning interfaces, or documenting REST APIs. Do not trigger for generic documentation requests without explicit API mention."
- appium"Provides comprehensive guidance for Appium mobile testing including mobile app automation, element location, gestures, and cross-platform testing. Use when the user asks about Appium, needs to test mobile applications, automate mobile apps, or write Appium test scripts."
- ascii-ansi-colorizer"Add an ANSI color layer to existing ASCII/plain-text output (gradient/rainbow/highlights) with alignment-safe rules and a required no-color fallback. Use when the user wants to colorize terminal output, add rainbow effects to CLI text, or style ASCII art with ANSI colors."