← Financial Cloud Cloud Cloud Club · 构建文章

极点宏观|Financial Cloud Cloud · 构建文章

Kiro:提示词库与深度代码说明附录

系列: Kiro 工作坊

文章: 23

文章
Kiro 工作坊
01 使用 Kiro 构建:他加禄语学习 App 的提示优先产品设计工作坊
02 使用 Kiro 构建:他加禄语 学习 App 的教育优先开发技巧工作坊
03 使用 Kiro 构建:他加禄语 学习 App 的深入开发流程工作坊
04 使用 Kiro 构建:将 他加禄语 学习 App 本地化为中文变体工作坊
05 使用 Kiro 构建:他加禄语 卡片的语法与发音补强流水线工作坊
06 使用 Kiro 构建:他加禄语 学习 App 中可审查的独特额外例句工作坊
07 与 Kiro 同行:晶圆厂工程健康度 Hook 工作坊
08 与 Kiro 同行:蚀刻工艺窗口风险测试自动化工作坊
09 与 Kiro 同行:黄光微影漂移风险开发工作坊
10 工程团队入门 — 日常工厂值班使用 fab spc drift sync portal
11 工程团队附录 — fab spc drift sync portal 的日常工厂值班使用
12 Kiro:规格驱动工厂软件的现场工程工作坊
13 Kiro:实施 Lab — 从零构建具类型的 Factory Risk Portal
14 Kiro:工程开发人员的提示、代码和类型标准手册
15 Kiro:为什么强 React 提示可以防止类型宣告错误启动
17 与 Kiro 一起构建:建立工厂自动化门户 React UI
18 与 Kiro 一同构建:打造工厂自动化门户背后的自动化分析引擎
19 与 Kiro 一起实施:将 AI 工厂自动化辅助程序新增至工厂自动化门户
21 Kiro:2 小时专业开发人员工作坊指南
22 Kiro:从零建置 Fab SPC Drift Synchronization Portal
23 Kiro:提示词库与深度代码说明附录
30 与 Kiro 一起构建:建立工厂自动化门户 UI
31 与 Kiro 一起构建:打造工厂自动化门户背后的自动化分析引擎
32 与 Kiro 一起实施:为工厂自动化门户添加 AI 工厂自动化辅助程序
33 与 Kiro 一起开发:重建 CME Direct 风格的量化损益排行榜 UI
34 与 Kiro 一起开发:重建损益排行榜背后的量化分析引擎
35 与 Kiro 一起构建:适用于量化排行榜的 AWS AI 驱动交易台助理
36 单页交易平台 SOP
AgentCore
A1 使用 AgentCore 与 Strands 构建:Gateway MCP 工具织网开发者工作坊
A2 使用 AgentCore 与 Strands 构建:受治理的多 Agent 风险系统开发者工作坊
A3 使用 AgentCore 与 Strands 构建:运行时主权风险代理人开发者工作坊
模拟考场
E1 用 Vibe Coding 打造多语言 AWS 认证模拟题上线系统
E2 利用 Vibe Coding 开发技巧打造 AWS 认证模拟练习室
E3 打造静态 AWS 模拟考场背后的练习引擎
Amazon Q
Q1 Amazon Q:面向 ACM 证书自动续订的 CloudShell 优先开发人员工作坊
Tagalog 练习室
T1 用提示词优先的产品设计,为 AWS Manila Community Day 构建 Tagalog 学习应用
T2 用教育优先的开发提示,为 AWS Manila Community Day 构建 Tagalog 学习应用
T3 面向 AWS Manila Community Day 的 Tagalog 学习应用深度开发流程
T4 为 AWS Manila Community Day 将 Tagalog 学习应用本地化为中文变体
T5 为 AWS Manila Community Day 的 Tagalog 卡片构建语法与发音增强流水线
T6 在 AWS Manila Community Day 的 Tagalog 学习应用中,让额外示例唯一且可审查
路线图
R1 企业级 Data Analytics Roadmap 一百个深度情境题
R2 前端开发路线图:真实企业场景
香港 Community Day
C1 与 AWS Community Day 共度香港周末:从云端议程到维港灯火
C2 演讲者的奢华周末:讲述你的 AWS 故事,再让香港登场
C3 在香港的七十二小时:AWS Community Day 演讲者的深度行程
马尼拉 Community Day
C4 AWS Community Day Manila:一场连接云技术、城市文化与真挚友谊的快乐周末
C5 AWS Community Day Manila:云端建设者在菲律宾感受最幸福的精神
C6 AWS Community Day Manila:在快乐之城构建、打破、重来,并找到归属
C7 菲律宾马尼拉初次到访建议
菲律宾 × 香港
C8 菲律宾香港资本市场升级
回测
B1 使用 Bedrock AgentCore 和 Strands Agents 构建机构级 Amazon 只做多回测代理
B2 使用 Backtrader、AgentCore 和 Strands Agents 构建具备市场状态感知能力的 Amazon 头寸管理
B3 使用 Nasdaq、S&P 500、Dow、AgentCore 与 Strands 构建相对基准的 Amazon 择时系统
B4 使用 Bedrock AgentCore、Strands Agents 与 Backtrader 构建受治理的 Amazon 交易历史工厂
B5 使用 Bedrock AgentCore 与 Strands Agents 构建代理式 Amazon 回测运营模型 [Part 1]
B6 为 Amazon 择时与头寸管理构建自定义 Cerebro 代码解读 [第 2 部分]
B7 为 Amazon 策略结果与经验教训构建交易员复盘记录 [Part 3]
B8 使用 AgentCore 和 Strands 构建受治理的 FSI Amazon 头寸管理手册 [第 4 部分]
B9 使用 Amazon Bedrock AgentCore 构建主权风险交易代理,分析收益率差、FX 对冲与债务重新定价
B11 构建现代波动率交易与合法泰国恢复规划智能体:内存驱动的 Strands 多智能体风险保护系统
B12 使用 Amazon Bedrock AgentCore Memory 构建做空跨式交易风险治理
B13 在 Amazon EKS 上构建生产环境就绪的信用与收益质押 AI 智能体
挑战
01 周末生产力挑战:Fab SPC 漂移同步门户
02 周末生产力挑战:Quant P&L Commander — AWS 上由 AI 驱动的交易生产力门户
03 周末烦人任务挑战:交易台在云端、链上、空中执行摘要
04 周末 Agent 挑战:早上 6 点交易风险审查
05 周末创意挑战:领导力卡牌游戏
06 全栈挑战:社区日留言板应用程序
领导力卡牌
01 Leadership Card Game: 云没有自动化的最后一项技能:像领导者一样说话
02 领导力回合解剖:Leadership Card Game 究竟如何玩
03 Leadership Card Game: 当机会不再属于组织者
04 周末创意挑战:Leadership Card Game
05 从周末挑战项目到 $1,386 众筹:改变你在职场现身方式的领导力练习
06 从周末挑战项目到 $1,386 众筹:进入科技产业的第一天路径
07 从周末挑战项目到 $1,386 众筹:用转移机会建立专业品牌
08 Leadership Card Game — 众筹活动
09 PR/FAQ 01 — Leadership Card Game 面向社区构建者正式推出
10 PR/FAQ 02 — 企业引导员采用 Leadership Card Game 开展现场领导力演练
10 PR/FAQ 03 — 多语言 Leadership Card Game 为构建者归属开放全球练习室
AWS Builder Center
01 AWS Builder Center、社区精神与 AWS Builder Jacket
02 走进 AWS Builder Center:一座能学习、贡献,也让人有归属感的全球技术平台
03 AWS Community Builder 的巨大成功
04 AWS Builder Center 的巨大成功
05 周末走进 AWS Builder Center:从社区灵感到令人难忘的 AWS Builder Jacket

仅供教育工程用途。本内容是软件架构演练,不属于工艺放行建议。

如何使用本附录

在工作坊期间,请在 Kiro 中使用这些提示。这些提示刻意写得具体,因为专业团队应该提供情境、限制与验收条件,而不是模糊地提出需求。


提示组 1 — 项目启动

提示 1.1 — 建立项目骨架

You are helping me build a professional TypeScript workshop project from scratch. Create the minimal Vite project files for a static browser application. Use no frontend framework. Include scripts for dev, build, test, test:watch, and lint. Do not add business logic yet.

这个提示为何有效

● 它定义角色、技术与范围。

● 它阻止过早实作领域逻辑。

● 它建立日后 hooks 可以呼叫的标准 scripts。

系统设计决策

● 提示缩小了第一个 Kiro 任务。 新项目很容易扩张出不必要的档。只要求骨架的请求提供受控基准,也避免将设定与产品行为混在一起。

● 不使用框架是一项架构限制。 工作坊重点是 Kiro 的 AI 工程工作流程,而不是组件函数库的使用。纯 TypeScript 让产生的决策更可见。

● 标准 scripts 建立稳定合约。 未来的提示、hooks 与文件可以一致参照 npm test、npm run lint 与 npm run build。


提示组 2 — Steering

提示 2.1 — 产生基础 Steering

Generate workspace steering files for this project. Create product.md, tech.md, structure.md, domain.md, and testing.md. The project is a local advisory-only Fab SPC portal. It must model CD-SEM risk but must never command equipment. Use deterministic TypeScript functions and Vitest tests.

提示 2.2 — 改善 Domain Steering

Review .kiro/steering/domain.md. Add missing terms for SPC blind window, TMG, Mandel Slope, Fleet deviation, Residual 3σ, FDC health-link, APC guard, and yield-loss triage. Keep the language concise and enforce advisory-only behavior.

系统设计决策

● Steering 提示应明确说明禁止的行为。 对敏感领域的工程工具而言,只描述要建置什么并不够。开发人员也必须定义不得产生什么。

● 领域词汇属于 workspace 记忆。 Kiro 理解这些术语后,后续的 spec、代码与测试产生会更一致。这能减少重复解释,并避免术语漂移。

● 测试期望应放在 steering 中。 如果及早说明需要决定性函数与 Vitest 覆盖率,Kiro 更可能产生可测试的结构,而不是高度耦合的 UI 代码。


提示组 3 — 建立 Spec

提示 3.1 — 建立 Spec

Create a Kiro spec named fab-spc-portal. The feature is a local browser portal for detecting when routine SPC monitoring frequency is out of sync with actual mass production. Include requirements, system design, data model, risk scoring, UI behavior, accessibility, tests, and implementation tasks.

提示 3.2 — 强化验收条件

Refine the requirements. Add acceptance criteria for: TMG above UCL, Mandel Slope outside 0.98–1.02, Fleet deviation above 2σ and 3σ, Residual 3σ above 0.18 nm, blind window above six hours, empty search results, and advisory-only safety language.

系统设计决策

● 第一个提示建立端到端计划。 Kiro 应将功能理解成一个系统,而不是一堆随机档。需求、设计与任务形成可追溯的交付路径。

● 第二个提示强化边界案例。 初始 AI spec 可能遗漏边界条件。要求特定阈值与空状态,让最终代码更容易验证。

● Spec 成为可审查的证据。 开发人员可以将产生的实作与 spec 比较,并拒绝偏离的代码。对采用 AI 辅助交付的专业团队而言,这尤其重要。


提示组 4 — 领域逻辑

提示 4.1 — 实作纯风险函数

Implement the risk engine as pure TypeScript functions. Inputs are CdSemTool objects. Outputs are RiskAssessment objects with score, level, action, and reasons. Do not read the DOM, localStorage, network, clock, or random values. Keep thresholds centralized.

提示 4.2 — 要求审查风险优先顺序

Review the risk engine priority order. Fleet deviation >3σ and Mandel Slope outside 0.98–1.02 should result in HoldReview. TMG above UCL should result in ApcGuard unless a higher-priority hold condition exists. Residual 3σ above limit should result in RunGoldenWafer unless a higher-priority condition exists.

系统设计决策

● 纯函数降低非决定性。 当计算不依赖外部状态时,Kiro 产生的代码更容易信任。开发人员可以有信心地测试、审查与重构领域层。

● 集中阈值改善可维护性。 散落在 UI 与测试中的阈值会造成未来漂移。单一常数区段让审查与依图层扩充更直接。

● 优先顺序审查防止误导性建议。 一般分数可能掩藏严重条件。明确的优先规则确保安全相关发现优先于较低层级的观察状态。


提示组 5 — UI 实作

提示 5.1 — Render 仪表板

Implement the UI rendering layer. Show summary metrics, tool rows, risk score, blind-window age, TMG, slope, Fleet σ, residual 3σ, action button, and reason details. Add search and sort. Keep rendering separate from risk calculations.

提示 5.2 — 无障碍审查

Review the UI for accessibility. Add semantic headings, button labels, sufficient contrast, keyboard-accessible interactions, useful empty states, and readable status text. Do not change domain logic.

系统设计决策

● UI 使用评估结果,而不是自行计算。 这让视觉程序代码专注在 render、互动与无障碍功能。业务规则留在领域层。

● 搜索与排序会揭示模型品质。 良好的产生 UI 不应只显示卡片,也应支持操作工作流程。依风险、TMG、斜率与 Fleet 偏差排序,能让入口网站真正有用。

● 将无障碍视为实作品质。 开发人员应要求 Kiro 审查语义与互动状态,再手动检查结果。无障碍不能成为事后补救。


提示组 6 — 测试

提示 6.1 — 产生测试

Generate Vitest tests for the risk engine. Cover healthy release, TMG ApcGuard, Mandel Slope HoldReview, Fleet deviation HoldReview, residual RunGoldenWafer, blind-window Watch, reason strings, and priority ordering when multiple thresholds are breached.

提示 6.2 — 询问遗漏案例

Analyze the current risk tests and list missing edge cases. Focus on threshold equality, just-over thresholds, negative inputs, NaN handling, empty series, and action priority conflicts. Do not modify files yet.

系统设计决策

● 阈值边界测试是必要的。 Production bug 常在刚好等于限制值时出现。Kiro 应测试相等与刚超过的案例,让规则解读明确。

● 无效数据处理必须刻意决定。 Demo 可以很简单,但专业开发人员应决定如何处理负值、NaN 或遗漏阵列,而不是让产生的代码意外决定行为。

● 先分析再修改能改善控制。 先要求 Kiro 列出遗漏测试,为开发人员提供一个在接受产生变更前的审查检查点。


提示组 7 — Hooks

提示 7.1 — 建立 Command Hook

Create a Kiro workspace hook that runs npm test after saving files under src/domain or tests. Use PostFileSave, a narrow matcher, command action, 60-second timeout, and enabled true.

提示 7.2 — 建立文件 Hook

Create a Kiro agent hook that updates docs/decision-log.md after a spec task is completed. The hook should summarize changed files, decisions made, and follow-up risks. Keep it workspace-local and do not modify source code.

系统设计决策

● Command hooks 用于决定性检查。 测试与 linting 有明确的成功或失败行为,因此自动化安全且可量测。

● Agent hooks 用于叙事工作。 Decision log 需要摘要与情境。Kiro 的语言能力在这里很有用,但 hook 应限制在文件范围。

● Matcher 保护开发人员生产力。 Hooks 只应在相关档变更时触发。范围过大的自动化会产生杂讯、拖慢开发并降低信任。


完整代码参考 — 领域层

src/domain/types.ts

export type AdvisoryAction =
  | "Release"
  | "Watch"
  | "RunGoldenWafer"
  | "RouteLimit"
  | "ApcGuard"
  | "HoldReview";

export type RiskLevel = "low" | "medium" | "high" | "critical";

export interface CdSemTool {
  id: string;
  layer: string;
  symptom: string;
  blindWindowHours: number;
  tmgNm: number;
  mandelSlope: number;
  fleetDeviationSigma: number;
  residualThreeSigmaNm: number;
  deltaMeanSeries: number[];
}

export interface RiskAssessment {
  toolId: string;
  score: number;
  level: RiskLevel;
  action: AdvisoryAction;
  reasons: string[];
}

说明

商业逻辑: 类型定义入口网站各處使用的领域合约,让风险输入与输出清楚。

代码逻辑: AdvisoryAction 与 RiskLevel 是 union type,因此 TypeScript 会拒绝无效字符串。介面定义必要字段。

预期结果: Kiro 产生的模块共享相同数据合约,若字段漂移,会在类型检查期间快速失败。


完整代码参考 — 风险引擎

src/domain/risk.ts

import type { AdvisoryAction, CdSemTool, RiskAssessment, RiskLevel } from "./types";

const LIMITS = {
  tmgUclNm: 0.2,
  slopeLow: 0.98,
  slopeHigh: 1.02,
  fleetWatchSigma: 2,
  fleetHoldSigma: 3,
  residualUclNm: 0.18,
  blindWindowWatchHours: 6
};

export function assessTool(tool: CdSemTool): RiskAssessment {
  let score = 0;
  const reasons: string[] = [];

  if (tool.tmgNm > LIMITS.tmgUclNm) {
    score += 30;
    reasons.push("TMG exceeds demo UCL");
  }

  if (tool.mandelSlope < LIMITS.slopeLow || tool.mandelSlope > LIMITS.slopeHigh) {
    score += 25;
    reasons.push("Mandel Slope outside safe range");
  }

  if (tool.fleetDeviationSigma > LIMITS.fleetHoldSigma) {
    score += 35;
    reasons.push("Fleet deviation exceeds hold threshold");
  } else if (tool.fleetDeviationSigma > LIMITS.fleetWatchSigma) {
    score += 20;
    reasons.push("Fleet deviation exceeds watch threshold");
  }

  if (tool.residualThreeSigmaNm > LIMITS.residualUclNm) {
    score += 20;
    reasons.push("Residual 3σ exceeds noise threshold");
  }

  if (tool.blindWindowHours > LIMITS.blindWindowWatchHours) {
    score += 15;
    reasons.push("SPC blind window is stale");
  }

  const normalizedScore = Math.min(score, 100);

  return {
    toolId: tool.id,
    score: normalizedScore,
    level: classifyRisk(normalizedScore),
    action: chooseAction(tool, normalizedScore),
    reasons: reasons.length > 0 ? reasons : ["No threshold breach detected"]
  };
}

export function classifyRisk(score: number): RiskLevel {
  if (score >= 85) return "critical";
  if (score >= 65) return "high";
  if (score >= 35) return "medium";
  return "low";
}

export function chooseAction(tool: CdSemTool, score: number): AdvisoryAction {
  if (tool.fleetDeviationSigma > LIMITS.fleetHoldSigma) return "HoldReview";
  if (tool.mandelSlope < LIMITS.slopeLow || tool.mandelSlope > LIMITS.slopeHigh) return "HoldReview";
  if (tool.tmgNm > LIMITS.tmgUclNm) return "ApcGuard";
  if (tool.residualThreeSigmaNm > LIMITS.residualUclNm) return "RunGoldenWafer";
  if (score >= 65) return "RouteLimit";
  if (score >= 35) return "Watch";
  return "Release";
}

说明

商业逻辑: 此函数将 fab 测量指标转换为风险严重程度与建议动作,并凸显哪些指标造成判定。

代码逻辑: 每个阈值都会增加分数与原因。分数上限为 100。动作选择使用优先规则,避免严重条件被降级。

预期结果: 开发人员可以信任入口网站一致分类已知条件,并解释机台为何具有风险。


完整代码参考 — Hook