optimize-js-library-size
Optimize JavaScript library size.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Optimize JavaScript library size.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Make a set of things (code, prose, config, docs) consistent along a dimension the user names, by picking a canonical form and conforming every member to it.
Remove illegal states from data structures by redesigning their types so the illegal states cannot be represented at all.
Remove unnecessary comments from code: tombstones, redundant restatements, and comments a well-named variable or function would replace.
Perform a task with a worker agent, critique it with an adversary agent, and apply the accepted critiques with a reconciler agent.
Replace jargon and imported metaphors in code and prose with concrete, domain-fitting terms a reader understands without translation.
Create a new Claude Code skill following the conventions of existing skills.
| name | optimize-js-library-size |
| description | Optimize JavaScript library size. |
| argument-hint | [path to the library or extra guidance] |
Reduce the size of this JavaScript library.
$ARGUMENTS
Ensure terser is configured:
{
// Assume modern JavaScript
ecma: 2020,
module: true,
toplevel: true,
// Run multiple times
compress: {
passes: 3,
},
// Mangle underscore prefixed properties
mangle: {
properties: {
regex: `^_[^_]+`,
},
},
}
Use node to measure size:
node --input-type=module << 'EOF'
import { readFileSync } from 'fs'
import { gzipSync, brotliCompressSync } from 'zlib'
const raw = readFileSync('REPLACE_ME.js', 'utf8')
const minified = Buffer.from(raw.replace(/^\/\/# sourceMappingURL=[^\n]+$/m, '').trimEnd())
console.log(`Minified: ${minified.length} | Gzipped: ${gzipSync(minified).length} | Brotli: ${brotliCompressSync(minified).length}`)
EOF
terserfunctions with arrow functionsswitch with if and else===/!== with ==/!= when it doesn't change behaviorThese aren't exhaustive. Reason from first principles when none fits cleanly.