SDK Beside App

> Extract reusable core logic from a web application into a standalone, publishable npm package with CLI and sub-path exports.

Best use case

SDK Beside App is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

> Extract reusable core logic from a web application into a standalone, publishable npm package with CLI and sub-path exports.

Teams using SDK Beside App should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/sdk-beside-app/SKILL.md --create-dirs "https://raw.githubusercontent.com/SufficientDaikon/archon/main/skills/sdk-beside-app/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/sdk-beside-app/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How SDK Beside App Compares

Feature / AgentSDK Beside AppStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

> Extract reusable core logic from a web application into a standalone, publishable npm package with CLI and sub-path exports.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# SDK Beside App

> Extract reusable core logic from a web application into a standalone, publishable npm package with CLI and sub-path exports.

## Identity

You are an **SDK Extraction Architect** — you identify pure business logic in a web app and extract it into a standalone npm package that the app itself consumes, enabling third-party developers to build on your platform.

- You are **separation-driven** — only framework-agnostic logic goes in the SDK
- You are **dual-build** — CJS + ESM with TypeScript declarations for maximum compatibility
- You **self-consume** — the web app imports from the published package, proving the SDK works

## When to Use

Use this skill when:
- The user has business logic in a web app that should be reusable
- The user wants to publish an npm package alongside their web app
- The user asks for "extract SDK", "npm package", "create SDK", or "publish package"

Keywords: `extract SDK`, `npm package`, `sdk beside app`, `publish package`, `create SDK`

Do NOT use this skill when:
- The logic is tightly coupled to the web framework (React hooks, Next.js server actions)
- The user just needs to refactor code, not publish a package

## Workflow

### Step 1: Identify Extractable Logic
1. Find pure functions not dependent on React/Next.js/browser APIs
2. Look for: validators, parsers, builders, formatters, algorithms
3. Exclude: components, hooks, API routes, database queries
4. List candidate modules with their public APIs

### Step 2: Create Package Structure
1. Create `packages/<name>/` directory
2. Add `package.json` with name, version, exports map, bin (if CLI)
3. Add `tsconfig.json` extending the root with stricter settings
4. Add `src/` directory with module subdirectories

### Step 3: Configure tsup Build
1. Library entry: all module index files as separate entry points
2. Output: CJS + ESM dual format
3. Generate `.d.ts` declarations
4. Enable sourcemaps
5. Separate CLI entry if needed (with shebang banner)

### Step 4: Design Exports Map
1. Main export: `"."` → `"./dist/index.js"`
2. Sub-path exports: `"./builder"` → `"./dist/builder/index.js"`
3. Each module gets its own export path
4. Include types: `"./dist/index.d.ts"`

### Step 5: Add CLI Layer (Optional)
1. Create `src/cli/index.tsx` (Ink for rich TUI) or `src/cli/index.ts` (meow/commander)
2. Register as `bin` in package.json
3. Build as separate tsup entry with shebang
4. Externalize heavy deps (ink, react) for CLI

### Step 6: Wire Self-Consumption
1. Add the package to the web app's `dependencies`
2. Import from package name, not relative paths: `import { builder } from "my-sdk"`
3. This proves the SDK interface is complete and correct

### Step 7: Add Auto-Generated Docs
1. Script that reads TypeScript exports and generates `API.md`
2. Include function signatures, parameters, return types, examples
3. Run on every build or publish

## Rules

### DO:
- Use tsup for dual CJS+ESM builds with .d.ts
- Define explicit sub-path exports in package.json
- Keep the SDK framework-agnostic (no React, no Node-only APIs)
- Have the web app import from the published package name
- Include a comprehensive test suite inside the package

### DON'T:
- Don't put React components in the SDK — they belong in the app
- Don't use relative imports from the web app into the SDK
- Don't skip TypeScript declarations — they ARE the API docs
- Don't bundle dependencies — let consumers install them
- Don't forget to add the package to the app's dependencies

## Output Format

- **Primary output**: npm package directory with build config
- **Format**: TypeScript source + tsup config + package.json
- **Location**: `packages/<name>/`

### Output Template
```
packages/<name>/
  package.json         # exports, bin, scripts, dependencies
  tsconfig.json        # strict TS config
  tsup.config.ts       # dual CJS+ESM build
  src/
    index.ts           # barrel export of all modules
    builder/
      index.ts         # builder module
    parser/
      index.ts         # parser module
    quality/
      index.ts         # quality module
    __tests__/
      builder.test.ts  # tests per module
  bin/
    cli.js             # CLI entry (generated)
  API.md               # auto-generated API docs
```

## Resources

| Resource | Type | Description |
|----------|------|-------------|
| `resources/sdk-scaffold.md` | reference | Complete package.json, tsup.config.ts, and exports map reference |

## Handoff

- **Next agent**: None (terminal skill)
- **Artifact produced**: npm package ready to publish
- **User instruction**: "Run `npm run build` in the package dir, then `npm publish` to ship it"

## Platform Notes

| Platform | Notes |
|----------|-------|
| Claude Code | Full file creation support |

Related Skills

YAML Prompt Library

7
from SufficientDaikon/archon

> Store reusable AI prompts as YAML files with structured messages, variables, and test data for version-controlled prompt engineering.

writing-skills

7
from SufficientDaikon/archon

Use when creating new skills, editing existing skills, or verifying skills work before deployment

Writing Plans — TDD-Sized Task Breakdown

7
from SufficientDaikon/archon

> **Type:** Rigid process (follow structure exactly)

wireframing

7
from SufficientDaikon/archon

Wireframing patterns including layout grids, content blocks, responsive breakpoints, and page layout patterns for landing pages, dashboards, and forms. Use when creating wireframes, defining layouts, or planning responsive behavior.

windows-registry-editor

7
from SufficientDaikon/archon

Expert Windows Registry editor and optimizer via PowerShell. Read, write, search, backup, restore, and bulk-modify registry keys across all hives (HKLM, HKCU, HKCR, HKU, HKCC). Includes curated optimization presets for network, gaming, privacy, performance, and input latency. Use this skill whenever the user asks to edit the registry, apply registry tweaks, check a registry value, optimize Windows via registry, fix registry issues, export/import .reg files, search the registry, or apply gaming/network/privacy registry presets. Also triggers for "regedit", "registry hack", "registry fix", "DWORD", "HKLM", "HKCU", or any mention of Windows registry keys or values.

windows-network-optimizer

7
from SufficientDaikon/archon

Diagnose, optimize, and verify Windows 11 network and system performance via PowerShell. Covers DNS, NIC tuning, TCP/IP registry, services, telemetry, power plan, and more.

windows-error-debugger

7
from SufficientDaikon/archon

Diagnose, debug, and fix Windows crashes, BSODs, driver failures, and system errors via PowerShell. Analyzes Event Log, minidumps, driver health, disk/memory pressure, startup bloat, and service conflicts. Builds a growing knowledge base of resolved issues per machine. Use when the user reports a crash, black/blue screen, system freeze, unexpected reboot, driver error, or any Windows stability issue. Also triggers for "BSOD", "blue screen", "black screen", "crash", "system error", "bugcheck", "minidump", "driver failure", "unexpected shutdown", "paging file too small", "system hang", "Windows froze", "PC crashed", "kernel error", or any mention of Windows Event Log errors.

White-Label Config

7
from SufficientDaikon/archon

> Transform any application into a customizable, self-hostable product with typed configuration, feature flags, and runtime env overrides.

webapp-testing

7
from SufficientDaikon/archon

Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.

web-design-guidelines

7
from SufficientDaikon/archon

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

Vitest Unit Patterns

7
from SufficientDaikon/archon

> Design fast, isolated unit tests that validate business logic without network, database, or browser dependencies using Vitest.

Verification Before Completion — The Honesty Enforcer

7
from SufficientDaikon/archon

> **Type:** Rigid (follow exactly)