본문으로 건너뛰기
Skillpedia
일반 코딩48k · #6113

vibe-code-cleanup

하는 일

빠르게 만든 웹 애플리케이션에서 필요 없거나 깨진 부분을 제거해 코드를 정리하는 도구입니다. 이미 작동하는 기능은 바꾸지 않습니다. 목표는 운영 환경에서 코드를 더 안전하고 유지 보수하기 쉽게 만드는 것입니다.

사용하는 경우

  • ✓앱은 작동하지만 가져오기 오류나 사용되지 않는 코드가 있을 때.
  • ✓앱을 출시하거나 다른 사람에게 넘기기 전에.
  • ✓라우트나 API 같은 핵심 기능을 바꾸지 않고 코드를 정리해야 할 때.

스킬 링크

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/vibe-code-cleanup/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/vibe-code-cleanup/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“사용되지 않는 부분을 제거하고 깨진 가져오기를 고치면서 내 코드를 정리해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 코드를 분석해 깨진 가져오기와 사용되지 않는 코드를 찾습니다. 라우트나 API 같은 중요한 기능이 계속 작동하도록 하면서 이런 부분을 조심스럽게 제거합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Vibe-Code Cleanup — Production Refactor Skill

A safe, incremental cleanup workflow for AI-generated / vibe-coded fullstack apps. The goal is to make the codebase production-ready without breaking anything that already works.

When to Use

  • Use when a rapidly built app works but has broken imports, duplicated logic, dead code, unclear environment variables, or fragile release hygiene.
  • Use before launch or handoff to convert exploratory code into a maintainable production baseline.
  • Use when cleanup must preserve existing behavior and avoid broad rewrites of routes, APIs, auth, data models, or integrations.

Core Philosophy

Surgery, not demolition. Remove only what is provably dead. Preserve everything else.

Never:

  • Rewrite working systems for cosmetic reasons
  • Rename routes, slugs, or API endpoints that may be indexed or cached
  • Change tool inputs/outputs, API contracts, DB schema, or auth flow
  • Delete files you haven't verified are unused
  • Make broad sweeping changes in a single commit

Always:

  • Make small, targeted, reversible changes
  • Validate after every meaningful batch of changes
  • Prefer shared helpers over copy-pasted blocks
  • Keep backward compatibility

Step 1 — Reconnaissance (read before touching)

Before changing anything, map the codebase:

# List all pages/routes
find . -type f \( -name 'page.js' -o -name 'page.jsx' -o -name 'page.ts' -o -name 'page.tsx' \)
find pages -type f \( -name '*.js' -o -name '*.jsx' -o -name '*.ts' -o -name '*.tsx' \) | rg -v '/_' | sort

# Find broken imports (TS projects)
npx tsc --noEmit 2>&1 | head -80

# Find unused exports (optional, for larger projects)
npx ts-prune 2>/dev/null | head -40

# Check for console.log / debug leftovers
grep -r "console\.log\|debugger\|TODO\|FIXME\|HACK" --include="*.{js,ts,jsx,tsx}" -l

Document what you find. Do NOT change yet.


Step 2 — Fix Broken Imports First

Broken imports cause build failures and should be fixed before anything else.

# TypeScript: list all errors
npx tsc --noEmit 2>&1

# Common patterns to fix:
# - Missing file (file was deleted or renamed)
# - Wrong relative path (../lib vs ../../lib)
# - Named export that doesn't exist

Fix rule: Fix the import reference. Do NOT delete the referenced file unless you've confirmed it's unused everywhere.


Step 3 — Identify Dead Code (verify before removing)

A file/export is safe to remove only if:

  1. No other file imports it (grep-confirmed)
  2. It's not referenced in config, sitemap, or route manifest
  3. It's not a public-facing URL (page.js, route.js)
# Check if a file is imported anywhere
grep -r "from.*my-file\|require.*my-file" --include="*.{js,ts,jsx,tsx}" .

# Check if a component is used anywhere  
grep -r "MyComponent" --include="*.{js,ts,jsx,tsx}" .

Step 4 — Consolidate Repeated Logic into Helpers

Look for repeated patterns (metadata blocks, API fetch wrappers, error handlers) that appear in 3+ places.

Good consolidation targets:

  • Page-level SEO metadata (Open Graph, Twitter cards, canonical)
  • Fetch wrappers with error handling
  • Repeated utility functions (slugify, formatDate, truncate)

Bad consolidation targets (leave alone):

  • One-off business logic
  • Route handlers with different contracts
  • Anything touching DB schema or auth

Pattern for shared metadata helper (Next.js):

// lib/socialMetadata.js
export function buildPageMetadata({ title, description, path, image }) {
  const baseUrl = process.env.NEXT_PUBLIC_BASE_URL || 'https://yourdomain.com';
  const imageUrl = image?.startsWith('http') ? image : `${baseUrl}${image}`;
  
  return {
    title,
    description,
    openGraph: {
      title,
      description,
      url: `${baseUrl}${path}`,
      images: [{ url: imageUrl, width: 1200, height: 630, alt: title }],
    },
    twitter: {
      card: 'summary_large_image',
      title,
      description,
      images: [imageUrl],
    },
    alternates: {
      canonical: `${baseUrl}${path}`,
    },
  };
}

Step 5 — Environment Variable Audit

# List all env vars used in code
grep -r "process\.env\." --include="*.{js,ts,jsx,tsx}" . | grep -oP 'process\.env\.\w+' | sort -u

# Compare against .env.example or .env.local
cat .env.example 2>/dev/null || cat .env.local 2>/dev/null

Flag any env vars used in code but missing from .env.example. Never add secrets to version control.


…

자주 묻는 질문

'죽은 코드(dead code)'는 무엇인가요?

작성되었지만 애플리케이션 어디에서도 실제로 사용되지 않는 코드입니다.

이 도구가 내 웹사이트를 망가뜨릴 수 있나요?

아니요, 주된 목표는 망가지는 것을 막는 것입니다. 사용되지 않는다고 확실히 판단한 것만 제거하고, 작고 안전한 변경만 합니다.

모든 웹 앱에 사용할 수 있나요?

네, Next.js, React, Node.js 같은 기술로 만든 웹 앱에서 특히 유용하며, 풀스택 개발에서 흔히 쓰입니다.

상세 정보

작성자의 원본 설명

Safe production cleanup and hardening for vibe-coded fullstack apps (Next.js, React, Node.js, etc.). Removes dead imports, unused files, and broken references without breaking routes or APIs.

repo: sickn33/agentic-awesome-skills

인기도

GitHub 스타
48k
순위
#6113
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬