@vesviet/agent-skills 0.0.0-stage → 5.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (808) hide show
  1. package/INDEX.md +973 -0
  2. package/LICENSE +201 -0
  3. package/README.md +137 -2
  4. package/VERSION +1 -0
  5. package/adapters/antigravity/ANTIGRAVITY.md +136 -0
  6. package/adapters/antigravity/a2a-config.template.yaml +82 -0
  7. package/adapters/antigravity/capability-role-map.generated.yaml +41 -0
  8. package/adapters/antigravity/role-skill-index.json +4812 -0
  9. package/adapters/antigravity/rules.template.md +39 -0
  10. package/adapters/claude/CLAUDE_ADAPTER.md +271 -0
  11. package/adapters/claude/commands/check-policy.md +15 -0
  12. package/adapters/claude/commands/coordinate.md +17 -0
  13. package/adapters/claude/commands/review.md +17 -0
  14. package/adapters/claude/settings.template.json +36 -0
  15. package/adapters/cursor/README.md +186 -0
  16. package/adapters/cursor/hooks.template.json +71 -0
  17. package/bin/agent-skills.mjs +241 -0
  18. package/core/README.md +53 -0
  19. package/core/contracts/README.md +158 -0
  20. package/core/contracts/schemas/INDEX.md +227 -0
  21. package/core/contracts/schemas/a2a-artifact.json +171 -0
  22. package/core/contracts/schemas/a2a-jsonrpc-envelope.json +74 -0
  23. package/core/contracts/schemas/a2a-message.json +107 -0
  24. package/core/contracts/schemas/a2a-push-notification-config.json +57 -0
  25. package/core/contracts/schemas/a2a-task-cancel.json +36 -0
  26. package/core/contracts/schemas/a2a-task-progress.json +80 -0
  27. package/core/contracts/schemas/a2a-task-status.json +181 -0
  28. package/core/contracts/schemas/a2a-task.json +219 -0
  29. package/core/contracts/schemas/accounting-compliance-review.json +379 -0
  30. package/core/contracts/schemas/adr-spec.json +225 -0
  31. package/core/contracts/schemas/agent-card.json +382 -0
  32. package/core/contracts/schemas/agent-eval-report.json +490 -0
  33. package/core/contracts/schemas/agent-trace-span.json +146 -0
  34. package/core/contracts/schemas/ai-risk-register.json +198 -0
  35. package/core/contracts/schemas/amis-voucher-contract.json +541 -0
  36. package/core/contracts/schemas/api-contract-spec.json +191 -0
  37. package/core/contracts/schemas/architecture-options.json +128 -0
  38. package/core/contracts/schemas/assumptions-ledger.json +130 -0
  39. package/core/contracts/schemas/aws-infra-spec.json +248 -0
  40. package/core/contracts/schemas/code-review-finding.json +295 -0
  41. package/core/contracts/schemas/compact-working-state.json +282 -0
  42. package/core/contracts/schemas/content-audit-report.json +270 -0
  43. package/core/contracts/schemas/content-handoff.json +534 -0
  44. package/core/contracts/schemas/coordination-plan.json +530 -0
  45. package/core/contracts/schemas/data-analysis-report.json +492 -0
  46. package/core/contracts/schemas/data-pipeline-spec.json +420 -0
  47. package/core/contracts/schemas/deployment-plan.json +600 -0
  48. package/core/contracts/schemas/design-tokens-spec.json +539 -0
  49. package/core/contracts/schemas/document-manifest.json +155 -0
  50. package/core/contracts/schemas/documentation-handoff.json +137 -0
  51. package/core/contracts/schemas/edge-deployment-spec.json +375 -0
  52. package/core/contracts/schemas/feature-ticket.json +1293 -0
  53. package/core/contracts/schemas/implementation-result.json +165 -0
  54. package/core/contracts/schemas/incident-report.json +466 -0
  55. package/core/contracts/schemas/learning-assessment-report.json +285 -0
  56. package/core/contracts/schemas/learning-handoff.json +244 -0
  57. package/core/contracts/schemas/legal-compliance-review.json +287 -0
  58. package/core/contracts/schemas/legal-opinion-contract.json +248 -0
  59. package/core/contracts/schemas/memory-audit-report.json +283 -0
  60. package/core/contracts/schemas/mmo-campaign-spec.json +414 -0
  61. package/core/contracts/schemas/mmo-roi-report.json +312 -0
  62. package/core/contracts/schemas/performance-audit.json +239 -0
  63. package/core/contracts/schemas/period-end-closing-report.json +472 -0
  64. package/core/contracts/schemas/pull-request-spec.json +338 -0
  65. package/core/contracts/schemas/references/detailed/01-solution-and-governance.md +19 -0
  66. package/core/contracts/schemas/references/detailed/02-engineering-delivery.md +93 -0
  67. package/core/contracts/schemas/references/detailed/03-quality-and-review.md +67 -0
  68. package/core/contracts/schemas/references/detailed/04-finance-accounting-and-compliance.md +54 -0
  69. package/core/contracts/schemas/references/detailed/05-design-and-content.md +92 -0
  70. package/core/contracts/schemas/references/detailed/06-seo-and-publishing.md +48 -0
  71. package/core/contracts/schemas/references/detailed/07-a2a-protocol.md +85 -0
  72. package/core/contracts/schemas/references/detailed/08-agent-infrastructure.md +31 -0
  73. package/core/contracts/schemas/research-report.json +823 -0
  74. package/core/contracts/schemas/schema-migration.json +86 -0
  75. package/core/contracts/schemas/security-audit.json +131 -0
  76. package/core/contracts/schemas/seo-audit-report.json +1057 -0
  77. package/core/contracts/schemas/seo-content-brief.json +852 -0
  78. package/core/contracts/schemas/seo-metadata.json +292 -0
  79. package/core/contracts/schemas/seo-weekly-board.json +840 -0
  80. package/core/contracts/schemas/series-article.json +155 -0
  81. package/core/contracts/schemas/solution-brief.json +244 -0
  82. package/core/contracts/schemas/stock-audit-session.json +522 -0
  83. package/core/contracts/schemas/system-design-spec.json +434 -0
  84. package/core/contracts/schemas/technical-delivery-plan.json +453 -0
  85. package/core/contracts/schemas/test-report.json +530 -0
  86. package/core/contracts/schemas/ui-component-spec.json +314 -0
  87. package/core/contracts/schemas/ux-flow-spec.json +306 -0
  88. package/core/contracts/schemas/validation-result.json +109 -0
  89. package/core/policies/README.md +110 -0
  90. package/core/policies/action-boundaries.yaml +1492 -0
  91. package/core/policies/data-classification.yaml +126 -0
  92. package/core/policies/execution-sandbox.md +362 -0
  93. package/core/policies/mcp-tool-map.yaml +302 -0
  94. package/core/roles/3d-graphics-engineer.md +303 -0
  95. package/core/roles/README.md +314 -0
  96. package/core/roles/agent-coordinator.md +453 -0
  97. package/core/roles/agent-discovery-engineer.md +243 -0
  98. package/core/roles/ai-systems-engineer.md +365 -0
  99. package/core/roles/aws-engineer.md +339 -0
  100. package/core/roles/backend-developer.md +466 -0
  101. package/core/roles/business-analyst.md +402 -0
  102. package/core/roles/cloudflare-engineer.md +298 -0
  103. package/core/roles/content-manager.md +336 -0
  104. package/core/roles/content-writer.md +399 -0
  105. package/core/roles/data-analyst.md +421 -0
  106. package/core/roles/data-engineer.md +439 -0
  107. package/core/roles/devops-engineer.md +614 -0
  108. package/core/roles/ecommerce-engineer.md +274 -0
  109. package/core/roles/frontend-developer.md +414 -0
  110. package/core/roles/game-developer.md +213 -0
  111. package/core/roles/mmo-engineer.md +228 -0
  112. package/core/roles/mobile-engineer.md +485 -0
  113. package/core/roles/product-manager.md +382 -0
  114. package/core/roles/project-manager.md +279 -0
  115. package/core/roles/prompt-engineer.md +197 -0
  116. package/core/roles/qa-engineer.md +574 -0
  117. package/core/roles/references/3d-graphics-engineer-review-checklist.md +116 -0
  118. package/core/roles/references/agent-coordinator-review-checklist.md +165 -0
  119. package/core/roles/references/agent-discovery-engineer-review-checklist.md +125 -0
  120. package/core/roles/references/ai-systems-engineer-review-checklist.md +151 -0
  121. package/core/roles/references/aws-engineer-review-checklist.md +169 -0
  122. package/core/roles/references/backend-developer-review-checklist.md +105 -0
  123. package/core/roles/references/business-analyst-responsibilities.md +207 -0
  124. package/core/roles/references/business-analyst-review-checklist.md +228 -0
  125. package/core/roles/references/cloudflare-engineer-review-checklist.md +152 -0
  126. package/core/roles/references/content-manager-governance-standards.md +147 -0
  127. package/core/roles/references/content-manager-review-checklist.md +68 -0
  128. package/core/roles/references/content-writer-anti-ai-standards.md +199 -0
  129. package/core/roles/references/content-writer-review-checklist.md +58 -0
  130. package/core/roles/references/data-analyst-review-checklist.md +76 -0
  131. package/core/roles/references/data-engineer-review-checklist.md +77 -0
  132. package/core/roles/references/devops-engineer-review-checklist.md +195 -0
  133. package/core/roles/references/ecommerce-engineer-review-checklist.md +129 -0
  134. package/core/roles/references/frontend-developer-responsibilities.md +275 -0
  135. package/core/roles/references/frontend-developer-review-checklist.md +122 -0
  136. package/core/roles/references/game-developer-review-checklist.md +115 -0
  137. package/core/roles/references/mmo-engineer-review-checklist.md +125 -0
  138. package/core/roles/references/mobile-engineer-review-checklist.md +54 -0
  139. package/core/roles/references/product-manager-review-checklist.md +113 -0
  140. package/core/roles/references/project-manager-review-checklist.md +122 -0
  141. package/core/roles/references/prompt-engineer-review-checklist.md +70 -0
  142. package/core/roles/references/qa-engineer-review-checklist.md +190 -0
  143. package/core/roles/references/researcher-review-checklist.md +176 -0
  144. package/core/roles/references/reviewer-review-checklist.md +67 -0
  145. package/core/roles/references/sdet-review-checklist.md +66 -0
  146. package/core/roles/references/security-engineer-review-checklist.md +122 -0
  147. package/core/roles/references/seo-analyst-geo-standards.md +195 -0
  148. package/core/roles/references/seo-analyst-review-checklist.md +84 -0
  149. package/core/roles/references/solution-architect-review-checklist.md +71 -0
  150. package/core/roles/references/sre-review-checklist.md +35 -0
  151. package/core/roles/references/system-engineer-review-checklist.md +124 -0
  152. package/core/roles/references/task-planner-review-checklist.md +114 -0
  153. package/core/roles/references/teacher-review-checklist.md +47 -0
  154. package/core/roles/references/technical-architect-review-checklist.md +72 -0
  155. package/core/roles/references/technical-lead-review-checklist.md +57 -0
  156. package/core/roles/references/technical-writer-review-checklist.md +120 -0
  157. package/core/roles/references/ui-ux-designer-anti-slop-standards.md +1000 -0
  158. package/core/roles/references/ui-ux-designer-responsibilities.md +250 -0
  159. package/core/roles/references/ui-ux-designer-review-checklist.md +114 -0
  160. package/core/roles/references/vietnam-accounting-specialist-review-checklist.md +53 -0
  161. package/core/roles/references/vietnam-legal-counsel-review-checklist.md +31 -0
  162. package/core/roles/researcher.md +427 -0
  163. package/core/roles/reviewer.md +294 -0
  164. package/core/roles/role-standard.md +242 -0
  165. package/core/roles/sdet.md +198 -0
  166. package/core/roles/security-engineer.md +343 -0
  167. package/core/roles/seo-analyst.md +425 -0
  168. package/core/roles/solution-architect.md +523 -0
  169. package/core/roles/sre.md +260 -0
  170. package/core/roles/system-engineer.md +465 -0
  171. package/core/roles/task-planner.md +277 -0
  172. package/core/roles/teacher.md +298 -0
  173. package/core/roles/technical-architect.md +536 -0
  174. package/core/roles/technical-lead.md +367 -0
  175. package/core/roles/technical-writer.md +359 -0
  176. package/core/roles/ui-ux-designer.md +397 -0
  177. package/core/roles/vietnam-accounting-specialist.md +317 -0
  178. package/core/roles/vietnam-legal-counsel.md +306 -0
  179. package/core/rules/README.md +101 -0
  180. package/core/rules/code.md +46 -0
  181. package/core/rules/knowledge.md +69 -0
  182. package/core/skills/README.md +440 -0
  183. package/core/skills/agent/INDEX.json +396 -0
  184. package/core/skills/agent/agent-a2a-protocol/SKILL.md +189 -0
  185. package/core/skills/agent/agent-a2a-protocol/agents/openai.yaml +4 -0
  186. package/core/skills/agent/agent-a2a-protocol/references/a2a-spec.md +60 -0
  187. package/core/skills/agent/agent-context-management/SKILL.md +187 -0
  188. package/core/skills/agent/agent-context-management/agents/openai.yaml +4 -0
  189. package/core/skills/agent/agent-delegation/SKILL.md +168 -0
  190. package/core/skills/agent/agent-delegation/agents/openai.yaml +4 -0
  191. package/core/skills/agent/agent-graph-orchestration/SKILL.md +172 -0
  192. package/core/skills/agent/agent-graph-orchestration/agents/openai.yaml +4 -0
  193. package/core/skills/agent/agent-handoff/SKILL.md +156 -0
  194. package/core/skills/agent/agent-handoff/agents/openai.yaml +4 -0
  195. package/core/skills/agent/agent-memory-compaction/SKILL.md +112 -0
  196. package/core/skills/agent/agent-memory-compaction/agents/openai.yaml +4 -0
  197. package/core/skills/agent/agent-memory-compaction/references/anchored-schema-and-compaction-algorithms.md +141 -0
  198. package/core/skills/agent/agent-model-routing/SKILL.md +175 -0
  199. package/core/skills/agent/agent-model-routing/agents/openai.yaml +4 -0
  200. package/core/skills/agent/agent-observability/SKILL.md +168 -0
  201. package/core/skills/agent/agent-observability/agents/openai.yaml +4 -0
  202. package/core/skills/agent/agent-panel-meeting/SKILL.md +153 -0
  203. package/core/skills/agent/agent-panel-meeting/agents/openai.yaml +4 -0
  204. package/core/skills/agent/agent-prompt-lifecycle/SKILL.md +191 -0
  205. package/core/skills/agent/agent-prompt-lifecycle/agents/openai.yaml +4 -0
  206. package/core/skills/agent/agent-prompt-lifecycle/references/output-format.md +32 -0
  207. package/core/skills/agent/agent-quality-gate/SKILL.md +174 -0
  208. package/core/skills/agent/agent-quality-gate/agents/openai.yaml +4 -0
  209. package/core/skills/agent/agent-semantic-memory/SKILL.md +164 -0
  210. package/core/skills/agent/agent-semantic-memory/agents/openai.yaml +4 -0
  211. package/core/skills/agent/agent-tool-orchestration/SKILL.md +193 -0
  212. package/core/skills/agent/agent-tool-orchestration/agents/openai.yaml +4 -0
  213. package/core/skills/agent/agent-tool-orchestration/references/2026-patterns.md +67 -0
  214. package/core/skills/agent/architect-mcp-server/SKILL.md +87 -0
  215. package/core/skills/agent/architect-mcp-server/agents/openai.yaml +4 -0
  216. package/core/skills/agent/architect-mcp-server/references/enterprise-mcp-server-architecture.md +217 -0
  217. package/core/skills/agent/configure-agent-commerce/SKILL.md +172 -0
  218. package/core/skills/agent/configure-agent-commerce/agents/openai.yaml +4 -0
  219. package/core/skills/agent/configure-agent-headers/SKILL.md +102 -0
  220. package/core/skills/agent/configure-agent-headers/agents/openai.yaml +4 -0
  221. package/core/skills/agent/configure-agent-skills/SKILL.md +108 -0
  222. package/core/skills/agent/configure-agent-skills/agents/openai.yaml +4 -0
  223. package/core/skills/agent/configure-mcp/SKILL.md +193 -0
  224. package/core/skills/agent/configure-mcp/agents/openai.yaml +4 -0
  225. package/core/skills/agent/configure-mcp/references/2026-07-28-migration.md +60 -0
  226. package/core/skills/agent/configure-oauth-metadata/SKILL.md +139 -0
  227. package/core/skills/agent/configure-oauth-metadata/agents/openai.yaml +4 -0
  228. package/core/skills/agent/debug-identity-provider/SKILL.md +109 -0
  229. package/core/skills/agent/debug-identity-provider/agents/openai.yaml +4 -0
  230. package/core/skills/agent/decompose-agentic-system/SKILL.md +88 -0
  231. package/core/skills/agent/decompose-agentic-system/agents/openai.yaml +4 -0
  232. package/core/skills/agent/decompose-agentic-system/references/recursive-decomposition-and-persistent-planning.md +200 -0
  233. package/core/skills/agent/manage-agent-identity/SKILL.md +187 -0
  234. package/core/skills/agent/manage-agent-identity/agents/openai.yaml +4 -0
  235. package/core/skills/agent/manage-api-catalog/SKILL.md +133 -0
  236. package/core/skills/agent/manage-api-catalog/agents/openai.yaml +4 -0
  237. package/core/skills/agent/manage-auth-md/SKILL.md +119 -0
  238. package/core/skills/agent/manage-auth-md/agents/openai.yaml +4 -0
  239. package/core/skills/ai/deploy-vllm-inference/SKILL.md +163 -0
  240. package/core/skills/ai/deploy-vllm-inference/agents/openai.yaml +4 -0
  241. package/core/skills/ai/deploy-vllm-inference/references/vllm-production-guide.md +466 -0
  242. package/core/skills/ai-agent/agent-evaluation/SKILL.md +102 -0
  243. package/core/skills/ai-agent/context-optimization/SKILL.md +97 -0
  244. package/core/skills/ai-agent/memory-hygiene/SKILL.md +112 -0
  245. package/core/skills/backend/add-api-endpoint/SKILL.md +102 -0
  246. package/core/skills/backend/add-api-endpoint/agents/openai.yaml +4 -0
  247. package/core/skills/backend/add-api-endpoint/references/api-contracts-and-error-specs.md +127 -0
  248. package/core/skills/backend/add-event-handler/SKILL.md +130 -0
  249. package/core/skills/backend/add-event-handler/agents/openai.yaml +4 -0
  250. package/core/skills/backend/add-service-client/SKILL.md +166 -0
  251. package/core/skills/backend/add-service-client/agents/openai.yaml +4 -0
  252. package/core/skills/backend/build-mcp-server/SKILL.md +100 -0
  253. package/core/skills/backend/build-mcp-server/agents/openai.yaml +4 -0
  254. package/core/skills/backend/implement-auth/SKILL.md +90 -0
  255. package/core/skills/backend/implement-auth/agents/openai.yaml +4 -0
  256. package/core/skills/backend/implement-auth/references/auth-flows-and-session-specs.md +229 -0
  257. package/core/skills/backend/implement-structured-outputs/SKILL.md +94 -0
  258. package/core/skills/backend/implement-structured-outputs/agents/openai.yaml +4 -0
  259. package/core/skills/backend/optimize-postgres/SKILL.md +89 -0
  260. package/core/skills/backend/optimize-postgres/agents/openai.yaml +4 -0
  261. package/core/skills/backend/optimize-postgres/references/pooling-branching-and-tuning.md +218 -0
  262. package/core/skills/backend/scaffold-new-service/SKILL.md +97 -0
  263. package/core/skills/backend/scaffold-new-service/agents/openai.yaml +4 -0
  264. package/core/skills/backend/scaffold-new-service/references/service-scaffolding-guide.md +141 -0
  265. package/core/skills/business/elicit-requirements/SKILL.md +102 -0
  266. package/core/skills/business/elicit-requirements/references/elicitation-techniques-and-babok-criteria.md +60 -0
  267. package/core/skills/business/trace-requirements-impact/SKILL.md +97 -0
  268. package/core/skills/business/trace-requirements-impact/references/rtm-graph-and-prioritization-models.md +109 -0
  269. package/core/skills/business/write-use-cases/SKILL.md +106 -0
  270. package/core/skills/business/write-use-cases/references/cockburn-scoping-and-13-field-template.md +135 -0
  271. package/core/skills/commerce/2026_STANDARDS_SUMMARY.md +316 -0
  272. package/core/skills/commerce/INDEX.json +72 -0
  273. package/core/skills/commerce/handle-checkout-flow/SKILL.md +192 -0
  274. package/core/skills/commerce/handle-checkout-flow/UPGRADE_PLAN_2026.md +99 -0
  275. package/core/skills/commerce/handle-checkout-flow/agents/openai.yaml +4 -0
  276. package/core/skills/commerce/integrate-payment-gateway/SKILL.md +187 -0
  277. package/core/skills/commerce/integrate-payment-gateway/UPGRADE_PLAN_2026.md +128 -0
  278. package/core/skills/commerce/integrate-payment-gateway/agents/openai.yaml +4 -0
  279. package/core/skills/commerce/manage-order-fulfillment/SKILL.md +197 -0
  280. package/core/skills/commerce/manage-order-fulfillment/UPGRADE_PLAN_2026.md +136 -0
  281. package/core/skills/commerce/manage-order-fulfillment/agents/openai.yaml +4 -0
  282. package/core/skills/commerce/manage-product-catalog/SKILL.md +189 -0
  283. package/core/skills/commerce/manage-product-catalog/UPGRADE_PLAN_2026.md +130 -0
  284. package/core/skills/commerce/manage-product-catalog/agents/openai.yaml +4 -0
  285. package/core/skills/content/audit-content/SKILL.md +120 -0
  286. package/core/skills/content/audit-content/agents/openai.yaml +4 -0
  287. package/core/skills/content/audit-content/references/ai-semantic-flaw-rubric.md +43 -0
  288. package/core/skills/content/audit-content/references/citation-verification-guide.md +39 -0
  289. package/core/skills/content/audit-content/references/information-gain-rubric.md +51 -0
  290. package/core/skills/content/design-content-strategy/SKILL.md +108 -0
  291. package/core/skills/content/design-content-strategy/agents/openai.yaml +4 -0
  292. package/core/skills/content/design-content-strategy/references/distribution-loops-and-drift-prevention.md +109 -0
  293. package/core/skills/content/design-content-strategy/references/information-gain-and-decay-triage.md +149 -0
  294. package/core/skills/content/design-content-strategy/references/pillar-cluster-and-funnel-playbook.md +159 -0
  295. package/core/skills/content/optimize-seo/SKILL.md +179 -0
  296. package/core/skills/content/optimize-seo/agents/openai.yaml +4 -0
  297. package/core/skills/content/optimize-seo/references/entity-salience-and-schema.md +88 -0
  298. package/core/skills/content/optimize-seo/references/geo-ai-citation-playbook.md +42 -0
  299. package/core/skills/content/optimize-seo/references/process-and-checklist.md +116 -0
  300. package/core/skills/content/repurpose-content/SKILL.md +150 -0
  301. package/core/skills/content/repurpose-content/agents/openai.yaml +4 -0
  302. package/core/skills/content/repurpose-content/references/channel-repurposing-playbook.md +96 -0
  303. package/core/skills/content/repurpose-content/references/entity-fidelity-guide.md +42 -0
  304. package/core/skills/content/write-article/SKILL.md +169 -0
  305. package/core/skills/content/write-article/agents/openai.yaml +4 -0
  306. package/core/skills/content/write-article/references/ai-drafting-playbook.md +141 -0
  307. package/core/skills/content/write-article/references/anti-ai-style-guide.md +52 -0
  308. package/core/skills/content/write-article/references/authentic-source-matrix.md +36 -0
  309. package/core/skills/content/write-article/references/suggested-process.md +61 -0
  310. package/core/skills/content/write-copy/SKILL.md +102 -0
  311. package/core/skills/content/write-copy/agents/openai.yaml +4 -0
  312. package/core/skills/content/write-copy/references/behavioral-psychology-and-conversion.md +147 -0
  313. package/core/skills/content/write-copy/references/copywriting-frameworks-playbook.md +250 -0
  314. package/core/skills/content/write-copy/references/humanizer-voice-and-cadence-guide.md +134 -0
  315. package/core/skills/document/docx/SKILL.md +64 -0
  316. package/core/skills/document/pdf/SKILL.md +65 -0
  317. package/core/skills/document/pptx/SKILL.md +67 -0
  318. package/core/skills/document/pptx/scripts/add_slide.py +91 -0
  319. package/core/skills/document/pptx/scripts/clean.py +84 -0
  320. package/core/skills/document/pptx/scripts/thumbnail.py +112 -0
  321. package/core/skills/document/xlsx/SKILL.md +65 -0
  322. package/core/skills/document/xlsx/scripts/recalc.py +388 -0
  323. package/core/skills/documentation/configure-llms-txt/SKILL.md +170 -0
  324. package/core/skills/documentation/configure-llms-txt/agents/openai.yaml +4 -0
  325. package/core/skills/documentation/write-documentation/SKILL.md +143 -0
  326. package/core/skills/documentation/write-documentation/agents/openai.yaml +4 -0
  327. package/core/skills/documentation/write-tech-radar/SKILL.md +149 -0
  328. package/core/skills/documentation/write-tech-radar/agents/openai.yaml +4 -0
  329. package/core/skills/education/2026_STANDARDS_SUMMARY.md +290 -0
  330. package/core/skills/education/INDEX.json +44 -0
  331. package/core/skills/education/create-exercises/SKILL.md +98 -0
  332. package/core/skills/education/create-exercises/UPGRADE_PLAN_2026.md +115 -0
  333. package/core/skills/education/create-exercises/agents/openai.yaml +4 -0
  334. package/core/skills/education/create-exercises/references/dok-and-ai-resistant-exercise-design.md +115 -0
  335. package/core/skills/education/create-exercises/references/irt-calibration-and-scoring-matrices.md +113 -0
  336. package/core/skills/education/design-learning-plan/SKILL.md +109 -0
  337. package/core/skills/education/design-learning-plan/UPGRADE_PLAN_2026.md +140 -0
  338. package/core/skills/education/design-learning-plan/agents/openai.yaml +4 -0
  339. package/core/skills/education/design-learning-plan/references/spaced-scheduling-and-socratic-scaffolding.md +117 -0
  340. package/core/skills/education/design-learning-plan/references/zpd-pathways-and-smart-objectives.md +108 -0
  341. package/core/skills/education/grade-and-review/SKILL.md +104 -0
  342. package/core/skills/education/grade-and-review/UPGRADE_PLAN_2026.md +141 -0
  343. package/core/skills/education/grade-and-review/agents/openai.yaml +4 -0
  344. package/core/skills/education/grade-and-review/references/analytic-rubrics-and-grading-hallucination-defense.md +117 -0
  345. package/core/skills/education/grade-and-review/references/cognitive-error-analysis-and-socratic-feedback.md +124 -0
  346. package/core/skills/foundation/accessibility-review/SKILL.md +160 -0
  347. package/core/skills/foundation/accessibility-review/agents/openai.yaml +4 -0
  348. package/core/skills/foundation/ai-risk-assessment/SKILL.md +198 -0
  349. package/core/skills/foundation/ai-risk-assessment/agents/openai.yaml +4 -0
  350. package/core/skills/foundation/combinatorial-testing/SKILL.md +165 -0
  351. package/core/skills/foundation/combinatorial-testing/agents/openai.yaml +4 -0
  352. package/core/skills/foundation/conduct-research/SKILL.md +132 -0
  353. package/core/skills/foundation/conduct-research/agents/openai.yaml +4 -0
  354. package/core/skills/foundation/conduct-research/references/ai-era-source-discipline.md +58 -0
  355. package/core/skills/foundation/conduct-research/references/output-format.md +75 -0
  356. package/core/skills/foundation/conduct-research/references/sota-deep-research-architecture.md +733 -0
  357. package/core/skills/foundation/create-migration/SKILL.md +151 -0
  358. package/core/skills/foundation/create-migration/agents/openai.yaml +4 -0
  359. package/core/skills/foundation/create-migration/references/patterns-and-gotchas.md +58 -0
  360. package/core/skills/foundation/create-migration/references/suggested-process.md +111 -0
  361. package/core/skills/foundation/design-review/SKILL.md +138 -0
  362. package/core/skills/foundation/design-review/agents/openai.yaml +4 -0
  363. package/core/skills/foundation/design-ux-flow/SKILL.md +153 -0
  364. package/core/skills/foundation/design-ux-flow/agents/openai.yaml +4 -0
  365. package/core/skills/foundation/discernment-nudge/SKILL.md +64 -0
  366. package/core/skills/foundation/hostile-component-stress-testing/SKILL.md +139 -0
  367. package/core/skills/foundation/incident-report/SKILL.md +119 -0
  368. package/core/skills/foundation/incident-report/agents/openai.yaml +4 -0
  369. package/core/skills/foundation/performance-profiling/SKILL.md +127 -0
  370. package/core/skills/foundation/performance-profiling/agents/openai.yaml +4 -0
  371. package/core/skills/foundation/performance-profiling/references/patterns-and-safety.md +57 -0
  372. package/core/skills/foundation/performance-profiling/references/suggested-process.md +113 -0
  373. package/core/skills/foundation/plan-technical-delivery/SKILL.md +118 -0
  374. package/core/skills/foundation/plan-technical-delivery/agents/openai.yaml +4 -0
  375. package/core/skills/foundation/plan-technical-delivery/references/spec-driven-planning.md +104 -0
  376. package/core/skills/foundation/playwright-evidence-qa/SKILL.md +139 -0
  377. package/core/skills/foundation/release-notes/SKILL.md +192 -0
  378. package/core/skills/foundation/release-notes/agents/openai.yaml +4 -0
  379. package/core/skills/foundation/systematic-debugging/SKILL.md +165 -0
  380. package/core/skills/foundation/systematic-debugging/agents/openai.yaml +4 -0
  381. package/core/skills/foundation/webapp-server-runner/SKILL.md +67 -0
  382. package/core/skills/foundation/webapp-server-runner/scripts/with_server.py +182 -0
  383. package/core/skills/foundation/write-product-brief/SKILL.md +160 -0
  384. package/core/skills/foundation/write-product-brief/agents/openai.yaml +4 -0
  385. package/core/skills/foundation/write-tests/SKILL.md +173 -0
  386. package/core/skills/foundation/write-tests/agents/openai.yaml +4 -0
  387. package/core/skills/foundation/write-tests/references/advanced-testing-methodologies.md +102 -0
  388. package/core/skills/foundation/write-tests/references/patterns-and-ai-testing.md +78 -0
  389. package/core/skills/frontend/2026_STANDARDS_SUMMARY.md +345 -0
  390. package/core/skills/frontend/INDEX.json +158 -0
  391. package/core/skills/frontend/add-page-route/SKILL.md +154 -0
  392. package/core/skills/frontend/add-page-route/UPGRADE_PLAN_2026.md +102 -0
  393. package/core/skills/frontend/add-page-route/agents/openai.yaml +4 -0
  394. package/core/skills/frontend/add-ui-component/SKILL.md +162 -0
  395. package/core/skills/frontend/add-ui-component/UPGRADE_PLAN_2026.md +114 -0
  396. package/core/skills/frontend/add-ui-component/agents/openai.yaml +4 -0
  397. package/core/skills/frontend/anti-ui-slop-finish-gate/SKILL.md +128 -0
  398. package/core/skills/frontend/component-composition/SKILL.md +116 -0
  399. package/core/skills/frontend/component-composition/UPGRADE_PLAN_2026.md +103 -0
  400. package/core/skills/frontend/component-composition/agents/openai.yaml +4 -0
  401. package/core/skills/frontend/component-composition/references/composition-architecture-and-headless-specs.md +375 -0
  402. package/core/skills/frontend/design-md-specification/SKILL.md +99 -0
  403. package/core/skills/frontend/design-system-engineering/SKILL.md +128 -0
  404. package/core/skills/frontend/frontend-micro-polish/SKILL.md +133 -0
  405. package/core/skills/frontend/frontend-testing/SKILL.md +196 -0
  406. package/core/skills/frontend/frontend-testing/UPGRADE_PLAN_2026.md +137 -0
  407. package/core/skills/frontend/frontend-testing/agents/openai.yaml +4 -0
  408. package/core/skills/frontend/implement-view-transitions/SKILL.md +109 -0
  409. package/core/skills/frontend/implement-view-transitions/UPGRADE_PLAN_2026.md +118 -0
  410. package/core/skills/frontend/implement-view-transitions/agents/openai.yaml +4 -0
  411. package/core/skills/frontend/implement-view-transitions/references/view-transitions-and-motion-specs.md +255 -0
  412. package/core/skills/frontend/implement-webmcp/SKILL.md +121 -0
  413. package/core/skills/frontend/implement-webmcp/UPGRADE_PLAN_2026.md +108 -0
  414. package/core/skills/frontend/implement-webmcp/agents/openai.yaml +4 -0
  415. package/core/skills/frontend/integrate-api-client/SKILL.md +186 -0
  416. package/core/skills/frontend/integrate-api-client/UPGRADE_PLAN_2026.md +118 -0
  417. package/core/skills/frontend/integrate-api-client/agents/openai.yaml +4 -0
  418. package/core/skills/frontend/interactive-component-workbench/SKILL.md +141 -0
  419. package/core/skills/frontend/motion-performance-engineering/SKILL.md +100 -0
  420. package/core/skills/frontend/setup-design-system/SKILL.md +179 -0
  421. package/core/skills/frontend/setup-design-system/UPGRADE_PLAN_2026.md +123 -0
  422. package/core/skills/frontend/setup-design-system/agents/openai.yaml +4 -0
  423. package/core/skills/frontend/setup-visual-regression/SKILL.md +115 -0
  424. package/core/skills/frontend/setup-visual-regression/UPGRADE_PLAN_2026.md +121 -0
  425. package/core/skills/frontend/setup-visual-regression/agents/openai.yaml +4 -0
  426. package/core/skills/frontend/ui-ux-designer-anti-slop-standards.md +1004 -0
  427. package/core/skills/frontend/web-quality-audit/SKILL.md +102 -0
  428. package/core/skills/gamedev/abstract-input-actions/SKILL.md +80 -0
  429. package/core/skills/gamedev/architect-ecs-systems/SKILL.md +80 -0
  430. package/core/skills/gamedev/author-game-ai/SKILL.md +78 -0
  431. package/core/skills/gamedev/automate-game-publishing/SKILL.md +80 -0
  432. package/core/skills/gamedev/build-game-ui-ux/SKILL.md +78 -0
  433. package/core/skills/gamedev/configure-physics-collision/SKILL.md +80 -0
  434. package/core/skills/gamedev/design-procedural-generation/SKILL.md +80 -0
  435. package/core/skills/gamedev/develop-gameplay-systems/SKILL.md +71 -0
  436. package/core/skills/gamedev/direct-camera-systems/SKILL.md +79 -0
  437. package/core/skills/gamedev/generate-game-assets-pipeline/SKILL.md +82 -0
  438. package/core/skills/gamedev/implement-save-persistence/SKILL.md +84 -0
  439. package/core/skills/gamedev/inspect-blender-rigs-motion/SKILL.md +82 -0
  440. package/core/skills/gamedev/integrate-dialogue-narrative/SKILL.md +80 -0
  441. package/core/skills/gamedev/integrate-game-engine/SKILL.md +81 -0
  442. package/core/skills/gamedev/manage-scene-lifecycle/SKILL.md +80 -0
  443. package/core/skills/gamedev/mix-dynamic-game-audio/SKILL.md +80 -0
  444. package/core/skills/gamedev/profile-game-performance/SKILL.md +81 -0
  445. package/core/skills/gamedev/program-game-shaders/SKILL.md +83 -0
  446. package/core/skills/gamedev/render-webgl-threejs/SKILL.md +81 -0
  447. package/core/skills/gamedev/tune-game-feel/SKILL.md +75 -0
  448. package/core/skills/legal-compliance/audit-ai-compliance/SKILL.md +85 -0
  449. package/core/skills/legal-compliance/audit-ai-compliance/agents/openai.yaml +4 -0
  450. package/core/skills/legal-compliance/audit-ai-compliance/references/ai-law-compliance-guide.md +52 -0
  451. package/core/skills/legal-compliance/draft-legal-opinion/SKILL.md +89 -0
  452. package/core/skills/legal-compliance/draft-legal-opinion/agents/openai.yaml +4 -0
  453. package/core/skills/legal-compliance/draft-legal-opinion/references/legal-opinion-guide.md +53 -0
  454. package/core/skills/legal-compliance/manage-vietnam-legal/SKILL.md +95 -0
  455. package/core/skills/legal-compliance/manage-vietnam-legal/references/statutory-checklists.md +208 -0
  456. package/core/skills/meetings-analysis/2026_STANDARDS_SUMMARY.md +236 -0
  457. package/core/skills/meetings-analysis/INDEX.json +56 -0
  458. package/core/skills/meetings-analysis/analyze-business-requirements/SKILL.md +146 -0
  459. package/core/skills/meetings-analysis/analyze-business-requirements/UPGRADE_PLAN_2026.md +97 -0
  460. package/core/skills/meetings-analysis/analyze-business-requirements/agents/openai.yaml +4 -0
  461. package/core/skills/meetings-analysis/analyze-business-requirements/references/layered-requirements-pipeline-and-bdd-standards.md +107 -0
  462. package/core/skills/meetings-analysis/analyze-data/SKILL.md +164 -0
  463. package/core/skills/meetings-analysis/analyze-data/UPGRADE_PLAN_2026.md +143 -0
  464. package/core/skills/meetings-analysis/analyze-data/agents/openai.yaml +4 -0
  465. package/core/skills/meetings-analysis/analyze-data/references/inprocess-analytics-and-hallucination-prevention.md +83 -0
  466. package/core/skills/meetings-analysis/analyze-data/references/semantic-catalog-and-drift-detection.md +87 -0
  467. package/core/skills/meetings-analysis/meeting-review/SKILL.md +199 -0
  468. package/core/skills/meetings-analysis/meeting-review/UPGRADE_PLAN_2026.md +125 -0
  469. package/core/skills/meetings-analysis/meeting-review/agents/openai.yaml +4 -0
  470. package/core/skills/meetings-analysis/meeting-review/references/perspectives-and-process.md +90 -0
  471. package/core/skills/mmo/INDEX.json +126 -0
  472. package/core/skills/mmo/analyze-campaign-roi/SKILL.md +134 -0
  473. package/core/skills/mmo/analyze-campaign-roi/agents/openai.yaml +4 -0
  474. package/core/skills/mmo/create-automation-script/SKILL.md +139 -0
  475. package/core/skills/mmo/create-automation-script/agents/openai.yaml +4 -0
  476. package/core/skills/mmo/deploy-mmo-infrastructure/SKILL.md +137 -0
  477. package/core/skills/mmo/deploy-mmo-infrastructure/agents/openai.yaml +4 -0
  478. package/core/skills/mmo/deploy-proxyware-fleet/SKILL.md +133 -0
  479. package/core/skills/mmo/deploy-proxyware-fleet/agents/openai.yaml +4 -0
  480. package/core/skills/mmo/generate-mmo-content/SKILL.md +134 -0
  481. package/core/skills/mmo/generate-mmo-content/agents/openai.yaml +4 -0
  482. package/core/skills/mmo/manage-mmo-assets/SKILL.md +134 -0
  483. package/core/skills/mmo/manage-mmo-assets/agents/openai.yaml +4 -0
  484. package/core/skills/mmo/setup-tracking-system/SKILL.md +149 -0
  485. package/core/skills/mmo/setup-tracking-system/agents/openai.yaml +4 -0
  486. package/core/skills/mobile/2026_STANDARDS_SUMMARY.md +209 -0
  487. package/core/skills/mobile/INDEX.json +40 -0
  488. package/core/skills/mobile/deploy-mobile-app/SKILL.md +132 -0
  489. package/core/skills/mobile/deploy-mobile-app/UPGRADE_PLAN_2026.md +122 -0
  490. package/core/skills/mobile/deploy-mobile-app/agents/openai.yaml +4 -0
  491. package/core/skills/mobile/deploy-mobile-app/references/eas-build-ota-and-store-compliance-specs.md +217 -0
  492. package/core/skills/mobile/develop-mobile-app/SKILL.md +125 -0
  493. package/core/skills/mobile/develop-mobile-app/UPGRADE_PLAN_2026.md +141 -0
  494. package/core/skills/mobile/develop-mobile-app/agents/openai.yaml +4 -0
  495. package/core/skills/mobile/develop-mobile-app/references/react-native-new-architecture-and-offline-specs.md +246 -0
  496. package/core/skills/platform/add-telemetry-instrumentation/SKILL.md +92 -0
  497. package/core/skills/platform/add-telemetry-instrumentation/agents/openai.yaml +4 -0
  498. package/core/skills/platform/agents-sdk/SKILL.md +90 -0
  499. package/core/skills/platform/aws-infrastructure/SKILL.md +120 -0
  500. package/core/skills/platform/aws-infrastructure/agents/openai.yaml +4 -0
  501. package/core/skills/platform/cloudflare-email-service/SKILL.md +166 -0
  502. package/core/skills/platform/cloudflare-email-service/agents/openai.yaml +4 -0
  503. package/core/skills/platform/cloudflare-email-service/references/cli-and-mcp.md +125 -0
  504. package/core/skills/platform/cloudflare-email-service/references/deliverability.md +285 -0
  505. package/core/skills/platform/cloudflare-email-service/references/rest-api.md +184 -0
  506. package/core/skills/platform/cloudflare-email-service/references/routing.md +199 -0
  507. package/core/skills/platform/cloudflare-email-service/references/sending.md +252 -0
  508. package/core/skills/platform/debug-runtime-platform/SKILL.md +143 -0
  509. package/core/skills/platform/debug-runtime-platform/agents/openai.yaml +4 -0
  510. package/core/skills/platform/debug-workers-edge/SKILL.md +111 -0
  511. package/core/skills/platform/debug-workers-edge/agents/openai.yaml +4 -0
  512. package/core/skills/platform/deploy-aws-eks-workloads/SKILL.md +168 -0
  513. package/core/skills/platform/deploy-aws-eks-workloads/agents/openai.yaml +4 -0
  514. package/core/skills/platform/deploy-aws-eks-workloads/references/aws-eks-workload-guide.md +353 -0
  515. package/core/skills/platform/durable-objects/SKILL.md +114 -0
  516. package/core/skills/platform/durable-objects/agents/openai.yaml +4 -0
  517. package/core/skills/platform/durable-objects/references/code-patterns.md +115 -0
  518. package/core/skills/platform/durable-objects/references/rules.md +295 -0
  519. package/core/skills/platform/durable-objects/references/testing.md +264 -0
  520. package/core/skills/platform/durable-objects/references/workers.md +346 -0
  521. package/core/skills/platform/orchestrate-chaos-experiment/SKILL.md +98 -0
  522. package/core/skills/platform/orchestrate-chaos-experiment/agents/openai.yaml +4 -0
  523. package/core/skills/platform/orchestrate-chaos-experiment/references/chaos-engineering-guide.md +237 -0
  524. package/core/skills/platform/sandbox-sdk/SKILL.md +183 -0
  525. package/core/skills/platform/sandbox-sdk/agents/openai.yaml +4 -0
  526. package/core/skills/platform/sandbox-sdk/references/api-quick-ref.md +113 -0
  527. package/core/skills/platform/sandbox-sdk/references/examples.md +49 -0
  528. package/core/skills/platform/setup-deployment/SKILL.md +136 -0
  529. package/core/skills/platform/setup-deployment/agents/openai.yaml +4 -0
  530. package/core/skills/platform/setup-gpu-finops/SKILL.md +107 -0
  531. package/core/skills/platform/setup-gpu-finops/agents/openai.yaml +4 -0
  532. package/core/skills/platform/setup-llm-gateway/SKILL.md +108 -0
  533. package/core/skills/platform/setup-llm-gateway/agents/openai.yaml +4 -0
  534. package/core/skills/platform/supply-chain-security/SKILL.md +195 -0
  535. package/core/skills/platform/supply-chain-security/agents/openai.yaml +4 -0
  536. package/core/skills/platform/system-design/SKILL.md +184 -0
  537. package/core/skills/platform/system-design/agents/openai.yaml +4 -0
  538. package/core/skills/platform/system-design/references/cellular-topology-and-capacity-sizing.md +151 -0
  539. package/core/skills/platform/turnstile-spin/README.md +45 -0
  540. package/core/skills/platform/turnstile-spin/SKILL.md +118 -0
  541. package/core/skills/platform/turnstile-spin/agents/openai.yaml +4 -0
  542. package/core/skills/platform/turnstile-spin/references/astro.md +102 -0
  543. package/core/skills/platform/turnstile-spin/references/code-patterns.md +132 -0
  544. package/core/skills/platform/turnstile-spin/references/hugo.md +62 -0
  545. package/core/skills/platform/turnstile-spin/references/nextjs-app.md +110 -0
  546. package/core/skills/platform/turnstile-spin/references/nextjs-pages.md +59 -0
  547. package/core/skills/platform/turnstile-spin/references/sveltekit.md +84 -0
  548. package/core/skills/platform/turnstile-spin/references/vanilla-html.md +62 -0
  549. package/core/skills/platform/turnstile-spin/scripts/auth-probe.sh +82 -0
  550. package/core/skills/platform/turnstile-spin/scripts/fetch-secret.sh +66 -0
  551. package/core/skills/platform/turnstile-spin/scripts/persist-skill.sh +53 -0
  552. package/core/skills/platform/turnstile-spin/scripts/validate.sh +87 -0
  553. package/core/skills/platform/turnstile-spin/scripts/widget-create.sh +57 -0
  554. package/core/skills/platform/turnstile-spin/scripts/worker-deploy.sh +102 -0
  555. package/core/skills/platform/turnstile-spin/templates/worker/LICENSE +21 -0
  556. package/core/skills/platform/turnstile-spin/templates/worker/README.md +196 -0
  557. package/core/skills/platform/turnstile-spin/templates/worker/package.json +39 -0
  558. package/core/skills/platform/turnstile-spin/templates/worker/public/post-deploy.html +287 -0
  559. package/core/skills/platform/turnstile-spin/templates/worker/src/errors.ts +29 -0
  560. package/core/skills/platform/turnstile-spin/templates/worker/src/index.ts +199 -0
  561. package/core/skills/platform/turnstile-spin/templates/worker/src/observability.ts +34 -0
  562. package/core/skills/platform/turnstile-spin/templates/worker/src/types.ts +95 -0
  563. package/core/skills/platform/turnstile-spin/templates/worker/src/validate.ts +101 -0
  564. package/core/skills/platform/turnstile-spin/templates/worker/test/deploy.test.ts +71 -0
  565. package/core/skills/platform/turnstile-spin/templates/worker/test/integration.test.ts +87 -0
  566. package/core/skills/platform/turnstile-spin/templates/worker/test/unit.test.ts +372 -0
  567. package/core/skills/platform/turnstile-spin/templates/worker/test/validation.test.ts +201 -0
  568. package/core/skills/platform/turnstile-spin/templates/worker/tsconfig.json +24 -0
  569. package/core/skills/platform/turnstile-spin/templates/worker/vitest.config.ts +12 -0
  570. package/core/skills/platform/turnstile-spin/templates/worker/wrangler.toml +31 -0
  571. package/core/skills/platform/turnstile-spin/tests/validation.md +69 -0
  572. package/core/skills/platform/web-perf/SKILL.md +151 -0
  573. package/core/skills/platform/web-perf/agents/openai.yaml +4 -0
  574. package/core/skills/platform/workers-best-practices/SKILL.md +93 -0
  575. package/core/skills/platform/workers-best-practices/agents/openai.yaml +4 -0
  576. package/core/skills/platform/workers-best-practices/references/review.md +174 -0
  577. package/core/skills/platform/workers-best-practices/references/rules.md +463 -0
  578. package/core/skills/platform/wrangler/SKILL.md +89 -0
  579. package/core/skills/platform/wrangler/agents/openai.yaml +4 -0
  580. package/core/skills/product/build-story-map/SKILL.md +104 -0
  581. package/core/skills/product/build-story-map/references/story-mapping-and-cpm-scheduling.md +101 -0
  582. package/core/skills/product/define-product-strategy/SKILL.md +105 -0
  583. package/core/skills/product/define-product-strategy/references/strategy-frameworks-and-pr-faq.md +142 -0
  584. package/core/skills/product/model-saas-metrics/SKILL.md +104 -0
  585. package/core/skills/product/model-saas-metrics/references/saas-unit-economics-and-pricing.md +110 -0
  586. package/core/skills/product/prioritize-roadmap/SKILL.md +106 -0
  587. package/core/skills/product/prioritize-roadmap/references/prioritization-scoring-and-kill-criteria.md +105 -0
  588. package/core/skills/repo-ops/commit-code/SKILL.md +190 -0
  589. package/core/skills/repo-ops/commit-code/agents/openai.yaml +4 -0
  590. package/core/skills/repo-ops/commit-code/references/multi-repo-and-deployment.md +21 -0
  591. package/core/skills/repo-ops/navigate-service/SKILL.md +199 -0
  592. package/core/skills/repo-ops/navigate-service/agents/openai.yaml +4 -0
  593. package/core/skills/repo-ops/review-code/SKILL.md +102 -0
  594. package/core/skills/repo-ops/review-code/agents/openai.yaml +4 -0
  595. package/core/skills/repo-ops/review-code/references/adversarial-review-rubric.md +80 -0
  596. package/core/skills/repo-ops/review-code/references/process-and-format.md +100 -0
  597. package/core/skills/repo-ops/review-code/references/two-axis-review.md +78 -0
  598. package/core/skills/repo-ops/review-service/SKILL.md +186 -0
  599. package/core/skills/repo-ops/review-service/agents/openai.yaml +4 -0
  600. package/core/skills/repo-ops/troubleshoot-service/SKILL.md +127 -0
  601. package/core/skills/repo-ops/troubleshoot-service/agents/openai.yaml +4 -0
  602. package/core/skills/repo-ops/troubleshoot-service/references/common-failure-areas.md +71 -0
  603. package/core/skills/repo-ops/troubleshoot-service/references/failure-modes-and-security.md +22 -0
  604. package/core/skills/repo-ops/troubleshoot-service/references/suggested-process.md +110 -0
  605. package/core/skills/security-data/build-data-pipeline/SKILL.md +139 -0
  606. package/core/skills/security-data/build-data-pipeline/agents/openai.yaml +4 -0
  607. package/core/skills/security-data/build-data-pipeline/references/producer-contracts-and-lakehouse.md +112 -0
  608. package/core/skills/security-data/build-data-pipeline/references/quality-gates-dlq-and-replayability.md +105 -0
  609. package/core/skills/security-data/database-maintenance/SKILL.md +102 -0
  610. package/core/skills/security-data/database-maintenance/agents/openai.yaml +4 -0
  611. package/core/skills/security-data/database-maintenance/references/lakehouse-ops-and-finops.md +125 -0
  612. package/core/skills/security-data/database-maintenance/references/relational-and-vector-maintenance.md +81 -0
  613. package/core/skills/security-data/manage-secrets/SKILL.md +137 -0
  614. package/core/skills/security-data/manage-secrets/agents/openai.yaml +4 -0
  615. package/core/skills/security-data/manage-vietnam-accounting/SKILL.md +93 -0
  616. package/core/skills/security-data/manage-vietnam-accounting/agents/openai.yaml +4 -0
  617. package/core/skills/security-data/manage-vietnam-accounting/references/e-invoice-risk-playbook.md +270 -0
  618. package/core/skills/security-data/manage-vietnam-accounting/references/three-way-matching-and-controls.md +227 -0
  619. package/core/skills/security-data/manage-vietnam-accounting/references/vas-vfrs-chart-of-accounts.md +199 -0
  620. package/core/skills/security-data/optimize-olap-database/SKILL.md +108 -0
  621. package/core/skills/security-data/optimize-olap-database/agents/openai.yaml +4 -0
  622. package/core/skills/security-data/optimize-olap-database/references/olap-database-guide.md +325 -0
  623. package/core/skills/security-data/prompt-injection-defense/SKILL.md +103 -0
  624. package/core/skills/security-data/query-analytical-engine/SKILL.md +92 -0
  625. package/core/skills/security-data/query-analytical-engine/agents/openai.yaml +4 -0
  626. package/core/skills/security-data/query-analytical-engine/references/analytical-query-guide.md +326 -0
  627. package/core/skills/security-data/security-audit/SKILL.md +119 -0
  628. package/core/skills/security-data/security-audit/agents/openai.yaml +4 -0
  629. package/core/skills/security-data/skill-preflight-ast-check/SKILL.md +132 -0
  630. package/core/skills/seo/audit-technical-seo/SKILL.md +109 -0
  631. package/core/skills/seo/audit-technical-seo/agents/openai.yaml +4 -0
  632. package/core/skills/seo/audit-technical-seo/references/core-web-vitals-and-performance.md +104 -0
  633. package/core/skills/seo/audit-technical-seo/references/crawl-budget-and-bot-access-guide.md +188 -0
  634. package/core/skills/seo/audit-technical-seo/references/redirects-canonicals-and-status-codes.md +145 -0
  635. package/core/skills/seo/implement-schema-markup/SKILL.md +103 -0
  636. package/core/skills/seo/implement-schema-markup/agents/openai.yaml +4 -0
  637. package/core/skills/seo/implement-schema-markup/references/connected-graph-schema-architecture.md +219 -0
  638. package/core/skills/seo/implement-schema-markup/references/entity-grounding-and-wikidata.md +155 -0
  639. package/core/skills/seo/implement-schema-markup/references/rich-results-and-validation-guide.md +83 -0
  640. package/core/workflows/README.md +140 -0
  641. package/core/workflows/add-new-feature.md +212 -0
  642. package/core/workflows/agent-a2a-delegation.md +142 -0
  643. package/core/workflows/bug-fix.md +147 -0
  644. package/core/workflows/build-deploy.md +208 -0
  645. package/core/workflows/code-review.md +137 -0
  646. package/core/workflows/content-audit.md +158 -0
  647. package/core/workflows/content-publishing.md +208 -0
  648. package/core/workflows/curriculum-delivery.md +181 -0
  649. package/core/workflows/data-migration.md +202 -0
  650. package/core/workflows/data-pipeline-incident.md +176 -0
  651. package/core/workflows/dependency-upgrade.md +193 -0
  652. package/core/workflows/feature-delivery.md +149 -0
  653. package/core/workflows/hotfix-production.md +172 -0
  654. package/core/workflows/mmo-campaign-lifecycle.md +123 -0
  655. package/core/workflows/period-end-closing.md +245 -0
  656. package/core/workflows/qa-validation.md +231 -0
  657. package/core/workflows/refactoring.md +154 -0
  658. package/core/workflows/revert-deployment.md +147 -0
  659. package/core/workflows/security-incident-response.md +191 -0
  660. package/core/workflows/seo-content-lifecycle.md +91 -0
  661. package/core/workflows/seo-keyword-brief.md +178 -0
  662. package/core/workflows/service-review-release.md +223 -0
  663. package/core/workflows/setup-new-service.md +214 -0
  664. package/core/workflows/tech-repo-review.md +245 -0
  665. package/core/workflows/troubleshooting.md +241 -0
  666. package/overlays/README.md +89 -0
  667. package/overlays/astro-cloudflare/README.md +93 -0
  668. package/overlays/astro-cloudflare/rules/astro-cloudflare-conventions.md +191 -0
  669. package/overlays/b2b-catalog-golf/README.md +50 -0
  670. package/overlays/b2b-catalog-golf/rules/golf-project-rules.md +78 -0
  671. package/overlays/b2b-catalog-golf/skills/develop-b2b-golf-feature/SKILL.md +84 -0
  672. package/overlays/b2b-catalog-golf/skills/develop-b2b-golf-feature/agents/openai.yaml +4 -0
  673. package/overlays/b2b-factory-catalog/README.md +54 -0
  674. package/overlays/b2b-factory-catalog/rules/icm-project-rules.md +93 -0
  675. package/overlays/b2b-factory-catalog/skills/develop-b2b-catalog-feature/SKILL.md +68 -0
  676. package/overlays/b2b-factory-catalog/skills/develop-b2b-catalog-feature/agents/openai.yaml +4 -0
  677. package/overlays/b2b-sport-catalog/README.md +64 -0
  678. package/overlays/b2b-sport-catalog/rules/sport-project-rules.md +82 -0
  679. package/overlays/cad-projection/README.md +49 -0
  680. package/overlays/cad-projection/rules/cad-conventions.md +76 -0
  681. package/overlays/cad-projection/skills/isometric-svg-projection/SKILL.md +132 -0
  682. package/overlays/data-analyst-stack/README.md +109 -0
  683. package/overlays/data-analyst-stack/rules/metric-dashboard-templates.md +135 -0
  684. package/overlays/data-analyst-stack/rules/stack-conventions.md +80 -0
  685. package/overlays/data-warehouse/README.md +133 -0
  686. package/overlays/data-warehouse/learning/README.md +40 -0
  687. package/overlays/data-warehouse/learning/learning-conventions.md +113 -0
  688. package/overlays/data-warehouse/learning/phase-roadmap.md +444 -0
  689. package/overlays/data-warehouse/learning/progress.md +38 -0
  690. package/overlays/data-warehouse/rules/amis-accounting-standards.md +271 -0
  691. package/overlays/data-warehouse/rules/duckdb-concurrency.md +362 -0
  692. package/overlays/data-warehouse/rules/pii-scrubbing.md +238 -0
  693. package/overlays/data-warehouse/rules/stocktake-tolerance.md +276 -0
  694. package/overlays/ecommerce-microservices/README.md +65 -0
  695. package/overlays/ecommerce-microservices/config/README.md +3 -0
  696. package/overlays/ecommerce-microservices/rules/README.md +3 -0
  697. package/overlays/ecommerce-microservices/skills/README.md +3 -0
  698. package/overlays/ecommerce-microservices/workflows/README.md +3 -0
  699. package/overlays/fintech-compliance/README.md +50 -0
  700. package/overlays/fintech-compliance/rules/credit-scorecard-rules.md +98 -0
  701. package/overlays/fintech-compliance/skills/build-credit-scorecard/SKILL.md +133 -0
  702. package/overlays/go-microservices/README.md +78 -0
  703. package/overlays/go-microservices/rules/go-conventions.md +223 -0
  704. package/overlays/hugo-authority-content/README.md +58 -0
  705. package/overlays/hugo-authority-content/config/sites.md +51 -0
  706. package/overlays/hugo-authority-content/roles/README.md +25 -0
  707. package/overlays/hugo-authority-content/rules/content-brand.md +124 -0
  708. package/overlays/hugo-authority-content/rules/link-topology.md +72 -0
  709. package/overlays/hugo-authority-content/rules/seo-authority.md +83 -0
  710. package/overlays/hugo-authority-content/rules/technical-article-2027.md +91 -0
  711. package/overlays/hugo-authority-content/skills/audit-technical-article/SKILL.md +77 -0
  712. package/overlays/hugo-authority-content/skills/write-hugo-twin-content/SKILL.md +103 -0
  713. package/overlays/hugo-authority-content/skills/write-hugo-twin-content/agents/openai.yaml +4 -0
  714. package/overlays/hugo-authority-content/workflows/README.md +31 -0
  715. package/overlays/hugo-authority-content/workflows/affiliate-publishing.md +55 -0
  716. package/overlays/hugo-authority-content/workflows/article-creation-and-upgrade-lifecycle.md +426 -0
  717. package/overlays/hugo-authority-content/workflows/content-audit-refresh.md +105 -0
  718. package/overlays/hugo-authority-content/workflows/masterclass-batch-upgrade.md +66 -0
  719. package/overlays/hugo-authority-content/workflows/publish-series.md +126 -0
  720. package/overlays/hugo-authority-content/workflows/series-sync-upgrade.md +138 -0
  721. package/overlays/hvac-authority-content/README.md +54 -0
  722. package/overlays/hvac-authority-content/config/collections.md +70 -0
  723. package/overlays/hvac-authority-content/rules/content-schema.md +134 -0
  724. package/overlays/hvac-authority-content/rules/hvac-engineering-standards.md +62 -0
  725. package/overlays/hvac-authority-content/rules/silo-linking.md +73 -0
  726. package/overlays/hvac-authority-content/skills/write-hvac-authority-content/SKILL.md +80 -0
  727. package/overlays/hvac-authority-content/workflows/publish-hvac-content.md +102 -0
  728. package/overlays/laravel-ecommerce/README.md +39 -0
  729. package/overlays/laravel-ecommerce/config/README.md +3 -0
  730. package/overlays/laravel-ecommerce/roles/README.md +3 -0
  731. package/overlays/laravel-ecommerce/rules/elomus-design-system.md +89 -0
  732. package/overlays/laravel-ecommerce/rules/laravel-ecommerce-rules.md +107 -0
  733. package/overlays/laravel-ecommerce/skills/develop-laravel-ecommerce-feature/SKILL.md +125 -0
  734. package/overlays/laravel-ecommerce/skills/develop-laravel-ecommerce-feature/agents/openai.yaml +4 -0
  735. package/overlays/laravel-ecommerce/workflows/README.md +3 -0
  736. package/overlays/laravel-ecommerce/workflows/deploy-laravel-ecommerce.md +128 -0
  737. package/overlays/laravel-filament/README.md +90 -0
  738. package/overlays/laravel-filament/config/README.md +3 -0
  739. package/overlays/laravel-filament/roles/README.md +3 -0
  740. package/overlays/laravel-filament/rules/laravel-conventions.md +220 -0
  741. package/overlays/laravel-filament/skills/develop-laravel-feature/SKILL.md +141 -0
  742. package/overlays/laravel-filament/skills/develop-laravel-feature/agents/openai.yaml +4 -0
  743. package/overlays/laravel-filament/workflows/README.md +3 -0
  744. package/overlays/laravel-filament/workflows/deploy-laravel.md +134 -0
  745. package/overlays/livestream-web/README.md +45 -0
  746. package/overlays/livestream-web/rules/livestream-web-ux-conventions.md +55 -0
  747. package/overlays/obj-configurator/README.md +42 -0
  748. package/overlays/obj-configurator/rules/obj-project-rules.md +111 -0
  749. package/overlays/obj-configurator/skills/develop-obj-feature/SKILL.md +71 -0
  750. package/overlays/obj-configurator/skills/develop-obj-feature/agents/openai.yaml +4 -0
  751. package/overlays/r3f-stack/README.md +89 -0
  752. package/overlays/r3f-stack/rules/stub.md +43 -0
  753. package/overlays/r3f-stack/skills/debug-3d-scene/SKILL.md +166 -0
  754. package/overlays/r3f-stack/skills/debug-3d-scene/agents/openai.yaml +4 -0
  755. package/overlays/r3f-stack/skills/integrate-r3f-three-legacy/SKILL.md +159 -0
  756. package/overlays/r3f-stack/skills/integrate-r3f-three-legacy/agents/openai.yaml +4 -0
  757. package/overlays/r3f-stack/skills/optimize-3d-assets/SKILL.md +128 -0
  758. package/overlays/r3f-stack/skills/optimize-3d-assets/agents/openai.yaml +4 -0
  759. package/overlays/real-estate-content/README.md +51 -0
  760. package/overlays/real-estate-content/config/collections.md +64 -0
  761. package/overlays/real-estate-content/roles/README.md +25 -0
  762. package/overlays/real-estate-content/rules/affiliate-links.md +54 -0
  763. package/overlays/real-estate-content/rules/content-schema.md +89 -0
  764. package/overlays/real-estate-content/rules/seo-baseline.md +53 -0
  765. package/overlays/real-estate-content/skills/write-real-estate-astro-data/SKILL.md +102 -0
  766. package/overlays/real-estate-content/skills/write-real-estate-astro-data/agents/openai.yaml +4 -0
  767. package/overlays/real-estate-content/workflows/README.md +25 -0
  768. package/overlays/real-estate-content/workflows/publish-real-estate-content.md +68 -0
  769. package/overlays/security-research/README.md +50 -0
  770. package/overlays/security-research/rules/reverse-engineering-rules.md +82 -0
  771. package/overlays/security-research/skills/reverse-engineer-binary/SKILL.md +129 -0
  772. package/overlays/seo-publishing/README.md +93 -0
  773. package/overlays/seo-publishing/rules/publish-log-conventions.md +64 -0
  774. package/overlays/seo-publishing/rules/publishing-cadence.md +89 -0
  775. package/overlays/seo-publishing/rules/site-mix-and-cannibalization.md +52 -0
  776. package/overlays/seo-publishing/rules/topic-board-template.md +67 -0
  777. package/overlays/ui-design-system/README.md +59 -0
  778. package/overlays/ui-design-system/rules/handoff-conventions.md +73 -0
  779. package/package.json +47 -4
  780. package/packs/README.md +223 -0
  781. package/packs/affiliate-cashback-team/README.md +219 -0
  782. package/packs/affiliate-cashback-team/manifest.yaml +125 -0
  783. package/packs/affiliate-cashback-team/workflows/affiliate-tri-engine-lifecycle.md +178 -0
  784. package/packs/b2b-catalog-team/manifest.yaml +63 -0
  785. package/packs/b2b-golf-team/manifest.yaml +63 -0
  786. package/packs/b2b-sport-team/manifest.yaml +63 -0
  787. package/packs/content-sprint-team/manifest.yaml +61 -0
  788. package/packs/data-analyst-team/manifest.yaml +65 -0
  789. package/packs/data-warehouse/manifest.yaml +143 -0
  790. package/packs/ecommerce-team/manifest.yaml +65 -0
  791. package/packs/global-engineering/manifest.yaml +55 -0
  792. package/packs/hugo-authority-team/README.md +381 -0
  793. package/packs/hugo-authority-team/manifest.yaml +167 -0
  794. package/packs/hugo-authority-team/workflows/article-creation-and-upgrade-lifecycle.md +426 -0
  795. package/packs/hvac-content-team/README.md +194 -0
  796. package/packs/hvac-content-team/manifest.yaml +117 -0
  797. package/packs/hvac-content-team/workflows/publish-hvac-content.md +68 -0
  798. package/packs/landing-pages-team/README.md +115 -0
  799. package/packs/landing-pages-team/manifest.yaml +91 -0
  800. package/packs/landing-pages-team/workflows/landing-page-creation-lifecycle.md +70 -0
  801. package/packs/laravel-ecommerce-team/manifest.yaml +65 -0
  802. package/packs/livestream-team/manifest.yaml +61 -0
  803. package/packs/mmo-growth-team/README.md +206 -0
  804. package/packs/mmo-growth-team/manifest.yaml +131 -0
  805. package/packs/obj-team/manifest.yaml +68 -0
  806. package/packs/real-estate-team/README.md +208 -0
  807. package/packs/real-estate-team/manifest.yaml +117 -0
  808. package/packs/real-estate-team/workflows/publish-real-estate-content.md +73 -0
@@ -0,0 +1,271 @@
1
+ # MISA AMIS Accounting Standards & Omnichannel Revenue Recognition
2
+
3
+ Operational standard and statutory accounting compliance rules for synchronizing omnichannel retail data (physical POS, Shopee, TikTok Shop) with MISA AMIS ERP. This rule enforces Vietnamese Accounting Standard 14 (VAS 14), Circular 200/2014/TT-BTC, Circular 133/2016/TT-BTC, strict delivery-time revenue recognition, 3-tier voucher decomposition, separate selling expense classification (TK 641), pretax unit price isolation, and inventory costing controls (TK 1561 / TK 632).
4
+
5
+ ---
6
+
7
+ ## 1. VAS 14 Revenue Recognition Invariant
8
+
9
+ ### 1.1 Statutory Criteria (Circular 200 / VAS 14)
10
+ Under Vietnamese Accounting Standard No. 14 (VAS 14 — *Revenue and Other Income*) and Circular 200/2014/TT-BTC (Article 79), revenue from goods sales (`TK 5111` / `TK 5112`) must be recognized if and only if **all five** statutory criteria are satisfied simultaneously:
11
+ 1. The enterprise has transferred to the buyer the significant risks and rewards of ownership of the goods.
12
+ 2. The enterprise retains neither continuing managerial involvement to the degree usually associated with ownership nor effective control over the goods sold.
13
+ 3. The amount of revenue can be measured reliably.
14
+ 4. It is probable that the economic benefits associated with the transaction will flow to the enterprise.
15
+ 5. The costs incurred or to be incurred in respect of the transaction can be measured reliably.
16
+
17
+ ### 1.2 The Strict Delivery Confirmation Invariant
18
+ In omnichannel e-commerce (Shopee, TikTok Shop, Web POS):
19
+ - **Mandatory Recognition Point**: Revenue and corresponding Cost of Goods Sold (COGS) **MUST ONLY BE RECOGNIZED** when an order reaches a terminal, confirmed completion state (`Delivered` / `Completed` / `Hoàn thành`).
20
+ - **STRICT PROHIBITION**: It is strictly prohibited to recognize sales revenue for orders currently in transit (`In Transit` / `Shipping` / `Đang vận chuyển`). While in transit, customer refusal, package damage, or delivery failure can occur, meaning risks and rewards of ownership remain with the merchant.
21
+
22
+ ### 1.3 Statutory Journal Entries by Order Lifecycle State
23
+
24
+ #### Phase 1: Order Pack & Dispatch (In Transit)
25
+ Goods leaving the warehouse are transferred to suspense inventory `TK 157` (*Hàng gửi đi bán*). Zero revenue is recognized.
26
+ - **Inventory Transfer**:
27
+ - `Debit TK 157` (*Hàng gửi đi bán*): Cost of dispatched goods
28
+ - `Credit TK 1561` (*Giá mua hàng hóa*): Cost of dispatched goods
29
+
30
+ #### Phase 2: Successful Delivery Confirmation (`Completed`)
31
+ Upon customer receipt confirmation via platform webhook or 3PL API:
32
+ - **Sales Revenue & Receivables Recognition**:
33
+ - `Debit TK 1388 (Shopee / TikTok Shop)` or `Debit TK 131 (POS Customer)`: Total gross order receivable
34
+ - `Credit TK 5111` (*Doanh thu bán hàng hóa*): Net pretax revenue
35
+ - `Credit TK 33311` (*Thuế GTGT đầu ra*): Output VAT payable
36
+ - **COGS Derecognition**:
37
+ - `Debit TK 632` (*Giá vốn hàng bán*): Historical inventory cost
38
+ - `Credit TK 157` (*Hàng gửi đi bán*): Historical inventory cost
39
+
40
+ #### Phase 3: Delivery Failure / Customer Return (`Returned` / `Cancelled`)
41
+ When a shipment fails or is rejected by the customer:
42
+ - **Inventory Return**:
43
+ - `Debit TK 1561` (*Giá mua hàng hóa*): Cost of returned goods
44
+ - `Credit TK 157` (*Hàng gửi đi bán*): Cost of returned goods
45
+ - Zero revenue and zero COGS entries are recorded. If a customer return occurs post-completion, issue a statutory Sales Return voucher (`TK 5212` / `TK 33311` / `TK 1388`).
46
+
47
+ ---
48
+
49
+ ## 2. 3-Tier E-Commerce Voucher Decomposition
50
+
51
+ E-commerce platforms (Shopee, TikTok Shop) allow stacking multiple promotional discounts on a single checkout. Aggregating these discounts into a single flat reduction distorts statutory revenue, falsifies receivables, and creates severe tax penalties.
52
+
53
+ All automated sync pipelines must decompose discounts into three distinct economic tiers:
54
+
55
+ | Voucher Tier | Economic Sponsor | Accounting Impact | Statutory Recording in MISA AMIS |
56
+ |:---|:---|:---|:---|
57
+ | **Tier 1: Shop Voucher** | Merchant / Seller | Trade discount reducing merchant revenue | Deducted from `TK 5111` or booked as `Debit TK 5211` (*Chiết khấu thương mại*) |
58
+ | **Tier 2: Platform Voucher** | Shopee / TikTok Shop | Platform marketing subsidy; does NOT reduce merchant gross revenue | Included in Gross Sales (`Credit TK 5111` + `Credit TK 33311`); voucher amount booked as receivable `Debit TK 1388` |
59
+ | **Tier 3: Shipping Subsidy** | Platform / 3PL | Pass-through logistics subsidy paid directly to carrier | Excluded entirely from merchandise sales (`TK 5111`). If routed through settlement, recorded in clearing `TK 1388 / TK 3388` |
60
+
61
+ ### 2.1 Voucher Decomposition Python Implementation
62
+ ```python
63
+ """Decompose e-commerce checkout line items into statutory 3-tier accounting buckets."""
64
+
65
+ from decimal import Decimal, ROUND_HALF_EVEN
66
+ from dataclasses import dataclass
67
+
68
+ @dataclass(frozen=True)
69
+ class OrderFinancialDecomposition:
70
+ gross_merchandise_pretax: Decimal
71
+ output_vat: Decimal
72
+ shop_discount_pretax: Decimal
73
+ platform_voucher_receivable: Decimal
74
+ customer_paid_cash: Decimal
75
+ net_sales_revenue: Decimal
76
+
77
+ def decompose_order_vouchers(
78
+ item_gross_price: Decimal,
79
+ quantity: int,
80
+ vat_rate: Decimal,
81
+ shop_voucher_gross: Decimal,
82
+ platform_voucher_gross: Decimal,
83
+ ) -> OrderFinancialDecomposition:
84
+ """Calculates statutory accounting buckets under VAS 14.
85
+
86
+ All gross figures are VAT-inclusive; pretax values are derived deterministically.
87
+ """
88
+ one = Decimal("1.00")
89
+ vat_divisor = one + vat_rate
90
+
91
+ # 1. Total gross merchandise value
92
+ total_gross = item_gross_price * Decimal(quantity)
93
+ gross_pretax = (total_gross / vat_divisor).quantize(Decimal("0.01"), rounding=ROUND_HALF_EVEN)
94
+
95
+ # 2. Tier 1: Shop Voucher (Trade discount reducing revenue)
96
+ shop_discount_pretax = (shop_voucher_gross / vat_divisor).quantize(
97
+ Decimal("0.01"), rounding=ROUND_HALF_EVEN
98
+ )
99
+
100
+ # Statutory Net Pretax Sales Revenue (TK 5111)
101
+ net_sales_pretax = gross_pretax - shop_discount_pretax
102
+ output_vat = (net_sales_pretax * vat_rate).quantize(Decimal("0.01"), rounding=ROUND_HALF_EVEN)
103
+
104
+ # 3. Tier 2: Platform Voucher (Receivable from platform, does not reduce revenue)
105
+ platform_receivable = platform_voucher_gross
106
+
107
+ # 4. Customer Cash Settlement (COD or payment gateway)
108
+ customer_cash = (total_gross - shop_voucher_gross - platform_voucher_gross).quantize(
109
+ Decimal("0.01"), rounding=ROUND_HALF_EVEN
110
+ )
111
+
112
+ return OrderFinancialDecomposition(
113
+ gross_merchandise_pretax=gross_pretax,
114
+ output_vat=output_vat,
115
+ shop_discount_pretax=shop_discount_pretax,
116
+ platform_voucher_receivable=platform_receivable,
117
+ customer_paid_cash=customer_cash,
118
+ net_sales_revenue=net_sales_pretax,
119
+ )
120
+ ```
121
+
122
+ ---
123
+
124
+ ## 3. Selling Expenses: Platform Fees in TK 641 (No-Netting Mandate)
125
+
126
+ ### 3.1 The Strict Prohibition Against Netting
127
+ E-commerce platforms deduct transaction fees, commission fees, payment processing fees, and affiliate fees directly from the merchant's payout balance.
128
+ - **NO NETTING RULE**: Under Circular 200/2014/TT-BTC (Article 79) and tax regulations issued by the General Department of Taxation, **expenses must never be netted against gross revenue**.
129
+ - Netting platform fees against sales revenue artificially deflates statutory turnover, distorts audited gross profit margins, and violates corporate income tax (CIT) and value-added tax (VAT) reporting requirements.
130
+
131
+ ### 3.2 Standard Statutory Journal Entries for Platform Settlement
132
+
133
+ ```text
134
+ 1. Recognizing Sales & Platform Receivables upon Delivery:
135
+ Debit TK 1388 (Chi tiết: Sàn TMĐT Shopee/TikTok): 1,100,000 VND
136
+ Credit TK 5111 (Doanh thu bán lẻ): 1,000,000 VND
137
+ Credit TK 33311 (Thuế GTGT đầu ra 10%): 100,000 VND
138
+
139
+ 2. Recording Platform Service Fees (Based on Platform E-Invoice):
140
+ Debit TK 6417 / TK 6418 (Chi phí dịch vụ bán hàng sàn): 50,000 VND
141
+ Debit TK 1331 (Thuế GTGT đầu vào được khấu trừ 10%): 5,000 VND
142
+ Credit TK 1388 (Cấn trừ công nợ sàn): 55,000 VND
143
+
144
+ 3. Bank Cash Payout Receipt (Net Remittance from Platform):
145
+ Debit TK 1121 (Tiền gửi ngân hàng): 1,045,000 VND
146
+ Credit TK 1388 (Thu hồi dứt điểm công nợ sàn): 1,045,000 VND
147
+ ```
148
+
149
+ ---
150
+
151
+ ## 4. Pretax Unit Price Isolation (Double VAT Prevention on MISA AMIS)
152
+
153
+ ### 4.1 Root Cause of Double VAT Distortion
154
+ MISA AMIS ERP calculates sales VAT automatically using the line item formula:
155
+ $$\text{VAT Amount} = \text{UnitPrice} \times \text{Quantity} \times \text{VAT Rate}$$
156
+
157
+ In consumer retail (Shopee, TikTok Shop, POS counters), all displayed prices and customer payments are **VAT-inclusive (Gross)**.
158
+ - If an integration pipeline directly inputs `Price_gross` into MISA AMIS's `UnitPrice` field, MISA AMIS applies the tax rate a second time.
159
+ - *Example Disaster*: For a product sold at $110,000\text{ VND}$ (inclusive of $10\%$ VAT, true pretax = $100,000\text{ VND}$, true VAT = $10,000\text{ VND}$):
160
+ - If $110,000$ is posted as `UnitPrice`: MISA AMIS computes $\text{VAT} = 11,000\text{ VND}$, resulting in total voucher amount $= 121,000\text{ VND}$!
161
+ - This creates false tax liabilities, overstates customer invoices, and causes audit rejection.
162
+
163
+ ### 4.2 Mandatory Pretax Formula & Banker's Rounding
164
+ The pretax unit price must be isolated prior to generating MISA AMIS voucher XML/JSON payloads:
165
+ $$\text{UnitPrice}_{\text{pretax}} = \frac{\text{UnitPrice}_{\text{gross}}}{1 + \text{VAT\_Rate}}$$
166
+
167
+ #### Rounding & Reconciliation Invariant:
168
+ 1. Maintain unit prices with 4 decimal places during intermediate transformations.
169
+ 2. Apply Banker's Rounding (`ROUND_HALF_EVEN`) to 2 decimal places (or integer VND) for line items.
170
+ 3. Validate invoice reconciliation before submission to MISA AMIS:
171
+ $$\left|\sum (\text{Line Pretax Amounts}) + \sum (\text{Line VAT}) - \text{Total Customer Paid}\right| = 0$$
172
+
173
+ ---
174
+
175
+ ## 5. Inventory Accounting: TK 1561 / TK 632
176
+
177
+ ### 5.1 Costing Methods & Ledger Parity
178
+ - All retail inventory must be maintained under **TK 1561** (*Giá mua hàng hóa*) using either **Monthly Weighted Average** (*Bình quân gia quyền*) or **FIFO** (*Nhập trước xuất trước*).
179
+ - Every sales dispatch voucher synced to MISA AMIS must generate a paired inventory delivery note (*Phiếu xuất kho kiêm bán hàng*):
180
+ - `Debit TK 632` (*Giá vốn hàng bán*)
181
+ - `Credit TK 1561` (*Giá mua hàng hóa*)
182
+
183
+ ### 5.2 Warehouse Code & SKU Mapping Standards
184
+ - MISA AMIS requires explicit warehouse codes (`StockCode`, e.g., `KHO_TONG`, `KHO_STORE_01`, `KHO_SHOPEE`).
185
+ - SKU codes must match between the Lakehouse Silver catalog and MISA AMIS inventory master data (`InventoryItemCode`). Unmapped SKUs must be routed to a quarantine reconciliation queue rather than posting to a generic placeholder.
186
+
187
+ ---
188
+
189
+ ## 6. MISA AMIS Sync Payload Schema Mapping
190
+
191
+ All outgoing vouchers to MISA AMIS must adhere to the structured schema defined in `core/contracts/schemas/amis-voucher-contract.json`:
192
+
193
+ ```json
194
+ {
195
+ "voucher_type": "delivery_note_cum_sales_invoice",
196
+ "voucher_date": "2026-09-05",
197
+ "posting_date": "2026-09-05",
198
+ "channel": "shopee",
199
+ "order_sn": "260905SHOPEE9981",
200
+ "currency": "VND",
201
+ "exchange_rate": 1.0,
202
+ "customer_code": "CUST_SHOPEE_RETAIL",
203
+ "customer_name": "Khách lẻ Shopee",
204
+ "journal_entries": [
205
+ {
206
+ "debit_account": "1388",
207
+ "credit_account": "5111",
208
+ "amount": 250000.0,
209
+ "description": "Doanh thu bán hàng đơn 260905SHOPEE9981"
210
+ },
211
+ {
212
+ "debit_account": "1388",
213
+ "credit_account": "33311",
214
+ "amount": 25000.0,
215
+ "description": "Thuế GTGT đầu ra 10% đơn 260905SHOPEE9981"
216
+ },
217
+ {
218
+ "debit_account": "632",
219
+ "credit_account": "1561",
220
+ "amount": 160000.0,
221
+ "description": "Giá vốn hàng bán đơn 260905SHOPEE9981"
222
+ }
223
+ ],
224
+ "line_items": [
225
+ {
226
+ "inventory_item_code": "SKU-POLO-NAVY-M",
227
+ "stock_code": "KHO_SHOPEE",
228
+ "quantity": 1,
229
+ "unit_price_pretax": 250000.0,
230
+ "vat_rate": 0.10,
231
+ "vat_amount": 25000.0,
232
+ "cogs_amount": 160000.0
233
+ }
234
+ ]
235
+ }
236
+ ```
237
+
238
+ ---
239
+
240
+ ## Standard 2026 Alignment
241
+
242
+ This overlay rule file is part of the agent-skills engineering pack. The 2026
243
+ upgrade pass added the following Standard 2026 alignment footer to every
244
+ overlay rule file in the pack.
245
+
246
+ - **OWASP ASI**: applied as described in the core pack — see
247
+ `core/roles/role-standard.md` (ASI01-ASI10) and the per-skill
248
+ `## Security Guardrails (OWASP ASI)` section in each skill. The rules in this
249
+ file are applied by the role that owns the affected action; the runtime
250
+ gate is `core/scripts/hooks/check-policy.py` with
251
+ `core/policies/action-boundaries.yaml`.
252
+ - **Failure Modes** (overlay-specific): the rules in this file can be violated
253
+ by drift, missing context, or untracked exceptions. The owning role is
254
+ expected to surface concrete failure scenarios in the workflow's
255
+ `### Failure Modes` section and to capture remediations via
256
+ `contracts/schemas/incident-report.json` when the rule is bypassed.
257
+ - **Output Contracts**: when a rule in this file produces a structured
258
+ artifact (brief, plan, config, content handoff, audit event), the artifact
259
+ must conform to the corresponding schema in `core/contracts/schemas/`.
260
+ See `core/skills/security-data/manage-vietnam-accounting/SKILL.md` and the `amis-voucher-contract.json` schema.
261
+ - **Skill Toolbox Lock**: a rule in this file is enforced by the role whose
262
+ Skill Toolbox lists the related skill as Primary. Roles that hold the
263
+ skill as Supporting must delegate rather than execute directly (per
264
+ `core/workflows/README.md`).
265
+ - **Commit / publish gate**: rule changes that affect user-visible behavior
266
+ must follow the META-RULE in `core/rules/code.md` — no commit, no push,
267
+ no publish without explicit user confirmation.
268
+
269
+ See `core/skills/security-data/manage-vietnam-accounting/SKILL.md` and the `amis-voucher-contract.json` schema.
270
+
271
+ Last updated: 2026-09-05
@@ -0,0 +1,362 @@
1
+ # DuckDB Concurrency & Single-Writer Governance
2
+
3
+ Operational standard and runtime governance for embedded DuckDB 1.5+ write operations in omnichannel retail architectures. This rule establishes strict single-writer multi-process serialization, resilient lock acquisition with exponential backoff and jitter, connection lifecycle discipline, and architectural segregation between OLTP (SQLite WAL) and OLAP (DuckDB).
4
+
5
+ ## 1. Concurrency Architecture & Failure Domain
6
+
7
+ ### 1.1 The DuckDB Concurrency Constraint
8
+ DuckDB utilizes an embedded columnar database engine optimized for vectorized OLAP workloads. By design:
9
+ - Multiple concurrent reader processes can safely query a single DuckDB database file simultaneously when connected in `read_only=True` mode.
10
+ - **Strictly only ONE writer process** can hold an open write handle to a `.duckdb` database file at any given moment.
11
+
12
+ When multiple processes (such as multiple ASGI Uvicorn workers, Celery/RQ background tasks, or cron ETL scripts) attempt to open concurrent write connections without coordination, DuckDB triggers an unrecoverable IO collision:
13
+ ```text
14
+ duckdb.IOException: Could not set lock on file ".../warehouse.duckdb": Resource temporarily unavailable
15
+ ```
16
+ Uncoordinated write attempts cause transaction aborts, corrupted lock headers, worker restarts, and data loss.
17
+
18
+ ### 1.2 Multi-Tier Serialization via `AsyncCrossProcessLock`
19
+ To enforce absolute single-writer governance across asynchronous coroutines, multiple operating system processes, and containerized multi-node deployments, all write operations must pass through `AsyncCrossProcessLock`.
20
+
21
+ The lock combines three distinct synchronization tiers:
22
+ 1. **Tier 1: In-Process Asynchronous Lock (`asyncio.Lock`)**:
23
+ - Serializes concurrent coroutines running inside the same Python event loop.
24
+ - Prevents intra-process contention and eliminates unnecessary OS kernel lock requests within the same worker.
25
+ 2. **Tier 2: Host-Level Inter-Process File Lock (`filelock.FileLock`)**:
26
+ - Acquires an exclusive file lock on a dedicated auxiliary lockfile (`<database>.duckdb.lock`).
27
+ - Prevents independent Python OS processes (e.g., separate Uvicorn worker PIDs) on the same host from opening simultaneous write connections.
28
+ 3. **Tier 3: Distributed Cluster Lock (Redis Lock with Fail-Closed Semantics)**:
29
+ - When running across multiple containers, pods, or host nodes, an atomic Redis lock (`SET lock:duckdb_writer <uuid> NX PX <lease_ms>`) acts as the distributed arbiter.
30
+ - **Fail-Closed Mandate**: If the Redis cluster is unreachable, encounters a network partition, or times out, lock acquisition **MUST FAIL CLOSED** immediately. Bypassing the distributed lock to "attempt writing anyway" is strictly prohibited under all circumstances.
31
+
32
+ ---
33
+
34
+ ## 2. Implementation Specification: `AsyncCrossProcessLock`
35
+
36
+ The following reference implementation provides the production-grade implementation required for all data pipelines and write endpoints.
37
+
38
+ ```python
39
+ """Single-writer governance for DuckDB multi-process concurrency."""
40
+
41
+ from __future__ import annotations
42
+
43
+ import asyncio
44
+ import logging
45
+ import os
46
+ import random
47
+ import time
48
+ from contextlib import asynccontextmanager
49
+ from dataclasses import dataclass
50
+ from pathlib import Path
51
+ from typing import AsyncIterator, Optional
52
+
53
+ import duckdb
54
+ from filelock import FileLock, Timeout as FileLockTimeout
55
+
56
+ logger = logging.getLogger("retail.duckdb.concurrency")
57
+
58
+
59
+ class DuckDBLockAcquisitionError(RuntimeError):
60
+ """Raised when the DuckDB single-writer lock cannot be acquired."""
61
+
62
+
63
+ class DuckDBFailClosedError(DuckDBLockAcquisitionError):
64
+ """Raised when distributed lockarbiter is unreachable and fail-closed policy triggers."""
65
+
66
+
67
+ @dataclass(frozen=True)
68
+ class LockConfig:
69
+ """Configuration parameters for DuckDB single-writer acquisition."""
70
+ timeout_seconds: float = 30.0
71
+ base_backoff_seconds: float = 0.1
72
+ max_backoff_seconds: float = 3.0
73
+ jitter_fraction: float = 0.2
74
+ redis_lease_ms: int = 30000
75
+
76
+
77
+ class AsyncCrossProcessLock:
78
+ """Three-tier cross-process lock coordinator for DuckDB single-writer operations.
79
+
80
+ Combines asyncio.Lock (coroutine tier), FileLock (host process tier),
81
+ and Redis atomic key (cluster tier, fail-closed).
82
+ """
83
+
84
+ _coro_locks: dict[str, asyncio.Lock] = {}
85
+
86
+ def __init__(
87
+ self,
88
+ db_path: Path | str,
89
+ lock_file_path: Optional[Path | str] = None,
90
+ redis_client: Optional[object] = None,
91
+ config: Optional[LockConfig] = None,
92
+ ) -> None:
93
+ self.db_path = Path(db_path).resolve()
94
+ self.lock_file_path = (
95
+ Path(lock_file_path).resolve()
96
+ if lock_file_path
97
+ else self.db_path.with_suffix(".duckdb.lock")
98
+ )
99
+ self.redis_client = redis_client
100
+ self.config = config or LockConfig()
101
+
102
+ # In-process coroutine lock registration
103
+ str_key = str(self.db_path)
104
+ if str_key not in self._coro_locks:
105
+ self._coro_locks[str_key] = asyncio.Lock()
106
+ self.coro_lock = self._coro_locks[str_key]
107
+
108
+ # OS file lock on auxiliary lock file
109
+ self.file_lock = FileLock(str(self.lock_file_path), timeout=0)
110
+
111
+ async def _acquire_redis_lock(self, token: str) -> bool:
112
+ """Acquire atomic cluster lock via Redis. Fails closed on any network error."""
113
+ if not self.redis_client:
114
+ return True # Standalone single-host mode
115
+ try:
116
+ # Atomic SET ... NX PX
117
+ acquired = await self.redis_client.set(
118
+ f"lock:duckdb_writer:{self.db_path.name}",
119
+ token,
120
+ nx=True,
121
+ px=self.config.redis_lease_ms,
122
+ )
123
+ return bool(acquired)
124
+ except Exception as exc:
125
+ logger.error("Redis lockarbiter connection failed: %s. Enforcing FAIL-CLOSED policy.", exc)
126
+ raise DuckDBFailClosedError(f"Redis lockarbiter failure: {exc}") from exc
127
+
128
+ async def _release_redis_lock(self, token: str) -> None:
129
+ """Release cluster lock using Lua script to verify ownership token."""
130
+ if not self.redis_client:
131
+ return
132
+ lua_release = """
133
+ if redis.call("get", KEYS[1]) == ARGV[1] then
134
+ return redis.call("del", KEYS[1])
135
+ else
136
+ return 0
137
+ end
138
+ """
139
+ try:
140
+ await self.redis_client.eval(
141
+ lua_release,
142
+ 1,
143
+ f"lock:duckdb_writer:{self.db_path.name}",
144
+ token,
145
+ )
146
+ except Exception as exc:
147
+ logger.warning("Error releasing Redis lock token %s: %s", token, exc)
148
+
149
+ @asynccontextmanager
150
+ async def acquire(self) -> AsyncIterator[None]:
151
+ """Acquire in-process, OS, and cluster locks with backoff and jitter."""
152
+ token = f"{os.getpid()}-{time.time()}-{random.randint(1000, 9999)}"
153
+ start_time = time.monotonic()
154
+ attempt = 0
155
+
156
+ # Tier 1: Coroutine serialization
157
+ await self.coro_lock.acquire()
158
+ try:
159
+ # Tier 2 & 3: Multi-process and cluster acquisition loop
160
+ while True:
161
+ elapsed = time.monotonic() - start_time
162
+ remaining_timeout = self.config.timeout_seconds - elapsed
163
+
164
+ if remaining_timeout <= 0:
165
+ raise DuckDBLockAcquisitionError(
166
+ f"Timed out after {self.config.timeout_seconds:.1f}s waiting for "
167
+ f"DuckDB lock on {self.db_path.name}"
168
+ )
169
+
170
+ try:
171
+ # Attempt non-blocking FileLock acquisition
172
+ self.file_lock.acquire(timeout=0.01)
173
+ file_lock_acquired = True
174
+ except FileLockTimeout:
175
+ file_lock_acquired = False
176
+
177
+ if file_lock_acquired:
178
+ try:
179
+ redis_acquired = await self._acquire_redis_lock(token)
180
+ if redis_acquired:
181
+ # All three tiers acquired successfully
182
+ break
183
+ # Release file lock if Redis cluster acquisition did not succeed
184
+ self.file_lock.release()
185
+ except Exception:
186
+ self.file_lock.release()
187
+ raise
188
+
189
+ # Calculate exponential backoff with randomized jitter
190
+ attempt += 1
191
+ backoff = min(
192
+ self.config.max_backoff_seconds,
193
+ self.config.base_backoff_seconds * (2 ** (attempt - 1)),
194
+ )
195
+ jitter = backoff * self.config.jitter_fraction * (random.uniform(-1.0, 1.0))
196
+ sleep_duration = max(0.05, min(remaining_timeout, backoff + jitter))
197
+
198
+ logger.debug(
199
+ "Lock contention on %s. Retrying in %.3fs (attempt %d)",
200
+ self.db_path.name,
201
+ sleep_duration,
202
+ attempt,
203
+ )
204
+ await asyncio.sleep(sleep_duration)
205
+
206
+ # Yield control to the caller while holding all locks
207
+ try:
208
+ yield
209
+ finally:
210
+ # Release Tier 3 (Redis)
211
+ await self._release_redis_lock(token)
212
+ # Release Tier 2 (FileLock)
213
+ if self.file_lock.is_locked:
214
+ self.file_lock.release()
215
+ finally:
216
+ # Release Tier 1 (asyncio.Lock)
217
+ self.coro_lock.release()
218
+ ```
219
+
220
+ ---
221
+
222
+ ## 3. Connection Lifecycle Management
223
+
224
+ ### 3.1 Write Connections: Strict Ephemeral Pattern
225
+ Write connections must NEVER be held as global variables, connection pools, or persistent application state. Every write operation must follow this exact lifecycle:
226
+
227
+ ```python
228
+ # CORRECT: Ephemeral write connection wrapped in AsyncCrossProcessLock
229
+ async def insert_gold_daily_sales(db_path: Path, parquet_path: Path) -> None:
230
+ lock = AsyncCrossProcessLock(db_path)
231
+ async with lock.acquire():
232
+ # Open write handle ONLY after acquiring the lock
233
+ con = duckdb.connect(str(db_path), read_only=False)
234
+ try:
235
+ con.execute("BEGIN TRANSACTION;")
236
+ con.execute("""
237
+ MERGE INTO gold_daily_sales AS target
238
+ USING (SELECT * FROM read_parquet(?)) AS source
239
+ ON target.store_id = source.store_id
240
+ AND target.sale_date = source.sale_date
241
+ WHEN MATCHED THEN UPDATE SET
242
+ gross_revenue = source.gross_revenue,
243
+ net_revenue = source.net_revenue,
244
+ order_count = source.order_count,
245
+ updated_at = CURRENT_TIMESTAMP
246
+ WHEN NOT MATCHED THEN INSERT VALUES (
247
+ source.store_id, source.sale_date, source.gross_revenue,
248
+ source.net_revenue, source.order_count, CURRENT_TIMESTAMP
249
+ );
250
+ """, [str(parquet_path)])
251
+ con.execute("COMMIT;")
252
+ except Exception:
253
+ con.execute("ROLLBACK;")
254
+ raise
255
+ finally:
256
+ # MUST explicitly close before releasing the lock
257
+ con.close()
258
+ ```
259
+
260
+ ### 3.2 Read Connections: Pooled / Long-Lived
261
+ Read operations do not acquire `AsyncCrossProcessLock`. Multiple workers can connect simultaneously:
262
+ ```python
263
+ # CORRECT: Read-only connection for analytical queries
264
+ def query_store_inventory_turnover(db_path: Path, store_id: str) -> list[tuple]:
265
+ with duckdb.connect(str(db_path), read_only=True) as con:
266
+ return con.execute("""
267
+ SELECT sku, current_stock, turnover_rate
268
+ FROM gold_inventory_metrics
269
+ WHERE store_id = ?
270
+ ORDER BY turnover_rate DESC
271
+ """, [store_id]).fetchall()
272
+ ```
273
+
274
+ ---
275
+
276
+ ## 4. Architectural Segregation: OLTP (SQLite WAL) vs. OLAP (DuckDB)
277
+
278
+ To prevent analytical DuckDB locks from starving high-speed retail checkout or physical barcode scanning, omnichannel retail systems enforce strict database tiering:
279
+
280
+ | Architecture Boundary | OLTP Ingestion Layer | OLAP Analytical Warehouse |
281
+ |:---|:---|:---|
282
+ | **Underlying Engine** | SQLite (WAL Mode) | DuckDB 1.5+ |
283
+ | **Concurrency Model** | Concurrent readers + serialized non-blocking writer | Concurrent readers + `AsyncCrossProcessLock` writer |
284
+ | **Write Latency SLA** | $< 2\text{ms}$ per transaction | Batch micro-intervals ($10\text{s} - 5\text{min}$) |
285
+ | **Primary Workload** | Barcode scan stream, POS receipts, cart events | Medallion aggregation, cohort analysis, AMIS sync feeds |
286
+ | **Storage Layout** | Row-oriented SQLite tables (`store/buffer_oltp.db`) | Columnar partitioned Parquet & DuckDB Gold tables |
287
+
288
+ ### 4.1 SQLite WAL Configuration
289
+ Every SQLite OLTP database instance must be initialized with the following pragmas:
290
+ ```sql
291
+ PRAGMA journal_mode = WAL;
292
+ PRAGMA synchronous = NORMAL;
293
+ PRAGMA busy_timeout = 5000;
294
+ PRAGMA foreign_keys = ON;
295
+ ```
296
+
297
+ ### 4.2 Micro-Batch CDC Pipeline to DuckDB
298
+ A lightweight asynchronous worker drains committed events from SQLite WAL every $N$ seconds, formats them into a Bronze/Silver Parquet chunk, and acquires `AsyncCrossProcessLock` to commit the data into DuckDB Gold tables:
299
+ ```text
300
+ [POS / Scanners] ──(HTTP/WS)──> [FastAPI Worker] ──(Append)──> [SQLite WAL]
301
+ │
302
+ (Batch Drain every 15s)
303
+ ▼
304
+ [Parquet Staging]
305
+ │
306
+ (AsyncCrossProcessLock)
307
+ ▼
308
+ [DuckDB Gold Warehouse]
309
+ ```
310
+
311
+ ---
312
+
313
+ ## 5. Failure Modes & Operational Runbook
314
+
315
+ ### 5.1 Lock Starvation & Timeout Escalation
316
+ - **Symptom**: `DuckDBLockAcquisitionError: Timed out after 30.0s waiting for DuckDB lock`.
317
+ - **Root Cause**: A long-running analytical query held a write connection instead of `read_only=True`, or an unhandled exception terminated a worker without closing the write handle.
318
+ - **Remediation**:
319
+ 1. Inspect active processes holding `.duckdb.lock` via OS tools (`lsof` or `handle.exe`).
320
+ 2. Verify whether any batch job is executing long-running unindexed `MERGE` statements.
321
+ 3. Ensure all analytical read endpoints explicitly instantiate `read_only=True`.
322
+
323
+ ### 5.2 Stale Lockfile Protocol
324
+ If an abrupt operating system kill signal (`SIGKILL` / `kill -9`) terminates a Python process while holding `filelock.FileLock`, modern OS kernels automatically release the file descriptor lock. However, if using NFS or network-attached mounts where lockfiles persist:
325
+ 1. Verify the owning PID recorded in the lock telemetry is no longer running.
326
+ 2. Only after PID validation, safely remove the orphaned `.duckdb.lock` file.
327
+ 3. Emit a structured incident event conforming to `core/contracts/schemas/incident-report.json`.
328
+
329
+ ---
330
+
331
+ ## Standard 2026 Alignment
332
+
333
+ This overlay rule file is part of the agent-skills engineering pack. The 2026
334
+ upgrade pass added the following Standard 2026 alignment footer to every
335
+ overlay rule file in the pack.
336
+
337
+ - **OWASP ASI**: applied as described in the core pack — see
338
+ `core/roles/role-standard.md` (ASI01-ASI10) and the per-skill
339
+ `## Security Guardrails (OWASP ASI)` section in each skill. The rules in this
340
+ file are applied by the role that owns the affected action; the runtime
341
+ gate is `core/scripts/hooks/check-policy.py` with
342
+ `core/policies/action-boundaries.yaml`.
343
+ - **Failure Modes** (overlay-specific): the rules in this file can be violated
344
+ by drift, missing context, or untracked exceptions. The owning role is
345
+ expected to surface concrete failure scenarios in the workflow's
346
+ `### Failure Modes` section and to capture remediations via
347
+ `contracts/schemas/incident-report.json` when the rule is bypassed.
348
+ - **Output Contracts**: when a rule in this file produces a structured
349
+ artifact (brief, plan, config, content handoff, audit event), the artifact
350
+ must conform to the corresponding schema in `core/contracts/schemas/`.
351
+ See `core/skills/security-data/build-data-pipeline/SKILL.md` and the `data-pipeline-spec.json` schema.
352
+ - **Skill Toolbox Lock**: a rule in this file is enforced by the role whose
353
+ Skill Toolbox lists the related skill as Primary. Roles that hold the
354
+ skill as Supporting must delegate rather than execute directly (per
355
+ `core/workflows/README.md`).
356
+ - **Commit / publish gate**: rule changes that affect user-visible behavior
357
+ must follow the META-RULE in `core/rules/code.md` — no commit, no push,
358
+ no publish without explicit user confirmation.
359
+
360
+ See `core/skills/security-data/build-data-pipeline/SKILL.md` and the `data-pipeline-spec.json` schema.
361
+
362
+ Last updated: 2026-09-05