openspec-generate-specs
Generate OpenSpec main specifications by analyzing the current project's code, documentation, issues, and pull requests.
Unlike openspec-propose (which creates a change with proposal/design/tasks artifacts for future work), this skill writes finished specs directly to openspec/specs/ based on what already exists in the project.
Input: Optionally specify which capabilities or areas to generate specs for. If omitted, analyze the full project and determine capabilities automatically.
Steps
-
Gather project context
Collect information from all available sources. Prioritize breadth over depth — skim first, then deep-dive into relevant areas.
a. Project documentation:
- Read
AGENTS.md(orCONTRIBUTING.md,README.md) for architecture overview, conventions, and design decisions - Read
docs/directory for feature specs, design docs, BDD features (.featurefiles) - Read
openspec/config.yamlfor project context and rules
b. Codebase structure:
- Scan
src/directory tree to understand module organization - Read key files (entry points, type definitions, core modules) to understand capabilities
- Identify the main functional areas / capabilities the system provides
c. GitHub issues and PRs (if available):
- Use GitHub MCP tools to fetch recent open/closed issues for requirements context
- Use GitHub MCP tools to fetch recent merged PRs for implemented features
- Extract requirement-like information (feature requests, bug fixes, design decisions)
d. Existing specs (if any):
- Read
openspec/specs/to understand what's already documented - Identify gaps between existing specs and actual implementation
- Read
-
Identify capabilities
Based on the gathered context, determine the project's main capability areas. Each capability becomes a spec file at
openspec/specs/<capability>/spec.md.Use the AskUserQuestion tool to confirm the identified capabilities before proceeding:
"I've identified these capabilities from the project. Which should I generate specs for?"
Present the list with brief descriptions. Let the user select all or a subset.
Naming convention: Use kebab-case for capability names (e.g.,
memory-system,platform-abstraction,acp-integration). -
Check existing specs
For each selected capability:
- If
openspec/specs/<capability>/spec.mdalready exists, read it - Use AskUserQuestion tool to ask: "Spec for
<capability>already exists. Overwrite, merge, or skip?"- Overwrite: Replace entirely with newly generated spec
- Merge: Add missing requirements/scenarios to existing spec, preserve existing content
- Skip: Leave as-is
- If
-
Generate specs
For each capability, create a spec file following the OpenSpec spec format.
Use the TodoWrite tool to track progress through capabilities.
Spec file structure (
openspec/specs/<capability>/spec.md):# <Capability Name> ## Purpose <Brief description of what this capability does and why it exists.> ## Requirements ### Requirement: <Requirement Name> <The system SHALL/SHOULD/MAY description using RFC 2119 language.> #### Scenario: <Scenario Name> - **GIVEN** <precondition> - **WHEN** <action> - **THEN** <expected outcome> #### Scenario: <Another Scenario> - **GIVEN** <precondition> - **WHEN** <action> - **THEN** <expected outcome>Writing guidelines:
- Use RFC 2119 keywords (SHALL, SHOULD, MAY) for requirement strength
- Derive requirements from actual code behavior, not aspirational features
- Include scenarios that reflect real code paths (check tests for scenario ideas)
- Reference source files in requirement descriptions when helpful (e.g., "Implemented in
src/core/workspace-manager.ts") - Keep requirements atomic — one concern per requirement
- Group related scenarios under their parent requirement
-
Write spec files
For each capability:
mkdir -p openspec/specs/<capability>Write the spec content to
openspec/specs/<capability>/spec.md.After writing each file, verify it exists and show brief progress.
-
Validate output
Run validation if available:
openspec validate --specs --jsonIf validation fails, fix issues and re-validate.
-
Show summary
Display what was generated:
## Specs Generated | Capability | Requirements | Scenarios | Status | |------------|-------------|-----------|--------| | <name> | N | M | New/Merged/Overwritten | Total: X capabilities, Y requirements, Z scenarios Files written to `openspec/specs/`.
Source Priority
When information conflicts across sources, prefer in this order:
- Actual code behavior (ground truth)
- Test assertions (verified behavior)
- BDD feature files / design docs (intended behavior)
- GitHub issues/PRs (discussed behavior)
- README / AGENTS.md (described behavior)
Guardrails
- Always confirm capability list with user before generating
- Never fabricate requirements not supported by code or documentation
- If a capability area is ambiguous, ask for clarification
- Preserve existing spec content when merging (only add, don't remove unless user confirms)
- Each spec file must have at least a Purpose section and one requirement
- Use consistent formatting across all generated spec files
More from jim60105/copilot-prompt
chinese-content-writing-guideline
>-
236docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
140pdf
Use 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 PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.
84rewrite-meeting-audio-transcription
Rewrite raw meeting audio transcriptions into clean, accurate meeting minutes in Traditional Chinese. Use when the user has an unprocessed audio transcription file with recognition errors and needs it cleaned up into proper meeting minutes.
26drawio-diagrams-enhanced
This skill should be used when the user asks to "create a diagram", "draw a flowchart", "make a swimlane diagram", "create WBS", "generate RACI matrix", "build network diagram", "create org chart", or mentions draw.io, diagrams.net, BPMN, UML, Gantt, PERT, or project management diagrams. Integrates with next-ai-draw-io MCP server for real-time diagram creation and editing.
14bump-version
Automate version bumping following semantic versioning and changelog management. Use when the user wants to bump a version, create a release, update the changelog, or tag a new version in a project using semver conventions and Keep a Changelog format.
12