From zenbu-powers
C# IT Step Template 生成器。從 Gherkin Feature 解析每個 Given/When/Then 步驟, 分類為 Handler 類型,產出 SpecFlow Step Definition 骨架(含 TODO 標註)。
npx claudepluginhub zenbuapps/zenbu-powers --plugin zenbu-powersThis skill uses the workspace's default tool permissions.
紅燈流程的第二步:將 `.feature` 轉換為 SpecFlow step definition 骨架。每個 step 含 TODO 標註指向對應 handler skill,等 Red Implementation 階段填入實作。
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Guides code writing, review, and refactoring with Karpathy-inspired rules to avoid overcomplication, ensure simplicity, surgical changes, and verifiable success criteria.
Share bugs, ideas, or general feedback.
紅燈流程的第二步:將 .feature 轉換為 SpecFlow step definition 骨架。每個 step 含 TODO 標註指向對應 handler skill,等 Red Implementation 階段填入實作。
Step definition skeleton generator — 從 Gherkin 產生 C# step classes,每個 step 先寫 throw new PendingStepException() 作為佔位。
${FEATURE_SPECS_DIR}/*.feature — Target feature file${CSHARP_STEPS_DIR}/ — 現有 step definitions(禁止覆寫).feature files to ${CSHARP_FEATURES_DIR}/${CSHARP_STEPS_DIR}/**/*.cs 找出已存在的 step pattern,避免重複產生| Gherkin 關鍵字 | 語句特徵 | Handler Type | Skill |
|---|---|---|---|
| Given | 描述實體狀態(「…的…為」「有」「存在」「包含」) | aggregate-given | /zenbu-powers:aibdd.auto.csharp.it.handlers.aggregate-given |
| Given | 過去式動作(「已訂閱」「已建立」「已完成」) | command | /zenbu-powers:aibdd.auto.csharp.it.handlers.command |
| When | 寫入動作(「更新」「提交」「建立」「刪除」「新增」) | command | /zenbu-powers:aibdd.auto.csharp.it.handlers.command |
| When | 讀取動作(「查詢」「取得」「列出」「檢視」) | query | /zenbu-powers:aibdd.auto.csharp.it.handlers.query |
| Then | 驗證 DB 狀態(「應為」「應存在」「不應存在」) | aggregate-then | /zenbu-powers:aibdd.auto.csharp.it.handlers.aggregate-then |
| Then | 驗證查詢結果(「結果應包含」「應顯示」「應回傳」) | readmodel-then | /zenbu-powers:aibdd.auto.csharp.it.handlers.readmodel-then |
| Then | 操作結果(「操作成功」「操作失敗」「HTTP 狀態碼應為 …」) | success-failure | /zenbu-powers:aibdd.auto.csharp.it.handlers.success-failure |
若有疑義,參考 chapter04/.claude/skills/zenbu-powers:aibdd-form-bdd-analysis/references/web-backend/句型分析方針.md(若存在)。
using TechTalk.SpecFlow;
namespace ProjectName.IntegrationTests.Steps.Lesson.AggregateGiven;
/// <summary>
/// TODO: [事件風暴部位: Aggregate - LessonProgress]
/// TODO: 參考 /zenbu-powers:aibdd.auto.csharp.it.handlers.aggregate-given 實作
/// </summary>
[Binding]
public class LessonProgressGivenSteps
{
private readonly ScenarioContext _ctx;
public LessonProgressGivenSteps(ScenarioContext ctx) => _ctx = ctx;
[Given(@"用戶 ""(.*)"" 在課程 (.*) 的進度為 (.*)%,狀態為 ""(.*)""")]
public void GivenUserLessonProgress(string userName, int lessonId, int progress, string status)
{
// TODO: [事件風暴部位: Aggregate - LessonProgress]
// TODO: 參考 /zenbu-powers:aibdd.auto.csharp.it.handlers.aggregate-given 實作
throw new PendingStepException();
}
}
using System.Threading.Tasks;
using TechTalk.SpecFlow;
namespace ProjectName.IntegrationTests.Steps.Lesson.Commands;
[Binding]
public class UpdateVideoProgressSteps
{
private readonly ScenarioContext _ctx;
public UpdateVideoProgressSteps(ScenarioContext ctx) => _ctx = ctx;
[When(@"用戶 ""(.*)"" 更新課程 (.*) 的影片進度為 (.*)%")]
public async Task WhenUpdateProgress(string userName, int lessonId, int progress)
{
// TODO: [事件風暴部位: Command]
// TODO: 參考 /zenbu-powers:aibdd.auto.csharp.it.handlers.command 實作
await Task.CompletedTask;
throw new PendingStepException();
}
}
[Given(@"系統中有以下用戶:")]
public void GivenUsersExist(Table table)
{
// TODO: [事件風暴部位: Aggregate - User]
// TODO: 參考 /zenbu-powers:aibdd.auto.csharp.it.handlers.aggregate-given 實作(DataTable 版本)
throw new PendingStepException();
}
[Given(@"用戶 ""(.*)"" 的個人簡介為:")]
public void GivenUserBio(string userName, string bioText)
{
throw new PendingStepException();
}
| 項目 | 格式 | 範例 |
|---|---|---|
| 檔名 | {Feature}{HandlerType}Steps.cs | LessonProgressGivenSteps.cs |
| 類別名 | {Feature}{HandlerType}Steps | LessonProgressGivenSteps |
| Namespace | {Project}.IntegrationTests.Steps.{Subdomain}.{HandlerType} | ProjectName.IntegrationTests.Steps.Lesson.AggregateGiven |
tests/${ProjectName}.IntegrationTests/Steps/
├── Lesson/ # {Subdomain}
│ ├── AggregateGiven/
│ │ └── LessonProgressGivenSteps.cs
│ ├── Commands/
│ │ └── UpdateVideoProgressSteps.cs
│ ├── Query/
│ │ └── GetLessonProgressSteps.cs
│ ├── AggregateThen/
│ │ └── LessonProgressThenSteps.cs
│ └── ReadModelThen/
│ └── ProgressResultSteps.cs
├── Order/ # 另一個 subdomain
│ └── ...
└── CommonThen/ # 跨 feature 共用
├── SuccessSteps.cs
└── FailureSteps.cs
| Handler Type | Skill | 目錄 |
|---|---|---|
| aggregate-given | /zenbu-powers:aibdd.auto.csharp.it.handlers.aggregate-given | AggregateGiven/ |
| command | /zenbu-powers:aibdd.auto.csharp.it.handlers.command | Commands/ |
| query | /zenbu-powers:aibdd.auto.csharp.it.handlers.query | Query/ |
| aggregate-then | /zenbu-powers:aibdd.auto.csharp.it.handlers.aggregate-then | AggregateThen/ |
| readmodel-then | /zenbu-powers:aibdd.auto.csharp.it.handlers.readmodel-then | ReadModelThen/ |
| success-failure | /zenbu-powers:aibdd.auto.csharp.it.handlers.success-failure | CommonThen/ |
| Gherkin 寫法 | SpecFlow Regex | C# 型別 |
|---|---|---|
"Alice" | ""(.*)"" | string |
5 | (.*) | int |
80 | (.*) | int |
3.14 | (.*) | double / decimal |
| (任意文字) | (.*) | string |
| Gherkin | C# Attribute |
|---|---|
Given 用戶 "Alice" 的進度為 80% | [Given(@"用戶 ""(.*)"" 的進度為 (.*)%")] |
When 查詢課程 1 的進度 | [When(@"查詢課程 (.*) 的進度")] |
Then 操作成功 | [Then(@"操作成功")] |
// DataTable
[Given(@"系統中有以下用戶:")]
public void GivenUsers(Table table) { /* ... */ }
// DocString(多行字串)
[Given(@"用戶 ""(.*)"" 的個人簡介為:")]
public void GivenBio(string userName, string multilineText) { /* ... */ }
PendingStepException — 不用空方法、不用 Assert.FailScenarioContext — 其他依賴在 Red Implementation 才引入async Task — Command 與 Query 建議 async,避免阻塞CommonThen/,避免每個 feature 重複throw new PendingStepException()Steps/{Subdomain}/{HandlerType}/ 慣例dotnet build 無錯誤(PendingStepException 可編譯通過)