Get the FREE Ultimate OpenClaw Setup Guide →

ln-724-artifact-cleaner

Scanned
npx machina-cli add skill levnikolaevich/claude-code-skills/ln-724-artifact-cleaner --openclaw
Files (1)
SKILL.md
8.6 KB

Paths: File paths (shared/, references/, ../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.

ln-724-artifact-cleaner

Type: L3 Worker Category: 7XX Project Bootstrap Parent: ln-720-structure-migrator

Removes platform-specific artifacts from projects exported from online platforms, preparing them for production deployment.


Overview

AspectDetails
InputProject directory, platform (auto-detect or manual)
OutputClean project without platform dependencies
PlatformsReplit, StackBlitz, CodeSandbox, Glitch
Duration~2-5 minutes
InvocationCalled from ln-720 (TRANSFORM mode, conditional) or user-invocable

Invocation conditions:

  • TRANSFORM mode only (SKIP in CREATE mode)
  • At least one platform detected
  • User confirmation before cleanup

Platform Support Matrix

PlatformConfig FilesDirectoriesNPM PackagesBuild ConfigComments
Replit.replit, replit.nix.local/, .cache/, .upm/@replit/*REPL_ID checks// @replit
StackBlitz.stackblitzrc.turbo/--Port overrides--
CodeSandboxsandbox.config.json.codesandbox/--CSB env checks--
Glitchglitch.json, .glitch-assets.glitch/, .data/--Glitch env vars--

Reference: platform_artifacts.md


Workflow

Phase 1: Detect & Scan
    |
    +---> 1.0 Detect platforms (auto-detect by config files)
    +---> 1.1 Scan platform-specific artifacts
    |
    v
Phase 2: Preview
    |
    v
Phase 3: Confirm
    |
    v
Phase 4: Execute (per detected platform)
    |
    +---> 4.1 Delete files/directories
    +---> 4.2 Modify package.json
    +---> 4.3 Modify build config (vite/webpack)
    +---> 4.4 Remove platform comments
    +---> 4.5 Modify .gitignore
    |
    v
Phase 5: Verify & Report

Phase 1: Detect & Scan

Step 1.0: Platform Detection

PlatformPrimary IndicatorConfidence
Replit.replit file100%
StackBlitz.stackblitzrc100%
CodeSandboxsandbox.config.json100%
Glitchglitch.json100%

Output:

Detected Platforms:
  - replit (confidence: 100%)

Step 1.1: Scan Artifacts

Per detected platform, scan for artifacts using platform-specific detection rules.

Replit Detection Rules:

Files:
  - Glob: .replit, replit.nix, .replit.nix
  - Glob: vite-plugin-meta-images.ts (if uses REPLIT_* env vars)
Directories:
  - Glob: .local/, .cache/, .upm/, .breakpoints
Package.json:
  - Grep: "@replit/" in devDependencies
Vite Config:
  - Grep: "@replit/" imports
  - Grep: "REPL_ID" or "REPLIT_" environment checks
Code:
  - Grep: "// @replit" comments in *.tsx, *.ts, *.jsx, *.js
.gitignore:
  - Grep: "^\.replit$" line

StackBlitz/CodeSandbox/Glitch: MANDATORY READ: Load platform_artifacts.md for detection rules.

Scan Output Format

Scan Results:
  Platform: Replit
  Files Found: 2
    - .replit (729 bytes)
    - vite-plugin-meta-images.ts (2333 bytes)
  Directories Found: 1
    - .local/ (6 files, 589KB)
  Package Dependencies: 3
    - @replit/vite-plugin-cartographer
    - @replit/vite-plugin-dev-banner
    - @replit/vite-plugin-runtime-error-modal
  Build Config Modifications: 4
    - Import: runtimeErrorOverlay
    - Import: metaImagesPlugin
    - Plugin: runtimeErrorOverlay()
    - Block: REPL_ID conditional (lines 14-24)
  Code Comments: 10
    - button.tsx: 5 comments
    - badge.tsx: 5 comments
  Gitignore Entries: 1
    - .replit

Phase 2: Preview

Show detailed preview of changes per platform.

Will DELETE files:
  - .replit (729 bytes)
  - vite-plugin-meta-images.ts (2333 bytes)
Will DELETE directories:
  - .local/ (6 files, 589KB)
Will MODIFY files:
  - package.json: Remove 3 @replit/* devDependencies
  - vite.config.ts: Remove 4 imports/plugins/blocks
  - 2 UI files: Remove 10 @replit comments
  - .gitignore: Remove ".replit" line

Summary: 2 files deleted, 1 directory deleted, 5 files modified

Phase 3: Confirm

Proceed with platform cleanup (Replit)? [Y/n]

Options:

  • Y (default): Execute cleanup
  • n: Cancel operation
  • Custom exclusions: User can specify files to skip

Phase 4: Execute

Platform Router

Based on detected platforms, dispatch to platform-specific cleanup. Execute sequentially if multiple platforms detected.

4.1 Replit Cleanup (Primary)

Delete files/directories:

rm -f .replit replit.nix .replit.nix
rm -f vite-plugin-meta-images.ts
rm -rf .local/ .cache/ .upm/ .breakpoints

Modify package.json: Remove keys starting with @replit/ from devDependencies.

Modify vite.config.ts:

  • Remove @replit/* imports
  • Remove Replit plugins from plugins array
  • Remove REPL_ID conditional blocks

Remove // @replit comments: Grep // @replit.*$ in **/*.tsx, **/*.ts, **/*.jsx, **/*.js.

Modify .gitignore: Remove .replit line.

4.2 StackBlitz Cleanup

rm -f .stackblitzrc
rm -rf .turbo/  # Only if not used in production

4.3 CodeSandbox Cleanup

rm -f sandbox.config.json
rm -rf .codesandbox/

Remove "sandbox" field from package.json (if exists).

4.4 Glitch Cleanup

rm -f glitch.json .glitch-assets
rm -rf .glitch/
# .data/ - ASK USER before deleting (may contain important data)

Remove Glitch env var checks (PROJECT_DOMAIN, ASSETS_URL) from server code.


Phase 5: Verify & Report

Cleanup Complete!

Platforms Cleaned: Replit

Deleted:
  - .replit
  - vite-plugin-meta-images.ts
  - .local/ (6 files)

Modified:
  - package.json (removed 3 dependencies)
  - vite.config.ts (removed 4 imports/plugins)
  - button.tsx (removed 5 comments)
  - badge.tsx (removed 5 comments)
  - .gitignore (removed 1 line)

Next Steps:
  1. Run `npm install` to update package-lock.json
  2. Run `npm run build` to verify build works
  3. Commit: git add . && git commit -m "chore: remove platform artifacts"

Edge Cases

CaseHandling
No platform artifacts foundReport "Project is clean" and exit
Multiple platforms detectedClean each sequentially, separate reports
Project uses Webpack (not Vite)Search webpack.config.* instead
No package.jsonSkip NPM cleanup phase
.data/ directory (Glitch)Ask user before deleting (may contain data)

Error Handling

ErrorAction
Permission deniedLog error, suggest chmod or admin rights
File in useRetry after delay, then warn user
JSON parse errorLog error, suggest manual fix
Build config syntax errorLog error, suggest manual fix

Integration

With ln-720-structure-migrator

Called conditionally in TRANSFORM mode:

ln-720-structure-migrator:
  Phase 1: Detect project type + platform
  Phase 2: Clean artifacts (ln-724-artifact-cleaner)  # CONDITIONAL
    Condition: Platform detected (Replit/StackBlitz/CodeSandbox/Glitch)
    Skipped if: CREATE mode OR no platform markers
  Phase 3: Restructure frontend (ln-721)
  Phase 4: Generate backend (ln-722)
  Phase 5: Generate seed data (ln-723)

Standalone Usage

User: Clean my project from platform artifacts
Claude: Invokes ln-724-artifact-cleaner

Critical Rules

  • Conditional Invocation: Only run when platform artifacts detected, SKIP in CREATE mode
  • User Confirmation: Always preview and confirm before deleting
  • No Data Loss: Ask user before deleting directories that may contain user data (.data/)
  • Build Verification: Recommend npm run build after cleanup
  • Idempotent: Re-running on clean project reports "no artifacts found"

References


Definition of Done

  • At least one platform detected (Replit/StackBlitz/CodeSandbox/Glitch)
  • All platform artifacts scanned and previewed to user
  • User confirmation received before any deletions
  • Platform files, directories, dependencies, build config, and comments cleaned
  • .gitignore entries for platform files removed
  • Cleanup report generated with deleted/modified file counts

Version: 2.0.0 Last Updated: 2026-02-07

Source

git clone https://github.com/levnikolaevich/claude-code-skills/blob/master/ln-724-artifact-cleaner/SKILL.mdView on GitHub

Overview

Removes platform-specific artifacts from projects exported from Replit, StackBlitz, CodeSandbox, and Glitch, preparing them for production deployment. It auto-detects platform traces and applies targeted cleanup so the codebase is platform-agnostic.

How This Skill Works

The tool auto-detects platforms by config files, then scans for artifacts across files, directories, and build configs. In Phase 4, it deletes platform artifacts, updates package.json, modifies build configs (vite/webpack), removes platform-specific comments, and refreshes .gitignore.

When to Use It

  • After exporting a project from Replit, StackBlitz, CodeSandbox, or Glitch to prepare for production deployment
  • When handing off a project or publishing an open-source release and you want to remove platform locks
  • During platform migrations to consolidate a multi-platform repo into a single, clean codebase
  • In CI/CD pipelines to ensure platform-specific configs don’t leak into builds or environments
  • When you need a verifiable cleanup pass (Phase 5) to confirm no platform artifacts remain

Quick Start

  1. Step 1: Detect platforms (auto-detect via config files or manual selection)
  2. Step 2: Preview planned changes and confirm cleanup
  3. Step 3: Execute cleanup per detected platform and verify results

Best Practices

  • Detect platforms early to avoid false positives and plan precise removals
  • Back up the repository before running the cleanup
  • Review the planned changes with a diff to track what was removed or modified
  • Validate build and test locally after cleanup to catch config regressions
  • Document the changes and update any platform-specific references in docs

Example Use Cases

  • Clean a Replit-exported React app before deploying to Netlify
  • Prepare a StackBlitz-exported Vue project for GitHub Pages deployment
  • Sanitize a CodeSandbox-exported Next.js app for production hosting
  • Remove Glitch-specific artifacts from a Node.js project before Dockerizing
  • Consolidate multiple platform exports into a single repo with artifacts removed

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers