agentleFS
agentsdanceagentsdance/agentskills/skills/code-migration-helper/SKILL.md

code-migration-helper

Skill3 starsChanged 11 months agoApache-2.0View on GitHub

Help migrate code between versions, frameworks, or languages. Use when the user needs to upgrade dependencies, migrate to new APIs, or convert code between technologies.

The file

Files
SKILL.md

Code Migration Helper

Assist with code migrations and upgrades.

Version Migration Strategies

Incremental Migration

v1.0 → v1.1 → v1.2 → v2.0

Upgrade step by step, fixing deprecation warnings.

Big Bang Migration

v1.0 ─────────────────────→ v2.0

Complete rewrite, higher risk but faster.

Strangler Fig Pattern

v1.0 ──┬── new feature → v2.0
       ├── new feature → v2.0
       └── migrate ────→ v2.0

Gradually replace old code with new.

React Migration Examples

Class to Functional Components

// Before (Class)
class UserProfile extends React.Component {
  state = { user: null, loading: true };

  componentDidMount() {
    this.fetchUser();
  }

  fetchUser = async () => {
    const user = await api.getUser(this.props.userId);
    this.setState({ user, loading: false });
  };

  render() {
    if (this.state.loading) return <Loading />;
    return <div>{this.state.user.name}</div>;
  }
}

// After (Functional + Hooks)
function UserProfile({ userId }) {
  const [user, setUser] = useState(null);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    async function fetchUser() {
      const user = await api.getUser(userId);
      setUser(user);
      setLoading(false);
    }
    fetchUser();
  }, [userId]);

  if (loading) return <Loading />;
  return <div>{user.name}</div>;
}

Python 2 to Python 3

# Python 2
print "Hello"
raw_input("Enter: ")
xrange(10)
dict.iteritems()
unicode("text")

# Python 3
print("Hello")
input("Enter: ")
range(10)
dict.items()
str("text")
# Automated conversion
2to3 -w script.py

# Check compatibility
python -m py_compile script.py

Database Migration

-- Add column with default
ALTER TABLE users ADD COLUMN status VARCHAR(20) DEFAULT 'active';

-- Backfill data
UPDATE users SET status = 'active' WHERE status IS NULL;

-- Make non-nullable after backfill
ALTER TABLE users ALTER COLUMN status SET NOT NULL;

Migration Checklist

PhaseTasks
PrepareBackup, read changelogs, plan rollback
TestRun on staging, check for issues
MigrateApply changes, monitor
VerifyRun tests, check functionality
CleanupRemove old code, update docs

Codemods (jscodeshift)

// codemod.js - Rename imports
module.exports = function(fileInfo, api) {
  const j = api.jscodeshift;

  return j(fileInfo.source)
    .find(j.ImportDeclaration, {
      source: { value: 'old-package' }
    })
    .forEach(path => {
      path.node.source.value = 'new-package';
    })
    .toSource();
};

// Run: jscodeshift -t codemod.js src/

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.