一键导入
decompose-requirements
Decompose large requirements into phased task files that fit AI context windows using Gherkin + State Machine approach.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Decompose large requirements into phased task files that fit AI context windows using Gherkin + State Machine approach.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | decompose-requirements |
| description | Decompose large requirements into phased task files that fit AI context windows using Gherkin + State Machine approach. |
Decompose requirements into phased task files using Gherkin + State Machine approach.
| Tool | Purpose |
|---|---|
| State Machine | See ALL possible states (catches what you forgot) |
| Gherkin | Describe behavior for each state/transition |
They complement each other:
Scan for vague terms before proceeding:
| Vague | Fix |
|---|---|
| fast, slow | Define in ms |
| secure | Specify standard |
| easy, simple | Define criteria |
| some, many | Exact number |
| etc | List all |
| handle, process | Specific action |
| automatically | Define logic |
If found: Ask user to clarify.
Draw state machine FIRST, before writing scenarios.
stateDiagram-v2
[*] --> Initial
Initial --> Active: trigger [guard] / action
Active --> Error: fail
Error --> Active: retry
Active --> [*]: complete
[ ] Every state reachable?
[ ] Every non-final state has exit?
[ ] Error states exist?
[ ] Timeout states if needed?
| Feature | Often Forgotten |
|---|---|
| Auth | locked, suspended, pending |
| Payment | pending, failed, refunded |
| Order | cancelled, partial, on_hold |
| Content | draft, scheduled, archived |
Write scenario for EVERY state machine transition.
Feature: [Name]
As a [actor]
I want [goal]
So that [benefit]
Definitions:
- Term: explanation
@must
Scenario: Happy path
Given [precondition]
When [action]
Then [result]
@must
Scenario: Error case
Given [precondition]
When [action]
Then [error]
@should
Scenario: Important secondary
...
@could
Scenario: Nice to have
...
| Tag | Meaning |
|---|---|
@must | Cannot launch without |
@should | Important, expected |
@could | Nice to have |
@wont | Explicitly excluded |
[ ] Happy path
[ ] Empty/missing input
[ ] Invalid format
[ ] Unauthorized
[ ] Not found
[ ] Conflict
[ ] Each error state
[ ] Each state transition
| Transition | Scenario |
|---|---|
A --> B: trigger | "Successful [trigger]" |
A --> Error: fail | "[trigger] fails when..." |
Map Gherkin scenarios to E2E test specifications. Output: docs/tasks/<feature>/e2e-scenarios.md
| Gherkin Tag | E2E Requirement |
|---|---|
@must | Full locale coverage (en + th) |
@should | At least one locale |
@could | Listed as optional (skipped) |
@wont | Excluded |
# E2E Test Scenarios
Source: `docs/tasks/<feature>/00-specifications.md`
## Feature: [Feature Name]
### Scenario: [Gherkin Scenario Title]
- **Priority:** @must
- **Route:** /[locale]/[path]
- **Preconditions:** [Setup needed]
- **Steps:**
1. Navigate to [route]
2. Click `[data-testid="module-component-element"]`
3. Fill `[data-testid="module-form-field"]` with "value"
- **Assertions:**
- [ ] [Expected outcome using data-testid selectors]
- **Locale coverage:** en, th
data-testid selectors or accessible rolesdata-testid values following the convention: <module>-<component>-<element>@must first → early phases@should next → middle phases@could last → final phasesdocs/tasks/<feature>/
├── 00-specifications.md # State machines + Gherkin
├── 01-overview.md # Summary, phases
├── phase-01-foundation.md # Entities, setup
├── phase-02-[sub-feature].md # @must scenarios
└── ...
1. Pattern match → catch vague terms
2. State machine → ALL states and transitions
3. Gherkin → scenario for EACH transition
4. E2E mapping → map scenarios to E2E test specs
5. Decompose → @must first, vertical slices
Input: "User authentication"
State Machine:
Anonymous → Pending (register)
Pending → Active (verify)
Anonymous → Active (login)
Active → Locked (5 failures)
Locked → Active (timeout)
Active → Anonymous (logout)
Gherkin:
@must Scenario: Successful registration
@must Scenario: Successful login
@must Scenario: Login fails with wrong password
@should Scenario: Account locks after 5 failures
@should Scenario: Account unlocks after timeout
Output:
phase-01-foundation.md # User, Session entities
phase-02-registration.md # Register + verify
phase-03-login.md # Login + logout
phase-04-security.md # Lock/unlock
This skill should be used when implementing code, creating files, or writing new features. Provides complete file structure, naming patterns, and import rules.
This skill should be used when working with database, Drizzle ORM, entities, schemas, migrations, and seeds. It provides Rails-style DB conventions, local sqlite/libSQL file defaults, and Effect-friendly data patterns.
Use this skill when generating enterprise admin, back-office, or operations module UI. Activates on: new module screen, admin panel, dashboard, operations list, approval queue, entity detail, multi-step form wizard, RBAC console, audit log, analytics cockpit, support console, settings page, or any layout described as "enterprise", "compact", or "admin-heavy". Provides recipe selection, page anatomy contract, density mode, state checklist, and AI prompt template.
This skill should be used when performing browser testing, verifying in browser, or runtime checks. Guides browser verification patterns.
This skill should be used when working with Chakra UI, UI components, or the design system. Guides Chakra UI v3 and Ark UI patterns.
This skill should be used when working with i18n, translation, locale, or internationalization. Guides next-intl setup, locale routing, and message management.