@softspark/ai-toolkit 1.0.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 (327) hide show
  1. package/AGENTS.md +412 -0
  2. package/CHANGELOG.md +68 -0
  3. package/LICENSE +21 -0
  4. package/README.md +632 -0
  5. package/action.yml +53 -0
  6. package/app/.claude-plugin/plugin.json +44 -0
  7. package/app/ARCHITECTURE.md +306 -0
  8. package/app/CLAUDE.md.template +23 -0
  9. package/app/agents/ai-engineer.md +128 -0
  10. package/app/agents/backend-specialist.md +193 -0
  11. package/app/agents/business-intelligence.md +54 -0
  12. package/app/agents/chaos-monkey.md +67 -0
  13. package/app/agents/chief-of-staff.md +51 -0
  14. package/app/agents/code-archaeologist.md +127 -0
  15. package/app/agents/code-reviewer.md +184 -0
  16. package/app/agents/command-expert.md +131 -0
  17. package/app/agents/data-analyst.md +205 -0
  18. package/app/agents/data-scientist.md +151 -0
  19. package/app/agents/database-architect.md +317 -0
  20. package/app/agents/debugger.md +238 -0
  21. package/app/agents/devops-implementer.md +194 -0
  22. package/app/agents/documenter.md +364 -0
  23. package/app/agents/explorer-agent.md +145 -0
  24. package/app/agents/fact-checker.md +172 -0
  25. package/app/agents/frontend-specialist.md +209 -0
  26. package/app/agents/game-developer.md +216 -0
  27. package/app/agents/incident-responder.md +226 -0
  28. package/app/agents/infrastructure-architect.md +127 -0
  29. package/app/agents/infrastructure-validator.md +247 -0
  30. package/app/agents/llm-ops-engineer.md +237 -0
  31. package/app/agents/mcp-expert.md +228 -0
  32. package/app/agents/mcp-server-architect.md +195 -0
  33. package/app/agents/mcp-testing-engineer.md +292 -0
  34. package/app/agents/meta-architect.md +58 -0
  35. package/app/agents/ml-engineer.md +136 -0
  36. package/app/agents/mobile-developer.md +190 -0
  37. package/app/agents/night-watchman.md +55 -0
  38. package/app/agents/nlp-engineer.md +154 -0
  39. package/app/agents/orchestrator.md +437 -0
  40. package/app/agents/performance-optimizer.md +254 -0
  41. package/app/agents/predictive-analyst.md +57 -0
  42. package/app/agents/product-manager.md +194 -0
  43. package/app/agents/project-planner.md +287 -0
  44. package/app/agents/prompt-engineer.md +103 -0
  45. package/app/agents/qa-automation-engineer.md +182 -0
  46. package/app/agents/rag-engineer.md +201 -0
  47. package/app/agents/research-synthesizer.md +138 -0
  48. package/app/agents/search-specialist.md +101 -0
  49. package/app/agents/security-architect.md +62 -0
  50. package/app/agents/security-auditor.md +293 -0
  51. package/app/agents/seo-specialist.md +111 -0
  52. package/app/agents/system-governor.md +57 -0
  53. package/app/agents/tech-lead.md +62 -0
  54. package/app/agents/technical-researcher.md +103 -0
  55. package/app/agents/test-engineer.md +264 -0
  56. package/app/constitution.md +38 -0
  57. package/app/hooks/_profile-check.sh +11 -0
  58. package/app/hooks/guard-destructive.sh +74 -0
  59. package/app/hooks/guard-path.sh +73 -0
  60. package/app/hooks/post-tool-use.sh +35 -0
  61. package/app/hooks/pre-compact.sh +31 -0
  62. package/app/hooks/quality-check.sh +22 -0
  63. package/app/hooks/quality-gate.sh +49 -0
  64. package/app/hooks/save-session.sh +24 -0
  65. package/app/hooks/session-end.sh +37 -0
  66. package/app/hooks/session-start.sh +29 -0
  67. package/app/hooks/subagent-start.sh +16 -0
  68. package/app/hooks/subagent-stop.sh +16 -0
  69. package/app/hooks/track-usage.sh +50 -0
  70. package/app/hooks/user-prompt-submit.sh +25 -0
  71. package/app/hooks.json +178 -0
  72. package/app/mcp-defaults.json +23 -0
  73. package/app/output-styles/golden-rules.md +43 -0
  74. package/app/plugins/README.md +19 -0
  75. package/app/plugins/csharp-pack/README.md +11 -0
  76. package/app/plugins/csharp-pack/plugin.json +18 -0
  77. package/app/plugins/enterprise-pack/README.md +16 -0
  78. package/app/plugins/enterprise-pack/hooks/output-style.sh +6 -0
  79. package/app/plugins/enterprise-pack/hooks/status-line.sh +8 -0
  80. package/app/plugins/enterprise-pack/plugin.json +24 -0
  81. package/app/plugins/frontend-pack/README.md +14 -0
  82. package/app/plugins/frontend-pack/plugin.json +22 -0
  83. package/app/plugins/java-pack/README.md +11 -0
  84. package/app/plugins/java-pack/plugin.json +18 -0
  85. package/app/plugins/kotlin-pack/README.md +11 -0
  86. package/app/plugins/kotlin-pack/plugin.json +18 -0
  87. package/app/plugins/memory-pack/README.md +24 -0
  88. package/app/plugins/memory-pack/hooks/observation-capture.sh +67 -0
  89. package/app/plugins/memory-pack/hooks/session-summary.sh +71 -0
  90. package/app/plugins/memory-pack/plugin.json +22 -0
  91. package/app/plugins/memory-pack/scripts/init_db.py +81 -0
  92. package/app/plugins/memory-pack/scripts/strip_private.py +22 -0
  93. package/app/plugins/memory-pack/skills/mem-search/SKILL.md +70 -0
  94. package/app/plugins/research-pack/README.md +14 -0
  95. package/app/plugins/research-pack/plugin.json +22 -0
  96. package/app/plugins/ruby-pack/README.md +11 -0
  97. package/app/plugins/ruby-pack/plugin.json +18 -0
  98. package/app/plugins/rust-pack/README.md +11 -0
  99. package/app/plugins/rust-pack/plugin.json +18 -0
  100. package/app/plugins/security-pack/README.md +15 -0
  101. package/app/plugins/security-pack/plugin.json +23 -0
  102. package/app/plugins/swift-pack/README.md +11 -0
  103. package/app/plugins/swift-pack/plugin.json +18 -0
  104. package/app/rules/claude-toolkit-rules.md +21 -0
  105. package/app/rules/git-conventions.md +5 -0
  106. package/app/rules/quality-gates.md +10 -0
  107. package/app/skills/_lib/__init__.py +1 -0
  108. package/app/skills/_lib/detect_utils.py +150 -0
  109. package/app/skills/agent-creator/SKILL.md +82 -0
  110. package/app/skills/analyze/SKILL.md +92 -0
  111. package/app/skills/analyze/scripts/complexity.py +165 -0
  112. package/app/skills/api-patterns/SKILL.md +305 -0
  113. package/app/skills/app-builder/SKILL.md +187 -0
  114. package/app/skills/architecture-audit/SKILL.md +141 -0
  115. package/app/skills/architecture-decision/SKILL.md +55 -0
  116. package/app/skills/architecture-decision/templates/adr-template.md +36 -0
  117. package/app/skills/biz-scan/SKILL.md +30 -0
  118. package/app/skills/briefing/SKILL.md +27 -0
  119. package/app/skills/build/SKILL.md +97 -0
  120. package/app/skills/build/scripts/detect-build.py +151 -0
  121. package/app/skills/chaos/SKILL.md +32 -0
  122. package/app/skills/ci/SKILL.md +77 -0
  123. package/app/skills/ci/scripts/ci-detect.py +135 -0
  124. package/app/skills/ci/templates/github-actions-node.yml +38 -0
  125. package/app/skills/ci/templates/github-actions-python.yml +42 -0
  126. package/app/skills/ci-cd-patterns/SKILL.md +299 -0
  127. package/app/skills/clean-code/SKILL.md +110 -0
  128. package/app/skills/clean-code/reference/dart.md +18 -0
  129. package/app/skills/clean-code/reference/go.md +23 -0
  130. package/app/skills/clean-code/reference/php.md +32 -0
  131. package/app/skills/clean-code/reference/python.md +180 -0
  132. package/app/skills/clean-code/reference/typescript.md +26 -0
  133. package/app/skills/command-creator/SKILL.md +83 -0
  134. package/app/skills/commit/SKILL.md +98 -0
  135. package/app/skills/commit/scripts/pre-commit-check.py +87 -0
  136. package/app/skills/commit/templates/conventional-commit.md +52 -0
  137. package/app/skills/csharp-patterns/SKILL.md +450 -0
  138. package/app/skills/database-patterns/SKILL.md +297 -0
  139. package/app/skills/debug/SKILL.md +154 -0
  140. package/app/skills/debug/scripts/error-parser.py +187 -0
  141. package/app/skills/debugging-tactics/SKILL.md +136 -0
  142. package/app/skills/deploy/SKILL.md +130 -0
  143. package/app/skills/deploy/scripts/pre_deploy_check.py +171 -0
  144. package/app/skills/deploy/templates/deployment-checklist.md +31 -0
  145. package/app/skills/design-an-interface/SKILL.md +105 -0
  146. package/app/skills/design-engineering/SKILL.md +260 -0
  147. package/app/skills/docker-devops/SKILL.md +303 -0
  148. package/app/skills/docs/SKILL.md +145 -0
  149. package/app/skills/docs/scripts/doc-inventory.py +176 -0
  150. package/app/skills/docs/templates/adr-template.md +36 -0
  151. package/app/skills/docs/templates/readme-template.md +67 -0
  152. package/app/skills/documentation-standards/SKILL.md +191 -0
  153. package/app/skills/ecommerce-patterns/SKILL.md +209 -0
  154. package/app/skills/evaluate/SKILL.md +132 -0
  155. package/app/skills/evolve/SKILL.md +27 -0
  156. package/app/skills/explain/SKILL.md +54 -0
  157. package/app/skills/explain/scripts/dependency-graph.py +215 -0
  158. package/app/skills/explore/SKILL.md +112 -0
  159. package/app/skills/explore/scripts/visualize.py +117 -0
  160. package/app/skills/fix/SKILL.md +78 -0
  161. package/app/skills/fix/scripts/error-classifier.py +191 -0
  162. package/app/skills/flutter-patterns/SKILL.md +254 -0
  163. package/app/skills/git-mastery/SKILL.md +70 -0
  164. package/app/skills/grill-me/SKILL.md +38 -0
  165. package/app/skills/health/SKILL.md +91 -0
  166. package/app/skills/health/scripts/health_check.py +162 -0
  167. package/app/skills/hive-mind/SKILL.md +56 -0
  168. package/app/skills/hook-creator/SKILL.md +107 -0
  169. package/app/skills/index/SKILL.md +74 -0
  170. package/app/skills/instinct-review/SKILL.md +77 -0
  171. package/app/skills/java-patterns/SKILL.md +442 -0
  172. package/app/skills/kotlin-patterns/SKILL.md +446 -0
  173. package/app/skills/lint/SKILL.md +103 -0
  174. package/app/skills/lint/scripts/detect-linters.py +112 -0
  175. package/app/skills/mcp-patterns/SKILL.md +270 -0
  176. package/app/skills/mem-search/SKILL.md +70 -0
  177. package/app/skills/migrate/SKILL.md +90 -0
  178. package/app/skills/migrate/scripts/migration-status.py +195 -0
  179. package/app/skills/migration-patterns/SKILL.md +260 -0
  180. package/app/skills/night-watch/SKILL.md +28 -0
  181. package/app/skills/observability-patterns/SKILL.md +203 -0
  182. package/app/skills/onboard/SKILL.md +76 -0
  183. package/app/skills/orchestrate/SKILL.md +86 -0
  184. package/app/skills/panic/SKILL.md +30 -0
  185. package/app/skills/performance-profiling/SKILL.md +59 -0
  186. package/app/skills/plan/SKILL.md +110 -0
  187. package/app/skills/plan/templates/plan-template.md +40 -0
  188. package/app/skills/plan-writing/SKILL.md +201 -0
  189. package/app/skills/plugin-creator/SKILL.md +78 -0
  190. package/app/skills/pr/SKILL.md +129 -0
  191. package/app/skills/pr/scripts/pr-summary.py +175 -0
  192. package/app/skills/prd-to-issues/SKILL.md +108 -0
  193. package/app/skills/prd-to-plan/SKILL.md +120 -0
  194. package/app/skills/predict/SKILL.md +30 -0
  195. package/app/skills/qa-session/SKILL.md +110 -0
  196. package/app/skills/rag-patterns/SKILL.md +203 -0
  197. package/app/skills/refactor/SKILL.md +124 -0
  198. package/app/skills/refactor/scripts/refactor-scan.py +210 -0
  199. package/app/skills/refactor-plan/SKILL.md +112 -0
  200. package/app/skills/repeat/SKILL.md +149 -0
  201. package/app/skills/research-mastery/SKILL.md +56 -0
  202. package/app/skills/review/SKILL.md +141 -0
  203. package/app/skills/review/scripts/diff-analyzer.py +170 -0
  204. package/app/skills/rollback/SKILL.md +87 -0
  205. package/app/skills/rollback/scripts/rollback_info.py +149 -0
  206. package/app/skills/ruby-patterns/SKILL.md +454 -0
  207. package/app/skills/rust-patterns/SKILL.md +446 -0
  208. package/app/skills/search/SKILL.md +64 -0
  209. package/app/skills/security-patterns/SKILL.md +91 -0
  210. package/app/skills/security-patterns/reference/authentication.md +37 -0
  211. package/app/skills/security-patterns/reference/authorization.md +22 -0
  212. package/app/skills/security-patterns/reference/input-validation.md +30 -0
  213. package/app/skills/security-patterns/reference/oauth-csrf-audit.md +131 -0
  214. package/app/skills/skill-creator/SKILL.md +154 -0
  215. package/app/skills/skill-creator/templates/dashboard/index.html +130 -0
  216. package/app/skills/skill-creator/templates/reasoning-engine/assets/example.json +12 -0
  217. package/app/skills/skill-creator/templates/reasoning-engine/search.py +110 -0
  218. package/app/skills/subagent-development/SKILL.md +225 -0
  219. package/app/skills/subagent-development/reference/code-quality-reviewer-prompt.md +145 -0
  220. package/app/skills/subagent-development/reference/implementer-prompt.md +118 -0
  221. package/app/skills/subagent-development/reference/spec-reviewer-prompt.md +100 -0
  222. package/app/skills/swarm/SKILL.md +81 -0
  223. package/app/skills/swift-patterns/SKILL.md +500 -0
  224. package/app/skills/tdd/SKILL.md +174 -0
  225. package/app/skills/tdd/reference/deep-modules.md +32 -0
  226. package/app/skills/tdd/reference/interface-design.md +32 -0
  227. package/app/skills/tdd/reference/mocking.md +52 -0
  228. package/app/skills/tdd/reference/refactoring.md +10 -0
  229. package/app/skills/tdd/reference/tests.md +59 -0
  230. package/app/skills/teams/SKILL.md +101 -0
  231. package/app/skills/test/SKILL.md +107 -0
  232. package/app/skills/test/scripts/detect-runner.py +113 -0
  233. package/app/skills/testing-patterns/SKILL.md +73 -0
  234. package/app/skills/testing-patterns/reference/flutter-testing.md +33 -0
  235. package/app/skills/testing-patterns/reference/go-testing.md +52 -0
  236. package/app/skills/testing-patterns/reference/php-phpunit.md +39 -0
  237. package/app/skills/testing-patterns/reference/python-pytest.md +228 -0
  238. package/app/skills/testing-patterns/reference/typescript-vitest.md +50 -0
  239. package/app/skills/triage-issue/SKILL.md +120 -0
  240. package/app/skills/typescript-patterns/SKILL.md +256 -0
  241. package/app/skills/ubiquitous-language/SKILL.md +74 -0
  242. package/app/skills/verification-before-completion/SKILL.md +108 -0
  243. package/app/skills/workflow/SKILL.md +250 -0
  244. package/app/skills/write-a-prd/SKILL.md +129 -0
  245. package/app/skills/write-a-prd/reference/visual-companion.md +78 -0
  246. package/app/skills/write-a-prd/scripts/frame-template.html +111 -0
  247. package/app/skills/write-a-prd/scripts/visual-server.cjs +79 -0
  248. package/app/templates/skill/generator/SKILL.md.template +40 -0
  249. package/app/templates/skill/knowledge/SKILL.md.template +52 -0
  250. package/app/templates/skill/linter/SKILL.md.template +34 -0
  251. package/app/templates/skill/reviewer/SKILL.md.template +51 -0
  252. package/app/templates/skill/workflow/SKILL.md.template +49 -0
  253. package/benchmarks/README.md +111 -0
  254. package/benchmarks/ecosystem-dashboard.json +148 -0
  255. package/benchmarks/ecosystem-harvest.json +148 -0
  256. package/benchmarks/results.json +38 -0
  257. package/benchmarks/run.py +351 -0
  258. package/bin/ai-toolkit.js +345 -0
  259. package/kb/best-practices/README.md +11 -0
  260. package/kb/howto/README.md +11 -0
  261. package/kb/procedures/maintenance-sop.md +306 -0
  262. package/kb/reference/agents-catalog.md +124 -0
  263. package/kb/reference/anti-pattern-registry-format.md +221 -0
  264. package/kb/reference/architecture-overview.md +232 -0
  265. package/kb/reference/benchmark-config.md +62 -0
  266. package/kb/reference/ci-integration.md +66 -0
  267. package/kb/reference/claude-ecosystem-benchmark-snapshot.md +80 -0
  268. package/kb/reference/claude-ecosystem-expansion-foundations.md +102 -0
  269. package/kb/reference/commands-catalog.md +21 -0
  270. package/kb/reference/distribution-model.md +63 -0
  271. package/kb/reference/global-install-model.md +56 -0
  272. package/kb/reference/hierarchical-override-pattern.md +200 -0
  273. package/kb/reference/hooks-catalog.md +306 -0
  274. package/kb/reference/integrations.md +88 -0
  275. package/kb/reference/language-packs.md +52 -0
  276. package/kb/reference/merge-friendly-install-model.md +58 -0
  277. package/kb/reference/plugin-pack-conventions.md +151 -0
  278. package/kb/reference/quick-wins-implementation-summary.md +70 -0
  279. package/kb/reference/skill-templates.md +50 -0
  280. package/kb/reference/skills-catalog.md +215 -0
  281. package/kb/reference/skills-unification.md +57 -0
  282. package/kb/reference/stats.md +69 -0
  283. package/kb/reference/sync.md +76 -0
  284. package/kb/troubleshooting/README.md +11 -0
  285. package/llms-full.txt +3068 -0
  286. package/llms.txt +39 -0
  287. package/package.json +75 -0
  288. package/scripts/_common.py +160 -0
  289. package/scripts/add_rule.py +50 -0
  290. package/scripts/benchmark_config.py +127 -0
  291. package/scripts/benchmark_ecosystem.py +288 -0
  292. package/scripts/check_deps.py +260 -0
  293. package/scripts/create_skill.py +118 -0
  294. package/scripts/doctor.py +504 -0
  295. package/scripts/eject.py +113 -0
  296. package/scripts/emission.py +256 -0
  297. package/scripts/evaluate_skills.py +260 -0
  298. package/scripts/frontmatter.py +58 -0
  299. package/scripts/generate_agents_md.py +91 -0
  300. package/scripts/generate_aider_conf.py +51 -0
  301. package/scripts/generate_cline.py +35 -0
  302. package/scripts/generate_copilot.py +30 -0
  303. package/scripts/generate_cursor_rules.py +35 -0
  304. package/scripts/generate_gemini.py +28 -0
  305. package/scripts/generate_llms_txt.py +164 -0
  306. package/scripts/generate_roo_modes.py +80 -0
  307. package/scripts/generate_windsurf.py +35 -0
  308. package/scripts/generator_base.py +140 -0
  309. package/scripts/harvest_ecosystem.py +50 -0
  310. package/scripts/inject_rule_cli.py +101 -0
  311. package/scripts/inject_section_cli.py +47 -0
  312. package/scripts/injection.py +180 -0
  313. package/scripts/install.py +236 -0
  314. package/scripts/install_git_hooks.py +71 -0
  315. package/scripts/install_steps/__init__.py +5 -0
  316. package/scripts/install_steps/ai_tools.py +261 -0
  317. package/scripts/install_steps/hooks.py +90 -0
  318. package/scripts/install_steps/markers.py +79 -0
  319. package/scripts/install_steps/symlinks.py +87 -0
  320. package/scripts/merge-hooks.py +192 -0
  321. package/scripts/plugin.py +642 -0
  322. package/scripts/plugin_schema.py +138 -0
  323. package/scripts/remove_rule.py +58 -0
  324. package/scripts/stats.py +81 -0
  325. package/scripts/sync.py +215 -0
  326. package/scripts/uninstall.py +292 -0
  327. package/scripts/validate.py +700 -0
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: fix
3
+ description: "Auto-fix lint errors, type issues, and simple bugs"
4
+ effort: low
5
+ disable-model-invocation: true
6
+ argument-hint: "[test or lint target]"
7
+ allowed-tools: Bash, Read, Edit, Grep
8
+ ---
9
+
10
+ # Fix Command
11
+
12
+ $ARGUMENTS
13
+
14
+ Attempts to fix code errors autonomously.
15
+
16
+ ## Usage
17
+
18
+ ```bash
19
+ /fix <file_or_scope>
20
+ # Example: /fix src/utils.ts
21
+ ```
22
+
23
+ ## Automated Error Classification
24
+
25
+ Before entering the fix loop, classify errors to prioritize auto-fixable ones:
26
+
27
+ ```bash
28
+ # Pipe lint or test output
29
+ ruff check . 2>&1 | python3 "$(dirname "$0")/scripts/error-classifier.py"
30
+ mypy src/ 2>&1 | python3 scripts/error-classifier.py
31
+ npx eslint . 2>&1 | python3 scripts/error-classifier.py
32
+ ```
33
+
34
+ The script outputs JSON with:
35
+ - **total_errors**: count of all parsed errors
36
+ - **auto_fixable_count**: errors that tools can fix automatically (e.g., F401 unused imports, formatting)
37
+ - **manual_count**: errors requiring human/agent intervention
38
+ - **tools_detected**: which linters produced the output (ruff, mypy, eslint, tsc, phpstan)
39
+ - **errors[]**: each error with file, line, code, message, and auto_fixable flag
40
+ - **suggested_order**: files to fix, auto-fixable first
41
+ - **fix_strategy**: recommended approach (auto-fix first, then manual)
42
+
43
+ Use this to run auto-fixers (e.g., `ruff check --fix .`) before spending time on manual fixes.
44
+
45
+ ---
46
+
47
+ ## Protocol (The "Fix Loop")
48
+
49
+ 1. **Analyze**: Run validation to get the exact error message.
50
+ ```bash
51
+ # Get error
52
+ npm test src/utils.ts 2>&1 | tee error.log
53
+ ```
54
+
55
+ 2. **Diagnose**: Analyze `error.log`.
56
+ - Use `debugging-tactics` skill.
57
+ - Trace the error to the source line.
58
+
59
+ 3. **Patch**: Apply a fix.
60
+ - Use `sed` or `write_file`.
61
+
62
+ 4. **Verify**: Run validation again.
63
+ - If PASS: Stop.
64
+ - If FAIL: Repeat (Max 3 retries).
65
+
66
+ ## Safety Limits
67
+ - **Max Retries**: 3
68
+ - **Scope**: Only modify the specified files.
69
+ - **Stop Condition**: If new errors appear that are totally different, STOP and ask user.
70
+
71
+ ## Example Flow
72
+ ```
73
+ User: /fix app.py
74
+ Agent: Running tests... FAIL (NameError)
75
+ Agent: Fixing app.py (Import missing module)
76
+ Agent: Running tests... PASS
77
+ Agent: Fixed NameError in app.py
78
+ ```
@@ -0,0 +1,191 @@
1
+ #!/usr/bin/env python3
2
+ """Parse lint/test error output from stdin and classify as auto-fixable or manual.
3
+
4
+ Reads multi-tool error output (ruff, mypy, ESLint, tsc, phpstan) from
5
+ stdin, parses each line into structured records, and classifies every
6
+ error as either auto-fixable or requiring manual intervention. The
7
+ output is a JSON object with error counts, a prioritised file order
8
+ (auto-fixable first), and a suggested fix strategy.
9
+
10
+ Usage::
11
+
12
+ ruff check . 2>&1 | python3 error-classifier.py
13
+ mypy src/ 2>&1 | python3 error-classifier.py
14
+ """
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import re
19
+ import sys
20
+ from typing import Any
21
+
22
+
23
+ # Patterns to parse error formats: (file, line, col_or_none, code_or_none, message)
24
+ ERROR_PARSERS: dict[str, re.Pattern[str]] = {
25
+ "ruff": re.compile(r"^(.+?):(\d+):(\d+):\s+([A-Z]\d+)\s+(.+)$"),
26
+ "mypy": re.compile(r"^(.+?):(\d+):\s+error:\s+(.+?)(?:\s+\[(.+)\])?$"),
27
+ "eslint": re.compile(r"^\s*(\d+):(\d+)\s+(error|warning)\s+(.+?)\s+(\S+)$"),
28
+ "tsc": re.compile(r"^(.+?)\((\d+),(\d+)\):\s+error\s+(TS\d+):\s+(.+)$"),
29
+ "phpstan": re.compile(r"^(.+?):(\d+)\s+(.+)$"),
30
+ }
31
+
32
+ # Auto-fixable error codes/patterns
33
+ AUTO_FIXABLE: dict[str, str] = {
34
+ # Ruff
35
+ "F401": "unused import",
36
+ "F841": "unused variable",
37
+ "W291": "trailing whitespace",
38
+ "W292": "no newline at end of file",
39
+ "W293": "whitespace before ':'",
40
+ "E301": "expected blank lines",
41
+ "E302": "expected 2 blank lines",
42
+ "E303": "too many blank lines",
43
+ "E501": "line too long",
44
+ "I001": "import sort order",
45
+ "C408": "unnecessary dict/list call",
46
+ "UP": "pyupgrade",
47
+ # ESLint
48
+ "no-unused-vars": "unused variable",
49
+ "semi": "missing semicolon",
50
+ "indent": "indentation",
51
+ "quotes": "quote style",
52
+ "comma-dangle": "trailing comma",
53
+ "eol-last": "newline at end",
54
+ }
55
+
56
+
57
+ def is_auto_fixable(code: str | None) -> bool:
58
+ """Check if an error code is auto-fixable.
59
+
60
+ Matches exact codes and short prefix patterns (e.g. ``"UP"`` matches
61
+ ``"UP006"``).
62
+
63
+ Args:
64
+ code: The error code string, or ``None``.
65
+
66
+ Returns:
67
+ ``True`` if the error can be fixed automatically.
68
+ """
69
+ if not code:
70
+ return False
71
+ if code in AUTO_FIXABLE:
72
+ return True
73
+ # Check prefix matches (e.g., UP006 matches "UP")
74
+ for prefix in AUTO_FIXABLE:
75
+ if len(prefix) <= 3 and code.startswith(prefix):
76
+ return True
77
+ return False
78
+
79
+
80
+ def _err(
81
+ tool: str,
82
+ file: str,
83
+ line: str | int,
84
+ col: str | int,
85
+ code: str | None,
86
+ msg: str,
87
+ ) -> dict[str, Any]:
88
+ """Build a structured error dictionary.
89
+
90
+ Args:
91
+ tool: Name of the tool that produced the error.
92
+ file: Source file path.
93
+ line: Line number (converted to int).
94
+ col: Column number (converted to int).
95
+ code: Error code or rule identifier.
96
+ msg: Human-readable error message.
97
+
98
+ Returns:
99
+ Dictionary with tool, file, line, column, code, message, and
100
+ auto_fixable flag.
101
+ """
102
+ return {"tool": tool, "file": file, "line": int(line), "column": int(col),
103
+ "code": code, "message": msg, "auto_fixable": is_auto_fixable(code)}
104
+
105
+
106
+ def parse_errors(text: str) -> list[dict[str, Any]]:
107
+ """Parse multi-tool error output and return structured error records.
108
+
109
+ Supports ruff, mypy, tsc, and ESLint output formats. ESLint is
110
+ detected via a file-header line followed by indented error lines.
111
+
112
+ Args:
113
+ text: Raw error output text, typically from stdout/stderr.
114
+
115
+ Returns:
116
+ List of structured error dictionaries.
117
+ """
118
+ errors: list[dict[str, Any]] = []
119
+ eslint_file: str | None = None
120
+ for line in text.strip().split("\n"):
121
+ line = line.rstrip()
122
+ if not line:
123
+ continue
124
+ m = ERROR_PARSERS["ruff"].match(line)
125
+ if m:
126
+ errors.append(_err("ruff", m[1], m[2], m[3], m[4], m[5]))
127
+ continue
128
+ m = ERROR_PARSERS["mypy"].match(line)
129
+ if m:
130
+ errors.append(_err("mypy", m[1], m[2], 0, m[4] or "mypy", m[3]))
131
+ continue
132
+ m = ERROR_PARSERS["tsc"].match(line)
133
+ if m:
134
+ errors.append(_err("tsc", m[1], m[2], m[3], m[4], m[5]))
135
+ continue
136
+ # ESLint: file header then indented errors
137
+ if re.match(r"^[/.]", line) and not re.search(r":\d+", line):
138
+ eslint_file = line.strip()
139
+ continue
140
+ m = ERROR_PARSERS["eslint"].match(line)
141
+ if m and eslint_file:
142
+ errors.append(_err("eslint", eslint_file, m[1], m[2], m[5], m[4]))
143
+ return errors
144
+
145
+
146
+ def main() -> None:
147
+ """Entry point: read stdin, classify errors, and print JSON to stdout."""
148
+ text = sys.stdin.read()
149
+ if not text.strip():
150
+ print(json.dumps({"error": "No input provided. Pipe lint/test output to stdin."}))
151
+ return
152
+
153
+ errors = parse_errors(text)
154
+ auto_fixable = [e for e in errors if e["auto_fixable"]]
155
+ manual = [e for e in errors if not e["auto_fixable"]]
156
+
157
+ # Group by file for suggested order
158
+ file_order: list[str] = []
159
+ seen: set[str] = set()
160
+ # Auto-fixable files first
161
+ for e in auto_fixable:
162
+ if e["file"] not in seen:
163
+ seen.add(e["file"])
164
+ file_order.append(e["file"])
165
+ # Then manual files
166
+ for e in manual:
167
+ if e["file"] not in seen:
168
+ seen.add(e["file"])
169
+ file_order.append(e["file"])
170
+
171
+ # Tool summary
172
+ tools_detected = list(set(e["tool"] for e in errors))
173
+
174
+ result: dict[str, Any] = {
175
+ "total_errors": len(errors),
176
+ "auto_fixable_count": len(auto_fixable),
177
+ "manual_count": len(manual),
178
+ "tools_detected": tools_detected,
179
+ "errors": errors,
180
+ "suggested_order": file_order,
181
+ "fix_strategy": (
182
+ "Run auto-fix first (e.g., ruff check --fix .), then address manual errors."
183
+ if auto_fixable
184
+ else "All errors require manual intervention."
185
+ ),
186
+ }
187
+ print(json.dumps(result, indent=2))
188
+
189
+
190
+ if __name__ == "__main__":
191
+ main()
@@ -0,0 +1,254 @@
1
+ ---
2
+ name: flutter-patterns
3
+ description: "Loaded when user asks about Flutter or Dart development patterns"
4
+ effort: medium
5
+ user-invocable: false
6
+ ---
7
+
8
+ # Flutter Patterns Skill
9
+
10
+ ## Project Structure
11
+
12
+ ```
13
+ lib/
14
+ ├── main.dart
15
+ ├── app.dart
16
+ ├── core/
17
+ │ ├── constants/
18
+ │ ├── errors/
19
+ │ ├── network/
20
+ │ └── utils/
21
+ ├── features/
22
+ │ └── feature_name/
23
+ │ ├── data/
24
+ │ │ ├── models/
25
+ │ │ ├── repositories/
26
+ │ │ └── sources/
27
+ │ ├── domain/
28
+ │ │ ├── entities/
29
+ │ │ └── usecases/
30
+ │ └── presentation/
31
+ │ ├── bloc/
32
+ │ ├── pages/
33
+ │ └── widgets/
34
+ └── shared/
35
+ ├── widgets/
36
+ └── theme/
37
+ ```
38
+
39
+ ---
40
+
41
+ ## State Management
42
+
43
+ ### BLoC Pattern
44
+ ```dart
45
+ // Event
46
+ abstract class AuthEvent {}
47
+ class LoginRequested extends AuthEvent {
48
+ final String email;
49
+ final String password;
50
+ LoginRequested(this.email, this.password);
51
+ }
52
+
53
+ // State
54
+ abstract class AuthState {}
55
+ class AuthInitial extends AuthState {}
56
+ class AuthLoading extends AuthState {}
57
+ class AuthSuccess extends AuthState {
58
+ final User user;
59
+ AuthSuccess(this.user);
60
+ }
61
+ class AuthFailure extends AuthState {
62
+ final String message;
63
+ AuthFailure(this.message);
64
+ }
65
+
66
+ // BLoC
67
+ class AuthBloc extends Bloc<AuthEvent, AuthState> {
68
+ AuthBloc() : super(AuthInitial()) {
69
+ on<LoginRequested>(_onLoginRequested);
70
+ }
71
+
72
+ Future<void> _onLoginRequested(
73
+ LoginRequested event,
74
+ Emitter<AuthState> emit,
75
+ ) async {
76
+ emit(AuthLoading());
77
+ try {
78
+ final user = await authRepository.login(event.email, event.password);
79
+ emit(AuthSuccess(user));
80
+ } catch (e) {
81
+ emit(AuthFailure(e.toString()));
82
+ }
83
+ }
84
+ }
85
+ ```
86
+
87
+ ### Riverpod
88
+ ```dart
89
+ final userProvider = FutureProvider<User>((ref) async {
90
+ final repository = ref.watch(userRepositoryProvider);
91
+ return repository.getUser();
92
+ });
93
+
94
+ // Usage
95
+ Consumer(
96
+ builder: (context, ref, child) {
97
+ final userAsync = ref.watch(userProvider);
98
+ return userAsync.when(
99
+ data: (user) => Text(user.name),
100
+ loading: () => CircularProgressIndicator(),
101
+ error: (e, s) => Text('Error: $e'),
102
+ );
103
+ },
104
+ )
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Navigation (GoRouter)
110
+
111
+ ```dart
112
+ final router = GoRouter(
113
+ routes: [
114
+ GoRoute(
115
+ path: '/',
116
+ builder: (context, state) => HomeScreen(),
117
+ routes: [
118
+ GoRoute(
119
+ path: 'details/:id',
120
+ builder: (context, state) => DetailsScreen(
121
+ id: state.pathParameters['id']!,
122
+ ),
123
+ ),
124
+ ],
125
+ ),
126
+ ],
127
+ );
128
+
129
+ // Navigation
130
+ context.go('/details/123');
131
+ context.push('/details/123');
132
+ context.pop();
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Widget Patterns
138
+
139
+ ### Responsive Layout
140
+ ```dart
141
+ class ResponsiveLayout extends StatelessWidget {
142
+ final Widget mobile;
143
+ final Widget? tablet;
144
+ final Widget desktop;
145
+
146
+ @override
147
+ Widget build(BuildContext context) {
148
+ return LayoutBuilder(
149
+ builder: (context, constraints) {
150
+ if (constraints.maxWidth < 600) {
151
+ return mobile;
152
+ } else if (constraints.maxWidth < 1200) {
153
+ return tablet ?? desktop;
154
+ }
155
+ return desktop;
156
+ },
157
+ );
158
+ }
159
+ }
160
+ ```
161
+
162
+ ### Sliver Patterns
163
+ ```dart
164
+ CustomScrollView(
165
+ slivers: [
166
+ SliverAppBar(
167
+ floating: true,
168
+ title: Text('Title'),
169
+ ),
170
+ SliverPadding(
171
+ padding: EdgeInsets.all(16),
172
+ sliver: SliverList(
173
+ delegate: SliverChildBuilderDelegate(
174
+ (context, index) => ListTile(title: Text('Item $index')),
175
+ childCount: 100,
176
+ ),
177
+ ),
178
+ ),
179
+ ],
180
+ )
181
+ ```
182
+
183
+ ---
184
+
185
+ ## Performance
186
+
187
+ ### const Constructors
188
+ ```dart
189
+ // Good
190
+ const Text('Hello');
191
+ const SizedBox(height: 8);
192
+
193
+ // Widget with const constructor
194
+ class MyWidget extends StatelessWidget {
195
+ const MyWidget({super.key});
196
+ }
197
+ ```
198
+
199
+ ### RepaintBoundary
200
+ ```dart
201
+ RepaintBoundary(
202
+ child: ComplexAnimatedWidget(),
203
+ )
204
+ ```
205
+
206
+ ### Image Optimization
207
+ ```dart
208
+ Image.network(
209
+ url,
210
+ cacheWidth: 200, // Resize in memory
211
+ cacheHeight: 200,
212
+ )
213
+ ```
214
+
215
+ ---
216
+
217
+ ## Testing
218
+
219
+ ### Widget Testing
220
+ ```dart
221
+ testWidgets('Counter increments', (tester) async {
222
+ await tester.pumpWidget(MyApp());
223
+
224
+ expect(find.text('0'), findsOneWidget);
225
+
226
+ await tester.tap(find.byIcon(Icons.add));
227
+ await tester.pump();
228
+
229
+ expect(find.text('1'), findsOneWidget);
230
+ });
231
+ ```
232
+
233
+ ### BLoC Testing
234
+ ```dart
235
+ blocTest<AuthBloc, AuthState>(
236
+ 'emits [loading, success] when login succeeds',
237
+ build: () => AuthBloc(),
238
+ act: (bloc) => bloc.add(LoginRequested('email', 'pass')),
239
+ expect: () => [AuthLoading(), isA<AuthSuccess>()],
240
+ );
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Best Practices
246
+
247
+ - ✅ Use const constructors
248
+ - ✅ Extract widgets to separate files
249
+ - ✅ Use named routes
250
+ - ✅ Implement proper error handling
251
+ - ✅ Use proper state management
252
+ - ❌ Avoid setState for complex state
253
+ - ❌ Don't nest too many widgets
254
+ - ❌ Avoid magic numbers
@@ -0,0 +1,70 @@
1
+ ---
2
+ name: git-mastery
3
+ description: "Loaded when user asks about advanced Git workflows or history rewriting"
4
+ effort: medium
5
+ user-invocable: false
6
+ allowed-tools: Bash
7
+ ---
8
+
9
+ # Git Mastery Skill
10
+
11
+ ## 🛡️ Safety First Protocol
12
+ - **Never** force push to `main` / `master` / `develop`.
13
+ - **Always** use `--force-with-lease` instead of `--force`.
14
+ - **Always** create a backup branch before complex operations:
15
+ `git branch backup/feature-xyz-pre-rebase`
16
+
17
+ ## Advanced Workflows
18
+
19
+ ### 1. Automated Bug Hunting (Git Bisect)
20
+ Find the specific commit that introduced a bug.
21
+ ```bash
22
+ # Start
23
+ git bisect start
24
+ git bisect bad # Current version is broken
25
+ git bisect good <commit-sha> # Version that worked
26
+
27
+ # Automate with test script
28
+ git bisect run pytest tests/test_failing_feature.py
29
+ ```
30
+
31
+ ### 2. Interactive Interactive Rebase
32
+ Clean up commit history before merge.
33
+ ```bash
34
+ git rebase -i HEAD~n
35
+ ```
36
+ - **squash**: Combine commits.
37
+ - **reword**: Fix messages.
38
+ - **dropped**: Remove junk commits.
39
+
40
+ ### 3. Log Analysis
41
+ Visualize branch topology.
42
+ ```bash
43
+ git log --graph --oneline --decorate --all
44
+ ```
45
+
46
+ ### 4. Recovery (Reflog)
47
+ Recover "lost" commits after a bad reset/rebase.
48
+ ```bash
49
+ git reflog
50
+ git reset --hard HEAD@{n}
51
+ ```
52
+
53
+ ### 5. Cherry Picking
54
+ Pick specific commits from other branches.
55
+ ```bash
56
+ git cherry-pick <commit-sha>
57
+ # If valid conflict
58
+ git add .
59
+ git cherry-pick --continue
60
+ ```
61
+
62
+ ## Commit Message Standard (Conventional Commits)
63
+ - `feat:` New feature
64
+ - `fix:` Bug fix
65
+ - `docs:` Documentation only
66
+ - `style:` Formatting (white-space, etc)
67
+ - `refactor:` Code change that neither fixes a bug nor adds a feature
68
+ - `perf:` Performance improvement
69
+ - `test:` Adding missing tests
70
+ - `chore:` Build process/auxiliary tools
@@ -0,0 +1,38 @@
1
+ ---
2
+ name: grill-me
3
+ description: "Stress-test a plan or design through relentless Socratic questioning, walking down each decision branch until reaching shared understanding. Use when user wants to stress-test a plan, get grilled, validate assumptions, or mentions 'grill me'."
4
+ user-invocable: true
5
+ effort: medium
6
+ argument-hint: "[plan or design to stress-test]"
7
+ allowed-tools: Read, Grep, Glob, Bash, Agent
8
+ ---
9
+
10
+ # Grill Me
11
+
12
+ $ARGUMENTS
13
+
14
+ Interview relentlessly about every aspect of the plan until reaching shared understanding.
15
+
16
+ ## Usage
17
+
18
+ ```
19
+ /grill-me [plan or design to stress-test]
20
+ ```
21
+
22
+ ## What This Command Does
23
+
24
+ 1. **Reads** the plan or design (from context, file, or user description)
25
+ 2. **Walks** down each branch of the decision tree
26
+ 3. **Resolves** dependencies between decisions one-by-one
27
+ 4. **Provides** recommended answers for each question
28
+ 5. **Continues** until shared understanding is reached
29
+
30
+ ## Rules
31
+
32
+ - Ask questions **one at a time**
33
+ - For each question, provide your **recommended answer**
34
+ - If a question can be answered by **exploring the codebase**, explore instead of asking
35
+ - Resolve dependencies between decisions — don't skip ahead
36
+ - Be relentless — don't settle for vague or hand-wavy answers
37
+ - Challenge assumptions, not just surface decisions
38
+ - Apply Devil's Advocate critique to every major decision