Langsung ke konten
CVKontak

rightsize

rightsize adalah skill Claude Code yang mengaudit konteks yang dimuat Claude, seperti CLAUDE.md, AGENTS.md, rules, skill, dan subagent, lalu mengusulkan diff yang hanya menyisakan baris yang mencegah kesalahan nyata.

0.1.3, dirilis 8 Nov 2026. Publik di GitHub sejak 19 Nov 2026.Dibangun sendiriPython, Claude Code skill, Claude Code plugin, GitHub Actions

Contoh, dari fixture tes

Fixture tes di repositorinya adalah CLAUDE.md 125 baris untuk API Laravel. Run rightsize 0.1.3 pada fixture itu, 17 November 2026, menyisakan CLAUDE.md 10 baris, dan konteks yang dimuat setiap sesi turun dari sekitar 1.366 ke sekitar 520 token, 62% lebih sedikit. Runbook deploy menjadi skill yang hanya dijalankan manual, migrate:fresh diblokir hook, dan .env oleh aturan deny.

CLAUDE.md Contoh rekaan

125 menjadi 10 baris

Setiap sesi ~1.366 menjadi ~520 token −62%

Delete: persona, stack, pohon direktori, duplikat, saran umum, rujukan basi, dan catatan bertanggal

@@ 3 @@ persona

3You are an expert senior Laravel developer with 15 years of experience. Think step by step before answering.

@@ 5 @@ section heading (its text is kept)

5## Project overview

@@ 9–16 @@ tech stack

9## Tech stack
Baris 10–16 · tech stack, 6 items
10
11- Laravel 11
12- PHP 8.3
13- laravel/sanctum for API authentication
14- spatie/laravel-permission for roles
15- Pest for tests
16- Vite for frontend assets

@@ 19–34 @@ directory tree

19## Directory structure
Baris 20–34 · directory tree, 16 lines
20
21```
22app/
23├── Http/
24│ ├── Controllers/
25│ └── Requests/
26├── Models/
27├── Services/
28routes/
29├── api.php
30└── web.php
31tests/
32├── Feature/
33└── Unit/
34```

@@ 36–41 @@ rules

36## Rules
38- IMPORTANT: ALWAYS write tests for every change..claude/rules/testing.md:3 (rewritten there)
40- Use camelCase for variables and PascalCase for classes.
41- ALWAYS use Form Requests for validation.

@@ 46–49 @@ rules

46- Double-check your work before saying you are done.
47- Be thorough and careful.
48- Follow PSR-12.
49- IMPORTANT: ALWAYS write tests for every change..claude/rules/testing.md:3 (rewritten there)

@@ 110–125 @@ commands, architecture, notes

110## Useful commands
Baris 111–115 · useful commands
111
112- `composer test` runs the test suite
113- `composer run analyse` runs PHPStan
114- `npm run lint` lints the frontend
115- `npm run dev` starts Vite
117## Architecture
Baris 118–119 · architecture pointer to missing files
118
119See `docs/architecture.md` for the full architecture and `app/Services/PaymentService.php` for the payment flow.
121## Notes
122
123- 2026-03-02: fixed the cart total bug, check cart totals after changes
125- 2026-04-11: added the refunds endpoint

Kenapa dibuat

Kebanyakan file instruksi proyek masih membawa kebiasaan dari model lama: ALWAYS dan NEVER dalam huruf kapital, contoh kode yang ditempel, runbook deploy, aturan yang sama di tiga tempat. Claude membaca semuanya di setiap giliran.

Claude membaca stack dari composer.json dan package.json, dan bisa melihat pohon direktorinya sendiri. Baris persona dan “be thorough” adalah penopang yang sudah tidak dibutuhkan model sekarang. Aturan tes kini cukup ada sekali, di .claude/rules/testing.md, dan perintah, dokumen, serta service yang disebut di sini tidak ada.

Rewrite: aturan mentah, ditulis dengan bahasa biasa

@@ 39 @@ rules

39- NEVER add comments to code.6- Match the comment density of the surrounding code; most files here have none.

Satu tes untuk setiap baris

Setiap instruksi dikelompokkan sebagai keep, rewrite, move, enforce, atau delete, dengan satu tes: kesalahan nyata apa yang akan dibuat Claude di repo ini tanpa baris ini?

Perlu keputusanmu: CLAUDE.md:39 bertentangan dengan .claude/rules/testing.md:6. Keduanya kini punya cakupan: di sini, ikuti kepadatan komentar di sekitarnya; di sana, komentar satu baris untuk setup tes boleh. Apakah itu maksud timnya?

Laporannya mencatat 5 rewrite; 4 lainnya ada di file .claude/.

Enforce: keluar dari prosa, masuk ke hook, aturan deny, dan aturan ask

@@ 42–45 @@ rules

42- DO NOT modify files in config/ without asking.10- Edits to `config/` ask for the user's OK first (an ask rule).
.claude/settings.json ask: Edit(./config/**), Write(./config/**)
44- NEVER run `php artisan migrate:fresh` against production. It drops every table.8- `php artisan migrate:fresh`, `migrate:reset` and `db:wipe` are blocked by a hook, because they drop every table; reset the test database with `--env=testing`.
.claude/hooks/block-destructive.py (PreToolUse hook in .claude/settings.json)
45- The .env file contains secrets. DO NOT read it or print it.9- `.env` holds secrets and Claude can't read it (a deny rule); ask the user for any value you need from it.
.claude/settings.json deny: Read(./.env), Read(./.env.*)

Aturan yang harus berlaku

Aturan yang harus selalu berlaku menjadi hook dan aturan izin, ditambah satu baris biasa yang menjelaskan alasannya.

Hook-nya menolak migrate:fresh, migrate:reset, dan db:wipe kecuali dengan --env=testing; hook ini sudah dicoba pada perintah yang harus diblokir dan yang harus dibiarkan lewat. .env tidak boleh dibaca, dan edit ke config/ harus minta izin dulu.

Keep: jebakan uang dalam sen, judul, dan ringkasan proyek

@@ 1 @@ title

1# Acme Shop API1# Acme Shop API

@@ 7 @@ overview

7Acme Shop is the backend for our online store. It serves a JSON API to the Flutter app and the admin panel.3Acme Shop is the backend for our online store. It serves a JSON API to the Flutter app and the admin panel. It runs on MySQL 8, and the queue driver is Redis.
17- MySQL 8CLAUDE.md:3 (after), in the overview

@@ 43 @@ rules

43- Prices are stored as integers in cents in the `amount` column; never use floats for money, because rounding errors break invoice totals.5- Prices are stored as integers in cents in the `amount` column; never use floats for money, because rounding errors break invoice totals.
124- 2026-03-09: switched the queue driver to redisCLAUDE.md:3 (after), in the overview

Baris yang mencegah kesalahan nyata

Tanpa baris 43, Claude bisa menyimpan uang sebagai float di repo ini, dan baris itu menjelaskan kenapa total invoice jadi salah. Baris ini dipertahankan apa adanya.

Ringkasan proyek tetap, dan kini memuat dua fakta yang tidak ada di manifest mana pun: MySQL 8 (baris 17) dan queue Redis (baris 124).

Move: contoh controller, checklist review, dan runbook deploy

@@ 51–78 @@ example controller

51## Example controller7- New controllers follow `app/Http/Controllers/ProductController.php`.
52app/Http/Controllers/ProductController.php (pointer at CLAUDE.md:7)
Baris 53–78 · pasted PHP example, 27 lines
53Use this as the template for every new controller:
54
55```php
56<?php
57
58namespace App\Http\Controllers;
59
60use App\Http\Requests\StoreProductRequest;
61use App\Models\Product;
62use Illuminate\Http\JsonResponse;
63
64class ProductController extends Controller
65{
66 public function index(): JsonResponse
67 {
68 return response()->json(Product::query()->paginate(20));
69 }
70
71 public function store(StoreProductRequest $request): JsonResponse
72 {
73 $product = Product::create($request->validated());
74
75 return response()->json($product, 201);
76 }
77}
78```

@@ 80–95 @@ code review checklist

80## Code review checklist.claude/skills/code-review/SKILL.md (merged)
Baris 81–95 · checklist, 12 items
81
82When reviewing code, check:
83
841. Naming is clear
852. Validation uses Form Requests
863. No N+1 queries (use eager loading)
874. Authorization is handled by policies
885. Money is stored in cents
896. Tests cover the happy path
907. Tests cover failure cases
918. No secrets in code
929. API resources are used for responses
9310. Migrations are reversible
9411. Jobs are idempotent
9512. Logs don't contain personal data

@@ 97–108 @@ deploy runbook

97## Deploying to the VPS.claude/skills/deploy/SKILL.md (new, manual-only)
Baris 98–108 · deploy steps, 10 items
98
991. SSH into the server: `ssh deploy@203.0.113.10`
1002. Go to the app directory: `cd /var/www/acme-shop`
1013. Put the app in maintenance mode: `php artisan down`
1024. Pull the latest code: `git pull origin main`
1035. Install dependencies: `composer install --no-dev --optimize-autoloader`
1046. Run migrations: `php artisan migrate --force`
1057. Build assets: `npm ci && npm run build`
1068. Clear and rebuild caches: `php artisan optimize`
1079. Restart the queue workers: `php artisan queue:restart`
10810. Bring the app back up: `php artisan up`

Dimuat hanya saat dibutuhkan

Langkah deploy menjadi skill baru yang hanya dijalankan manual, jadi dimuat saat dibutuhkan, bukan setiap sesi. Checklist-nya bergabung ke skill review yang sudah ada. Controller yang ditempel, yang sudah tidak sama dengan aslinya, diganti rujukan ke file aslinya.

Setiap baris berisi teks dari 125 baris ada di salah satu hunk; hanya 13 baris kosong di antara bagian yang dilewati. Angka tokennya estimasi rightsize 0.1.3, jumlah karakter dibagi 2,7.

Apa itu rightsize

Jalankan /rightsize:rightsize, atau minta Claude merampingkan CLAUDE.md yang terlalu gemuk. rightsize lalu bekerja dalam lima langkah:

Memindai
setiap file konteks dengan scanner Python yang deterministik dan hanya memakai standard library: apa yang dimuat setiap sesi dan apa yang dimuat saat dibutuhkan, estimasi token, dan 24 pengecekan. Scanner hanya membaca file.
Mengelompokkan
setiap instruksi sebagai keep, rewrite, move, enforce, atau delete, dengan satu tes: kesalahan nyata apa yang akan dibuat Claude di repo ini tanpa baris ini?
Mengusulkan
diff yang dikelompokkan per verdict. Tidak ada yang berubah sampai kamu memilih kelompok mana yang diterapkan.
Menegakkan
aturan yang harus selalu berlaku lewat hook dan aturan izin, ditambah satu baris biasa yang menjelaskan alasannya.
Mengukur
sebelum dan sesudah, dari snapshot pemindaian pertama.

Yang saya kerjakan

Saya membangun rightsize sendiri. 0.1.0 keluar pada 5 November 2026, dan 0.1.1 di hari yang sama, disetel pada file CLAUDE.md sungguhan dari repositori publik untuk mengurangi alarm palsu. 0.1.2 (7 November) memperbaiki temuan uji lapangan pada plugin Claude Code, aplikasi desktop, proyek Vite baru, dan ~/.claude pribadi, dan 0.1.3 (8 November) menulis file baru sebelum memotong konten yang dipindahkannya.

Status

0.1.3 adalah rilis terbaru (8 November 2026). Butuh Claude Code dan Python 3.8 atau lebih baru, dan bisa dipasang sebagai plugin atau skill pribadi. Kodenya publik di github.com/mrramdn/rightsize.