원클릭으로
shrink-framework
Validation-driven compression workflow that requires semantic comparison before approval.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Validation-driven compression workflow that requires semantic comparison before approval.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
This skill should be used when the user asks to "plan a blog post", "research for blog", "draft a blog post", "critique a draft", "deformulize a post", "commit blog changes", "editorial review", "voice check", "style check", "audit blog", "content audit", "audit series", or "audit drafts".
This skill should be used when the user asks to "commit code", "review code", "fix lint/type error", "improve performance", "compare code", "shrink code", "generate spec from code", "investigate code", or "create handoff prompt".
This skill should be used when the user asks to "create documentation", "build docs", "review docs", "compare documents", "compress docs", "adversarial review docs", or "commit docs".
Unified identify-verify-stage-commit logic reused by other skills.
Semantic comparison workflow for validating equivalence between artifacts.
Pre-edit investigation workflow for understanding code and behavior before changes.
| name | shrink-framework |
| description | Validation-driven compression workflow that requires semantic comparison before approval. |
Every compression MUST be validated via compare framework. No manual checks.
ALLOWED: Application source code, Claude-facing docs, config files FORBIDDEN: Tests, generated files, vendored code, migrations, changelogs, READMEs (unless explicit)
Use Task tool with subagent_type: "general-purpose":
**COMPRESSION TASK**
**File**: {{path}}
**Goal**: {{threshold}} equivalence score. Target ~{{target}}% reduction.
## Equivalence Definition
Same inputs -> same outputs, same side effects, same error handling.
## Preserve ALL
- Public API / interface
- Type contracts
- Side effects, error handling, control flow
- Dependencies
- Critical comments (TODO, FIXME, why-comments)
## Safe to Remove
- Dead code, redundant implementations
- Verbose patterns -> concise equivalents
- Unnecessary intermediate variables
- Comments repeating code
- Defensive code for impossible conditions
## Output
Read file, compress, USE WRITE TOOL to save compressed version.
CRITICAL: Actually write the file.
1. Save baseline (if not exists)
2. Compress -> save as v{N}
3. Compare: baseline vs v{N}
4. Score >= threshold:
- Run tests (if applicable) -> pass: APPROVE, overwrite original, clean up
5. Score < threshold:
- Generate iteration prompt with feedback -> step 2 (max 3 iterations)
| Condition | Action |
|---|---|
| Score >= threshold AND tests pass | APPROVE - overwrite original |
| Score >= threshold AND tests fail | FIX tests or revert |
| Score < threshold AND iterations < 3 | ITERATE with feedback |
| Score < threshold AND iterations >= 3 | Report best version, ask guidance |
**COMPRESSION REVISION {N}**
**Previous Score**: {score}/{threshold}
**Issues**: {warnings from comparison}
**Task**: Restore equivalence while maintaining compression.
**Original**: {baseline_path}
**Previous**: {version_path}
Focus: restore contracts, fix dependencies, maintain error handling.
CRITICAL: USE WRITE TOOL to save revised version.
BASELINE="/tmp/original-{filename}"
VERSION_FILE="/tmp/shrink-{filename}-version.txt"
VERSION=$(($(cat "$VERSION_FILE" 2>/dev/null || echo 0) + 1))
echo "$VERSION" > "$VERSION_FILE"
COMPRESSED="/tmp/compressed-{filename}-v${VERSION}.{ext}"
## Compression Results
| Version | Size | Reduction | Score | Status |
|---------|------|-----------|-------|--------|
| Original | {lines} | - | N/A | Baseline |
| V1 | {lines} | {%} | {score} | {status} |
### Removed/Simplified
- {item}
### Validation: Primary {score}, Relationship {score}, Structure {score}
### Recommendation: {APPROVED|ITERATE|MANUAL_REVIEW}
On success: rm /tmp/compressed-{filename}-v*.{ext} (keep baseline for future iterations)
On user done: rm /tmp/original-{filename} /tmp/shrink-{filename}-version.txt
| Case | Handling |
|---|---|
| Public API changes | STOP and ask user |
| Test dependencies | Preserve or update tests |
| Score plateau | After 3 attempts, report best |
| Large files | Consider section-by-section |
| Already minimal | Report "minimal opportunities" |