Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@nebutra/next-unicorn-skill

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nebutra/next-unicorn-skill

Stop Vibe Coding debt: audit your codebase, replace reinvented wheels with unicorn-grade libraries, scan vulnerabilities, auto-update deps, and auto-create PRs — all verified via Context7 MCP.

latest
Source
npmnpm
Version
2.1.0
Version published
Maintainers
1
Created
Source

Next-Unicorn

Stop Vibe Coding debt. Audit your codebase, replace reinvented wheels with
unicorn-grade libraries, and ship a migration plan + "delete-code" checklist.

Smithery CI npm version npm downloads GitHub Stars License TypeScript Tests Property Tests

English | 简体中文

Quick StartFeaturesHow It WorksComparisonAPIExamplesContributing

Why Next-Unicorn?

Every codebase accumulates hand-rolled implementations that should be mature libraries. Custom date formatters, DIY loggers, bespoke state machines, ad-hoc i18n — Vibe Coding debt.

Snyk, Dependabot, and Renovate manage your existing dependencies. They can't find code you wrote that should become a dependency — or capabilities your project is missing entirely.

Next-Unicorn does all three — replacement, gap analysis, and dependency management — verified against real documentation via Context7 MCP.

Quick Start

Browse and install directly from the Smithery skill registry:

Next-Unicorn on Smithery

From npmjs.org

npm install @nebutra/next-unicorn-skill
# or
pnpm add @nebutra/next-unicorn-skill

From GitHub Packages

Configure your .npmrc first:

echo "@nebutra:registry=https://npm.pkg.github.com" >> .npmrc

Then install:

npm install @nebutra/next-unicorn-skill
import { analyze, scanCodebase } from '@nebutra/next-unicorn-skill';
import type { Recommender, GapRecommendation } from '@nebutra/next-unicorn-skill';

// The recommender: AI agent decides which library fits each detection
const recommender: Recommender = (detection) => ({
  library: '@lingui/core',
  version: '^4.0.0',
  license: 'MIT',
  rationale: 'Compile-time i18n with near-zero runtime overhead',
  ecosystem: [
    { library: '@lingui/macro', version: '^4.0.0', role: 'Tagged templates' },
    { library: '@lingui/cli', version: '^4.0.0', role: 'CI message extraction' },
  ],
  antiPatterns: ['Avoid i18next if bundle size matters — Lingui compiles away'],
  alternatives: [
    { library: 'next-intl', when: 'Next.js App Router with server components' },
  ],
});

// Gap analysis: capabilities the project should have but doesn't
const gaps: GapRecommendation[] = [
  {
    domain: 'observability',
    description: 'No structured logging detected',
    recommendedLibrary: {
      name: 'pino', version: '^9.0.0', license: 'MIT',
      rationale: 'Fastest Node.js JSON logger with redaction and child loggers',
    },
    priority: 'critical',
  },
];

const result = await analyze({
  input: {
    projectMetadata: {
      repoPath: './my-project',
      languages: ['typescript'],
      packageManagers: ['pnpm'],
      currentLibraries: { react: '18.2.0', next: '14.1.0' },
    },
    optimizationGoals: ['reduce custom code', 'improve maintainability'],
    constraints: { licenseAllowlist: ['MIT', 'Apache-2.0', 'ISC'] },
    priorityFocusAreas: ['i18n', 'observability', 'auth-security'],
  },
  context7Client: myContext7Client,
  recommender,
  gaps,
});

if (result.success) {
  console.log(result.prettyJson);
  // result.scanResult — raw detections + structural findings for AI analysis
  // result.output.gapAnalysis — Context7-verified gap recommendations
}

Or use as an MCP SKILL — provide SKILL.md to your AI agent (Claude Code, Kiro, Cursor, etc.).

Features

Core Analysis

FeatureDescription
Pattern-based scanningDetects hand-rolled code across 31 domains with 52 regex patterns (design-system, auth, state-management, code-organization, etc.)
Structural analysisDetects monorepo architecture gaps: missing token layers, dependency flow violations, hardcoded config values
Gap analysisAI agent identifies missing capabilities — not just hand-rolled code, but things you should have but don't
Ecosystem-level recommendationsSolutions include rationale, companion packages, anti-patterns, and alternatives
Context7 verificationEvery recommendation (replacements AND gaps) verified with exponential backoff retry
7-dimension impact scoringScalability, performance, security, maintainability, feature richness, UX, UI aesthetics
Phased migration plansLow / medium / high risk phases with adapter strategies
Deletion checklistsEvery file and line range to remove, with estimated lines saved
UX completeness auditA11y, error/empty/loading states, form validation, design system alignment
Design system supportTwo paths: scaffold from reference repos (Primer, Polaris, Supabase, Dub) or extract from existing code
Code organization analysisDetects god directories, mixed naming conventions, deep nesting, barrel bloat, catch-all directories, and circular dependencies via import graph traversal
Human-in-the-loop gates4 structured decision gates at irreversible/preference-driven points — triage, preferences (SWOT), accept/reject, execution confirmation
Monorepo supportDetects npm, pip, cargo, go workspaces independently

Dependency Management

FeatureDescription
Vulnerability scanningScans current AND recommended deps via OSV — prevents "upgrade into a vuln"
Auto-update depsImpact-scored version upgrades with Context7-powered breaking change detection
PR auto-creationGitHub/GitLab PRs with conventional commit titles, impact tables, reviewer checklists
Migration PRsPRs with adapter code scaffolding for hand-rolled code replacement

How It Works

Architecture Diagram

flowchart TB
    subgraph input [Input]
        I[InputSchema JSON]
    end

    subgraph deterministic [Deterministic Layer — TypeScript]
        V[Zod Validator]
        S[Scanner — 52 regex patterns across 31 domains]
        SA[Structure Analyzer — monorepo architecture, dependency flow, token layers]
        C7[Context7 Verifier — exponential backoff, query ranking]
        VS[Vuln Scanner — OSV database]
        PC[Peer Checker — semver range validation]
        PR[PR Strategy + Executor]
    end

    subgraph agent [AI Agent Layer — Claude generalization]
        GA[Gap Analysis — single library / ecosystem / architecture gaps]
        REC[Recommender — ecosystem-level solutions with rationale]
        UX[UX Audit — 8 categories]
        DS{Design System?}
        DSE[Extract from existing code]
        DSS[Scaffold from reference repos]
    end

    subgraph output [Output]
        O[OutputSchema JSON]
    end

    I --> V --> S
    S --> SA
    S --> REC
    SA --> GA
    GA --> DS
    DS -->|Existing frontend| DSE
    DS -->|No frontend| DSS
    GA --> O
    REC --> C7 --> O
    S --> PC --> O
    S --> VS --> O
    UX --> O
    O --> PR

Design Principles

PrincipleImplementation
Occam's RazorOnly 17 TS modules remain — each does something Claude cannot (regex, semver, file I/O, API calls, import graph traversal). Scoring, planning, UX audit, PR descriptions are AI-agent-driven.
No hardcoded recommendationsPattern catalog contains zero library names. The Recommender callback and GapRecommendation are filled by the AI agent at runtime.
Context7 best practicesExponential backoff (3 retries), query parameter for ranking, per-library isolation. Both replacements and gaps are verified.
Progressive disclosureSKILL.md is 111 lines. references/ files load only when design system gaps are detected.
Two analysis modesReplacement: scanner finds hand-rolled code → agent recommends library. Gap: agent identifies missing capabilities → verified via Context7.
Design system supportStructure analyzer detects missing layers. Two paths: scaffold from 25+ reference repos, or extract spec from existing code (6 principles, 5 phases).

Each stage is a pure function with structured I/O. All external dependencies (Context7, OSV, npm registry, GitHub API) are injected via interfaces for testability.

Before / After

Before (hand-rolled)After (recommended)
// Custom i18n across 47 files
const translations = {
  en: { greeting: 'Hello' },
  es: { greeting: 'Hola' },
};
function t(key, locale) {
  return translations[locale]?.[key] ?? key;
}
// No plurals, no interpolation, no RTL
// @lingui/core — Context7 verified, MIT
// Ecosystem: @lingui/macro + @lingui/cli
// Impact: 9.2/10 | Risk: low | Effort: 8h
import { useLingui } from '@lingui/react';

export default function Page() {
  const { t } = useLingui();
  return <h1>{t`greeting`}</h1>;
}
// Custom logger with console.log
function logRequest(req) {
  console.log(JSON.stringify({
    time: new Date().toISOString(),
    method: req.method,
    url: req.url,
  }));
}
// No levels, no redaction, no rotation
// pino — Context7 verified, MIT
// Gap analysis: "No structured logging detected"
// Priority: critical
import pino from 'pino';
const logger = pino({
  level: 'info',
  redact: ['req.headers.authorization'],
});

Comparison

FeatureNext-UnicornSnykDependabotRenovate
Finds hand-rolled code to replaceYes
Identifies missing capabilities (gaps)Yes
Structural architecture analysisYes
Recommends new librariesYes
Ecosystem-level solutionsYes
7-dimension impact scoringYes
Context7 doc verificationYes
Phased migration plansYes
UX completeness auditYes
Design system scaffold/extractionYes
Code organization analysisYes
Human-in-the-loop gatesYes
Deletion checklistsYes
Vulnerability scanningYesYesYes
Scans recommended libs for vulnsYes
Auto-update existing depsYesYesYes
Impact-scored updatesYes
PR auto-creationYesYesYesYes
Migration PRs with adapter codeYes
License complianceYesYes
Monorepo supportYesYesYesYes

API

analyze(options): Promise<AnalyzeResult>

OptionTypeRequiredDescription
inputInputSchemaYesProject metadata, goals, constraints, focus areas
context7ClientContext7ClientYesContext7 MCP client for doc verification
recommenderRecommenderYesMaps each detection → library recommendation (AI agent provides this)
gapsGapRecommendation[]NoMissing capabilities the project should have (AI agent identifies these)
vulnClientVulnerabilityClientNoOSV client for vulnerability scanning
registryClientRegistryClientNoPackage registry client for auto-update
platformClientPlatformClientNoGitHub/GitLab client for PR creation
gitOpsGitOperationsNoGit CLI operations for PR creation

scanCodebase(input): Promise<ScanResult>

Standalone scanner — returns detections, workspace info, and structural findings (design system layer analysis, dependency flow violations). AI agents can call this first, then provide recommendations via the Recommender callback.

analyzeStructure(repoPath, workspaces): StructuralAnalysis

Standalone structure analyzer — detects missing design system layers, dependency flow violations, hardcoded config values, and missing shared presets in monorepos.

Output Structure

{
  "recommendedChanges": [...],     // Replacement recommendations with impact scores
  "gapAnalysis": [...],            // (optional) Context7-verified gap recommendations
  "filesToDelete": [...],          // Files to remove after migration
  "linesSavedEstimate": 1250,      // Total lines saved
  "uxAudit": [...],                // UX completeness (8 categories)
  "migrationPlan": {               // Phased plan
    "phases": [...],               // low → medium → high risk
    "deletionChecklist": [...]     // Detailed items with reasons
  },
  "vulnerabilityReport": {...},    // (optional) Vuln findings + SARIF
  "updatePlan": {...},             // (optional) Scored dep updates
  "pullRequests": {...}            // (optional) Created PR results
}

Vibe Coding Domains

69 domains across 12 categories, aligned with ISO/IEC 25010. 31 domains have scanner patterns; the rest are covered by AI agent gap analysis.

CategoryCountExamples
UX / Design14design-system, a11y-accessibility, forms-ux, empty-loading-error-states
SEO / i18n5seo, i18n, content-marketing
Growth / Data7analytics-tracking, ab-testing-experimentation
Frontend Arch8state-management, data-fetching-caching, realtime-collaboration
Backend / Platform8database-orm-migrations, caching-rate-limit, feature-flags-config
Security5auth-security, security-hardening, fraud-abuse-prevention
Observability4logging-tracing-metrics, error-monitoring
Code Organization1code-organization (god-dirs, naming, circular deps, barrel bloat, nesting, catch-all)
Delivery / DevEx6testing-strategy, ci-cd-release, dependency-management
Performance3performance-web-vitals, cost-optimization
AI Engineering3ai-model-serving, rag-vector-search
Business3payments-billing, marketplace-platform

Extensible via customDomains in the input schema.

Testing

pnpm test          # 176 tests (vitest + fast-check)
pnpm typecheck     # TypeScript strict mode
pnpm build         # Compile to dist/

29 property-based tests verify correctness invariants:

  • Schema round-trip guarantees (Properties 1–3)
  • Detection completeness (Property 4)
  • Context7 verification correctness (Property 5)
  • Scoring range and composite correctness (Properties 6–7)
  • Migration phase ordering and adapter mandates (Properties 8–10)
  • UX audit completeness (Property 11)
  • Constraint filtering (Properties 12–13)
  • JSON indentation (Property 14)
  • Vulnerability scanning (Properties 15–18)
  • Update policy and scoring (Properties 19–24)
  • PR strategy and formatting (Properties 25–29)

Examples

ScenarioInputOutput
Next.js Frontendexamples/frontend-nextjs/input.jsonoutput.json
Node.js Backendexamples/backend-node/input.jsonoutput.json

Templates

TemplatePurpose
summary-table.mdComparison table for stakeholders
migration-plan.mdPhased migration plan
deletion-checklist.mdFiles to delete after migration
vuln-report.mdVulnerability scan report
update-plan.mdDependency update plan
prd-template.mdPRD for stakeholder presentation

References

ReferencePurpose
design-system-sources.md25+ curated design system repos for scaffolding (Primer, Polaris, Dub, Supabase, etc.)
design-system-extraction.mdWorkflow for extracting a design system from existing code (6 principles, 5 phases)
code-organization-workflow.mdCode organization decision tree, Gate examples (SWOT), Phase A/B workflow with worked examples

Star History

Star History Chart

Contributing

See CONTRIBUTING.md for development setup, architecture overview, and contribution guidelines.

Security

See SECURITY.md for our security policy and how to report vulnerabilities.

Releasing

Releases are automated via GitHub Actions:

# Tag a new version
git tag v1.0.5
git push origin v1.0.5
# → CI runs tests → creates GitHub Release → publishes to npmjs + GitHub Packages

Packages are also published automatically on every push to main via the CI workflow.

Required Secrets: NPM_TOKEN (npmjs.org publish token). GITHUB_TOKEN is provided automatically.

See CHANGELOG.md for version history.

License

MIT © Nebutra

Keywords

skill

FAQs

Package last updated on 09 Feb 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts