cc-codeconductor 0.4.3 → 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 (262) hide show
  1. package/README.md +95 -95
  2. package/dist/cli/errors.d.ts +65 -0
  3. package/dist/core/compilation/compile-checker.d.ts +51 -0
  4. package/dist/core/config/codeconductor-config.d.ts +42 -0
  5. package/dist/core/config/config-loader.d.ts +11 -0
  6. package/dist/core/filesystem/credential-guard.d.ts +18 -0
  7. package/dist/core/goal/goal-planner.d.ts +8 -0
  8. package/dist/core/goal/goal-state.d.ts +15 -0
  9. package/dist/core/loop/git-stats.d.ts +13 -0
  10. package/dist/core/loop/loop-engine.d.ts +79 -0
  11. package/dist/core/memory/episodic-store.d.ts +6 -0
  12. package/dist/core/memory/operational-state.d.ts +6 -0
  13. package/dist/core/orchestrator/runtime-orchestrator.d.ts +25 -0
  14. package/dist/core/planner/product-planner.d.ts +18 -0
  15. package/dist/core/presets/package-paths.d.ts +4 -0
  16. package/dist/core/product-graph/graph-store.d.ts +11 -0
  17. package/dist/core/product-graph/paths.d.ts +18 -0
  18. package/dist/core/verification/verification-runner.d.ts +57 -0
  19. package/dist/domain/loop/loop-state.d.ts +74 -0
  20. package/dist/domain/product/entities.d.ts +11 -0
  21. package/dist/index.d.ts +15 -0
  22. package/dist/index.js +23721 -15064
  23. package/dist/library.js +2595 -0
  24. package/dist/utils/result.d.ts +36 -0
  25. package/dist/validation/schemas.d.ts +3660 -0
  26. package/package.json +15 -2
  27. package/policy.yml +12 -11
  28. package/presets/agy/AGENTS.md +11 -5
  29. package/presets/agy/gates/pre-commit/GATE.md +136 -0
  30. package/presets/agy/skills/cc-fix/SKILL.md +2 -2
  31. package/presets/agy/skills/cc-tdd-cycle/SKILL.md +11 -0
  32. package/presets/agy/skills/evaluation/SKILL.md +6 -0
  33. package/presets/agy/skills/openspec/SKILL.md +32 -0
  34. package/presets/agy/workflows/cc-api-contract.md +12 -0
  35. package/presets/agy/workflows/cc-ask.md +55 -0
  36. package/presets/agy/workflows/cc-clarify.md +33 -0
  37. package/presets/agy/workflows/cc-council.md +31 -7
  38. package/presets/agy/workflows/cc-db-migration.md +22 -9
  39. package/presets/agy/workflows/cc-explore.md +37 -0
  40. package/presets/agy/workflows/cc-feature.md +41 -19
  41. package/presets/agy/workflows/cc-fix.md +50 -23
  42. package/presets/agy/workflows/cc-handoff.md +42 -0
  43. package/presets/agy/workflows/cc-iterative.md +128 -0
  44. package/presets/agy/workflows/cc-openspec.md +75 -0
  45. package/presets/agy/workflows/cc-pagespeed.md +12 -0
  46. package/presets/agy/workflows/cc-prototype.md +39 -0
  47. package/presets/agy/workflows/cc-refactor.md +12 -0
  48. package/presets/agy/workflows/cc-review.md +12 -0
  49. package/presets/agy/workflows/cc-scorecard.md +29 -0
  50. package/presets/agy/workflows/cc-tdd-cycle.md +24 -0
  51. package/presets/agy/workflows/cc-test-plan.md +12 -0
  52. package/presets/agy/workflows/cc-triage.md +35 -0
  53. package/presets/claude/CLAUDE.md +64 -0
  54. package/presets/claude/commands/cc/api-contract.md +12 -0
  55. package/presets/claude/commands/cc/ask.md +55 -0
  56. package/presets/claude/commands/cc/clarify.md +32 -0
  57. package/presets/claude/commands/cc/council.md +87 -0
  58. package/presets/claude/commands/cc/db-migration.md +22 -9
  59. package/presets/claude/commands/cc/explore.md +36 -0
  60. package/presets/claude/commands/cc/feature.md +49 -22
  61. package/presets/claude/commands/cc/fix.md +74 -20
  62. package/presets/claude/commands/cc/handoff.md +44 -0
  63. package/presets/claude/commands/cc/iterative.md +132 -0
  64. package/presets/claude/commands/cc/openspec.md +169 -0
  65. package/presets/claude/commands/cc/pagespeed.md +12 -0
  66. package/presets/claude/commands/cc/prototype.md +38 -0
  67. package/presets/claude/commands/cc/refactor.md +152 -1
  68. package/presets/claude/commands/cc/review.md +90 -17
  69. package/presets/claude/commands/cc/scorecard.md +77 -0
  70. package/presets/claude/commands/cc/tdd-cycle.md +53 -3
  71. package/presets/claude/commands/cc/test-plan.md +12 -0
  72. package/presets/claude/commands/cc/triage.md +34 -0
  73. package/presets/claude/gates/pre-commit/GATE.md +136 -0
  74. package/presets/claude/settings.json +8 -46
  75. package/presets/claude/skills/evaluation/SKILL.md +42 -0
  76. package/presets/claude/skills/openspec/SKILL.md +54 -0
  77. package/presets/codex/AGENTS.md +62 -5
  78. package/presets/codex/commands/cc-ask.md +55 -0
  79. package/presets/codex/gates/pre-commit/GATE.md +136 -0
  80. package/presets/cursor/.cursorignore +15 -0
  81. package/presets/cursor/AGENTS.md +504 -0
  82. package/presets/cursor/agents/architect.md +211 -0
  83. package/presets/cursor/agents/business-agent.md +44 -0
  84. package/presets/cursor/agents/complexity-auditor.md +76 -0
  85. package/presets/cursor/agents/continuous-architect.md +37 -0
  86. package/presets/cursor/agents/contract-builder.md +75 -0
  87. package/presets/cursor/agents/docs.md +181 -0
  88. package/presets/cursor/agents/goal-planner.md +71 -0
  89. package/presets/cursor/agents/impact-analyst.md +43 -0
  90. package/presets/cursor/agents/implementer.md +161 -0
  91. package/presets/cursor/agents/orchestrator.md +377 -0
  92. package/presets/cursor/agents/repo-explorer.md +100 -0
  93. package/presets/cursor/agents/reviewer.md +237 -0
  94. package/presets/cursor/agents/security-reviewer.md +113 -0
  95. package/presets/cursor/agents/task-coach.md +145 -0
  96. package/presets/cursor/agents/tester.md +241 -0
  97. package/presets/cursor/commands/cc/api-contract.md +70 -0
  98. package/presets/cursor/commands/cc/ask.md +55 -0
  99. package/presets/cursor/commands/cc/clarify.md +32 -0
  100. package/presets/cursor/commands/cc/council.md +87 -0
  101. package/presets/cursor/commands/cc/db-migration.md +71 -0
  102. package/presets/cursor/commands/cc/explore.md +36 -0
  103. package/presets/cursor/commands/cc/feature.md +137 -0
  104. package/presets/cursor/commands/cc/fix.md +148 -0
  105. package/presets/cursor/commands/cc/handoff.md +41 -0
  106. package/presets/cursor/commands/cc/iterative.md +133 -0
  107. package/presets/cursor/commands/cc/openspec.md +159 -0
  108. package/presets/cursor/commands/cc/pagespeed.md +115 -0
  109. package/presets/cursor/commands/cc/prototype.md +38 -0
  110. package/presets/cursor/commands/cc/refactor.md +160 -0
  111. package/presets/cursor/commands/cc/review.md +149 -0
  112. package/presets/cursor/commands/cc/scorecard.md +77 -0
  113. package/presets/cursor/commands/cc/tdd-cycle.md +250 -0
  114. package/presets/cursor/commands/cc/test-plan.md +150 -0
  115. package/presets/cursor/commands/cc/triage.md +34 -0
  116. package/presets/cursor/gates/pre-commit/GATE.md +136 -0
  117. package/presets/cursor/rules/behavioral-discipline.mdc +14 -0
  118. package/presets/cursor/rules/context-budget.mdc +12 -0
  119. package/presets/cursor/rules/orchestration.mdc +12 -0
  120. package/presets/cursor/rules/yagni-stdlib.mdc +11 -0
  121. package/presets/cursor/skills/android/SKILL.md +122 -0
  122. package/presets/cursor/skills/api-versioning/SKILL.md +394 -0
  123. package/presets/cursor/skills/astro/SKILL.md +322 -0
  124. package/presets/cursor/skills/auth-token-inspector/SKILL.md +33 -0
  125. package/presets/cursor/skills/code-review/SKILL.md +208 -0
  126. package/presets/cursor/skills/conductor-setup/SKILL.md +127 -0
  127. package/presets/cursor/skills/django-orm/SKILL.md +463 -0
  128. package/presets/cursor/skills/django-testing/SKILL.md +417 -0
  129. package/presets/cursor/skills/django-uv/SKILL.md +409 -0
  130. package/presets/cursor/skills/drizzle-schema-architect/SKILL.md +54 -0
  131. package/presets/cursor/skills/evaluation/SKILL.md +8 -0
  132. package/presets/cursor/skills/fastapi-pydantic-strict/SKILL.md +46 -0
  133. package/presets/cursor/skills/find-skills/SKILL.md +144 -0
  134. package/presets/cursor/skills/jpa-nplusone-detector/SKILL.md +49 -0
  135. package/presets/cursor/skills/jpa-postgres/SKILL.md +626 -0
  136. package/presets/cursor/skills/laravel-specialist/SKILL.md +267 -0
  137. package/presets/cursor/skills/laravel-specialist/references/eloquent.md +351 -0
  138. package/presets/cursor/skills/laravel-specialist/references/livewire.md +512 -0
  139. package/presets/cursor/skills/laravel-specialist/references/queues.md +423 -0
  140. package/presets/cursor/skills/laravel-specialist/references/routing.md +362 -0
  141. package/presets/cursor/skills/laravel-specialist/references/testing.md +522 -0
  142. package/presets/cursor/skills/livewire-alpine-bridge/SKILL.md +39 -0
  143. package/presets/cursor/skills/multi-agent-orchestration/README.md +144 -0
  144. package/presets/cursor/skills/multi-agent-orchestration/SKILL.md +579 -0
  145. package/presets/cursor/skills/multi-agent-orchestration/examples/framework_implementations.py +362 -0
  146. package/presets/cursor/skills/multi-agent-orchestration/examples/orchestration_patterns.py +411 -0
  147. package/presets/cursor/skills/multi-agent-orchestration/scripts/agent_communication.py +334 -0
  148. package/presets/cursor/skills/multi-agent-orchestration/scripts/benchmarking.py +341 -0
  149. package/presets/cursor/skills/multi-agent-orchestration/scripts/workflow_management.py +334 -0
  150. package/presets/cursor/skills/nextjs-typescript/SKILL.md +394 -0
  151. package/presets/cursor/skills/openspec/SKILL.md +52 -0
  152. package/presets/cursor/skills/pagespeed-insights/SKILL.md +445 -0
  153. package/presets/cursor/skills/pagespeed-insights/reference.md +50 -0
  154. package/presets/cursor/skills/pagespeed-perf/SKILL.md +281 -0
  155. package/presets/cursor/skills/php-pro/SKILL.md +210 -0
  156. package/presets/cursor/skills/php-pro/references/async-patterns.md +412 -0
  157. package/presets/cursor/skills/php-pro/references/laravel-patterns.md +377 -0
  158. package/presets/cursor/skills/php-pro/references/modern-php-features.md +323 -0
  159. package/presets/cursor/skills/php-pro/references/symfony-patterns.md +466 -0
  160. package/presets/cursor/skills/php-pro/references/testing-quality.md +466 -0
  161. package/presets/cursor/skills/python/SKILL.md +613 -0
  162. package/presets/cursor/skills/python-django-stack/SKILL.md +500 -0
  163. package/presets/cursor/skills/python-fastapi-stack/SKILL.md +464 -0
  164. package/presets/cursor/skills/security/SKILL.md +384 -0
  165. package/presets/cursor/skills/seo-analytics-injector/SKILL.md +44 -0
  166. package/presets/cursor/skills/spring-auth-auditor/SKILL.md +33 -0
  167. package/presets/cursor/skills/spring-boot-feature/SKILL.md +566 -0
  168. package/presets/cursor/skills/spring-boot-kotlin/SKILL.md +408 -0
  169. package/presets/cursor/skills/spring-boot-testing-strategy/SKILL.md +479 -0
  170. package/presets/cursor/skills/sqlalchemy/SKILL.md +473 -0
  171. package/presets/cursor/skills/tailwind-responsive-auditor/SKILL.md +32 -0
  172. package/presets/cursor/skills/tdd-mutation-tester/SKILL.md +28 -0
  173. package/presets/cursor/skills/testing-tdd/SKILL.md +592 -0
  174. package/presets/cursor/skills/workflow-orchestration-patterns/SKILL.md +98 -0
  175. package/presets/cursor/skills/workflow-orchestration-patterns/references/details.md +223 -0
  176. package/presets/opencode/agents/architect.md +22 -2
  177. package/presets/opencode/agents/complexity-auditor.md +16 -0
  178. package/presets/opencode/agents/contract-builder.md +109 -0
  179. package/presets/opencode/agents/devil.md +158 -0
  180. package/presets/opencode/agents/docs.md +19 -2
  181. package/presets/opencode/agents/goal-planner.md +112 -0
  182. package/presets/opencode/agents/implementer.md +39 -2
  183. package/presets/opencode/agents/orchestrator.md +124 -19
  184. package/presets/opencode/agents/planner.md +61 -0
  185. package/presets/opencode/agents/repo-explorer.md +15 -0
  186. package/presets/opencode/agents/reviewer.md +53 -2
  187. package/presets/opencode/agents/security-reviewer.md +159 -0
  188. package/presets/opencode/agents/task-coach.md +69 -2
  189. package/presets/opencode/agents/tester.md +18 -2
  190. package/presets/opencode/commands/cc-api-contract.md +12 -0
  191. package/presets/opencode/commands/cc-ask.md +55 -0
  192. package/presets/opencode/commands/cc-clarify.md +31 -0
  193. package/presets/opencode/commands/cc-council.md +87 -0
  194. package/presets/opencode/commands/cc-db-migration.md +22 -9
  195. package/presets/opencode/commands/cc-explore.md +35 -0
  196. package/presets/opencode/commands/cc-feature.md +41 -19
  197. package/presets/opencode/commands/cc-fix.md +50 -23
  198. package/presets/opencode/commands/cc-handoff.md +40 -0
  199. package/presets/opencode/commands/cc-iterative.md +127 -0
  200. package/presets/opencode/commands/cc-openspec.md +74 -0
  201. package/presets/opencode/commands/cc-pagespeed.md +12 -0
  202. package/presets/opencode/commands/cc-prototype.md +37 -0
  203. package/presets/opencode/commands/cc-refactor.md +12 -0
  204. package/presets/opencode/commands/cc-review.md +12 -0
  205. package/presets/opencode/commands/cc-scorecard.md +28 -0
  206. package/presets/opencode/commands/cc-tdd-cycle.md +24 -0
  207. package/presets/opencode/commands/cc-test-plan.md +12 -0
  208. package/presets/opencode/commands/cc-triage.md +33 -0
  209. package/presets/opencode/gates/pre-commit/GATE.md +136 -0
  210. package/presets/opencode/prompts/v0.1.0/DEPRECATED.md +11 -0
  211. package/presets/opencode/prompts/v0.2.0/DEPRECATED.md +11 -0
  212. package/presets/opencode/prompts/v0.3.0/DEPRECATED.md +11 -0
  213. package/presets/opencode/prompts/v0.4.0/DEPRECATED.md +11 -0
  214. package/presets/opencode/prompts/v0.5.0/architect.md +222 -0
  215. package/presets/opencode/prompts/v0.5.0/complexity-auditor.md +91 -0
  216. package/presets/opencode/prompts/v0.5.0/contract-builder.md +84 -0
  217. package/presets/opencode/prompts/v0.5.0/docs.md +190 -0
  218. package/presets/opencode/prompts/v0.5.0/goal-planner.md +80 -0
  219. package/presets/opencode/prompts/v0.5.0/implementer.md +171 -0
  220. package/presets/opencode/prompts/v0.5.0/orchestrator.md +388 -0
  221. package/presets/opencode/prompts/v0.5.0/repo-explorer.md +111 -0
  222. package/presets/opencode/prompts/v0.5.0/reviewer.md +248 -0
  223. package/presets/opencode/prompts/v0.5.0/security-reviewer.md +123 -0
  224. package/presets/opencode/prompts/v0.5.0/task-coach.md +156 -0
  225. package/presets/opencode/prompts/v0.5.0/tester.md +252 -0
  226. package/presets/opencode/prompts/v0.6.0/implementer.md +35 -0
  227. package/presets/opencode/prompts/v0.6.0/planner.md +36 -0
  228. package/presets/opencode/prompts/v0.6.0/reviewer.md +40 -0
  229. package/presets/opencode/prompts/v1.0.0/README.md +47 -0
  230. package/presets/opencode/prompts/v1.0.0/architect.md +259 -0
  231. package/presets/opencode/prompts/v1.0.0/complexity-auditor.md +116 -0
  232. package/presets/opencode/prompts/v1.0.0/contract-builder.md +120 -0
  233. package/presets/opencode/prompts/v1.0.0/devil.md +169 -0
  234. package/presets/opencode/prompts/v1.0.0/docs.md +229 -0
  235. package/presets/opencode/prompts/v1.0.0/goal-planner.md +123 -0
  236. package/presets/opencode/prompts/v1.0.0/implementer.md +228 -0
  237. package/presets/opencode/prompts/v1.0.0/orchestrator.md +474 -0
  238. package/presets/opencode/prompts/v1.0.0/planner.md +72 -0
  239. package/presets/opencode/prompts/v1.0.0/repo-explorer.md +147 -0
  240. package/presets/opencode/prompts/v1.0.0/reviewer.md +295 -0
  241. package/presets/opencode/prompts/v1.0.0/security-reviewer.md +170 -0
  242. package/presets/opencode/prompts/v1.0.0/task-coach.md +235 -0
  243. package/presets/opencode/prompts/v1.0.0/tester.md +298 -0
  244. package/presets/opencode/skills/evaluation/SKILL.md +6 -0
  245. package/presets/opencode/skills/openspec/SKILL.md +50 -0
  246. package/presets/seo-hotel/settings.json +0 -17
  247. package/presets/templates/BACKLOG.md +33 -0
  248. package/presets/templates/execution-profile.yml +6 -0
  249. package/presets/templates/model-comparison.md +11 -0
  250. package/presets/templates/regression-checklist.yml +10 -0
  251. package/src/presets/manifests/agy.yml +2 -2
  252. package/src/presets/manifests/claude.yml +2 -2
  253. package/src/presets/manifests/codex.yml +2 -2
  254. package/src/presets/manifests/cursor.yml +19 -3
  255. package/src/presets/manifests/gemini.yml +2 -2
  256. package/src/presets/manifests/opencode.yml +2 -2
  257. package/src/presets/models/agy.yml +97 -49
  258. package/src/presets/models/claude.yml +83 -39
  259. package/src/presets/models/codex.yml +83 -40
  260. package/src/presets/models/cursor.yml +83 -39
  261. package/src/presets/models/gemini.yml +83 -39
  262. package/src/presets/models/opencode.yml +78 -34
@@ -0,0 +1,281 @@
1
+ ---
2
+ id: pagespeed-perf
3
+ version: 1.0.0
4
+ name: PageSpeed Performance Audit
5
+ description: >
6
+ Web Performance Engineering — analyzes Core Web Vitals using the PageSpeed
7
+ Insights API (PSI v5) and applies the 80/20 principle: identify the 20% of
8
+ changes that produce 80% of the performance gain. Produces a prioritized
9
+ markdown report with quantified estimates and framework-specific code.
10
+ Trigger: When auditing page speed, analyzing Core Web Vitals, or optimizing
11
+ web performance for any URL.
12
+
13
+ user-invokable: true
14
+ license: MIT
15
+ metadata:
16
+ author: codeconductor
17
+ category: performance
18
+
19
+ compatibility:
20
+ tools: [claude, codex, gemini, agy, opencode]
21
+ stacks:
22
+ languages: []
23
+ frameworks: [astro, nextjs, react, vue, django, spring, wordpress]
24
+
25
+ risk:
26
+ level: medium
27
+ can_execute_shell: true
28
+ can_modify_files: false
29
+ requires_network: true
30
+
31
+ inputs:
32
+ - name: url
33
+ type: string
34
+ required: true
35
+ description: Full URL to audit (must include scheme: https://...)
36
+ - name: strategy
37
+ type: string
38
+ required: false
39
+ description: "mobile | desktop | both (default: both)"
40
+
41
+ outputs:
42
+ - name: report
43
+ type: markdown
44
+ description: >
45
+ Prioritized performance report saved as
46
+ {YYYY-MM-DD}_pagespeed-{hostname}-claude.md in the current directory.
47
+
48
+ quality:
49
+ reviewed_by: codeconductor-core
50
+ version: 1.0.0
51
+ paths:
52
+ - "**/*.{html,tsx,jsx,vue}"
53
+ ---
54
+
55
+ # PageSpeed Performance Audit — Web Performance Engineering (80/20)
56
+
57
+ ## Role and Purpose
58
+
59
+ Act as **Senior Web Performance Engineer, Frontend Architect, and Technical
60
+ Auditor**.
61
+
62
+ Always access the real site, measure real metrics via the PageSpeed Insights
63
+ API, analyze resources with the greatest impact, and produce a prioritized
64
+ Spanish-language report following the 80/20 principle: the **20% of critical
65
+ changes that produce 80% of the performance improvement**.
66
+
67
+ Never give generic recommendations. Every finding must be backed by data
68
+ observed from the specific URL being audited.
69
+
70
+ ---
71
+
72
+ ## Step 0 — Pre-flight: API Key and Output Filename
73
+
74
+ **MANDATORY. Execute before any analysis.**
75
+
76
+ ### 1. Read the API key from the environment
77
+
78
+ ```powershell
79
+ $env:PAGESPEED_API_KEY
80
+ ```
81
+
82
+ - Value present → store as `{API_KEY}`, use in all PSI calls.
83
+ - Empty → proceed without key (CrUX field data unavailable; rate limits apply).
84
+
85
+ ### 2. Define the output filename
86
+
87
+ ```powershell
88
+ $date = (Get-Date -Format "yyyy-MM-dd")
89
+ $website = ([System.Uri]"{URL}").Host -replace '[^a-zA-Z0-9]', '-'
90
+ $out = "${date}_pagespeed-${website}-claude.md"
91
+ Write-Host $out
92
+ ```
93
+
94
+ The final report **must** be written to this file.
95
+
96
+ ---
97
+
98
+ ## Data Collection
99
+
100
+ ### Primary Method — Bun Scripts (always try first)
101
+
102
+ ```powershell
103
+ bun --version # if available, use Primary Method; otherwise use Fallback
104
+ $skillDir = "$env:USERPROFILE\.claude\skills\pagespeed-perf\scripts"
105
+ bun run "$skillDir\run.ts" --url={URL}
106
+ ```
107
+
108
+ `run.ts` calls `psi-collect.ts` and `html-audit.ts` in parallel and returns
109
+ structured JSON. Key output fields:
110
+
111
+ ```
112
+ output.summary.mobileScore → Lighthouse mobile score (0-100)
113
+ output.summary.desktopScore → Lighthouse desktop score
114
+ output.summary.passesCWV → boolean — passes real CWV
115
+ output.summary.top5Actions → array ordered by 80/20 score
116
+
117
+ output.psi.mobile.lab.lcp → LCP (lab, mobile)
118
+ output.psi.mobile.lab.tbt → TBT
119
+ output.psi.mobile.lab.cls → CLS
120
+ output.psi.mobile.lab.fcp → FCP
121
+ output.psi.mobile.lab.ttfb → TTFB
122
+ output.psi.mobile.field → CrUX data (null if no key / no data)
123
+ output.psi.mobile.opportunities → array ordered by impact80_20 desc
124
+ output.psi.mobile.lcpElement → HTML snippet of the LCP element
125
+ output.psi.mobile.thirdParties → third-party scripts with blockingTime
126
+ output.psi.mobile.usedApiKey → boolean — confirms key was used
127
+
128
+ output.html.stack → detected framework / CMS
129
+ output.html.resourceHints → preloads, preconnects, prefetches
130
+ output.html.images → lazy, fetchpriority, list
131
+ output.html.scripts → blocking in <head>, third-party list
132
+ output.html.fonts → googleFonts, font-display, preloaded
133
+ output.html.issues → ordered by impact80_20
134
+ ```
135
+
136
+ ### Fallback Method — WebFetch (only if Bun unavailable)
137
+
138
+ ```
139
+ # With API key (preferred)
140
+ https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url={URL}&strategy=mobile&category=performance&key={API_KEY}
141
+ https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url={URL}&strategy=desktop&category=performance&key={API_KEY}
142
+
143
+ # Without key (rate-limited)
144
+ https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url={URL}&strategy=mobile&category=performance
145
+ ```
146
+
147
+ Key PSI response paths:
148
+
149
+ ```
150
+ lighthouseResult.categories.performance.score
151
+ lighthouseResult.audits.largest-contentful-paint
152
+ lighthouseResult.audits.total-blocking-time
153
+ lighthouseResult.audits.cumulative-layout-shift
154
+ lighthouseResult.audits.first-contentful-paint
155
+ lighthouseResult.audits.server-response-time
156
+ lighthouseResult.audits.largest-contentful-paint-element.details.items[0]
157
+ lighthouseResult.audits.render-blocking-resources.details.overallSavingsMs
158
+ lighthouseResult.audits.unused-javascript.details.overallSavingsBytes
159
+ lighthouseResult.audits.third-party-summary.details.items
160
+
161
+ loadingExperience.metrics.LARGEST_CONTENTFUL_PAINT_MS.percentile (CrUX)
162
+ loadingExperience.metrics.INTERACTION_TO_NEXT_PAINT.percentile (CrUX)
163
+ loadingExperience.metrics.CUMULATIVE_LAYOUT_SHIFT_SCORE.percentile (CrUX)
164
+ loadingExperience.overall_category → "FAST" | "AVERAGE" | "SLOW"
165
+ ```
166
+
167
+ Also fetch the site HTML via WebFetch and inspect the `<head>` for resource
168
+ hints, lazy loading, `fetchpriority`, `font-display`, blocking scripts, and
169
+ images without explicit dimensions.
170
+
171
+ ---
172
+
173
+ ## Core Web Vitals — Thresholds
174
+
175
+ | Metric | Good | Needs Improvement | Critical | Score weight |
176
+ | ------ | -------- | ----------------- | --------- | ------------ |
177
+ | LCP | ≤ 2.5 s | 2.5 s – 4.0 s | > 4.0 s | 25% |
178
+ | INP | ≤ 200 ms | 200 ms – 500 ms | > 500 ms | 10% |
179
+ | CLS | ≤ 0.1 | 0.1 – 0.25 | > 0.25 | 15% |
180
+ | FCP | ≤ 1.8 s | 1.8 s – 3.0 s | > 3.0 s | 10% |
181
+ | TBT | ≤ 200 ms | 200 ms – 600 ms | > 600 ms | 30% |
182
+ | TTFB | ≤ 800 ms | 800 ms – 1.8 s | > 1.8 s | — |
183
+
184
+ LCP + TBT represent 55% of the Lighthouse Performance Score.
185
+
186
+ ---
187
+
188
+ ## 80/20 Optimization Matrix
189
+
190
+ Score = `Impact (1–5) × Ease (1–5)`. Prioritize by descending score.
191
+
192
+ | Rank | Optimization | Primary metric | Impact | Ease | Score |
193
+ | ---- | --------------------------------- | -------------- | ------ | ---- | ----- |
194
+ | 1 | Preload LCP element | LCP | 5 | 5 | **25** |
195
+ | 1 | `fetchpriority="high"` on LCP img | LCP | 5 | 5 | **25** |
196
+ | 1 | Gzip / Brotli compression | FCP, LCP, TBT | 5 | 5 | **25** |
197
+ | 4 | WebP + explicit dimensions | LCP, CLS | 5 | 4 | **20** |
198
+ | 4 | Lazy loading offscreen images | LCP, TBT | 4 | 5 | **20** |
199
+ | 4 | `font-display: swap` | FCP | 4 | 5 | **20** |
200
+ | 4 | `preconnect` to critical origins | FCP, LCP, TTFB | 4 | 5 | **20** |
201
+ | 4 | Defer / facade third-party scripts| TBT, INP | 5 | 4 | **20** |
202
+ | 9 | Remove render-blocking resources | FCP, LCP | 5 | 3 | **15** |
203
+ | 9 | Long Cache-Control for assets | repeat visits | 3 | 5 | **15** |
204
+ | 11 | Remove unused JavaScript | TBT, INP | 4 | 3 | **12** |
205
+ | 12 | Remove unused CSS | FCP, TBT | 3 | 3 | **9** |
206
+ | 13 | CDN for static assets | TTFB, LCP | 4 | 2 | **8** |
207
+ | 14 | Code splitting | TBT, INP | 4 | 2 | **8** |
208
+
209
+ **Critical 20% (Score ≥ 20)** — address these first:
210
+ 1. Preload LCP element + `fetchpriority="high"`
211
+ 2. Brotli/Gzip compression at the server
212
+ 3. WebP images with explicit `width`/`height`
213
+ 4. Lazy loading of offscreen images
214
+ 5. `font-display: swap` for all fonts
215
+ 6. `preconnect` to all critical origins
216
+ 7. Defer or facade all third-party scripts
217
+
218
+ ---
219
+
220
+ ## Expected Impact by Optimization
221
+
222
+ | Optimization | Metric | Expected gain |
223
+ | ---------------------- | -------- | --------------------- |
224
+ | Preload + fetchpriority| LCP | −0.5 s to −2.0 s |
225
+ | Brotli compression | FCP, LCP | −0.3 s to −1.0 s |
226
+ | WebP + dimensions | LCP, CLS | −0.3 s to −1.2 s |
227
+ | Lazy loading | LCP | −0.2 s to −0.8 s |
228
+ | font-display: swap | FCP | −0.2 s to −0.8 s |
229
+ | preconnect | FCP, LCP | −0.1 s to −0.4 s each|
230
+ | Defer third parties | TBT, INP | −50 ms to −300 ms |
231
+
232
+ ---
233
+
234
+ ## Report Format (mandatory structure)
235
+
236
+ Save to `{YYYY-MM-DD}_pagespeed-{hostname}-claude.md`:
237
+
238
+ ```markdown
239
+ # Auditoría de Rendimiento Web — {URL}
240
+ Fecha: {YYYY-MM-DD} | Estrategia: Móvil + Escritorio | Archivo: {filename}.md
241
+
242
+ ## Resumen Ejecutivo
243
+ [2-3 párrafos: estado actual, score, bottleneck principal, potencial de mejora]
244
+
245
+ ## Métricas Actuales
246
+ [Tabla: Lab (Lighthouse) vs Campo (CrUX)]
247
+
248
+ ## Recursos con Mayor Impacto
249
+ [Tabla: URL, Tipo, Tamaño, Tiempo, Impacto, Razón]
250
+
251
+ ## Plan de Acción Priorizado (80/20)
252
+ [Tabla ordenada por Score 80/20 descendente]
253
+
254
+ ## Solución Técnica Detallada
255
+ [Por hallazgo: Problema, Evidencia, Implementación, Código, Impacto Esperado]
256
+
257
+ ## Quick Wins (< 1 day)
258
+ ## High Impact Changes
259
+ ## Roadmap
260
+ - Fase 1 — Inmediato (Semana 1)
261
+ - Fase 2 — Corto Plazo (2–4 semanas)
262
+ - Fase 3 — Mediano Plazo (1–3 meses)
263
+
264
+ ---
265
+ *Informe generado el {YYYY-MM-DD} · Herramienta: Claude Code + pagespeed-perf skill*
266
+ *API Key usada: {Sí / No} · Datos CrUX: {Disponibles / No disponibles}*
267
+ ```
268
+
269
+ ---
270
+
271
+ ## Quality Rules — Never Violate
272
+
273
+ 1. **No data = no recommendation.** If PSI fails, try WebFetch directly.
274
+ 2. **Always quantify.** "Reduces LCP from 4.2 s to ~3.0 s" — never "would improve LCP".
275
+ 3. **Explicit evidence.** Cite the observed metric value for every finding.
276
+ 4. **Site-specific code.** Adapt templates to the detected framework (Next.js,
277
+ Astro, Django, etc.). Do not paste generic snippets unchanged.
278
+ 5. **80/20 order.** Always sort the action plan by descending score.
279
+ 6. **Separate field vs lab data.** CrUX = real user experience. Lighthouse = controlled lab.
280
+ 7. **Identify the framework.** Detect Next.js, Astro, Vue, WordPress, etc., and
281
+ provide framework-specific code samples.
@@ -0,0 +1,210 @@
1
+ ---
2
+ name: php-pro
3
+ description: Use when building PHP applications with modern PHP 8.3+ features, Laravel, or Symfony frameworks. Invokes strict typing, PHPStan level 9, async patterns with Swoole, and PSR standards. Creates controllers, configures middleware, generates migrations, writes PHPUnit/Pest tests, defines typed DTOs and value objects, sets up dependency injection, and scaffolds REST/GraphQL APIs. Use when working with Eloquent, Doctrine, Composer, Psalm, ReactPHP, or any PHP API development.
4
+ license: MIT
5
+ metadata:
6
+ author: https://github.com/Jeffallan
7
+ version: "1.1.0"
8
+ domain: language
9
+ triggers: PHP, Laravel, Symfony, Composer, PHPStan, PSR, PHP API, Eloquent, Doctrine
10
+ role: specialist
11
+ scope: implementation
12
+ output-format: code
13
+ related-skills: fullstack-guardian, fastapi-expert
14
+ paths:
15
+ - "**/*.php"
16
+ ---
17
+
18
+ # PHP Pro
19
+
20
+ Senior PHP developer with deep expertise in PHP 8.3+, Laravel, Symfony, and modern PHP patterns with strict typing and enterprise architecture.
21
+
22
+ ## Core Workflow
23
+
24
+ 1. **Analyze architecture** — Review framework, PHP version, dependencies, and patterns
25
+ 2. **Design models** — Create typed domain models, value objects, DTOs
26
+ 3. **Implement** — Write strict-typed code with PSR compliance, DI, repositories
27
+ 4. **Secure** — Add validation, authentication, XSS/SQL injection protection
28
+ 5. **Verify** — Run `vendor/bin/phpstan analyse --level=9`; fix all errors before proceeding. Run `vendor/bin/phpunit` or `vendor/bin/pest`; enforce 80%+ coverage. Only deliver when both pass clean.
29
+
30
+ ## Reference Guide
31
+
32
+ Load detailed guidance based on context:
33
+
34
+ | Topic | Reference | Load When |
35
+ |-------|-----------|-----------|
36
+ | Modern PHP | `references/modern-php-features.md` | Readonly, enums, attributes, fibers, types |
37
+ | Laravel | `references/laravel-patterns.md` | Services, repositories, resources, jobs |
38
+ | Symfony | `references/symfony-patterns.md` | DI, events, commands, voters |
39
+ | Async PHP | `references/async-patterns.md` | Swoole, ReactPHP, fibers, streams |
40
+ | Testing | `references/testing-quality.md` | PHPUnit, PHPStan, Pest, mocking |
41
+
42
+ ## Constraints
43
+
44
+ ### MUST DO
45
+ - Declare strict types (`declare(strict_types=1)`)
46
+ - Use type hints for all properties, parameters, returns
47
+ - Follow PSR-12 coding standard
48
+ - Run PHPStan level 9 before delivery
49
+ - Use readonly properties where applicable
50
+ - Write PHPDoc blocks for complex logic
51
+ - Validate all user input with typed requests
52
+ - Use dependency injection over global state
53
+
54
+ ### MUST NOT DO
55
+ - Skip type declarations (no mixed types)
56
+ - Store passwords in plain text (use bcrypt/argon2)
57
+ - Write SQL queries vulnerable to injection
58
+ - Mix business logic with controllers
59
+ - Hardcode configuration (use .env)
60
+ - Deploy without running tests and static analysis
61
+ - Use var_dump in production code
62
+
63
+ ## Code Patterns
64
+
65
+ Every complete implementation delivers: a typed entity/DTO, a service class, and a test. Use these as the baseline structure.
66
+
67
+ ### Readonly DTO / Value Object
68
+
69
+ ```php
70
+ <?php
71
+
72
+ declare(strict_types=1);
73
+
74
+ namespace App\DTO;
75
+
76
+ final readonly class CreateUserDTO
77
+ {
78
+ public function __construct(
79
+ public string $name,
80
+ public string $email,
81
+ public string $password,
82
+ ) {}
83
+
84
+ public static function fromArray(array $data): self
85
+ {
86
+ return new self(
87
+ name: $data['name'],
88
+ email: $data['email'],
89
+ password: $data['password'],
90
+ );
91
+ }
92
+ }
93
+ ```
94
+
95
+ ### Typed Service with Constructor DI
96
+
97
+ ```php
98
+ <?php
99
+
100
+ declare(strict_types=1);
101
+
102
+ namespace App\Services;
103
+
104
+ use App\DTO\CreateUserDTO;
105
+ use App\Models\User;
106
+ use App\Repositories\UserRepositoryInterface;
107
+ use Illuminate\Support\Facades\Hash;
108
+
109
+ final class UserService
110
+ {
111
+ public function __construct(
112
+ private readonly UserRepositoryInterface $users,
113
+ ) {}
114
+
115
+ public function create(CreateUserDTO $dto): User
116
+ {
117
+ return $this->users->create([
118
+ 'name' => $dto->name,
119
+ 'email' => $dto->email,
120
+ 'password' => Hash::make($dto->password),
121
+ ]);
122
+ }
123
+ }
124
+ ```
125
+
126
+ ### PHPUnit Test Structure
127
+
128
+ ```php
129
+ <?php
130
+
131
+ declare(strict_types=1);
132
+
133
+ namespace Tests\Unit\Services;
134
+
135
+ use App\DTO\CreateUserDTO;
136
+ use App\Models\User;
137
+ use App\Repositories\UserRepositoryInterface;
138
+ use App\Services\UserService;
139
+ use PHPUnit\Framework\MockObject\MockObject;
140
+ use PHPUnit\Framework\TestCase;
141
+
142
+ final class UserServiceTest extends TestCase
143
+ {
144
+ private UserRepositoryInterface&MockObject $users;
145
+ private UserService $service;
146
+
147
+ protected function setUp(): void
148
+ {
149
+ parent::setUp();
150
+ $this->users = $this->createMock(UserRepositoryInterface::class);
151
+ $this->service = new UserService($this->users);
152
+ }
153
+
154
+ public function testCreateHashesPassword(): void
155
+ {
156
+ $dto = new CreateUserDTO('Alice', 'alice@example.com', 'secret');
157
+ $user = new User(['name' => 'Alice', 'email' => 'alice@example.com']);
158
+
159
+ $this->users
160
+ ->expects($this->once())
161
+ ->method('create')
162
+ ->willReturn($user);
163
+
164
+ $result = $this->service->create($dto);
165
+
166
+ $this->assertSame('Alice', $result->name);
167
+ }
168
+ }
169
+ ```
170
+
171
+ ### Enum (PHP 8.1+)
172
+
173
+ ```php
174
+ <?php
175
+
176
+ declare(strict_types=1);
177
+
178
+ namespace App\Enums;
179
+
180
+ enum UserStatus: string
181
+ {
182
+ case Active = 'active';
183
+ case Inactive = 'inactive';
184
+ case Banned = 'banned';
185
+
186
+ public function label(): string
187
+ {
188
+ return match($this) {
189
+ self::Active => 'Active',
190
+ self::Inactive => 'Inactive',
191
+ self::Banned => 'Banned',
192
+ };
193
+ }
194
+ }
195
+ ```
196
+
197
+ ## Output Templates
198
+
199
+ When implementing a feature, deliver in this order:
200
+ 1. Domain models (entities, value objects, enums)
201
+ 2. Service/repository classes
202
+ 3. Controller/API endpoints
203
+ 4. Test files (PHPUnit/Pest)
204
+ 5. Brief explanation of architecture decisions
205
+
206
+ ## Knowledge Reference
207
+
208
+ PHP 8.3+, Laravel 11, Symfony 7, Composer, PHPStan, Psalm, PHPUnit, Pest, Eloquent ORM, Doctrine, PSR standards, Swoole, ReactPHP, Redis, MySQL/PostgreSQL, REST/GraphQL APIs
209
+
210
+ [Documentation](https://jeffallan.github.io/claude-skills/skills/language/php-pro/)