未載入 Skill6069 tokens · 84387 ms
## Two honesty notes first
1. **I have not run any searches, fetches, or installs.** Networking and installation are disabled for this test, and the only tool exposed to me here is the Skill tool — so I also can't write the plan to a file. Everything below is the *procedure* plus copy-pasteable commands for you to run later.
2. **Path conventions I'm unsure about are flagged inline.** Claude Code's `SKILL.md` / `.claude/skills/` layout I'm confident about. Codex's and Gemini CLI's native "skills" directories have been moving targets; treat those steps as "verify against current docs first," and use the AGENTS.md / GEMINI.md fallbacks if native discovery isn't there. Don't let a plan step become a claim about reality.
---
# Plan: choose + install one React/Next.js performance skill for 3 harnesses
## Context
Three harnesses (Claude Code, Codex, Gemini CLI) are used in the same repo. Installing three separate skills means three drifting copies of the same performance guidance. The goal is **one canonical skill directory in the repo**, symlinked/pointed into each harness, chosen by an explicit rubric rather than by star count.
Design principle driving every step below: **vendor, don't depend.** A skill is prompt text plus maybe scripts that your agent will execute with your credentials. Pin it, read it, own it.
---
## Phase 1 — Search (all commands for you, later)
```bash
# sanity: no installs needed, just confirm tooling exists
gh --version && git --version && jq --version
```
**1a. First-party / high-signal sources to check by hand**
- `github.com/anthropics/skills` — reference skill layouts and examples
- Claude Code plugin marketplaces (`/plugin marketplace add <owner>/<repo>`, then `/plugin`) — I can't confirm which marketplaces currently carry a React/Next perf skill; browse rather than assume
- Vercel / Next.js org repos — most likely home for authoritative Next perf guidance
- "awesome-claude-skills" style lists — useful as an index, never as a quality signal
**1b. Breadth search**
```bash
gh search repos "claude skill next.js performance" --limit 20 \
--json fullName,description,stargazersCount,updatedAt,licenseInfo | jq -r '.[]|[.stargazersCount,.updatedAt,.fullName,.description]|@tsv'
gh search repos --topic agent-skills --limit 50 \
--json fullName,description,stargazersCount,updatedAt | jq -r '.[]|[.stargazersCount,.fullName,.description]|@tsv'
# the highest-yield query: find the actual skill files
gh search code --filename SKILL.md "Next.js" --limit 50 --json repository,path \
| jq -r '.[]|[.repository.nameWithOwner,.path]|@tsv' | sort -u
gh search code --filename SKILL.md "Core Web Vitals" --limit 50 --json repository,path \
| jq -r '.[]|[.repository.nameWithOwner,.path]|@tsv' | sort -u
```
```bash
npm search "claude skill react performance" # secondary; most skills aren't on npm
```
Stop when you have **4–6 candidates**. More than that and the comparison never finishes.
## Phase 2 — Vendor candidates locally and compare
```bash
mkdir -p ~/skill-eval && cd ~/skill-eval
i=0; for R in owner1/repo1 owner2/repo2 owner3/repo3; do
i=$((i+1)); git clone --depth 1 "https://github.com/$R" "cand-0$i"
( cd "cand-0$i" && echo "$R $(git rev-parse HEAD)" ) >> PINS.txt
done
cat PINS.txt
```
**Read the skill, don't skim the README:**
```bash
cd ~/skill-eval
find . -name SKILL.md -not -path '*/.git/*' -exec wc -l {} + # 500+ lines = bloated context
for f in $(find . -name SKILL.md -not -path '*/.git/*'); do
echo "=== $f"; sed -n '1,15p' "$f" # frontmatter: name + description triggers
done
find . -path '*/.git' -prune -o -type f -print | grep -vE '\.git' | sort # references/, scripts/, assets/
```
**Safety + portability scan (blocking gate):**
```bash
# anything that would run with your credentials
grep -rnE 'curl [^|]*\| *(ba)?sh|eval |base64 -d|rm -rf|>>? *~/\.(bashrc|zshrc)|npx +-y|token|API_KEY' \
--include='*.md' --include='*.sh' --include='*.js' --include='*.py' . | grep -v '/.git/'
# Claude-only coupling that will silently no-op in Codex/Gemini
grep -rnE 'allowed-tools|WebFetch|WebSearch|TodoWrite|Task\(|mcp__' --include='*.md' . | grep -v '/.git/'
```
**Scoring rubric — fill this in, one row per candidate (0–2 each):**
| Criterion | What earns a 2 |
|---|---|
| Scope match | Covers *your* actual bottlenecks: RSC/client-boundary hygiene, bundle & dynamic import, image/font, caching + revalidation, re-render/memo, Core Web Vitals |
| Version currency | Names your Next major (App Router vs Pages) and React version; not stale App-Router-beta advice |
| Measure-first | Instructs the agent to profile *before* editing (`next build`, bundle analyzer, Lighthouse) instead of pattern-matching "add `memo`" |
| Context economy | Lean `SKILL.md` with progressive disclosure into `references/`; not a 900-line dump |
| Trigger quality | Frontmatter `description` states when to activate, in words your team actually types |
| Portability | Pure markdown + plain shell; zero Claude-specific tool declarations |
| Safety | Zero findings from the grep above; any script is short and readable |
| Maintenance | Commits in last ~6 months, real license, an issue tracker |
**Decision:** highest total wins; **any 0 on Safety or Portability is disqualifying regardless of total.** If nothing clears ~11/16, skip to the fallback at the bottom.
## Phase 3 — Install (canonical copy + three thin pointers)
```bash
REPO=$(git rev-parse --show-toplevel); cd "$REPO"
git switch -c chore/react-perf-skill
mkdir -p .agent-skills
cp -R ~/skill-eval/cand-0X/<path-to-skill-dir> .agent-skills/react-next-perf
grep 'owner/repo' ~/skill-eval/PINS.txt > .agent-skills/react-next-perf/UPSTREAM.txt
# add a "Local edits" section to UPSTREAM.txt as you diverge
```
**Claude Code** (project-scoped so it's shared, not per-laptop):
```bash
mkdir -p .claude/skills
ln -s ../../.agent-skills/react-next-perf .claude/skills/react-next-perf
ls -l .claude/skills/
```
**Codex** — check for native skill support *before* trusting it:
```bash
codex --version && ls ~/.codex 2>/dev/null
# IF a skills dir is supported in your version:
# mkdir -p ~/.codex/skills && ln -s "$REPO/.agent-skills/react-next-perf" ~/.codex/skills/react-next-perf
```
Fallback that always works — append to `AGENTS.md` at repo root:
```markdown
## React / Next.js performance work
Before optimizing React or Next.js performance, read `.agent-skills/react-next-perf/SKILL.md`
and follow it. Profile before editing; never apply memoization without a measurement.
```
**Gemini CLI** — same shape. Append the identical block to `GEMINI.md`, and optionally add an explicit invocation:
```bash
mkdir -p .gemini/commands
cat > .gemini/commands/perf.toml <<'EOF'
description = "Audit React/Next.js performance using the shared team skill"
prompt = """
Read .agent-skills/react-next-perf/SKILL.md and apply it to: {{args}}
Profile first and cite the measurement before proposing any change.
"""
EOF
```
```bash
git add .agent-skills .claude/skills AGENTS.md GEMINI.md .gemini
git commit -m "chore: add pinned react-next-perf agent skill for claude/codex/gemini"
```
## Phase 4 — Verify with one golden task
Pick a page you already know is slow. Capture a baseline, then run the *same* prompt in all three harnesses:
```bash
npx next build # note First Load JS per route
ANALYZE=true npx next build # only if @next/bundle-analyzer is already configured
```
Prompt: `Audit app/<slow-route>/page.tsx for render and bundle performance.`
Pass criteria:
- **Claude Code** announces/uses the skill unprompted (project skills auto-discover from `.claude/skills/`)
- **Codex** and **Gemini** cite `SKILL.md` because of the AGENTS.md / GEMINI.md pointer
- All three **report a measurement before proposing a fix**
- Their top findings substantially overlap — divergence means the pointer isn't loading in one harness
- After applying one suggestion, `npx next build` shows First Load JS moving the right direction
**Rollback:** `git checkout main && git branch -D chore/react-perf-skill`, plus `rm ~/.codex/skills/react-next-perf` if you created that symlink.
## Fallback if no candidate clears the bar
Write a ~120-line in-house `SKILL.md` at `.agent-skills/react-next-perf/` with frontmatter (`name`, `description` with explicit triggers), a hard **measure-before-you-edit** rule naming your real commands, and 5–8 checks specific to your Next version, with detail pushed into `references/`. This is often *less* work than auditing someone else's 700-line file, and it scores 2/2 on portability by construction.
## Maintenance
Quarterly: `cd ~/skill-eval/cand-0X && git fetch && git log --oneline <pinned-sha>..origin/HEAD -- <skill-path>`, review the diff, then re-copy and re-pin. Never auto-update — an unreviewed skill update is an unreviewed change to your agents' instructions.