opencode-skills-collection 3.0.31 → 3.0.33

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 (51) hide show
  1. package/bundled-skills/.antigravity-install-manifest.json +14 -1
  2. package/bundled-skills/bilig-workpaper/SKILL.md +12 -3
  3. package/bundled-skills/bumblebee/SKILL.md +6 -2
  4. package/bundled-skills/bun-development/SKILL.md +5 -3
  5. package/bundled-skills/cloud-penetration-testing/SKILL.md +5 -3
  6. package/bundled-skills/container-security-hardening/SKILL.md +1001 -0
  7. package/bundled-skills/container-security-hardening/references/base-image-comparison.md +245 -0
  8. package/bundled-skills/container-security-hardening/references/kubernetes-pod-security.md +567 -0
  9. package/bundled-skills/container-security-hardening/references/seccomp-profile-template.json +337 -0
  10. package/bundled-skills/doc2math/SKILL.md +102 -0
  11. package/bundled-skills/docs/integrations/jetski-cortex.md +3 -3
  12. package/bundled-skills/docs/integrations/jetski-gemini-loader/README.md +1 -1
  13. package/bundled-skills/docs/maintainers/repo-growth-seo.md +3 -3
  14. package/bundled-skills/docs/maintainers/skills-update-guide.md +1 -1
  15. package/bundled-skills/docs/users/bundles.md +1 -1
  16. package/bundled-skills/docs/users/claude-code-skills.md +1 -1
  17. package/bundled-skills/docs/users/gemini-cli-skills.md +1 -1
  18. package/bundled-skills/docs/users/getting-started.md +6 -2
  19. package/bundled-skills/docs/users/kiro-integration.md +1 -1
  20. package/bundled-skills/docs/users/usage.md +4 -4
  21. package/bundled-skills/docs/users/visual-guide.md +4 -4
  22. package/bundled-skills/environment-setup-guide/SKILL.md +10 -6
  23. package/bundled-skills/evolution/SKILL.md +5 -3
  24. package/bundled-skills/github-actions-advanced/SKILL.md +1100 -0
  25. package/bundled-skills/gitops-workflow/SKILL.md +5 -3
  26. package/bundled-skills/ii-commons/SKILL.md +15 -1
  27. package/bundled-skills/lemmaly/SKILL.md +15 -6
  28. package/bundled-skills/linkerd-patterns/SKILL.md +5 -3
  29. package/bundled-skills/longbridge/SKILL.md +95 -0
  30. package/bundled-skills/mercury-mcp/SKILL.md +9 -1
  31. package/bundled-skills/moatmri/SKILL.md +84 -0
  32. package/bundled-skills/nextjs-seo-indexing/SKILL.md +263 -0
  33. package/bundled-skills/openclaw-github-repo-commander/scripts/repo-audit.sh +42 -0
  34. package/bundled-skills/photopea-embedded-editor/SKILL.md +7 -3
  35. package/bundled-skills/runaway-guard/SKILL.md +331 -0
  36. package/bundled-skills/schema-markup-generator/SKILL.md +319 -0
  37. package/bundled-skills/sendblue/sendblue-api/SKILL.md +6 -1
  38. package/bundled-skills/sendblue/sendblue-cli/SKILL.md +6 -1
  39. package/bundled-skills/sendblue/sendblue-notify/SKILL.md +6 -1
  40. package/bundled-skills/sendblue/textme/SKILL.md +4 -0
  41. package/bundled-skills/social-metadata-hardening/SKILL.md +230 -0
  42. package/bundled-skills/socialclaw/SKILL.md +6 -1
  43. package/bundled-skills/uv-package-manager/resources/implementation-playbook.md +5 -3
  44. package/bundled-skills/varlock/SKILL.md +10 -6
  45. package/bundled-skills/vibe-code-cleanup/SKILL.md +231 -0
  46. package/bundled-skills/vibecode-production-qa-validator/SKILL.md +237 -0
  47. package/bundled-skills/wordpress-centric-high-seo-optimized-blogwriting-skill/SKILL.md +229 -162
  48. package/bundled-skills/yield-intelligence/SKILL.md +121 -0
  49. package/bundled-skills/youtube-full/SKILL.md +144 -0
  50. package/package.json +1 -1
  51. package/skills_index.json +330 -28
@@ -2,7 +2,7 @@
2
2
  name: sendblue-cli
3
3
  description: "Send iMessage and SMS from the shell via the @sendblue/cli npm package — outbound sends, contact management, and account setup with no API client or webhook server required."
4
4
  category: api-integration
5
- risk: safe
5
+ risk: critical
6
6
  source: community
7
7
  source_repo: sendblue-api/sendblue-cli
8
8
  source_type: official
@@ -12,6 +12,10 @@ tags: [sendblue, imessage, sms, cli, messaging, notifications]
12
12
  tools: [claude, cursor, gemini]
13
13
  license: "MIT"
14
14
  license_source: "https://github.com/sendblue-api/sendblue-cli/blob/main/LICENSE"
15
+ plugin:
16
+ targets:
17
+ codex: blocked
18
+ claude: blocked
15
19
  ---
16
20
 
17
21
  # Sendblue CLI
@@ -121,6 +125,7 @@ To text yourself at the end of every agent turn, register a `Stop` hook in `sett
121
125
  ## Security & Safety Notes
122
126
 
123
127
  - Credentials are written to `~/.sendblue/credentials.json` with mode `600`. Treat that file like an API key — do not commit it, do not copy it across machines without the same posture.
128
+ - Treat every outbound send, contact setup, login, or account setup action as state-changing. Preview the recipient, message body, and account/email target, then wait for explicit user confirmation before running it.
124
129
  - Run the CLI as the OS user that owns the credentials file. `sudo` writes a separate copy under root's home and silently desyncs.
125
130
  - Outbound messages to phone numbers are not free of consequence — wire `sendblue send` into hooks or loops only after gating on duration or success conditions to avoid spamming the recipient.
126
131
  - Verification codes arrive by email; treat the address you registered with as a recovery factor for the account.
@@ -2,13 +2,17 @@
2
2
  name: sendblue-notify
3
3
  description: "Text the user's phone when a long-running task, agent turn, or scheduled job finishes — via @sendblue/cli for outbound, optionally wired to a Claude Code Stop hook for automatic fire."
4
4
  category: automation
5
- risk: safe
5
+ risk: critical
6
6
  source: community
7
7
  source_type: official
8
8
  date_added: "2026-05-22"
9
9
  author: AnthonyFirth
10
10
  tags: [sendblue, imessage, sms, notifications, hooks, claude-code, automation]
11
11
  tools: [claude, cursor, gemini]
12
+ plugin:
13
+ targets:
14
+ codex: blocked
15
+ claude: blocked
12
16
  ---
13
17
 
14
18
  # Sendblue Notify
@@ -146,6 +150,7 @@ You can install both: textme on a server for inbound, notify as a local `Stop`-h
146
150
  ## Security & Safety Notes
147
151
 
148
152
  - **Lock-screen previews leak.** Anyone holding the phone can read notification copy. Do not embed secrets, customer data, full error stacks, or auth tokens. Link to a log, dashboard, or PR instead.
153
+ - **Confirm before sending or wiring hooks.** Preview the destination, message template, trigger, and duration gate; wait for explicit user confirmation before running `sendblue send` or editing hook config.
149
154
  - **Automated outbound is a footgun.** A misconfigured `Stop` hook can fire dozens of messages a minute. Always gate by duration and prove the threshold in a dry run before committing.
150
155
  - **Per-user numbers.** The destination phone number is a personal identifier — keep it in user-local config (env var, gitignored file), not in committed repo files or CI logs.
151
156
  - **Free-plan verification is silent.** If the destination contact hasn't texted in once, sends return an API error but the user just sees "no text arrived". Confirm verification before wiring an unattended hook.
@@ -12,6 +12,10 @@ tags: [textme, sendblue, imessage, sms, claude-code, daemon, remote-control, aut
12
12
  tools: [claude, cursor, gemini]
13
13
  license: "MIT"
14
14
  license_source: "https://github.com/njerschow/textme/blob/main/LICENSE"
15
+ plugin:
16
+ targets:
17
+ codex: blocked
18
+ claude: blocked
15
19
  ---
16
20
 
17
21
  # TextMe
@@ -0,0 +1,230 @@
1
+ ---
2
+ name: social-metadata-hardening
3
+ description: "Fix social sharing previews so URLs render as rich cards on Facebook, LinkedIn, X/Twitter, WhatsApp, Telegram, Slack, and Discord. Covers OG tags, Twitter cards, absolute image URLs, and metadata debugging."
4
+ category: seo
5
+ risk: safe
6
+ source: self
7
+ source_type: self
8
+ date_added: "2026-05-31"
9
+ author: Whoisabhishekadhikari
10
+ tags: [seo, open-graph, twitter-card, social-sharing, og-image, nextjs, metadata]
11
+ tools: [claude, cursor, gemini, claude-code]
12
+ version: 1.0.0
13
+ ---
14
+
15
+ # Social Metadata Hardening Skill
16
+
17
+ Fix social sharing so every important URL unfurls as a rich card across all platforms.
18
+
19
+ ---
20
+
21
+ ## When to Use
22
+
23
+ - Use when shared links show missing, stale, cropped, or incorrect previews on social and chat platforms.
24
+ - Use when auditing Open Graph, Twitter/X card, image URL, alt text, or `metadataBase` coverage in a web app.
25
+ - Use before launch when every public page needs predictable rich previews across LinkedIn, X, Facebook, WhatsApp, Slack, Discord, and Telegram.
26
+
27
+ ---
28
+
29
+ ## Why Previews Break
30
+
31
+ | Problem | Root Cause |
32
+ |---------|-----------|
33
+ | No preview at all | Missing og:title, og:description, or og:image |
34
+ | Broken image | Relative URL (must be absolute) |
35
+ | Wrong image size | Image not 1200×630px (OG standard) |
36
+ | Plain text card | Twitter card type missing or set to `summary` |
37
+ | Stale preview | Platform caching old metadata |
38
+ | Metadata missing on crawl | Tags added by client-side JS (crawlers don't run JS) |
39
+
40
+ ---
41
+
42
+ ## The Gold Standard Metadata Block
43
+
44
+ Every shareable page needs ALL of these in static HTML:
45
+
46
+ ```js
47
+ // Next.js App Router — lib/socialMetadata.js
48
+ export function buildSocialMetadata({
49
+ title,
50
+ description,
51
+ path, // '/blog/my-post'
52
+ image, // '/images/og/my-post.jpg' or full URL
53
+ imageAlt,
54
+ imageWidth = 1200,
55
+ imageHeight = 630,
56
+ }) {
57
+ const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || 'https://www.yourdomain.com';
58
+
59
+ // Always produce an absolute URL
60
+ const imageUrl = image?.startsWith('http') ? image : `${baseUrl}${image}`;
61
+ const pageUrl = `${baseUrl}${path}`;
62
+
63
+ // Detect MIME type from extension
64
+ const ext = imageUrl.split('.').pop().toLowerCase();
65
+ const mimeMap = { jpg: 'image/jpeg', jpeg: 'image/jpeg', png: 'image/png', webp: 'image/webp' };
66
+ const imageType = mimeMap[ext] || 'image/jpeg';
67
+
68
+ return {
69
+ title,
70
+ description,
71
+ alternates: { canonical: pageUrl },
72
+ openGraph: {
73
+ title,
74
+ description,
75
+ url: pageUrl,
76
+ type: 'website', // use 'article' for blog posts
77
+ images: [{
78
+ url: imageUrl,
79
+ secureUrl: imageUrl, // explicit HTTPS version
80
+ width: imageWidth,
81
+ height: imageHeight,
82
+ alt: imageAlt || title,
83
+ type: imageType,
84
+ }],
85
+ },
86
+ twitter: {
87
+ card: 'summary_large_image', // NOT 'summary' — that shows a tiny image
88
+ title,
89
+ description,
90
+ images: [imageUrl],
91
+ },
92
+ };
93
+ }
94
+ ```
95
+
96
+ ---
97
+
98
+ ## Applying the Helper
99
+
100
+ ### Static page
101
+ ```js
102
+ // app/about/page.js
103
+ import { buildSocialMetadata } from '@/lib/socialMetadata';
104
+
105
+ export const metadata = buildSocialMetadata({
106
+ title: 'About Us | My Site',
107
+ description: 'Learn about our team and mission.',
108
+ path: '/about',
109
+ image: '/images/og/about.jpg',
110
+ imageAlt: 'The My Site team',
111
+ });
112
+ ```
113
+
114
+ ### Dynamic page (blog post, tool page)
115
+ ```js
116
+ // app/blog/[slug]/page.js
117
+ import { buildSocialMetadata } from '@/lib/socialMetadata';
118
+
119
+ export async function generateMetadata({ params }) {
120
+ const post = await getPost(params.slug);
121
+ return buildSocialMetadata({
122
+ title: `${post.title} | My Blog`,
123
+ description: post.excerpt,
124
+ path: `/blog/${params.slug}`,
125
+ image: post.ogImage || '/images/og/default.jpg',
126
+ imageAlt: post.title,
127
+ });
128
+ }
129
+ ```
130
+
131
+ ### Homepage (app/layout.js or app/page.js)
132
+ ```js
133
+ export const metadata = {
134
+ metadataBase: new URL('https://www.yourdomain.com'), // REQUIRED for absolute URLs
135
+ ...buildSocialMetadata({
136
+ title: 'My Site — Tagline Here',
137
+ description: 'Site-wide description.',
138
+ path: '/',
139
+ image: '/images/og/home.jpg',
140
+ }),
141
+ };
142
+ ```
143
+
144
+ > ⚠️ **`metadataBase` is critical.** Without it, Next.js generates relative OG image URLs that every platform rejects.
145
+
146
+ ---
147
+
148
+ ## OG Image Checklist
149
+
150
+ Good OG images:
151
+ - **1200 × 630px** (2:1 ratio — works on all platforms)
152
+ - **Under 8MB** (Facebook limit)
153
+ - Served over **HTTPS**
154
+ - File name has **no spaces** (use hyphens)
155
+ - Format: **JPEG or PNG** (WebP works on most but not all crawlers)
156
+ - **Accessible via GET** with no authentication
157
+
158
+ ```bash
159
+ # Verify your OG image is reachable and correct size
160
+ curl -sI https://www.yourdomain.com/images/og/home.jpg | grep -i "content-type\|content-length\|status"
161
+ ```
162
+
163
+ ---
164
+
165
+ ## Platform-Specific Notes
166
+
167
+ ### Facebook / Meta
168
+ - Caches aggressively — use the [Sharing Debugger](https://developers.facebook.com/tools/debug/) to force recrawl
169
+ - Minimum image: 200×200px (but use 1200×630 for quality)
170
+ - Needs: `og:title`, `og:description`, `og:image`, `og:url`
171
+
172
+ ### X / Twitter
173
+ - Use `twitter:card = summary_large_image` for full-width images
174
+ - `twitter:image` must be an absolute URL
175
+ - Use the [Card Validator](https://cards-dev.twitter.com/validator) to test
176
+
177
+ ### LinkedIn
178
+ - Caches hard — use [Post Inspector](https://www.linkedin.com/post-inspector/) to refresh
179
+ - Respects `og:` tags; ignores `twitter:` tags
180
+ - Image must be ≥1.91:1 aspect ratio
181
+
182
+ ### WhatsApp / Telegram
183
+ - Read OG tags on first share; cache can last hours
184
+ - Re-share after a few hours for the cache to clear naturally
185
+
186
+ ### Slack / Discord
187
+ - Both use OG tags; both cache
188
+ - Discord also supports `og:type = article` for richer embeds
189
+
190
+ ---
191
+
192
+ ## Debugging Social Previews
193
+
194
+ ### 1. Check raw HTML for tags
195
+ ```bash
196
+ curl -s https://www.yourdomain.com/blog/my-post | grep -i "og:\|twitter:"
197
+ ```
198
+ If tags don't appear → they're being added by JavaScript (not crawlable). Fix: move to `export const metadata` or `generateMetadata`.
199
+
200
+ ### 2. Validate with platform tools
201
+ | Platform | Tool |
202
+ |----------|------|
203
+ | Facebook | https://developers.facebook.com/tools/debug/ |
204
+ | LinkedIn | https://www.linkedin.com/post-inspector/ |
205
+ | Twitter/X | https://cards-dev.twitter.com/validator |
206
+ | General | https://metatags.io |
207
+
208
+ ### 3. Force cache refresh
209
+ After deploying fixes, paste the URL into each platform's debugger and click "Fetch new scrape information" (or equivalent).
210
+
211
+ ---
212
+
213
+ ## Social Metadata Checklist
214
+
215
+ - [ ] `metadataBase` set in root layout
216
+ - [ ] All shareable pages use shared `buildSocialMetadata` helper
217
+ - [ ] OG image URLs are absolute (start with `https://`)
218
+ - [ ] `secureUrl` set equal to `url` in OG image block
219
+ - [ ] Image is 1200×630px, under 8MB, HTTPS
220
+ - [ ] `twitter:card` is `summary_large_image` (not `summary`)
221
+ - [ ] Image alt text present
222
+ - [ ] Tags visible in raw HTML (not JavaScript-rendered)
223
+ - [ ] All platform debuggers show correct preview
224
+ - [ ] Cache refreshed on all platforms after deployment
225
+
226
+ ## Limitations
227
+
228
+ - Cannot force immediate cache refresh on every social platform; some previews may remain stale after a correct fix.
229
+ - Requires deployed, publicly reachable URLs for reliable validation with platform debuggers.
230
+ - Does not replace brand, accessibility, or legal review of image text, alt text, and preview copy.
@@ -2,7 +2,7 @@
2
2
  name: socialclaw
3
3
  description: "Agent-first social media publishing skill — schedule and publish posts across 13 platforms (X, LinkedIn, Instagram, Facebook Pages, TikTok, Discord, Telegram, YouTube, Reddit, WordPress, Pinterest) via a single workspace API key."
4
4
  category: marketing
5
- risk: safe
5
+ risk: critical
6
6
  source: community
7
7
  source_repo: ndesv21/socialclaw
8
8
  source_type: community
@@ -12,6 +12,10 @@ tags: [social-media, publishing, scheduling, marketing, twitter, linkedin, insta
12
12
  tools: [claude]
13
13
  license: "MIT"
14
14
  license_source: "https://github.com/ndesv21/socialclaw/blob/main/LICENSE"
15
+ plugin:
16
+ targets:
17
+ codex: blocked
18
+ claude: blocked
15
19
  ---
16
20
 
17
21
  # SocialClaw — Social Media Publisher
@@ -103,5 +107,6 @@ Website: [getsocialclaw.com](https://getsocialclaw.com)
103
107
  ## Limitations
104
108
 
105
109
  - Requires a valid SocialClaw workspace API key; do not attempt publishing without explicit user-provided credentials.
110
+ - Treat every publish, schedule, delete, or account-changing action as state-changing: show the target platforms, content, media, and timing, then wait for explicit user confirmation before calling the service.
106
111
  - Platform availability, rate limits, analytics fields, and scheduling behavior depend on the upstream SocialClaw service.
107
112
  - This skill describes the publishing workflow; it does not replace platform-specific compliance, brand review, or legal approval before posting.
@@ -51,9 +51,11 @@ Comprehensive guide to using uv, an extremely fast Python package installer and
51
51
 
52
52
  ```bash
53
53
  # macOS/Linux
54
- curl -LsSf https://astral.sh/uv/install.sh -o /tmp/uv-install.sh
55
- sed -n '1,160p' /tmp/uv-install.sh
56
- sh /tmp/uv-install.sh
54
+ tmpdir="$(mktemp -d)"
55
+ trap 'rm -rf "$tmpdir"' EXIT
56
+ curl -LsSf https://astral.sh/uv/install.sh -o "$tmpdir/uv-install.sh"
57
+ sed -n '1,160p' "$tmpdir/uv-install.sh"
58
+ sh "$tmpdir/uv-install.sh"
57
59
 
58
60
  # Windows (PowerShell)
59
61
  powershell -NoProfile -Command "Invoke-WebRequest https://astral.sh/uv/install.ps1 -OutFile $env:TEMP\\uv-install.ps1; Get-Content $env:TEMP\\uv-install.ps1 -TotalCount 120; powershell -ExecutionPolicy Bypass -File $env:TEMP\\uv-install.ps1"
@@ -88,9 +88,11 @@ curl -H "Authorization: Bearer $API_KEY" https://api.example.com
88
88
 
89
89
  ```bash
90
90
  # Install Varlock CLI
91
- curl -sSfL https://varlock.dev/install.sh -o /tmp/varlock-install.sh
92
- sed -n '1,160p' /tmp/varlock-install.sh
93
- sh /tmp/varlock-install.sh --force-no-brew
91
+ tmpdir="$(mktemp -d)"
92
+ trap 'rm -rf "$tmpdir"' EXIT
93
+ curl -sSfL https://varlock.dev/install.sh -o "$tmpdir/varlock-install.sh"
94
+ sed -n '1,160p' "$tmpdir/varlock-install.sh"
95
+ sh "$tmpdir/varlock-install.sh" --force-no-brew
94
96
 
95
97
  # Add to PATH (add to ~/.zshrc or ~/.bashrc)
96
98
  export PATH="$HOME/.varlock/bin:$PATH"
@@ -245,9 +247,11 @@ varlock load
245
247
 
246
248
  ```dockerfile
247
249
  # Install Varlock in container
248
- RUN curl -sSfL https://varlock.dev/install.sh -o /tmp/varlock-install.sh \
249
- && sed -n '1,160p' /tmp/varlock-install.sh \
250
- && sh /tmp/varlock-install.sh --force-no-brew \
250
+ RUN tmpdir="$(mktemp -d)" \
251
+ && curl -sSfL https://varlock.dev/install.sh -o "$tmpdir/varlock-install.sh" \
252
+ && sed -n '1,160p' "$tmpdir/varlock-install.sh" \
253
+ && sh "$tmpdir/varlock-install.sh" --force-no-brew \
254
+ && rm -rf "$tmpdir" \
251
255
  && ln -s /root/.varlock/bin/varlock /usr/local/bin/varlock
252
256
 
253
257
  # Validate at container start
@@ -0,0 +1,231 @@
1
+ ---
2
+ name: vibe-code-cleanup
3
+ description: "Safe production cleanup and hardening for vibe-coded fullstack apps (Next.js, React, Node.js, etc.). Removes dead imports, unused files, broken references, and standardizes helpers without breaking routes or APIs."
4
+ category: fullstack
5
+ risk: safe
6
+ source: self
7
+ source_type: self
8
+ date_added: "2026-05-31"
9
+ author: Whoisabhishekadhikari
10
+ tags: [cleanup, refactor, nextjs, production, vibe-code, fullstack, nodejs]
11
+ tools: [claude, cursor, gemini, claude-code]
12
+ version: 1.0.0
13
+ ---
14
+
15
+ # Vibe-Code Cleanup — Production Refactor Skill
16
+
17
+ A safe, incremental cleanup workflow for AI-generated / vibe-coded fullstack apps.
18
+ The goal is to make the codebase production-ready **without** breaking anything that already works.
19
+
20
+ ## When to Use
21
+
22
+ - Use when a rapidly built app works but has broken imports, duplicated logic, dead code, unclear environment variables, or fragile release hygiene.
23
+ - Use before launch or handoff to convert exploratory code into a maintainable production baseline.
24
+ - Use when cleanup must preserve existing behavior and avoid broad rewrites of routes, APIs, auth, data models, or integrations.
25
+
26
+ ## Core Philosophy
27
+
28
+ > **Surgery, not demolition.** Remove only what is provably dead. Preserve everything else.
29
+
30
+ Never:
31
+ - Rewrite working systems for cosmetic reasons
32
+ - Rename routes, slugs, or API endpoints that may be indexed or cached
33
+ - Change tool inputs/outputs, API contracts, DB schema, or auth flow
34
+ - Delete files you haven't verified are unused
35
+ - Make broad sweeping changes in a single commit
36
+
37
+ Always:
38
+ - Make small, targeted, reversible changes
39
+ - Validate after every meaningful batch of changes
40
+ - Prefer shared helpers over copy-pasted blocks
41
+ - Keep backward compatibility
42
+
43
+ ---
44
+
45
+ ## Step 1 — Reconnaissance (read before touching)
46
+
47
+ Before changing anything, map the codebase:
48
+
49
+ ```bash
50
+ # List all pages/routes
51
+ find . -path "*/app/**/page.{js,jsx,ts,tsx}" | sort
52
+ find . -path "*/pages/**/*.{js,jsx,ts,tsx}" | grep -v "_" | sort
53
+
54
+ # Find broken imports (TS projects)
55
+ npx tsc --noEmit 2>&1 | head -80
56
+
57
+ # Find unused exports (optional, for larger projects)
58
+ npx ts-prune 2>/dev/null | head -40
59
+
60
+ # Check for console.log / debug leftovers
61
+ grep -r "console\.log\|debugger\|TODO\|FIXME\|HACK" --include="*.{js,ts,jsx,tsx}" -l
62
+ ```
63
+
64
+ Document what you find. Do NOT change yet.
65
+
66
+ ---
67
+
68
+ ## Step 2 — Fix Broken Imports First
69
+
70
+ Broken imports cause build failures and should be fixed before anything else.
71
+
72
+ ```bash
73
+ # TypeScript: list all errors
74
+ npx tsc --noEmit 2>&1
75
+
76
+ # Common patterns to fix:
77
+ # - Missing file (file was deleted or renamed)
78
+ # - Wrong relative path (../lib vs ../../lib)
79
+ # - Named export that doesn't exist
80
+ ```
81
+
82
+ **Fix rule:** Fix the import reference. Do NOT delete the referenced file unless you've confirmed it's unused everywhere.
83
+
84
+ ---
85
+
86
+ ## Step 3 — Identify Dead Code (verify before removing)
87
+
88
+ A file/export is safe to remove **only if**:
89
+ 1. No other file imports it (grep-confirmed)
90
+ 2. It's not referenced in config, sitemap, or route manifest
91
+ 3. It's not a public-facing URL (page.js, route.js)
92
+
93
+ ```bash
94
+ # Check if a file is imported anywhere
95
+ grep -r "from.*my-file\|require.*my-file" --include="*.{js,ts,jsx,tsx}" .
96
+
97
+ # Check if a component is used anywhere
98
+ grep -r "MyComponent" --include="*.{js,ts,jsx,tsx}" .
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Step 4 — Consolidate Repeated Logic into Helpers
104
+
105
+ Look for repeated patterns (metadata blocks, API fetch wrappers, error handlers) that appear in 3+ places.
106
+
107
+ **Good consolidation targets:**
108
+ - Page-level SEO metadata (Open Graph, Twitter cards, canonical)
109
+ - Fetch wrappers with error handling
110
+ - Repeated utility functions (slugify, formatDate, truncate)
111
+
112
+ **Bad consolidation targets (leave alone):**
113
+ - One-off business logic
114
+ - Route handlers with different contracts
115
+ - Anything touching DB schema or auth
116
+
117
+ **Pattern for shared metadata helper (Next.js):**
118
+ ```js
119
+ // lib/socialMetadata.js
120
+ export function buildPageMetadata({ title, description, path, image }) {
121
+ const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || 'https://yourdomain.com';
122
+ const imageUrl = image?.startsWith('http') ? image : `${baseUrl}${image}`;
123
+
124
+ return {
125
+ title,
126
+ description,
127
+ openGraph: {
128
+ title,
129
+ description,
130
+ url: `${baseUrl}${path}`,
131
+ images: [{ url: imageUrl, width: 1200, height: 630, alt: title }],
132
+ },
133
+ twitter: {
134
+ card: 'summary_large_image',
135
+ title,
136
+ description,
137
+ images: [imageUrl],
138
+ },
139
+ alternates: {
140
+ canonical: `${baseUrl}${path}`,
141
+ },
142
+ };
143
+ }
144
+ ```
145
+
146
+ ---
147
+
148
+ ## Step 5 — Environment Variable Audit
149
+
150
+ ```bash
151
+ # List all env vars used in code
152
+ grep -r "process\.env\." --include="*.{js,ts,jsx,tsx}" . | grep -oP 'process\.env\.\w+' | sort -u
153
+
154
+ # Compare against .env.example or .env.local
155
+ cat .env.example 2>/dev/null || cat .env.local 2>/dev/null
156
+ ```
157
+
158
+ Flag any env vars used in code but missing from `.env.example`. Never add secrets to version control.
159
+
160
+ ---
161
+
162
+ ## Step 6 — Validate After Every Batch
163
+
164
+ Run this after every meaningful batch of cleanup changes:
165
+
166
+ ```bash
167
+ # TypeScript check
168
+ npx tsc --noEmit
169
+
170
+ # Lint
171
+ npx eslint . --ext .js,.jsx,.ts,.tsx --max-warnings 0
172
+
173
+ # Build (catches runtime issues TypeScript misses)
174
+ npm run build
175
+
176
+ # Tests (if present)
177
+ npm test -- --runInBand --passWithNoTests
178
+ ```
179
+
180
+ If build or typecheck breaks → **revert the last batch** before continuing.
181
+
182
+ ---
183
+
184
+ ## Step 7 — Commit Strategy
185
+
186
+ Each commit should be a single logical unit:
187
+
188
+ ```
189
+ fix: remove broken import in app/blog/page.js
190
+ refactor: consolidate social metadata into lib/socialMetadata.js
191
+ chore: remove verified-unused utils/oldHelper.js
192
+ fix: standardize env var references to NEXT_PUBLIC_BASE_URL
193
+ ```
194
+
195
+ Never bundle UI changes + logic changes + file deletions in one commit. Smaller commits = easier rollback.
196
+
197
+ ---
198
+
199
+ ## What NOT to Clean Up
200
+
201
+ Treat these as off-limits unless there's a verified bug:
202
+
203
+ | Area | Why |
204
+ |------|-----|
205
+ | Route slugs / page paths | May be indexed by Google |
206
+ | API route contracts | Callers depend on exact shape |
207
+ | DB schema / Prisma models | Migration required |
208
+ | Auth flow logic | Security-sensitive |
209
+ | Third-party integration configs | Keys/webhooks are environment-specific |
210
+ | Working tool pages | User-facing functionality |
211
+
212
+ ---
213
+
214
+ ## Cleanup Checklist
215
+
216
+ - [ ] TypeScript errors fixed
217
+ - [ ] No broken imports
218
+ - [ ] Dead code removed (grep-verified)
219
+ - [ ] Shared helpers created for repeated patterns (3+ uses)
220
+ - [ ] No hardcoded secrets or local-only URLs
221
+ - [ ] All env vars documented in `.env.example`
222
+ - [ ] Build passes
223
+ - [ ] Tests pass (or no tests exist)
224
+ - [ ] Lint passes
225
+ - [ ] Each commit is scoped and explainable
226
+
227
+ ## Limitations
228
+
229
+ - Does not infer product intent from code alone; confirm behavior before deleting routes, components, API contracts, or data models.
230
+ - Cleanup should be applied in small reviewed batches because broad refactors can hide regressions.
231
+ - Avoid changing auth, billing, persistence, or third-party integration behavior without explicit requirements and tests.