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.
- package/README.md +95 -95
- package/dist/cli/errors.d.ts +65 -0
- package/dist/core/compilation/compile-checker.d.ts +51 -0
- package/dist/core/config/codeconductor-config.d.ts +42 -0
- package/dist/core/config/config-loader.d.ts +11 -0
- package/dist/core/filesystem/credential-guard.d.ts +18 -0
- package/dist/core/goal/goal-planner.d.ts +8 -0
- package/dist/core/goal/goal-state.d.ts +15 -0
- package/dist/core/loop/git-stats.d.ts +13 -0
- package/dist/core/loop/loop-engine.d.ts +79 -0
- package/dist/core/memory/episodic-store.d.ts +6 -0
- package/dist/core/memory/operational-state.d.ts +6 -0
- package/dist/core/orchestrator/runtime-orchestrator.d.ts +25 -0
- package/dist/core/planner/product-planner.d.ts +18 -0
- package/dist/core/presets/package-paths.d.ts +4 -0
- package/dist/core/product-graph/graph-store.d.ts +11 -0
- package/dist/core/product-graph/paths.d.ts +18 -0
- package/dist/core/verification/verification-runner.d.ts +57 -0
- package/dist/domain/loop/loop-state.d.ts +74 -0
- package/dist/domain/product/entities.d.ts +11 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +23721 -15064
- package/dist/library.js +2595 -0
- package/dist/utils/result.d.ts +36 -0
- package/dist/validation/schemas.d.ts +3660 -0
- package/package.json +15 -2
- package/policy.yml +12 -11
- package/presets/agy/AGENTS.md +11 -5
- package/presets/agy/gates/pre-commit/GATE.md +136 -0
- package/presets/agy/skills/cc-fix/SKILL.md +2 -2
- package/presets/agy/skills/cc-tdd-cycle/SKILL.md +11 -0
- package/presets/agy/skills/evaluation/SKILL.md +6 -0
- package/presets/agy/skills/openspec/SKILL.md +32 -0
- package/presets/agy/workflows/cc-api-contract.md +12 -0
- package/presets/agy/workflows/cc-ask.md +55 -0
- package/presets/agy/workflows/cc-clarify.md +33 -0
- package/presets/agy/workflows/cc-council.md +31 -7
- package/presets/agy/workflows/cc-db-migration.md +22 -9
- package/presets/agy/workflows/cc-explore.md +37 -0
- package/presets/agy/workflows/cc-feature.md +41 -19
- package/presets/agy/workflows/cc-fix.md +50 -23
- package/presets/agy/workflows/cc-handoff.md +42 -0
- package/presets/agy/workflows/cc-iterative.md +128 -0
- package/presets/agy/workflows/cc-openspec.md +75 -0
- package/presets/agy/workflows/cc-pagespeed.md +12 -0
- package/presets/agy/workflows/cc-prototype.md +39 -0
- package/presets/agy/workflows/cc-refactor.md +12 -0
- package/presets/agy/workflows/cc-review.md +12 -0
- package/presets/agy/workflows/cc-scorecard.md +29 -0
- package/presets/agy/workflows/cc-tdd-cycle.md +24 -0
- package/presets/agy/workflows/cc-test-plan.md +12 -0
- package/presets/agy/workflows/cc-triage.md +35 -0
- package/presets/claude/CLAUDE.md +64 -0
- package/presets/claude/commands/cc/api-contract.md +12 -0
- package/presets/claude/commands/cc/ask.md +55 -0
- package/presets/claude/commands/cc/clarify.md +32 -0
- package/presets/claude/commands/cc/council.md +87 -0
- package/presets/claude/commands/cc/db-migration.md +22 -9
- package/presets/claude/commands/cc/explore.md +36 -0
- package/presets/claude/commands/cc/feature.md +49 -22
- package/presets/claude/commands/cc/fix.md +74 -20
- package/presets/claude/commands/cc/handoff.md +44 -0
- package/presets/claude/commands/cc/iterative.md +132 -0
- package/presets/claude/commands/cc/openspec.md +169 -0
- package/presets/claude/commands/cc/pagespeed.md +12 -0
- package/presets/claude/commands/cc/prototype.md +38 -0
- package/presets/claude/commands/cc/refactor.md +152 -1
- package/presets/claude/commands/cc/review.md +90 -17
- package/presets/claude/commands/cc/scorecard.md +77 -0
- package/presets/claude/commands/cc/tdd-cycle.md +53 -3
- package/presets/claude/commands/cc/test-plan.md +12 -0
- package/presets/claude/commands/cc/triage.md +34 -0
- package/presets/claude/gates/pre-commit/GATE.md +136 -0
- package/presets/claude/settings.json +8 -46
- package/presets/claude/skills/evaluation/SKILL.md +42 -0
- package/presets/claude/skills/openspec/SKILL.md +54 -0
- package/presets/codex/AGENTS.md +62 -5
- package/presets/codex/commands/cc-ask.md +55 -0
- package/presets/codex/gates/pre-commit/GATE.md +136 -0
- package/presets/cursor/.cursorignore +15 -0
- package/presets/cursor/AGENTS.md +504 -0
- package/presets/cursor/agents/architect.md +211 -0
- package/presets/cursor/agents/business-agent.md +44 -0
- package/presets/cursor/agents/complexity-auditor.md +76 -0
- package/presets/cursor/agents/continuous-architect.md +37 -0
- package/presets/cursor/agents/contract-builder.md +75 -0
- package/presets/cursor/agents/docs.md +181 -0
- package/presets/cursor/agents/goal-planner.md +71 -0
- package/presets/cursor/agents/impact-analyst.md +43 -0
- package/presets/cursor/agents/implementer.md +161 -0
- package/presets/cursor/agents/orchestrator.md +377 -0
- package/presets/cursor/agents/repo-explorer.md +100 -0
- package/presets/cursor/agents/reviewer.md +237 -0
- package/presets/cursor/agents/security-reviewer.md +113 -0
- package/presets/cursor/agents/task-coach.md +145 -0
- package/presets/cursor/agents/tester.md +241 -0
- package/presets/cursor/commands/cc/api-contract.md +70 -0
- package/presets/cursor/commands/cc/ask.md +55 -0
- package/presets/cursor/commands/cc/clarify.md +32 -0
- package/presets/cursor/commands/cc/council.md +87 -0
- package/presets/cursor/commands/cc/db-migration.md +71 -0
- package/presets/cursor/commands/cc/explore.md +36 -0
- package/presets/cursor/commands/cc/feature.md +137 -0
- package/presets/cursor/commands/cc/fix.md +148 -0
- package/presets/cursor/commands/cc/handoff.md +41 -0
- package/presets/cursor/commands/cc/iterative.md +133 -0
- package/presets/cursor/commands/cc/openspec.md +159 -0
- package/presets/cursor/commands/cc/pagespeed.md +115 -0
- package/presets/cursor/commands/cc/prototype.md +38 -0
- package/presets/cursor/commands/cc/refactor.md +160 -0
- package/presets/cursor/commands/cc/review.md +149 -0
- package/presets/cursor/commands/cc/scorecard.md +77 -0
- package/presets/cursor/commands/cc/tdd-cycle.md +250 -0
- package/presets/cursor/commands/cc/test-plan.md +150 -0
- package/presets/cursor/commands/cc/triage.md +34 -0
- package/presets/cursor/gates/pre-commit/GATE.md +136 -0
- package/presets/cursor/rules/behavioral-discipline.mdc +14 -0
- package/presets/cursor/rules/context-budget.mdc +12 -0
- package/presets/cursor/rules/orchestration.mdc +12 -0
- package/presets/cursor/rules/yagni-stdlib.mdc +11 -0
- package/presets/cursor/skills/android/SKILL.md +122 -0
- package/presets/cursor/skills/api-versioning/SKILL.md +394 -0
- package/presets/cursor/skills/astro/SKILL.md +322 -0
- package/presets/cursor/skills/auth-token-inspector/SKILL.md +33 -0
- package/presets/cursor/skills/code-review/SKILL.md +208 -0
- package/presets/cursor/skills/conductor-setup/SKILL.md +127 -0
- package/presets/cursor/skills/django-orm/SKILL.md +463 -0
- package/presets/cursor/skills/django-testing/SKILL.md +417 -0
- package/presets/cursor/skills/django-uv/SKILL.md +409 -0
- package/presets/cursor/skills/drizzle-schema-architect/SKILL.md +54 -0
- package/presets/cursor/skills/evaluation/SKILL.md +8 -0
- package/presets/cursor/skills/fastapi-pydantic-strict/SKILL.md +46 -0
- package/presets/cursor/skills/find-skills/SKILL.md +144 -0
- package/presets/cursor/skills/jpa-nplusone-detector/SKILL.md +49 -0
- package/presets/cursor/skills/jpa-postgres/SKILL.md +626 -0
- package/presets/cursor/skills/laravel-specialist/SKILL.md +267 -0
- package/presets/cursor/skills/laravel-specialist/references/eloquent.md +351 -0
- package/presets/cursor/skills/laravel-specialist/references/livewire.md +512 -0
- package/presets/cursor/skills/laravel-specialist/references/queues.md +423 -0
- package/presets/cursor/skills/laravel-specialist/references/routing.md +362 -0
- package/presets/cursor/skills/laravel-specialist/references/testing.md +522 -0
- package/presets/cursor/skills/livewire-alpine-bridge/SKILL.md +39 -0
- package/presets/cursor/skills/multi-agent-orchestration/README.md +144 -0
- package/presets/cursor/skills/multi-agent-orchestration/SKILL.md +579 -0
- package/presets/cursor/skills/multi-agent-orchestration/examples/framework_implementations.py +362 -0
- package/presets/cursor/skills/multi-agent-orchestration/examples/orchestration_patterns.py +411 -0
- package/presets/cursor/skills/multi-agent-orchestration/scripts/agent_communication.py +334 -0
- package/presets/cursor/skills/multi-agent-orchestration/scripts/benchmarking.py +341 -0
- package/presets/cursor/skills/multi-agent-orchestration/scripts/workflow_management.py +334 -0
- package/presets/cursor/skills/nextjs-typescript/SKILL.md +394 -0
- package/presets/cursor/skills/openspec/SKILL.md +52 -0
- package/presets/cursor/skills/pagespeed-insights/SKILL.md +445 -0
- package/presets/cursor/skills/pagespeed-insights/reference.md +50 -0
- package/presets/cursor/skills/pagespeed-perf/SKILL.md +281 -0
- package/presets/cursor/skills/php-pro/SKILL.md +210 -0
- package/presets/cursor/skills/php-pro/references/async-patterns.md +412 -0
- package/presets/cursor/skills/php-pro/references/laravel-patterns.md +377 -0
- package/presets/cursor/skills/php-pro/references/modern-php-features.md +323 -0
- package/presets/cursor/skills/php-pro/references/symfony-patterns.md +466 -0
- package/presets/cursor/skills/php-pro/references/testing-quality.md +466 -0
- package/presets/cursor/skills/python/SKILL.md +613 -0
- package/presets/cursor/skills/python-django-stack/SKILL.md +500 -0
- package/presets/cursor/skills/python-fastapi-stack/SKILL.md +464 -0
- package/presets/cursor/skills/security/SKILL.md +384 -0
- package/presets/cursor/skills/seo-analytics-injector/SKILL.md +44 -0
- package/presets/cursor/skills/spring-auth-auditor/SKILL.md +33 -0
- package/presets/cursor/skills/spring-boot-feature/SKILL.md +566 -0
- package/presets/cursor/skills/spring-boot-kotlin/SKILL.md +408 -0
- package/presets/cursor/skills/spring-boot-testing-strategy/SKILL.md +479 -0
- package/presets/cursor/skills/sqlalchemy/SKILL.md +473 -0
- package/presets/cursor/skills/tailwind-responsive-auditor/SKILL.md +32 -0
- package/presets/cursor/skills/tdd-mutation-tester/SKILL.md +28 -0
- package/presets/cursor/skills/testing-tdd/SKILL.md +592 -0
- package/presets/cursor/skills/workflow-orchestration-patterns/SKILL.md +98 -0
- package/presets/cursor/skills/workflow-orchestration-patterns/references/details.md +223 -0
- package/presets/opencode/agents/architect.md +22 -2
- package/presets/opencode/agents/complexity-auditor.md +16 -0
- package/presets/opencode/agents/contract-builder.md +109 -0
- package/presets/opencode/agents/devil.md +158 -0
- package/presets/opencode/agents/docs.md +19 -2
- package/presets/opencode/agents/goal-planner.md +112 -0
- package/presets/opencode/agents/implementer.md +39 -2
- package/presets/opencode/agents/orchestrator.md +124 -19
- package/presets/opencode/agents/planner.md +61 -0
- package/presets/opencode/agents/repo-explorer.md +15 -0
- package/presets/opencode/agents/reviewer.md +53 -2
- package/presets/opencode/agents/security-reviewer.md +159 -0
- package/presets/opencode/agents/task-coach.md +69 -2
- package/presets/opencode/agents/tester.md +18 -2
- package/presets/opencode/commands/cc-api-contract.md +12 -0
- package/presets/opencode/commands/cc-ask.md +55 -0
- package/presets/opencode/commands/cc-clarify.md +31 -0
- package/presets/opencode/commands/cc-council.md +87 -0
- package/presets/opencode/commands/cc-db-migration.md +22 -9
- package/presets/opencode/commands/cc-explore.md +35 -0
- package/presets/opencode/commands/cc-feature.md +41 -19
- package/presets/opencode/commands/cc-fix.md +50 -23
- package/presets/opencode/commands/cc-handoff.md +40 -0
- package/presets/opencode/commands/cc-iterative.md +127 -0
- package/presets/opencode/commands/cc-openspec.md +74 -0
- package/presets/opencode/commands/cc-pagespeed.md +12 -0
- package/presets/opencode/commands/cc-prototype.md +37 -0
- package/presets/opencode/commands/cc-refactor.md +12 -0
- package/presets/opencode/commands/cc-review.md +12 -0
- package/presets/opencode/commands/cc-scorecard.md +28 -0
- package/presets/opencode/commands/cc-tdd-cycle.md +24 -0
- package/presets/opencode/commands/cc-test-plan.md +12 -0
- package/presets/opencode/commands/cc-triage.md +33 -0
- package/presets/opencode/gates/pre-commit/GATE.md +136 -0
- package/presets/opencode/prompts/v0.1.0/DEPRECATED.md +11 -0
- package/presets/opencode/prompts/v0.2.0/DEPRECATED.md +11 -0
- package/presets/opencode/prompts/v0.3.0/DEPRECATED.md +11 -0
- package/presets/opencode/prompts/v0.4.0/DEPRECATED.md +11 -0
- package/presets/opencode/prompts/v0.5.0/architect.md +222 -0
- package/presets/opencode/prompts/v0.5.0/complexity-auditor.md +91 -0
- package/presets/opencode/prompts/v0.5.0/contract-builder.md +84 -0
- package/presets/opencode/prompts/v0.5.0/docs.md +190 -0
- package/presets/opencode/prompts/v0.5.0/goal-planner.md +80 -0
- package/presets/opencode/prompts/v0.5.0/implementer.md +171 -0
- package/presets/opencode/prompts/v0.5.0/orchestrator.md +388 -0
- package/presets/opencode/prompts/v0.5.0/repo-explorer.md +111 -0
- package/presets/opencode/prompts/v0.5.0/reviewer.md +248 -0
- package/presets/opencode/prompts/v0.5.0/security-reviewer.md +123 -0
- package/presets/opencode/prompts/v0.5.0/task-coach.md +156 -0
- package/presets/opencode/prompts/v0.5.0/tester.md +252 -0
- package/presets/opencode/prompts/v0.6.0/implementer.md +35 -0
- package/presets/opencode/prompts/v0.6.0/planner.md +36 -0
- package/presets/opencode/prompts/v0.6.0/reviewer.md +40 -0
- package/presets/opencode/prompts/v1.0.0/README.md +47 -0
- package/presets/opencode/prompts/v1.0.0/architect.md +259 -0
- package/presets/opencode/prompts/v1.0.0/complexity-auditor.md +116 -0
- package/presets/opencode/prompts/v1.0.0/contract-builder.md +120 -0
- package/presets/opencode/prompts/v1.0.0/devil.md +169 -0
- package/presets/opencode/prompts/v1.0.0/docs.md +229 -0
- package/presets/opencode/prompts/v1.0.0/goal-planner.md +123 -0
- package/presets/opencode/prompts/v1.0.0/implementer.md +228 -0
- package/presets/opencode/prompts/v1.0.0/orchestrator.md +474 -0
- package/presets/opencode/prompts/v1.0.0/planner.md +72 -0
- package/presets/opencode/prompts/v1.0.0/repo-explorer.md +147 -0
- package/presets/opencode/prompts/v1.0.0/reviewer.md +295 -0
- package/presets/opencode/prompts/v1.0.0/security-reviewer.md +170 -0
- package/presets/opencode/prompts/v1.0.0/task-coach.md +235 -0
- package/presets/opencode/prompts/v1.0.0/tester.md +298 -0
- package/presets/opencode/skills/evaluation/SKILL.md +6 -0
- package/presets/opencode/skills/openspec/SKILL.md +50 -0
- package/presets/seo-hotel/settings.json +0 -17
- package/presets/templates/BACKLOG.md +33 -0
- package/presets/templates/execution-profile.yml +6 -0
- package/presets/templates/model-comparison.md +11 -0
- package/presets/templates/regression-checklist.yml +10 -0
- package/src/presets/manifests/agy.yml +2 -2
- package/src/presets/manifests/claude.yml +2 -2
- package/src/presets/manifests/codex.yml +2 -2
- package/src/presets/manifests/cursor.yml +19 -3
- package/src/presets/manifests/gemini.yml +2 -2
- package/src/presets/manifests/opencode.yml +2 -2
- package/src/presets/models/agy.yml +97 -49
- package/src/presets/models/claude.yml +83 -39
- package/src/presets/models/codex.yml +83 -40
- package/src/presets/models/cursor.yml +83 -39
- package/src/presets/models/gemini.yml +83 -39
- 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/)
|