@ketecode/loom 0.0.0-stage → 0.1.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 (656) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +516 -2
  3. package/agents/accessibility-reviewer/AGENT.md +70 -0
  4. package/agents/accessibility-reviewer/evals/triggers.json +15 -0
  5. package/agents/agent-evaluator/AGENT.md +74 -0
  6. package/agents/agent-evaluator/evals/triggers.json +15 -0
  7. package/agents/architect/AGENT.md +82 -0
  8. package/agents/architect/evals/triggers.json +17 -0
  9. package/agents/billing-reviewer/AGENT.md +68 -0
  10. package/agents/billing-reviewer/evals/triggers.json +16 -0
  11. package/agents/code-reviewer/AGENT.md +51 -0
  12. package/agents/code-reviewer/evals/triggers.json +14 -0
  13. package/agents/code-simplifier/AGENT.md +74 -0
  14. package/agents/code-simplifier/evals/triggers.json +15 -0
  15. package/agents/cpp-build-resolver/AGENT.md +73 -0
  16. package/agents/cpp-build-resolver/evals/triggers.json +16 -0
  17. package/agents/cpp-reviewer/AGENT.md +59 -0
  18. package/agents/cpp-reviewer/evals/triggers.json +16 -0
  19. package/agents/csharp-build-resolver/AGENT.md +84 -0
  20. package/agents/csharp-build-resolver/evals/triggers.json +17 -0
  21. package/agents/csharp-reviewer/AGENT.md +88 -0
  22. package/agents/csharp-reviewer/evals/triggers.json +17 -0
  23. package/agents/dart-build-resolver/AGENT.md +80 -0
  24. package/agents/dart-build-resolver/evals/triggers.json +17 -0
  25. package/agents/dart-reviewer/AGENT.md +66 -0
  26. package/agents/dart-reviewer/evals/triggers.json +17 -0
  27. package/agents/database-reviewer/AGENT.md +72 -0
  28. package/agents/database-reviewer/evals/triggers.json +16 -0
  29. package/agents/django-reviewer/AGENT.md +61 -0
  30. package/agents/django-reviewer/evals/triggers.json +15 -0
  31. package/agents/doc-updater/AGENT.md +92 -0
  32. package/agents/doc-updater/evals/triggers.json +14 -0
  33. package/agents/e2e-runner/AGENT.md +88 -0
  34. package/agents/e2e-runner/evals/triggers.json +16 -0
  35. package/agents/fastapi-reviewer/AGENT.md +63 -0
  36. package/agents/fastapi-reviewer/evals/triggers.json +15 -0
  37. package/agents/flutter-reviewer/AGENT.md +70 -0
  38. package/agents/flutter-reviewer/evals/triggers.json +15 -0
  39. package/agents/fsharp-build-resolver/AGENT.md +81 -0
  40. package/agents/fsharp-build-resolver/evals/triggers.json +15 -0
  41. package/agents/fsharp-reviewer/AGENT.md +77 -0
  42. package/agents/fsharp-reviewer/evals/triggers.json +15 -0
  43. package/agents/go-build-resolver/AGENT.md +85 -0
  44. package/agents/go-build-resolver/evals/triggers.json +16 -0
  45. package/agents/go-reviewer/AGENT.md +66 -0
  46. package/agents/go-reviewer/evals/triggers.json +16 -0
  47. package/agents/healthcare-reviewer/AGENT.md +65 -0
  48. package/agents/healthcare-reviewer/evals/triggers.json +16 -0
  49. package/agents/i18n-reviewer/AGENT.md +64 -0
  50. package/agents/i18n-reviewer/evals/triggers.json +16 -0
  51. package/agents/infra-reviewer/AGENT.md +93 -0
  52. package/agents/infra-reviewer/evals/triggers.json +15 -0
  53. package/agents/java-build-resolver/AGENT.md +82 -0
  54. package/agents/java-build-resolver/evals/triggers.json +16 -0
  55. package/agents/java-reviewer/AGENT.md +64 -0
  56. package/agents/java-reviewer/evals/triggers.json +16 -0
  57. package/agents/kotlin-build-resolver/AGENT.md +89 -0
  58. package/agents/kotlin-build-resolver/evals/triggers.json +16 -0
  59. package/agents/kotlin-reviewer/AGENT.md +75 -0
  60. package/agents/kotlin-reviewer/evals/triggers.json +16 -0
  61. package/agents/mle-reviewer/AGENT.md +68 -0
  62. package/agents/mle-reviewer/evals/triggers.json +16 -0
  63. package/agents/network-config-reviewer/AGENT.md +68 -0
  64. package/agents/network-config-reviewer/evals/triggers.json +17 -0
  65. package/agents/payments-reviewer/AGENT.md +64 -0
  66. package/agents/payments-reviewer/evals/triggers.json +16 -0
  67. package/agents/performance-optimizer/AGENT.md +86 -0
  68. package/agents/performance-optimizer/evals/triggers.json +16 -0
  69. package/agents/perl-build-resolver/AGENT.md +84 -0
  70. package/agents/perl-build-resolver/evals/triggers.json +15 -0
  71. package/agents/perl-reviewer/AGENT.md +77 -0
  72. package/agents/perl-reviewer/evals/triggers.json +15 -0
  73. package/agents/php-build-resolver/AGENT.md +88 -0
  74. package/agents/php-build-resolver/evals/triggers.json +16 -0
  75. package/agents/php-reviewer/AGENT.md +61 -0
  76. package/agents/php-reviewer/evals/triggers.json +15 -0
  77. package/agents/planner/AGENT.md +75 -0
  78. package/agents/planner/evals/triggers.json +17 -0
  79. package/agents/pr-test-analyzer/AGENT.md +82 -0
  80. package/agents/pr-test-analyzer/evals/triggers.json +16 -0
  81. package/agents/python-build-resolver/AGENT.md +87 -0
  82. package/agents/python-build-resolver/evals/triggers.json +16 -0
  83. package/agents/python-reviewer/AGENT.md +63 -0
  84. package/agents/python-reviewer/evals/triggers.json +15 -0
  85. package/agents/rag-reviewer/AGENT.md +71 -0
  86. package/agents/rag-reviewer/evals/triggers.json +16 -0
  87. package/agents/react-reviewer/AGENT.md +70 -0
  88. package/agents/react-reviewer/evals/triggers.json +16 -0
  89. package/agents/refactor-cleaner/AGENT.md +82 -0
  90. package/agents/refactor-cleaner/evals/triggers.json +16 -0
  91. package/agents/ruby-build-resolver/AGENT.md +93 -0
  92. package/agents/ruby-build-resolver/evals/triggers.json +16 -0
  93. package/agents/ruby-reviewer/AGENT.md +62 -0
  94. package/agents/ruby-reviewer/evals/triggers.json +16 -0
  95. package/agents/rust-build-resolver/AGENT.md +98 -0
  96. package/agents/rust-build-resolver/evals/triggers.json +16 -0
  97. package/agents/rust-reviewer/AGENT.md +78 -0
  98. package/agents/rust-reviewer/evals/triggers.json +15 -0
  99. package/agents/security-reviewer/AGENT.md +84 -0
  100. package/agents/security-reviewer/evals/triggers.json +16 -0
  101. package/agents/silent-failure-hunter/AGENT.md +66 -0
  102. package/agents/silent-failure-hunter/evals/triggers.json +16 -0
  103. package/agents/solidity-reviewer/AGENT.md +70 -0
  104. package/agents/solidity-reviewer/evals/triggers.json +16 -0
  105. package/agents/swift-build-resolver/AGENT.md +85 -0
  106. package/agents/swift-build-resolver/evals/triggers.json +15 -0
  107. package/agents/swift-reviewer/AGENT.md +75 -0
  108. package/agents/swift-reviewer/evals/triggers.json +15 -0
  109. package/agents/typescript-build-resolver/AGENT.md +76 -0
  110. package/agents/typescript-build-resolver/evals/triggers.json +15 -0
  111. package/agents/typescript-reviewer/AGENT.md +76 -0
  112. package/agents/typescript-reviewer/evals/triggers.json +15 -0
  113. package/agents/vue-reviewer/AGENT.md +75 -0
  114. package/agents/vue-reviewer/evals/triggers.json +15 -0
  115. package/bin/kete-loom.js +683 -0
  116. package/commands/aside.md +19 -0
  117. package/commands/build-fix.md +26 -0
  118. package/commands/campaign.md +19 -0
  119. package/commands/changelog.md +36 -0
  120. package/commands/checkpoint.md +26 -0
  121. package/commands/codemap.md +25 -0
  122. package/commands/commit.md +26 -0
  123. package/commands/deps-audit.md +32 -0
  124. package/commands/epic-decompose.md +21 -0
  125. package/commands/explain.md +37 -0
  126. package/commands/feature-dev.md +22 -0
  127. package/commands/hookify.md +23 -0
  128. package/commands/i18n-check.md +39 -0
  129. package/commands/issue-sync.md +22 -0
  130. package/commands/jira.md +19 -0
  131. package/commands/learn.md +23 -0
  132. package/commands/loom.md +21 -0
  133. package/commands/loop.md +20 -0
  134. package/commands/model-route.md +27 -0
  135. package/commands/onboard.md +35 -0
  136. package/commands/orchestrate.md +21 -0
  137. package/commands/plan-feature.md +36 -0
  138. package/commands/postmortem.md +42 -0
  139. package/commands/pr-describe.md +39 -0
  140. package/commands/pr.md +22 -0
  141. package/commands/prd.md +41 -0
  142. package/commands/project-init.md +21 -0
  143. package/commands/refactor-clean.md +24 -0
  144. package/commands/resume-session.md +22 -0
  145. package/commands/review.md +35 -0
  146. package/commands/save-session.md +37 -0
  147. package/commands/security-scan.md +32 -0
  148. package/commands/sessions.md +21 -0
  149. package/commands/skill-create.md +21 -0
  150. package/commands/tdd.md +36 -0
  151. package/commands/test-coverage.md +24 -0
  152. package/commands/threat-model.md +36 -0
  153. package/commands/update-docs.md +25 -0
  154. package/commands/verify.md +21 -0
  155. package/hooks/block-dangerous-commands/HOOK.md +30 -0
  156. package/hooks/block-dangerous-commands/cases.json +50 -0
  157. package/hooks/block-dangerous-commands/hook.js +75 -0
  158. package/hooks/block-no-verify/HOOK.md +25 -0
  159. package/hooks/block-no-verify/cases.json +30 -0
  160. package/hooks/block-no-verify/hook.js +43 -0
  161. package/hooks/format-on-edit/HOOK.md +24 -0
  162. package/hooks/format-on-edit/hook.js +89 -0
  163. package/hooks/guard-secrets/HOOK.md +19 -0
  164. package/hooks/guard-secrets/cases.json +110 -0
  165. package/hooks/guard-secrets/hook.js +44 -0
  166. package/hooks/load-session-context/HOOK.md +20 -0
  167. package/hooks/load-session-context/hook.js +56 -0
  168. package/hooks/protect-files/HOOK.md +24 -0
  169. package/hooks/protect-files/cases.json +27 -0
  170. package/hooks/protect-files/hook.js +39 -0
  171. package/hooks/run.js +132 -0
  172. package/mcp/atlassian.json +11 -0
  173. package/mcp/chrome-devtools.json +18 -0
  174. package/mcp/cloudflare.json +11 -0
  175. package/mcp/context7.json +11 -0
  176. package/mcp/fetch.json +17 -0
  177. package/mcp/figma.json +11 -0
  178. package/mcp/git.json +17 -0
  179. package/mcp/github.json +11 -0
  180. package/mcp/linear.json +11 -0
  181. package/mcp/memory.json +18 -0
  182. package/mcp/notion.json +11 -0
  183. package/mcp/playwright.json +18 -0
  184. package/mcp/sentry.json +11 -0
  185. package/mcp/stripe.json +11 -0
  186. package/mcp/supabase.json +11 -0
  187. package/mcp/time.json +17 -0
  188. package/package.json +59 -4
  189. package/profiles.json +165 -0
  190. package/rules/common.md +21 -0
  191. package/rules/cpp.md +29 -0
  192. package/rules/csharp.md +25 -0
  193. package/rules/dart.md +29 -0
  194. package/rules/fsharp.md +28 -0
  195. package/rules/git.md +26 -0
  196. package/rules/go.md +29 -0
  197. package/rules/java.md +29 -0
  198. package/rules/kotlin.md +27 -0
  199. package/rules/perl.md +26 -0
  200. package/rules/php.md +28 -0
  201. package/rules/python.md +30 -0
  202. package/rules/ruby.md +27 -0
  203. package/rules/rust.md +26 -0
  204. package/rules/security.md +29 -0
  205. package/rules/swift.md +28 -0
  206. package/rules/testing.md +25 -0
  207. package/rules/typescript.md +29 -0
  208. package/schemas/skill-frontmatter.schema.json +52 -0
  209. package/scripts/lib/audit.js +96 -0
  210. package/scripts/lib/frontmatter.js +65 -0
  211. package/scripts/lib/hooks-install.js +292 -0
  212. package/scripts/lib/i18n.js +51 -0
  213. package/scripts/lib/inventory.js +85 -0
  214. package/scripts/lib/lint.js +158 -0
  215. package/scripts/lib/mcp-install.js +284 -0
  216. package/scripts/lib/profiles.js +128 -0
  217. package/scripts/lib/render.js +86 -0
  218. package/scripts/lib/rules-install.js +118 -0
  219. package/scripts/lib/skills.js +86 -0
  220. package/scripts/lib/targets.js +113 -0
  221. package/skills/accounting-api-integration/SKILL.md +81 -0
  222. package/skills/accounting-api-integration/evals/triggers.json +17 -0
  223. package/skills/accounting-api-integration/references/quickbooks.md +48 -0
  224. package/skills/accounting-api-integration/references/xero.md +45 -0
  225. package/skills/agent-harness-design/SKILL.md +125 -0
  226. package/skills/agent-harness-design/evals/triggers.json +21 -0
  227. package/skills/ai-media-generation/SKILL.md +89 -0
  228. package/skills/ai-media-generation/evals/triggers.json +16 -0
  229. package/skills/ai-media-generation/references/job-pipeline.md +76 -0
  230. package/skills/angular-patterns/SKILL.md +122 -0
  231. package/skills/angular-patterns/evals/triggers.json +16 -0
  232. package/skills/api-design/SKILL.md +96 -0
  233. package/skills/api-design/evals/triggers.json +18 -0
  234. package/skills/api-design/references/conventions.md +133 -0
  235. package/skills/architecture-decision-records/SKILL.md +98 -0
  236. package/skills/architecture-decision-records/evals/triggers.json +17 -0
  237. package/skills/article-writing/SKILL.md +108 -0
  238. package/skills/article-writing/evals/triggers.json +16 -0
  239. package/skills/aspnet-core-patterns/SKILL.md +149 -0
  240. package/skills/aspnet-core-patterns/evals/triggers.json +16 -0
  241. package/skills/auth-patterns/SKILL.md +104 -0
  242. package/skills/auth-patterns/evals/triggers.json +17 -0
  243. package/skills/auth-patterns/references/oauth-oidc.md +64 -0
  244. package/skills/autonomous-loops/SKILL.md +99 -0
  245. package/skills/autonomous-loops/evals/triggers.json +14 -0
  246. package/skills/aws-patterns/SKILL.md +91 -0
  247. package/skills/aws-patterns/evals/triggers.json +16 -0
  248. package/skills/azure-patterns/SKILL.md +86 -0
  249. package/skills/azure-patterns/evals/triggers.json +16 -0
  250. package/skills/benchmark-methodology/SKILL.md +88 -0
  251. package/skills/benchmark-methodology/evals/triggers.json +16 -0
  252. package/skills/benchmark-methodology/references/language-harnesses.md +130 -0
  253. package/skills/bgp-diagnostics/SKILL.md +84 -0
  254. package/skills/bgp-diagnostics/evals/triggers.json +18 -0
  255. package/skills/bgp-diagnostics/references/bgp-reference.md +81 -0
  256. package/skills/bioinformatics-workflows/SKILL.md +108 -0
  257. package/skills/bioinformatics-workflows/evals/triggers.json +16 -0
  258. package/skills/bioinformatics-workflows/references/commands.md +71 -0
  259. package/skills/bioinformatics-workflows/references/formats.md +24 -0
  260. package/skills/bioinformatics-workflows/references/workflow-managers.md +107 -0
  261. package/skills/brand-voice/SKILL.md +112 -0
  262. package/skills/brand-voice/evals/triggers.json +16 -0
  263. package/skills/browser-qa/SKILL.md +99 -0
  264. package/skills/browser-qa/evals/triggers.json +16 -0
  265. package/skills/bun-runtime/SKILL.md +93 -0
  266. package/skills/bun-runtime/evals/triggers.json +16 -0
  267. package/skills/cisco-ios-config/SKILL.md +101 -0
  268. package/skills/cisco-ios-config/evals/triggers.json +18 -0
  269. package/skills/cisco-ios-config/references/verification.md +63 -0
  270. package/skills/clickhouse-patterns/SKILL.md +101 -0
  271. package/skills/clickhouse-patterns/evals/triggers.json +18 -0
  272. package/skills/clickhouse-patterns/references/engines-and-views.md +138 -0
  273. package/skills/clinical-decision-support/SKILL.md +90 -0
  274. package/skills/clinical-decision-support/evals/triggers.json +16 -0
  275. package/skills/clinical-decision-support/references/cds-hooks.md +76 -0
  276. package/skills/clinical-decision-support/references/regulatory-boundaries.md +37 -0
  277. package/skills/code-tour/SKILL.md +97 -0
  278. package/skills/code-tour/evals/triggers.json +14 -0
  279. package/skills/codebase-onboarding/SKILL.md +112 -0
  280. package/skills/codebase-onboarding/evals/triggers.json +14 -0
  281. package/skills/cold-outreach-sequences/SKILL.md +90 -0
  282. package/skills/cold-outreach-sequences/evals/triggers.json +16 -0
  283. package/skills/content-repurposing/SKILL.md +82 -0
  284. package/skills/content-repurposing/evals/triggers.json +16 -0
  285. package/skills/context-budget/SKILL.md +84 -0
  286. package/skills/context-budget/evals/triggers.json +14 -0
  287. package/skills/conventional-commits/SKILL.md +144 -0
  288. package/skills/conventional-commits/evals/triggers.json +16 -0
  289. package/skills/cpp-patterns/SKILL.md +129 -0
  290. package/skills/cpp-patterns/evals/triggers.json +16 -0
  291. package/skills/cpp-patterns/references/cmake-and-tooling.md +88 -0
  292. package/skills/cpp-patterns/references/undefined-behaviour.md +75 -0
  293. package/skills/cpp-testing/SKILL.md +131 -0
  294. package/skills/cpp-testing/evals/triggers.json +16 -0
  295. package/skills/csharp-patterns/SKILL.md +110 -0
  296. package/skills/csharp-patterns/evals/triggers.json +17 -0
  297. package/skills/csharp-patterns/references/analyzers.md +59 -0
  298. package/skills/csharp-testing/SKILL.md +85 -0
  299. package/skills/csharp-testing/evals/triggers.json +17 -0
  300. package/skills/csharp-testing/references/integration-tests.md +77 -0
  301. package/skills/css-architecture/SKILL.md +143 -0
  302. package/skills/css-architecture/evals/triggers.json +16 -0
  303. package/skills/customs-trade-compliance/SKILL.md +95 -0
  304. package/skills/customs-trade-compliance/evals/triggers.json +16 -0
  305. package/skills/customs-trade-compliance/references/incoterms-2020.md +42 -0
  306. package/skills/dart-patterns/SKILL.md +157 -0
  307. package/skills/dart-patterns/evals/triggers.json +18 -0
  308. package/skills/dart-testing/SKILL.md +164 -0
  309. package/skills/dart-testing/evals/triggers.json +18 -0
  310. package/skills/data-analysis-notebooks/SKILL.md +113 -0
  311. package/skills/data-analysis-notebooks/evals/triggers.json +16 -0
  312. package/skills/data-analysis-notebooks/references/dataframe-pitfalls.md +49 -0
  313. package/skills/data-analysis-notebooks/references/statistics-pitfalls.md +24 -0
  314. package/skills/data-pipelines/SKILL.md +90 -0
  315. package/skills/data-pipelines/evals/triggers.json +16 -0
  316. package/skills/data-pipelines/references/orchestrators.md +64 -0
  317. package/skills/database-migrations/SKILL.md +102 -0
  318. package/skills/database-migrations/evals/triggers.json +16 -0
  319. package/skills/database-migrations/references/recipes.md +98 -0
  320. package/skills/database-migrations/references/tools.md +21 -0
  321. package/skills/dbt-patterns/SKILL.md +96 -0
  322. package/skills/dbt-patterns/evals/triggers.json +16 -0
  323. package/skills/dbt-patterns/references/yaml-examples.md +114 -0
  324. package/skills/deep-research/SKILL.md +107 -0
  325. package/skills/deep-research/evals/triggers.json +14 -0
  326. package/skills/dependency-audit/SKILL.md +103 -0
  327. package/skills/dependency-audit/evals/triggers.json +16 -0
  328. package/skills/dependency-audit/references/tools.md +124 -0
  329. package/skills/deployment-strategies/SKILL.md +108 -0
  330. package/skills/deployment-strategies/evals/triggers.json +16 -0
  331. package/skills/django-patterns/SKILL.md +123 -0
  332. package/skills/django-patterns/evals/triggers.json +16 -0
  333. package/skills/docker-patterns/SKILL.md +132 -0
  334. package/skills/docker-patterns/evals/triggers.json +16 -0
  335. package/skills/docker-patterns/references/dockerfiles.md +105 -0
  336. package/skills/e2e-testing-playwright/SKILL.md +94 -0
  337. package/skills/e2e-testing-playwright/evals/triggers.json +16 -0
  338. package/skills/e2e-testing-playwright/references/config-and-ci.md +129 -0
  339. package/skills/ef-core-patterns/SKILL.md +117 -0
  340. package/skills/ef-core-patterns/evals/triggers.json +16 -0
  341. package/skills/email-deliverability/SKILL.md +99 -0
  342. package/skills/email-deliverability/evals/triggers.json +17 -0
  343. package/skills/email-deliverability/references/dns-records.md +85 -0
  344. package/skills/error-handling-patterns/SKILL.md +112 -0
  345. package/skills/error-handling-patterns/evals/triggers.json +18 -0
  346. package/skills/error-handling-patterns/references/language-idioms.md +49 -0
  347. package/skills/estimation-and-scoping/SKILL.md +97 -0
  348. package/skills/estimation-and-scoping/evals/triggers.json +14 -0
  349. package/skills/evm-dapp-integration/SKILL.md +73 -0
  350. package/skills/evm-dapp-integration/evals/triggers.json +16 -0
  351. package/skills/fastapi-patterns/SKILL.md +127 -0
  352. package/skills/fastapi-patterns/evals/triggers.json +16 -0
  353. package/skills/ffmpeg-media-processing/SKILL.md +94 -0
  354. package/skills/ffmpeg-media-processing/evals/triggers.json +16 -0
  355. package/skills/ffmpeg-media-processing/references/recipes.md +112 -0
  356. package/skills/fhir-integration/SKILL.md +81 -0
  357. package/skills/fhir-integration/evals/triggers.json +16 -0
  358. package/skills/fhir-integration/references/search-and-bundles.md +73 -0
  359. package/skills/fhir-integration/references/smart-on-fhir.md +50 -0
  360. package/skills/flask-patterns/SKILL.md +132 -0
  361. package/skills/flask-patterns/evals/triggers.json +16 -0
  362. package/skills/flutter-patterns/SKILL.md +99 -0
  363. package/skills/flutter-patterns/evals/triggers.json +16 -0
  364. package/skills/flutterwave-integration/SKILL.md +75 -0
  365. package/skills/flutterwave-integration/evals/triggers.json +16 -0
  366. package/skills/flutterwave-integration/references/api.md +73 -0
  367. package/skills/flutterwave-integration/references/webhooks.md +49 -0
  368. package/skills/fsharp-patterns/SKILL.md +133 -0
  369. package/skills/fsharp-patterns/evals/triggers.json +16 -0
  370. package/skills/fsharp-testing/SKILL.md +136 -0
  371. package/skills/fsharp-testing/evals/triggers.json +16 -0
  372. package/skills/gcp-patterns/SKILL.md +86 -0
  373. package/skills/gcp-patterns/evals/triggers.json +16 -0
  374. package/skills/git-workflow/SKILL.md +114 -0
  375. package/skills/git-workflow/evals/triggers.json +16 -0
  376. package/skills/github-actions-ci/SKILL.md +117 -0
  377. package/skills/github-actions-ci/evals/triggers.json +16 -0
  378. package/skills/github-api-automation/SKILL.md +101 -0
  379. package/skills/github-api-automation/evals/triggers.json +17 -0
  380. package/skills/go-patterns/SKILL.md +118 -0
  381. package/skills/go-patterns/evals/triggers.json +17 -0
  382. package/skills/go-patterns/references/concurrency.md +162 -0
  383. package/skills/go-testing/SKILL.md +154 -0
  384. package/skills/go-testing/evals/triggers.json +17 -0
  385. package/skills/hexagonal-architecture/SKILL.md +89 -0
  386. package/skills/hexagonal-architecture/evals/triggers.json +17 -0
  387. package/skills/hipaa-compliance/SKILL.md +91 -0
  388. package/skills/hipaa-compliance/evals/triggers.json +18 -0
  389. package/skills/hipaa-compliance/references/safeguards.md +68 -0
  390. package/skills/hl7v2-integration/SKILL.md +69 -0
  391. package/skills/hl7v2-integration/evals/triggers.json +16 -0
  392. package/skills/hl7v2-integration/references/messages-and-ack.md +78 -0
  393. package/skills/homelab-network-setup/SKILL.md +125 -0
  394. package/skills/homelab-network-setup/evals/triggers.json +18 -0
  395. package/skills/homelab-network-setup/references/firewall-and-dns.md +45 -0
  396. package/skills/homelab-network-setup/references/wireguard.md +72 -0
  397. package/skills/hubtel-integration/SKILL.md +77 -0
  398. package/skills/hubtel-integration/evals/triggers.json +16 -0
  399. package/skills/hubtel-integration/references/api.md +92 -0
  400. package/skills/i18n-localization/SKILL.md +114 -0
  401. package/skills/i18n-localization/evals/triggers.json +16 -0
  402. package/skills/i18n-localization/references/libraries.md +52 -0
  403. package/skills/incident-postmortem/SKILL.md +118 -0
  404. package/skills/incident-postmortem/evals/triggers.json +14 -0
  405. package/skills/inventory-demand-planning/SKILL.md +89 -0
  406. package/skills/inventory-demand-planning/evals/triggers.json +16 -0
  407. package/skills/inventory-demand-planning/references/formulas.md +62 -0
  408. package/skills/investor-materials/SKILL.md +127 -0
  409. package/skills/investor-materials/evals/triggers.json +16 -0
  410. package/skills/investor-materials/references/templates.md +74 -0
  411. package/skills/invoicing-and-tax/SKILL.md +84 -0
  412. package/skills/invoicing-and-tax/evals/triggers.json +17 -0
  413. package/skills/invoicing-and-tax/references/e-invoicing.md +24 -0
  414. package/skills/invoicing-and-tax/references/invoice-fields.md +38 -0
  415. package/skills/invoicing-and-tax/references/rounding.md +26 -0
  416. package/skills/java-patterns/SKILL.md +141 -0
  417. package/skills/java-patterns/evals/triggers.json +17 -0
  418. package/skills/java-testing/SKILL.md +142 -0
  419. package/skills/java-testing/evals/triggers.json +16 -0
  420. package/skills/jetpack-compose-patterns/SKILL.md +88 -0
  421. package/skills/jetpack-compose-patterns/evals/triggers.json +16 -0
  422. package/skills/jira-integration/SKILL.md +92 -0
  423. package/skills/jira-integration/evals/triggers.json +17 -0
  424. package/skills/jpa-hibernate/SKILL.md +92 -0
  425. package/skills/jpa-hibernate/evals/triggers.json +18 -0
  426. package/skills/jpa-hibernate/references/mapping.md +99 -0
  427. package/skills/kotlin-multiplatform/SKILL.md +97 -0
  428. package/skills/kotlin-multiplatform/evals/triggers.json +16 -0
  429. package/skills/kotlin-patterns/SKILL.md +128 -0
  430. package/skills/kotlin-patterns/evals/triggers.json +16 -0
  431. package/skills/kotlin-testing/SKILL.md +117 -0
  432. package/skills/kotlin-testing/evals/triggers.json +16 -0
  433. package/skills/ktor-patterns/SKILL.md +135 -0
  434. package/skills/ktor-patterns/evals/triggers.json +18 -0
  435. package/skills/kubernetes-patterns/SKILL.md +106 -0
  436. package/skills/kubernetes-patterns/evals/triggers.json +16 -0
  437. package/skills/kubernetes-patterns/references/manifests.md +115 -0
  438. package/skills/laravel-patterns/SKILL.md +136 -0
  439. package/skills/laravel-patterns/evals/triggers.json +16 -0
  440. package/skills/linear-integration/SKILL.md +98 -0
  441. package/skills/linear-integration/evals/triggers.json +17 -0
  442. package/skills/literature-review/SKILL.md +109 -0
  443. package/skills/literature-review/evals/triggers.json +16 -0
  444. package/skills/literature-review/references/appraisal.md +41 -0
  445. package/skills/literature-review/references/search-sources.md +39 -0
  446. package/skills/llm-app-patterns/SKILL.md +97 -0
  447. package/skills/llm-app-patterns/evals/triggers.json +17 -0
  448. package/skills/llm-evals/SKILL.md +98 -0
  449. package/skills/llm-evals/evals/triggers.json +16 -0
  450. package/skills/llm-evals/references/graders.md +66 -0
  451. package/skills/logistics-exception-management/SKILL.md +90 -0
  452. package/skills/logistics-exception-management/evals/triggers.json +16 -0
  453. package/skills/manim-animations/SKILL.md +106 -0
  454. package/skills/manim-animations/evals/triggers.json +16 -0
  455. package/skills/market-research/SKILL.md +117 -0
  456. package/skills/market-research/evals/triggers.json +16 -0
  457. package/skills/marketing-campaign/SKILL.md +111 -0
  458. package/skills/marketing-campaign/evals/triggers.json +16 -0
  459. package/skills/mcp-server-patterns/SKILL.md +127 -0
  460. package/skills/mcp-server-patterns/evals/triggers.json +18 -0
  461. package/skills/mcp-server-patterns/references/protocol-notes.md +68 -0
  462. package/skills/metrics-dashboards/SKILL.md +113 -0
  463. package/skills/metrics-dashboards/evals/triggers.json +16 -0
  464. package/skills/ml-experiment-workflow/SKILL.md +125 -0
  465. package/skills/ml-experiment-workflow/evals/triggers.json +16 -0
  466. package/skills/mongodb-patterns/SKILL.md +115 -0
  467. package/skills/mongodb-patterns/evals/triggers.json +18 -0
  468. package/skills/mongodb-patterns/references/indexes-and-aggregation.md +94 -0
  469. package/skills/mpesa-daraja-integration/SKILL.md +70 -0
  470. package/skills/mpesa-daraja-integration/evals/triggers.json +16 -0
  471. package/skills/mpesa-daraja-integration/references/api.md +103 -0
  472. package/skills/mpesa-daraja-integration/references/callbacks.md +74 -0
  473. package/skills/mtn-momo-integration/SKILL.md +66 -0
  474. package/skills/mtn-momo-integration/evals/triggers.json +16 -0
  475. package/skills/mtn-momo-integration/references/api.md +153 -0
  476. package/skills/mtn-momo-integration/references/callbacks.md +92 -0
  477. package/skills/mtn-momo-integration/references/sandbox-and-go-live.md +51 -0
  478. package/skills/mtn-momo-integration/scripts/sandbox-setup.js +79 -0
  479. package/skills/mysql-patterns/SKILL.md +96 -0
  480. package/skills/mysql-patterns/evals/triggers.json +16 -0
  481. package/skills/mysql-patterns/references/explain.md +34 -0
  482. package/skills/mysql-patterns/references/online-ddl.md +41 -0
  483. package/skills/nestjs-patterns/SKILL.md +114 -0
  484. package/skills/nestjs-patterns/evals/triggers.json +16 -0
  485. package/skills/nestjs-patterns/references/testing.md +68 -0
  486. package/skills/network-automation/SKILL.md +107 -0
  487. package/skills/network-automation/evals/triggers.json +18 -0
  488. package/skills/network-automation/references/tool-snippets.md +153 -0
  489. package/skills/network-troubleshooting/SKILL.md +152 -0
  490. package/skills/network-troubleshooting/evals/triggers.json +18 -0
  491. package/skills/network-troubleshooting/references/commands.md +33 -0
  492. package/skills/nextjs-patterns/SKILL.md +150 -0
  493. package/skills/nextjs-patterns/evals/triggers.json +18 -0
  494. package/skills/nextjs-patterns/references/caching.md +87 -0
  495. package/skills/node-backend-patterns/SKILL.md +103 -0
  496. package/skills/node-backend-patterns/evals/triggers.json +16 -0
  497. package/skills/node-backend-patterns/references/templates.md +122 -0
  498. package/skills/nuxt-patterns/SKILL.md +103 -0
  499. package/skills/nuxt-patterns/evals/triggers.json +16 -0
  500. package/skills/parallel-agent-orchestration/SKILL.md +106 -0
  501. package/skills/parallel-agent-orchestration/evals/triggers.json +14 -0
  502. package/skills/paystack-integration/SKILL.md +59 -0
  503. package/skills/paystack-integration/evals/triggers.json +14 -0
  504. package/skills/paystack-integration/references/api.md +73 -0
  505. package/skills/paystack-integration/references/mobile-money.md +50 -0
  506. package/skills/paystack-integration/references/webhooks.md +80 -0
  507. package/skills/pci-dss-scope/SKILL.md +103 -0
  508. package/skills/pci-dss-scope/evals/triggers.json +18 -0
  509. package/skills/pci-dss-scope/references/saq-and-data.md +36 -0
  510. package/skills/perl-patterns/SKILL.md +135 -0
  511. package/skills/perl-patterns/evals/triggers.json +18 -0
  512. package/skills/perl-testing/SKILL.md +126 -0
  513. package/skills/perl-testing/evals/triggers.json +17 -0
  514. package/skills/php-patterns/SKILL.md +116 -0
  515. package/skills/php-patterns/evals/triggers.json +16 -0
  516. package/skills/php-testing/SKILL.md +123 -0
  517. package/skills/php-testing/evals/triggers.json +16 -0
  518. package/skills/postgres-patterns/SKILL.md +103 -0
  519. package/skills/postgres-patterns/evals/triggers.json +17 -0
  520. package/skills/postgres-patterns/references/explain.md +59 -0
  521. package/skills/postgres-patterns/references/locks.md +53 -0
  522. package/skills/prd-writing/SKILL.md +124 -0
  523. package/skills/prd-writing/evals/triggers.json +15 -0
  524. package/skills/prisma-patterns/SKILL.md +83 -0
  525. package/skills/prisma-patterns/evals/triggers.json +18 -0
  526. package/skills/prisma-patterns/references/prisma-8.md +46 -0
  527. package/skills/prisma-patterns/references/workflow.md +50 -0
  528. package/skills/privacy-compliance/SKILL.md +121 -0
  529. package/skills/privacy-compliance/evals/triggers.json +18 -0
  530. package/skills/privacy-compliance/references/jurisdictions.md +51 -0
  531. package/skills/production-scheduling/SKILL.md +98 -0
  532. package/skills/production-scheduling/evals/triggers.json +16 -0
  533. package/skills/prompt-engineering/SKILL.md +92 -0
  534. package/skills/prompt-engineering/evals/triggers.json +16 -0
  535. package/skills/python-patterns/SKILL.md +107 -0
  536. package/skills/python-patterns/evals/triggers.json +16 -0
  537. package/skills/python-patterns/references/tooling.md +101 -0
  538. package/skills/python-testing/SKILL.md +126 -0
  539. package/skills/python-testing/evals/triggers.json +16 -0
  540. package/skills/python-testing/references/mocking.md +71 -0
  541. package/skills/pytorch-patterns/SKILL.md +139 -0
  542. package/skills/pytorch-patterns/evals/triggers.json +16 -0
  543. package/skills/pytorch-patterns/references/debugging.md +39 -0
  544. package/skills/quarkus-patterns/SKILL.md +93 -0
  545. package/skills/quarkus-patterns/evals/triggers.json +18 -0
  546. package/skills/rag-pipeline-patterns/SKILL.md +117 -0
  547. package/skills/rag-pipeline-patterns/evals/triggers.json +18 -0
  548. package/skills/rag-pipeline-patterns/references/evaluation.md +37 -0
  549. package/skills/rag-pipeline-patterns/references/retrieval-recipes.md +78 -0
  550. package/skills/rails-patterns/SKILL.md +132 -0
  551. package/skills/rails-patterns/evals/triggers.json +16 -0
  552. package/skills/react-native-patterns/SKILL.md +101 -0
  553. package/skills/react-native-patterns/evals/triggers.json +16 -0
  554. package/skills/react-patterns/SKILL.md +140 -0
  555. package/skills/react-patterns/evals/triggers.json +18 -0
  556. package/skills/react-performance/SKILL.md +107 -0
  557. package/skills/react-performance/evals/triggers.json +18 -0
  558. package/skills/redis-patterns/SKILL.md +109 -0
  559. package/skills/redis-patterns/evals/triggers.json +18 -0
  560. package/skills/redis-patterns/references/operations.md +61 -0
  561. package/skills/refactoring-safely/SKILL.md +107 -0
  562. package/skills/refactoring-safely/evals/triggers.json +17 -0
  563. package/skills/release-management/SKILL.md +141 -0
  564. package/skills/release-management/evals/triggers.json +16 -0
  565. package/skills/remotion-video/SKILL.md +91 -0
  566. package/skills/remotion-video/evals/triggers.json +16 -0
  567. package/skills/remotion-video/references/lambda.md +66 -0
  568. package/skills/returns-reverse-logistics/SKILL.md +97 -0
  569. package/skills/returns-reverse-logistics/evals/triggers.json +16 -0
  570. package/skills/ruby-patterns/SKILL.md +127 -0
  571. package/skills/ruby-patterns/evals/triggers.json +18 -0
  572. package/skills/ruby-testing/SKILL.md +113 -0
  573. package/skills/ruby-testing/evals/triggers.json +18 -0
  574. package/skills/runbook-writing/SKILL.md +101 -0
  575. package/skills/runbook-writing/evals/triggers.json +14 -0
  576. package/skills/rust-patterns/SKILL.md +118 -0
  577. package/skills/rust-patterns/evals/triggers.json +16 -0
  578. package/skills/rust-patterns/references/cargo-and-clippy.md +105 -0
  579. package/skills/rust-patterns/references/errors-and-traits.md +97 -0
  580. package/skills/rust-testing/SKILL.md +148 -0
  581. package/skills/rust-testing/evals/triggers.json +16 -0
  582. package/skills/rust-testing/references/fakes-proptest-async.md +113 -0
  583. package/skills/search-first/SKILL.md +73 -0
  584. package/skills/search-first/evals/triggers.json +14 -0
  585. package/skills/security-review/SKILL.md +58 -0
  586. package/skills/security-review/evals/triggers.json +14 -0
  587. package/skills/security-review/references/checklist.md +54 -0
  588. package/skills/security-review/scripts/scan-secrets.js +79 -0
  589. package/skills/seo-audit/SKILL.md +111 -0
  590. package/skills/seo-audit/evals/triggers.json +16 -0
  591. package/skills/seo-audit/references/checks.md +65 -0
  592. package/skills/session-handoff/SKILL.md +101 -0
  593. package/skills/session-handoff/evals/triggers.json +14 -0
  594. package/skills/skill-authoring/SKILL.md +87 -0
  595. package/skills/skill-authoring/evals/triggers.json +14 -0
  596. package/skills/skill-authoring/references/frontmatter.md +40 -0
  597. package/skills/slack-app-integration/SKILL.md +108 -0
  598. package/skills/slack-app-integration/evals/triggers.json +17 -0
  599. package/skills/smart-contract-security/SKILL.md +110 -0
  600. package/skills/smart-contract-security/evals/triggers.json +16 -0
  601. package/skills/smart-contract-security/references/vulnerability-checklist.md +79 -0
  602. package/skills/social-media-publishing/SKILL.md +84 -0
  603. package/skills/social-media-publishing/evals/triggers.json +17 -0
  604. package/skills/social-media-publishing/references/platform-apis.md +116 -0
  605. package/skills/solidity-patterns/SKILL.md +95 -0
  606. package/skills/solidity-patterns/evals/triggers.json +16 -0
  607. package/skills/spring-boot-patterns/SKILL.md +128 -0
  608. package/skills/spring-boot-patterns/evals/triggers.json +18 -0
  609. package/skills/spring-boot-patterns/references/testing.md +72 -0
  610. package/skills/stripe-integration/SKILL.md +69 -0
  611. package/skills/stripe-integration/evals/triggers.json +16 -0
  612. package/skills/stripe-integration/references/api.md +71 -0
  613. package/skills/stripe-integration/references/billing.md +58 -0
  614. package/skills/stripe-integration/references/webhooks.md +76 -0
  615. package/skills/subscription-billing-ops/SKILL.md +118 -0
  616. package/skills/subscription-billing-ops/evals/triggers.json +17 -0
  617. package/skills/subscription-billing-ops/references/proration.md +47 -0
  618. package/skills/subscription-billing-ops/references/revenue-metrics.md +38 -0
  619. package/skills/svelte-patterns/SKILL.md +122 -0
  620. package/skills/svelte-patterns/evals/triggers.json +16 -0
  621. package/skills/swift-patterns/SKILL.md +113 -0
  622. package/skills/swift-patterns/evals/triggers.json +16 -0
  623. package/skills/swift-patterns/references/concurrency-migration.md +40 -0
  624. package/skills/swift-testing/SKILL.md +121 -0
  625. package/skills/swift-testing/evals/triggers.json +16 -0
  626. package/skills/swift-testing/references/swift-testing-cheatsheet.md +81 -0
  627. package/skills/swiftui-patterns/SKILL.md +102 -0
  628. package/skills/swiftui-patterns/evals/triggers.json +16 -0
  629. package/skills/tdd-workflow/SKILL.md +67 -0
  630. package/skills/tdd-workflow/evals/triggers.json +14 -0
  631. package/skills/technical-writing/SKILL.md +95 -0
  632. package/skills/technical-writing/evals/triggers.json +14 -0
  633. package/skills/terraform-patterns/SKILL.md +122 -0
  634. package/skills/terraform-patterns/evals/triggers.json +16 -0
  635. package/skills/terraform-patterns/references/backends.md +67 -0
  636. package/skills/test-coverage-improvement/SKILL.md +107 -0
  637. package/skills/test-coverage-improvement/evals/triggers.json +16 -0
  638. package/skills/threat-modeling/SKILL.md +113 -0
  639. package/skills/threat-modeling/evals/triggers.json +16 -0
  640. package/skills/typescript-patterns/SKILL.md +122 -0
  641. package/skills/typescript-patterns/evals/triggers.json +16 -0
  642. package/skills/typescript-testing/SKILL.md +101 -0
  643. package/skills/typescript-testing/evals/triggers.json +16 -0
  644. package/skills/verification-loop/SKILL.md +70 -0
  645. package/skills/verification-loop/evals/triggers.json +14 -0
  646. package/skills/verification-loop/scripts/detect-checks.js +102 -0
  647. package/skills/vite-patterns/SKILL.md +117 -0
  648. package/skills/vite-patterns/evals/triggers.json +16 -0
  649. package/skills/vue-patterns/SKILL.md +104 -0
  650. package/skills/vue-patterns/evals/triggers.json +16 -0
  651. package/skills/web-accessibility/SKILL.md +119 -0
  652. package/skills/web-accessibility/evals/triggers.json +16 -0
  653. package/skills/web-performance/SKILL.md +107 -0
  654. package/skills/web-performance/evals/triggers.json +16 -0
  655. package/skills/web-scraping/SKILL.md +80 -0
  656. package/skills/web-scraping/evals/triggers.json +16 -0
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: dependency-audit
3
+ description: Software supply-chain audit of a project's third-party packages across npm, pnpm, Yarn, pip/uv, Cargo, Go modules and similar ecosystems. Runs the ecosystem's vulnerability scanner, checks that lockfiles exist and are enforced in CI, vets new or suspicious packages for typosquatting, install scripts and abandoned maintainers, and sets a pinning, update-cadence and SBOM policy. Use when a scanner or Dependabot reports a vulnerable package, before adding a new library, when asked whether the project's dependencies are safe, or when setting up dependency hygiene and an SBOM for a release.
4
+ license: MIT
5
+ compatibility: Any Agent Skills host. Needs the project's package manager; audit tools such as pip-audit, cargo-audit, govulncheck or osv-scanner are used when installed. Advisory lookups need network access.
6
+ metadata:
7
+ kete-loom/version: "0.1.0"
8
+ kete-loom/category: security
9
+ kete-loom/risk: network
10
+ kete-loom/owner: "Kete-org"
11
+ ---
12
+
13
+ # Dependency audit
14
+
15
+ Find the third-party code that can hurt this project, and leave behind a policy that keeps it from creeping back. Report first; change manifests or lockfiles only when the user asks.
16
+
17
+ ## 1. Inventory
18
+
19
+ 1. Find every manifest and lockfile: `package.json` + `package-lock.json` / `pnpm-lock.yaml` / `yarn.lock` / `bun.lock`, `pyproject.toml` + `uv.lock` / `poetry.lock` / `requirements*.txt`, `Cargo.toml` + `Cargo.lock`, `go.mod` + `go.sum`, `Gemfile.lock`, `composer.lock`, `*.csproj` / `packages.lock.json`, Dockerfiles and CI files that install tools.
20
+ 2. Flag any manifest with **no lockfile**, or a lockfile not committed. An application without a committed lockfile is a finding on its own.
21
+ 3. Note which package manager CI uses and whether it installs from the lockfile strictly (`npm ci`, `pnpm install --frozen-lockfile`, `yarn install --immutable`, `uv sync --locked`, `cargo build --locked`, `pip install --require-hashes -r requirements.txt`).
22
+
23
+ ## 2. Scan for known vulnerabilities
24
+
25
+ Run the scanner for each ecosystem present. Exact commands and flags are in `references/tools.md`; the defaults:
26
+
27
+ | Ecosystem | Command |
28
+ |---|---|
29
+ | npm | `npm audit --omit=dev` (then without `--omit` for dev tooling) |
30
+ | pnpm / Yarn | `pnpm audit`, `yarn npm audit` (Yarn Berry) |
31
+ | Python | `pip-audit -r requirements.txt` or `pip-audit` in the project env |
32
+ | Rust | `cargo audit` |
33
+ | Go | `govulncheck ./...` |
34
+ | Any (lockfile based) | `osv-scanner scan -r .` |
35
+
36
+ If a tool is not installed, say so and suggest the install command; **ask before installing** anything globally.
37
+
38
+ For each advisory, decide reachability before ranking it:
39
+
40
+ - Is the package in production code, or only dev/build/test tooling?
41
+ - Is the vulnerable function or code path used? `govulncheck` reports this for Go; elsewhere, search the codebase for the affected API.
42
+ - Is it exposed to untrusted input (HTTP bodies, uploads, user-supplied URLs, parsers)?
43
+
44
+ A critical CVE in a test-only dependency is lower priority than a moderate one in the request parser.
45
+
46
+ ## 3. Vet risky packages
47
+
48
+ Do this for packages added in the change under review, and for any package the scan or the user flags.
49
+
50
+ 1. **Typosquatting**: compare the name against the well-known package it resembles (`reqeusts` vs `requests`, `lodahs` vs `lodash`, scope swaps like `@type/node`). Check the registry page: download count, repository link, first publish date, maintainer.
51
+ 2. **Install scripts**: look for `preinstall`, `install`, `postinstall` in the package's `package.json`, or `setup.py` / build backends that run code at install. Network calls, obfuscated code, or reading env vars in an install script is a **stop and tell the user** finding.
52
+ 3. **Health**: last release, open security issues, single maintainer, archived repository, recent maintainer change followed by a new major or patch with unexplained binary or minified code.
53
+ 4. **Necessity**: can a few lines of standard library replace it? Fewer dependencies is the best mitigation.
54
+
55
+ Never install, import or run a suspect package to "see what it does".
56
+
57
+ ## 4. Fix
58
+
59
+ Prefer the smallest safe change, in this order:
60
+
61
+ 1. Bump to the lowest patched version within the same major (`npm audit fix` without `--force`; `cargo update -p <crate>`; `go get <module>@<version>` then `go mod tidy`).
62
+ 2. If the vulnerable package is transitive, update the direct parent first. Use an override (`overrides` in npm, `pnpm.overrides`, `resolutions` in Yarn, `[tool.uv] override-dependencies`) only when the parent has no fixed release, and leave a comment with the advisory ID and a date to remove it.
63
+ 3. A major-version bump, a replacement library, or `npm audit fix --force` changes behaviour: **stop and ask** before doing it.
64
+ 4. If no fix exists, document the advisory, why it is or is not reachable, and the compensating control. Record ignores in the tool's own config (for example `audit.toml` for cargo-audit, `--ignore-vuln` for pip-audit) with a reason and expiry, never by deleting the check.
65
+
66
+ After any change, run the project's install from the lockfile, the build and the tests, then re-run the scanner to show the advisory is gone.
67
+
68
+ ## 5. Policy to leave behind
69
+
70
+ Recommend what is missing, briefly:
71
+
72
+ - **Pinning**: applications commit lockfiles and install strictly in CI. Libraries keep compatible ranges in the manifest but still commit a lockfile for their own CI. Pin CI actions and container base images by digest or full commit SHA, not a moving tag.
73
+ - **Install scripts**: disable by default where the tool supports it (`npm ci --ignore-scripts`; pnpm 10+ only runs build scripts for packages you allow) and allow-list the packages that need them.
74
+ - **Release-age cooldown**: if the package manager supports a minimum release age, set a few days so a freshly hijacked release is not picked up at once (see `references/tools.md`).
75
+ - **Updates**: automated update PRs (Dependabot or Renovate) grouped weekly for patch/minor, security updates immediately, majors reviewed by hand. Every update PR runs the full test suite.
76
+ - **Gate**: the scanner runs in CI and fails on high or critical in production dependencies (`npm audit --omit=dev --audit-level=high`).
77
+ - **SBOM**: generate one per release in CycloneDX or SPDX (`npm sbom --sbom-format cyclonedx`, `syft <dir-or-image> -o cyclonedx-json`, `cargo cyclonedx`) and store it with the release artifacts. Details in `references/tools.md`.
78
+ - **Registry**: for private scoped packages, map the scope to the private registry explicitly so a public package with the same name cannot be resolved (dependency confusion).
79
+
80
+ ## Never
81
+
82
+ - Never run `npm audit fix --force`, delete a lockfile, or bump a major without asking.
83
+ - Never silence an advisory without a recorded reason.
84
+ - Never paste registry tokens or `.npmrc` / `pip.conf` credentials into output.
85
+ - Never call a project "safe": state which ecosystems and lockfiles were scanned and when.
86
+
87
+ ## Report format
88
+
89
+ ```
90
+ ## Dependency audit: <project> (<date>)
91
+ Scanned: <ecosystems, lockfiles, tools and versions> Not scanned: <what and why>
92
+
93
+ ### Findings
94
+ 1. [critical|high|medium|low] <package>@<version> (<direct|transitive via X>, <prod|dev>)
95
+ Advisory: <ID> <one line> Reachable: <yes/no/unknown + evidence>
96
+ Fix: <exact version or action> Breaking: <yes/no>
97
+
98
+ ### Supply-chain risks
99
+ - <typosquat / install script / unmaintained / no lockfile / unpinned CI action>
100
+
101
+ ### Policy gaps
102
+ - <missing item from section 5, one line each>
103
+ ```
@@ -0,0 +1,16 @@
1
+ {
2
+ "should_trigger": [
3
+ "Dependabot flagged a critical vulnerability in a transitive dependency, how do I fix it safely?",
4
+ "Audit our Python and Rust dependencies for known vulnerabilities",
5
+ "Is this npm package safe to add? It has a postinstall script and only 200 weekly downloads",
6
+ "Set up a dependency update and pinning policy plus an SBOM for our releases",
7
+ "Check if we're exposed to any supply chain attacks through our lockfiles and CI installs"
8
+ ],
9
+ "should_not_trigger": [
10
+ "Upgrade our app from React 18 to React 19 and fix the breaking changes",
11
+ "The build fails with a module not found error after npm install",
12
+ "Scan the diff on this branch for hardcoded secrets and SQL injection",
13
+ "Set up a GitHub Actions workflow that runs tests on every pull request",
14
+ "Threat model how an attacker could tamper with our deployment pipeline"
15
+ ]
16
+ }
@@ -0,0 +1,124 @@
1
+ # Dependency audit: tool reference
2
+
3
+ Read this when you need the exact command for an ecosystem. Flags change between releases: if a command fails, check `<tool> --help` and the tool's docs before guessing.
4
+
5
+ ## Vulnerability scanners
6
+
7
+ ### npm
8
+
9
+ ```
10
+ npm audit # all dependencies
11
+ npm audit --omit=dev # production dependencies only
12
+ npm audit --audit-level=high # exit non-zero only at high or critical (does not filter the report)
13
+ npm audit --json # machine-readable
14
+ npm audit signatures # verify registry signatures and provenance attestations of installed packages
15
+ npm audit fix # semver-compatible fixes only
16
+ npm ls <package> # who pulls in a transitive dependency
17
+ ```
18
+
19
+ `npm audit fix --force` can install breaking majors. Ask first.
20
+
21
+ ### pnpm and Yarn
22
+
23
+ ```
24
+ pnpm audit [--prod] [--audit-level high]
25
+ pnpm audit --ignore <GHSA-ID> # documented exception, saved to pnpm-workspace.yaml
26
+ pnpm why <package>
27
+ yarn npm audit [--all] [--recursive] # Yarn Berry (2+)
28
+ yarn why <package>
29
+ ```
30
+
31
+ ### Python
32
+
33
+ ```
34
+ pip-audit # current environment
35
+ pip-audit -r requirements.txt # a requirements file
36
+ pip-audit --ignore-vuln <ID> # documented exception
37
+ ```
38
+
39
+ For uv projects, export the lock first if needed (`uv export --format requirements-txt > /tmp/req.txt`) and run `pip-audit -r` on it.
40
+
41
+ Hash-checked installs: `pip install --require-hashes -r requirements.txt` (generate hashes with `pip-compile --generate-hashes` or `uv pip compile --generate-hashes`).
42
+
43
+ ### Rust
44
+
45
+ ```
46
+ cargo install cargo-audit --locked # once
47
+ cargo audit # RustSec advisory DB against Cargo.lock
48
+ cargo tree -i <crate> # who depends on a crate
49
+ ```
50
+
51
+ Ignores go in `.cargo/audit.toml` under `[advisories] ignore = ["RUSTSEC-..."]`. `cargo deny check` (cargo-deny) adds licence, banned-crate and duplicate checks.
52
+
53
+ ### Go
54
+
55
+ ```
56
+ go install golang.org/x/vuln/cmd/govulncheck@latest
57
+ govulncheck ./... # reports only vulnerabilities your code can reach
58
+ go mod why -m <module>
59
+ ```
60
+
61
+ ### Others
62
+
63
+ | Ecosystem | Command |
64
+ |---|---|
65
+ | Ruby | `bundle audit check --update` (bundler-audit) |
66
+ | PHP | `composer audit` |
67
+ | .NET | `dotnet list package --vulnerable --include-transitive` |
68
+ | Java/Kotlin | OWASP Dependency-Check, or `osv-scanner` on the Gradle/Maven lockfile |
69
+ | Containers | `trivy image <image>` or `grype <image>` |
70
+
71
+ ### osv-scanner (multi-ecosystem)
72
+
73
+ ```
74
+ osv-scanner scan -r . # every lockfile under the directory
75
+ osv-scanner scan -L package-lock.json # one lockfile
76
+ ```
77
+
78
+ ## Strict installs in CI
79
+
80
+ | Tool | Command |
81
+ |---|---|
82
+ | npm | `npm ci` |
83
+ | pnpm | `pnpm install --frozen-lockfile` |
84
+ | Yarn Berry | `yarn install --immutable` |
85
+ | uv | `uv sync --locked` |
86
+ | Poetry | `poetry install` with the lock committed; `poetry check --lock` |
87
+ | Cargo | `cargo build --locked` |
88
+ | Go | `go mod verify` (checks downloaded modules against go.sum) |
89
+
90
+ ## Install scripts
91
+
92
+ - npm: `ignore-scripts=true` in `.npmrc`, or `npm ci --ignore-scripts`. Scripts you run by name (`npm test`, `npm run build`) still run; their pre/post hooks do not.
93
+ - pnpm 10+: dependency lifecycle scripts do not run unless allowed. Older 10.x releases use `pnpm.onlyBuiltDependencies`; newer releases document `allowBuilds` in `pnpm-workspace.yaml`. `pnpm approve-builds` and `pnpm ignored-builds` manage the list. Check the docs for the installed version.
94
+ - Python: source distributions run build code at install. Prefer wheels (`pip install --only-binary :all:` where feasible) for untrusted packages.
95
+
96
+ ## Release-age cooldown
97
+
98
+ Delays picking up versions published in the last few days. Units differ; check the docs for your installed version before relying on these:
99
+
100
+ | Tool | Setting | Unit |
101
+ |---|---|---|
102
+ | npm | `min-release-age` in `.npmrc` | days |
103
+ | pnpm | `minimumReleaseAge` | minutes |
104
+ | uv | `exclude-newer` (absolute timestamp; recent releases accept durations) | timestamp or duration |
105
+
106
+ Automated update tools have their own equivalent (Renovate `minimumReleaseAge`, Dependabot `cooldown` with `default-days`). Dependabot's cooldown applies to version updates, not security updates.
107
+
108
+ ## SBOM
109
+
110
+ ```
111
+ npm sbom --sbom-format cyclonedx > sbom.cdx.json # from package-lock.json
112
+ npm sbom --sbom-format spdx > sbom.spdx.json
113
+ pnpm sbom --sbom-format cyclonedx # pnpm 11+
114
+ syft . -o cyclonedx-json > sbom.cdx.json # a directory; or syft <image>
115
+ cargo cyclonedx # after: cargo install cargo-cyclonedx
116
+ ```
117
+
118
+ Generate the SBOM from the exact lockfile or image that ships, attach it to the release, and scan it later (for example `grype sbom:sbom.cdx.json`) when new advisories appear.
119
+
120
+ ## Pinning CI and images
121
+
122
+ - GitHub Actions: `uses: actions/checkout@<full 40-char commit SHA> # vX.Y.Z`.
123
+ - Containers: `FROM node:22-slim@sha256:<digest>`.
124
+ - Tools installed with `curl | sh` in CI: pin a version and verify a checksum.
@@ -0,0 +1,108 @@
1
+ ---
2
+ name: deployment-strategies
3
+ description: Plans and runs low-risk production releases with blue-green switches, progressive canary rollouts, feature flags that separate deploy from release, expand-and-contract database changes ordered so old and new code both work, readiness and liveness health checks, rollback triggered automatically by error and latency signals, and smoke tests after every deploy. Use when shipping a risky change to production, designing a rollout or rollback plan, deploying alongside a schema change, or deciding between blue-green, canary and flags.
4
+ license: MIT
5
+ compatibility: Any Agent Skills host and any platform (Kubernetes, ECS, Cloud Run, App Service, VMs). Commands depend on the project's deploy tooling.
6
+ metadata:
7
+ kete-loom/version: "0.1.0"
8
+ kete-loom/category: devops
9
+ kete-loom/risk: runs-commands
10
+ kete-loom/owner: "Kete-org"
11
+ ---
12
+
13
+ # Deployment strategies
14
+
15
+ Ship so that a bad release reaches few users, is detected by numbers rather than by complaints, and can be undone in minutes without losing data. CI pipeline mechanics are in `github-actions-ci`; migration tooling in `database-migrations`; tags and changelogs in `release-management`.
16
+
17
+ ## Ground rules
18
+
19
+ 1. **Rollback must be possible before you roll forward.** Know the exact rollback command and that the previous version still runs against the current database. If you can't say how to undo a deploy, **stop and ask** before deploying.
20
+ 2. **Deploy is not release.** Code can reach production switched off behind a flag; releasing is turning it on for users.
21
+ 3. **Build once, promote the same artifact** (image digest, not a tag like `latest`) through staging to production.
22
+ 4. **Every version must run against the schema of its neighbour.** During any rollout old and new code run at the same time.
23
+ 5. **Decide health by signals agreed in advance:** error rate, latency (p95/p99), saturation, and one business metric (checkouts, sign-ins). Write the thresholds down before you start.
24
+ 6. **Production changes need the user's go-ahead.** Ask before each promotion step unless the user has approved an automated rollout with defined thresholds.
25
+
26
+ ## Choosing a strategy
27
+
28
+ | Situation | Strategy |
29
+ |---|---|
30
+ | Small low-risk change, good tests, fast rollback | Rolling update with health checks |
31
+ | Need instant full cutover and instant revert, can afford double capacity briefly | Blue-green |
32
+ | Risky change, enough traffic for statistics | Canary (1% → 5% → 25% → 50% → 100%) |
33
+ | Behaviour change you want to target, test in prod, or kill quickly | Feature flag (with any deploy method) |
34
+ | Schema change | Expand and contract, always, combined with one of the above |
35
+
36
+ Low-traffic services can't produce meaningful canary statistics; use blue-green plus a flag instead.
37
+
38
+ ## Health checks
39
+
40
+ - **Readiness:** "can this instance serve traffic now?" Checks the app is initialised and can reach its required dependencies. Load balancers and orchestrators route only to ready instances.
41
+ - **Liveness:** "is this process stuck?" Checks only the process itself. Never make liveness depend on a database or downstream service, or one outage restarts every pod.
42
+ - **Startup grace:** give slow-starting apps a startup probe or initial delay so they aren't killed while booting.
43
+ - Implement graceful shutdown: on SIGTERM stop accepting new requests, finish in-flight ones, then exit.
44
+
45
+ ## Blue-green
46
+
47
+ 1. Deploy the new version (green) beside the live one (blue), on the same database.
48
+ 2. Run smoke tests against green directly.
49
+ 3. Switch traffic at the router (load balancer target, DNS weight, slot swap, service selector).
50
+ 4. Watch the signals for an agreed window. Keep blue running and untouched.
51
+ 5. Revert by switching back. Remove blue only after the window passes.
52
+
53
+ ## Canary
54
+
55
+ 1. Route a small slice of traffic (or an internal cohort) to the new version.
56
+ 2. Compare canary vs baseline on the agreed signals, not against last week.
57
+ 3. Promote in steps, holding at each long enough to see real traffic. Automate with the platform's progressive delivery tool (Argo Rollouts, Flagger, ECS/CodeDeploy, Cloud Run traffic splitting, App Service slots with traffic percentage) where available.
58
+ 4. **Automatic rollback:** if any threshold is breached, shift all traffic back and alert. A human decides when to retry.
59
+
60
+ ## Feature flags
61
+
62
+ - Default off; ship the code dark, then enable for staff, then a percentage, then everyone.
63
+ - Flag checks happen server-side for anything that matters for security or money.
64
+ - Every flag has an owner and a removal date. Delete the flag and the dead branch once it is at 100% and stable.
65
+ - A kill switch for a risky dependency is a flag too: test that turning it off works.
66
+
67
+ ## Database-compatible ordering (expand and contract)
68
+
69
+ Never ship a schema change and code that needs it in a single step. For renaming a column, for example:
70
+
71
+ 1. **Expand:** add the new column (nullable or with a default). No code change. Old code ignores it.
72
+ 2. **Dual write:** deploy code that writes both columns and reads the old one.
73
+ 3. **Backfill** existing rows in batches, outside the deploy.
74
+ 4. **Switch reads:** deploy code that reads the new column (still writing both).
75
+ 5. **Stop writing the old column:** deploy.
76
+ 6. **Contract:** drop the old column in a later release, once no running or rollback-target version uses it.
77
+
78
+ Rules: additive changes go before the code that uses them; destructive changes go after the code stops using them. Avoid migrations that lock big tables during a deploy; see `database-migrations`. **Stop and ask** before any step that drops or rewrites data.
79
+
80
+ ## Post-deploy verification
81
+
82
+ 1. Confirm the running version is the one you meant (version endpoint, image digest).
83
+ 2. Run smoke tests for the critical paths: sign-in, the main read, the main write, payment if any.
84
+ 3. Check the dashboards for the agreed signals over the hold window, and the error tracker for new error types.
85
+ 4. Confirm background workers and scheduled jobs picked up the new version too.
86
+ 5. Announce completion, or roll back and announce that.
87
+
88
+ ## Never
89
+
90
+ - Deploy on top of a failing or unknown-state production.
91
+ - Run destructive migrations in the same release as the code change.
92
+ - Remove the old environment or the rollback artifact before the hold window ends.
93
+ - Turn off alerts "to get through the deploy".
94
+
95
+ ## Rollout plan format
96
+
97
+ Produce this before deploying anything non-trivial:
98
+
99
+ ```
100
+ Change: <what ships>
101
+ Strategy: <rolling | blue-green | canary | flag> and why
102
+ Schema steps: <expand/contract steps and which release each goes in>
103
+ Signals and thresholds: <metric: limit>
104
+ Steps: <numbered, with hold time per step>
105
+ Rollback: <exact command or action, and how long it takes>
106
+ Verification: <smoke tests and dashboards>
107
+ Approval needed at: <steps where you stop for the user>
108
+ ```
@@ -0,0 +1,16 @@
1
+ {
2
+ "should_trigger": [
3
+ "We need to rename a column in production without downtime while the new code rolls out",
4
+ "Design a canary release for the new search service with automatic rollback on error rate",
5
+ "Blue-green or canary for our monolith that gets very little traffic?",
6
+ "Put the new pricing page behind a feature flag so we can deploy it dark and turn it on later",
7
+ "What should our readiness and liveness probes check, and how do we verify a deploy worked?"
8
+ ],
9
+ "should_not_trigger": [
10
+ "Write the Alembic migration that adds an index to the orders table",
11
+ "Add a matrix build to our GitHub Actions workflow",
12
+ "Tag version 2.4.0 and write the release notes",
13
+ "Choose between App Service and Container Apps on Azure",
14
+ "Our Kubernetes pods are stuck in CrashLoopBackOff, help me read the events"
15
+ ]
16
+ }
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: django-patterns
3
+ description: Django project conventions for building and changing apps, covering app layout, ORM query efficiency with select_related and prefetch_related, safe migrations, forms and model validation, auth and permission checks, per-environment settings, Celery tasks that run after commit, and production security settings. Use when adding a Django model, view, form or Celery task, fixing slow querysets, planning a schema migration, or hardening Django settings for deployment.
4
+ license: MIT
5
+ compatibility: Any Agent Skills host. Needs Python and the project's Django manage.py. Guidance targets currently supported Django releases.
6
+ metadata:
7
+ kete-loom/version: "0.1.0"
8
+ kete-loom/category: coding
9
+ kete-loom/risk: runs-commands
10
+ kete-loom/requires: "python"
11
+ kete-loom/owner: "Kete-org"
12
+ ---
13
+
14
+ # Django patterns
15
+
16
+ Write Django code that follows the project's existing shape, issues a predictable number of queries, and keeps schema changes reversible.
17
+
18
+ ## 0. Before you change anything
19
+
20
+ 1. Find the settings module (`DJANGO_SETTINGS_MODULE` in `manage.py`, `wsgi.py`, `asgi.py` or the env) and the Django version in `pyproject.toml` or `requirements*.txt`.
21
+ 2. Find how tests run (`pytest` with `pytest-django`, or `python manage.py test`). Run them once and record the result. If they already fail, **stop and tell the user**.
22
+ 3. Run `python manage.py check`. Fix nothing unrelated; just note warnings.
23
+ 4. Copy the conventions already there: class-based or function views, DRF or plain views, where services and selectors live.
24
+
25
+ ## 1. App structure
26
+
27
+ - One app per bounded area (`billing`, `accounts`), not per model. Avoid cyclic imports between apps; refer to other apps' models with the `"app_label.Model"` string in `ForeignKey`.
28
+ - Keep views thin: parse input, call a function, return a response. Put multi-model business logic in a plain module (`services.py`) and read-heavy query building in `selectors.py` or a custom `QuerySet`/`Manager`, if the project does that.
29
+ - Always reference the user model with `settings.AUTH_USER_MODEL` (in models) or `get_user_model()` (in code), never `django.contrib.auth.models.User` directly.
30
+ - Define `__str__` on every model. Set `Meta.ordering` only when every query needs that order (it adds an `ORDER BY` to every query). Put invariants in `Meta.constraints` (`UniqueConstraint`, `CheckConstraint`) rather than relying on form validation alone.
31
+
32
+ ## 2. Query efficiency
33
+
34
+ Count queries before and after. In tests use `django_assert_num_queries` (pytest-django) or `self.assertNumQueries(n)`.
35
+
36
+ | Access pattern | Use |
37
+ |---|---|
38
+ | Forward `ForeignKey` / `OneToOne` used in a loop or template | `select_related("author")` (SQL join) |
39
+ | Reverse FK or `ManyToMany` used in a loop | `prefetch_related("tags")` (one extra query) |
40
+ | Prefetch with a filter or its own `select_related` | `Prefetch("items", queryset=Item.objects.select_related("sku"))` |
41
+ | Only need a few columns | `only(...)`, `values(...)` or `values_list(..., flat=True)` |
42
+ | Counting or existence | `.count()`, `.exists()`, never `len(qs)` or `if qs:` on a big queryset |
43
+ | Per-row totals | `annotate(Count(...), Sum(...))`, not a query per row |
44
+ | Bulk writes | `bulk_create`, `bulk_update`, `qs.update(...)`; remember these skip `save()` and signals |
45
+ | Race-free increments | `F("stock") - 1` with `update()`, or `select_for_update()` inside `transaction.atomic()` |
46
+
47
+ Rules:
48
+ - Any loop over a queryset that touches a relation is an N+1 until proven otherwise.
49
+ - DRF serializers with nested serializers need the matching `select_related`/`prefetch_related` in the view's `get_queryset`.
50
+ - Iterate huge tables with `.iterator(chunk_size=...)`; paginate anything user-facing.
51
+ - Raw SQL: use `params=[...]` with `raw()` or `cursor.execute(sql, params)`. **Never** build SQL with f-strings or `%` formatting on user input, and never pass user input to `extra()` or `RawSQL` without params.
52
+
53
+ ## 3. Migrations
54
+
55
+ 1. Change models, then run `python manage.py makemigrations <app>`. Read the generated file; rename it if the auto name is meaningless.
56
+ 2. Show the SQL for risky steps: `python manage.py sqlmigrate <app> <number>`.
57
+ 3. Run `python manage.py makemigrations --check --dry-run` to prove nothing is left ungenerated. Add it to CI if missing.
58
+ 4. Apply locally with `python manage.py migrate`, then roll back with `python manage.py migrate <app> <previous_migration_name>` and re-apply to prove reversibility.
59
+
60
+ Safe-change rules for tables with live traffic:
61
+ - Adding a non-null column: add it nullable (or with a database default), backfill in a separate data migration, then make it non-null in a later migration.
62
+ - Removing or renaming a column: first ship code that no longer reads it, then drop it in the next release. `RenameField` breaks old code still running during a rolling deploy.
63
+ - Data migrations use `RunPython(forwards, backwards)` with `apps.get_model("app", "Model")`, never a direct import of the model class. Supply a `backwards` function or `RunPython.noop` deliberately.
64
+ - On PostgreSQL, add indexes to big tables with `AddIndexConcurrently` in a migration with `atomic = False`.
65
+ - **Stop and ask the user** before writing a migration that drops a column or table, rewrites a large table, or squashes migrations other branches may depend on.
66
+ - Never edit a migration that has already been applied anywhere shared; add a new one.
67
+
68
+ ## 4. Forms and validation
69
+
70
+ - Validate user input with a `Form`/`ModelForm` (or DRF serializer). Use `form.cleaned_data`, never `request.POST[...]` directly.
71
+ - Field-level checks go in `clean_<field>()`, cross-field checks in `clean()`. Invariants that must hold everywhere belong on the model (`clean()` plus database constraints), because `save()` does not call `full_clean()`.
72
+ - Always list `fields` explicitly on a `ModelForm`; never `fields = "__all__"` or `exclude` for forms users submit, or a new model field becomes writable.
73
+ - Keep CSRF on. `@csrf_exempt` is only for endpoints authenticated another way (signed webhooks), with a comment saying why.
74
+
75
+ ## 5. Auth and permissions
76
+
77
+ - Every view that is not public needs an explicit check: `@login_required`, `LoginRequiredMixin`, `@permission_required`, `PermissionRequiredMixin`, or DRF `permission_classes`.
78
+ - Authentication is not authorization. Scope object lookups to the user: `get_object_or_404(Invoice, pk=pk, owner=request.user)`, or filter `get_queryset()` by owner/tenant. Never fetch by `pk` alone and trust it.
79
+ - Check DRF's `DEFAULT_PERMISSION_CLASSES`; if it is `AllowAny`, every view must set its own.
80
+ - Use `user.has_perm("app.change_model")` for permissions; don't compare group names in code.
81
+
82
+ ## 6. Settings per environment
83
+
84
+ - One settings package (`settings/base.py`, `dev.py`, `prod.py`) or one module reading environment variables (`django-environ`, `os.environ`). Follow whichever exists.
85
+ - Secrets (`SECRET_KEY`, database password, API keys) come from the environment, never from committed files. Fail at startup if a required secret is missing in production.
86
+ - `DEBUG = False` in production, with `ALLOWED_HOSTS` set explicitly.
87
+
88
+ ## 7. Celery tasks
89
+
90
+ - Pass IDs to tasks, not model instances or querysets; reload inside the task.
91
+ - Enqueue after the transaction commits: `transaction.on_commit(lambda: send_receipt.delay(order.id))` (Celery 5.4+ also offers `send_receipt.delay_on_commit(order.id)`). Enqueuing inside `atomic()` lets the worker read data that isn't committed yet, or that is rolled back.
92
+ - Make tasks idempotent; brokers can deliver twice. Use `autoretry_for`, `retry_backoff` and `max_retries` for transient errors only.
93
+ - Set time limits (`soft_time_limit`, `time_limit`) on anything that calls the network.
94
+ - In tests, call the task function directly, or enable eager mode only in test settings. With the usual `config_from_object("django.conf:settings", namespace="CELERY")` the key is `CELERY_TASK_ALWAYS_EAGER`; check the project's namespace before naming it.
95
+
96
+ ## 8. Production security settings
97
+
98
+ Run `python manage.py check --deploy --settings=<prod settings>` and resolve each warning or document why it doesn't apply. The usual set:
99
+
100
+ ```python
101
+ DEBUG = False
102
+ SECURE_SSL_REDIRECT = True # unless the proxy already redirects
103
+ SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https") # only behind a proxy that sets it
104
+ SESSION_COOKIE_SECURE = True
105
+ CSRF_COOKIE_SECURE = True
106
+ SECURE_HSTS_SECONDS = 31536000 # start small (e.g. 3600) and raise once HTTPS is confirmed
107
+ SECURE_CONTENT_TYPE_NOSNIFF = True
108
+ X_FRAME_OPTIONS = "DENY"
109
+ CSRF_TRUSTED_ORIGINS = ["https://app.example.com"]
110
+ ```
111
+
112
+ - Never render user content with `mark_safe`, `|safe` or `format_html` misuse; let templates autoescape.
113
+ - Uploaded files: validate type and size, and never serve `MEDIA_ROOT` from the same origin with executable content types.
114
+
115
+ ## Rules
116
+
117
+ - Never disable a security middleware, CSRF, or a permission check to make a test pass.
118
+ - Never run `migrate` against a shared or production database yourself; hand the user the command.
119
+ - Never commit secrets or a `DEBUG = True` production settings file.
120
+
121
+ ## Report back
122
+
123
+ End with: files changed, migrations created (with the `sqlmigrate` summary for risky ones), query counts before and after for any queryset you optimised, the test command and its result, and any `check --deploy` warning left open.
@@ -0,0 +1,16 @@
1
+ {
2
+ "should_trigger": [
3
+ "This Django list view runs 300 queries, help me fix it with select_related or prefetch_related",
4
+ "Add a non-null column to the Order model in Django without breaking the live deploy",
5
+ "Set up a Celery task in our Django app that emails the receipt after checkout",
6
+ "Split our Django settings.py into dev and prod and fix what manage.py check --deploy complains about",
7
+ "Create a ModelForm with cross-field validation for the booking app"
8
+ ],
9
+ "should_not_trigger": [
10
+ "Review my Django pull request for N+1 queries and missing permission checks",
11
+ "Build a FastAPI router with Pydantic request models",
12
+ "Create a Flask application factory with blueprints",
13
+ "Write pytest fixtures for a plain Python utility module",
14
+ "Tune this PostgreSQL index for a slow query outside of any ORM"
15
+ ]
16
+ }
@@ -0,0 +1,132 @@
1
+ ---
2
+ name: docker-patterns
3
+ description: Writes and fixes Dockerfiles and Docker Compose files that build small, cacheable, non-root images, using multi-stage builds, a tight .dockerignore, BuildKit cache and secret mounts, healthchecks, and a Compose setup for local development with dependent services. Use when containerising an app, shrinking a bloated or slow image build, removing secrets baked into image layers, or wiring a local stack of app, database and queue with Compose.
4
+ license: MIT
5
+ compatibility: Any Agent Skills host. Building and running images needs Docker with BuildKit (default in current Docker Engine and Docker Desktop) and the docker compose plugin.
6
+ metadata:
7
+ kete-loom/version: "0.1.0"
8
+ kete-loom/category: devops
9
+ kete-loom/risk: runs-commands
10
+ kete-loom/requires: "docker"
11
+ kete-loom/owner: "Kete-org"
12
+ ---
13
+
14
+ # Docker patterns
15
+
16
+ Produce images that are small, rebuild fast, run as a non-root user and carry no secrets. Production deployment on Kubernetes belongs to `kubernetes-patterns`; this skill stops at the image and local Compose.
17
+
18
+ ## 0. Read before you write
19
+
20
+ 1. Find the runtime and its lockfile (`package-lock.json`, `pnpm-lock.yaml`, `poetry.lock`, `uv.lock`, `go.sum`, `Cargo.lock`, `pom.xml`, `*.csproj`). The lockfile drives the dependency layer.
21
+ 2. Find the build command, the start command, the port and any files the app reads at runtime (templates, migrations, static assets).
22
+ 3. Check for an existing `Dockerfile`, `compose.yaml` / `docker-compose.yml`, `.dockerignore` and CI build steps. Edit what exists; keep the image name and tags CI uses.
23
+ 4. Stop and ask the user if the target platform is unclear (for example `linux/amd64` servers built on an `arm64` laptop) or if the app needs native libraries you cannot identify.
24
+
25
+ ## 1. Dockerfile rules
26
+
27
+ 1. **Pin the base image** to a specific version tag (`node:22-bookworm-slim`, `python:3.12-slim`), never `latest`. Pin by digest (`@sha256:...`) when the project asks for reproducible builds.
28
+ 2. **Multi-stage**: a `build` stage with compilers and dev dependencies, and a final stage that copies only the built output and runtime dependencies. For static binaries (Go, Rust) the final stage can be `gcr.io/distroless/static` or `scratch`.
29
+ 3. **Order for caching**: copy the manifest and lockfile, install dependencies, then copy the source. Source changes must not invalidate the dependency layer.
30
+ 4. **Install reproducibly** from the lockfile: `npm ci`, `pnpm install --frozen-lockfile`, `pip install --no-cache-dir -r requirements.txt`, `uv sync --frozen`, `go mod download`.
31
+ 5. **Clean in the same layer**: `apt-get update && apt-get install -y --no-install-recommends ... && rm -rf /var/lib/apt/lists/*`. A later `RUN rm` does not shrink the image.
32
+ 6. **Non-root**: create or use an unprivileged user and set `USER` before `CMD`. Many official images ship one (`node` in Node images, `nonroot` in distroless). Copy app files with `COPY --chown=` so the user can read them, and don't make the app directory writable unless it must be.
33
+ 7. **Exec form for the entrypoint**: `CMD ["node", "server.js"]`, not `CMD node server.js`, so the process is PID 1 and receives `SIGTERM`. If the app spawns children or ignores signals, add `--init` at run time or a small init such as `tini`.
34
+ 8. **`EXPOSE` the port** the app listens on, and make the app bind `0.0.0.0`, not `127.0.0.1`.
35
+ 9. **`HEALTHCHECK`** only with a tool that exists in the final image (`curl`, `wget` or the app's own `healthcheck` subcommand). Distroless images have no shell or curl; skip `HEALTHCHECK` there and rely on the orchestrator's probes.
36
+ 10. **`ARG` vs `ENV`**: `ARG` for build-time values, `ENV` for runtime defaults. Neither is a safe place for secrets: both can be read back from image metadata or history.
37
+
38
+ A template per runtime is in `references/dockerfiles.md`.
39
+
40
+ ## 2. Secrets
41
+
42
+ - Never `COPY` a `.env`, key file or credentials file into any stage, and never pass a token with `--build-arg`.
43
+ - Build-time secrets (private registry token, package-index credential): `RUN --mount=type=secret,id=npmrc,target=/root/.npmrc npm ci` with `docker build --secret id=npmrc,src=$HOME/.npmrc .`. The secret is not written to a layer.
44
+ - Private Git dependencies: `RUN --mount=type=ssh` with `docker build --ssh default .`.
45
+ - Runtime secrets come from the environment or a mounted file at `docker run` / Compose / orchestrator level, never from the image.
46
+ - If a secret was already baked into a pushed image, removing it from the Dockerfile is not enough: tell the user to rotate it.
47
+
48
+ ## 3. .dockerignore
49
+
50
+ Always present. Start from:
51
+
52
+ ```
53
+ .git
54
+ **/node_modules
55
+ **/__pycache__
56
+ **/.venv
57
+ dist
58
+ build
59
+ target
60
+ coverage
61
+ .env
62
+ .env.*
63
+ *.pem
64
+ *.key
65
+ Dockerfile*
66
+ compose*.yaml
67
+ docker-compose*.yml
68
+ ```
69
+
70
+ Adjust so the build output you need is not excluded (for example, keep `dist` if you build outside Docker and copy it in).
71
+
72
+ ## 4. Faster builds
73
+
74
+ - Cache package downloads across builds: `RUN --mount=type=cache,target=/root/.npm npm ci`, `--mount=type=cache,target=/root/.cache/pip`, `--mount=type=cache,target=/go/pkg/mod`.
75
+ - Keep the build context small (`.dockerignore`) and put rarely changing steps first.
76
+ - In CI, use the builder's registry or CI cache backend (`--cache-from` / `--cache-to`), not a fresh build each time.
77
+
78
+ ## 5. Compose for local development
79
+
80
+ Use `compose.yaml` (the current default file name) and no top-level `version:` key; it is obsolete.
81
+
82
+ ```yaml
83
+ services:
84
+ app:
85
+ build: .
86
+ ports: ["3000:3000"]
87
+ env_file: .env # local only, git-ignored
88
+ depends_on:
89
+ db:
90
+ condition: service_healthy
91
+ db:
92
+ image: postgres:16
93
+ environment:
94
+ POSTGRES_PASSWORD: dev-only
95
+ volumes: [db-data:/var/lib/postgresql/data]
96
+ healthcheck:
97
+ test: ["CMD-SHELL", "pg_isready -U postgres"]
98
+ interval: 5s
99
+ retries: 10
100
+ volumes:
101
+ db-data:
102
+ ```
103
+
104
+ - `depends_on` with `condition: service_healthy` waits for the healthcheck, not just for the container to start.
105
+ - Services reach each other by service name (`db:5432`), not `localhost`.
106
+ - Bind-mount source for hot reload, or use `develop.watch` with `docker compose watch`. Don't bind-mount over a directory the image built (such as `node_modules`) without an anonymous volume to protect it.
107
+ - Bind database ports to localhost only when exposed: `"127.0.0.1:5432:5432"`.
108
+ - Use profiles (`profiles: [tools]`) for optional services instead of extra Compose files.
109
+
110
+ ## 6. Verify
111
+
112
+ Run, and report the results:
113
+
114
+ 1. `docker build -t <name>:dev .` succeeds.
115
+ 2. `docker image ls <name>:dev` for the size; compare with the old image if there was one.
116
+ 3. `docker run --rm <name>:dev id` (or check `docker inspect --format '{{.Config.User}}'`) shows a non-root user.
117
+ 4. `docker history --no-trunc <name>:dev` shows no secrets in any layer command.
118
+ 5. `docker run --rm -p <port>:<port> <name>:dev` and hit the health endpoint; then `docker stop` returns quickly (signals handled).
119
+ 6. For Compose: `docker compose config` validates, `docker compose up -d` and `docker compose ps` shows services healthy.
120
+
121
+ If an image scanner is available (`docker scout cves`, `trivy image`), run it and list high and critical findings.
122
+
123
+ ## Never
124
+
125
+ - Never use `latest` or an unpinned base in a production Dockerfile.
126
+ - Never run the final stage as root without the user's explicit reason.
127
+ - Never add `--privileged`, the Docker socket mount (`/var/run/docker.sock`) or `network_mode: host` unless the user asks for it and understands the risk.
128
+ - Never `chmod -R 777`.
129
+
130
+ ## Report back
131
+
132
+ End with: files changed, base image and final size (before and after if known), user the container runs as, the verification commands you ran with pass or fail, and anything you could not check.