Sandbox
@aspenkit/aspens

CLI for generated skills and sync in agent repos

aspens scans your repo, maps imports, and writes short skill files for the parts of the codebase an agent is likely to touch. It keeps those files current by reading git changes and updating only the affected skills, so Claude Code, Codex, and OpenCode get narrower context instead of one oversized instruction file.

99 stars7 forksJavaScriptUpdated 6d ago
Who it's for

Builders who want Claude Code, Codex, or OpenCode to work from scoped repo context instead of a single drifting instruction file.

What it delivers

You can keep agent instructions short, relevant, and automatically updated as the codebase changes.

What it does

Import graph analysis

Scans JS, TS, and Python imports to find code domains, hub files, and coupling patterns.

Scoped skill generation

Writes short skill files with activation rules, key files, concepts, and critical rules for each domain.

Post-commit sync

Reads recent git changes and updates only the skills affected by those edits.

Context health checks

`doc impact` checks coverage, freshness, and whether the generated context matches the current repo.

Target output support

Generates context for Claude, Codex, and OpenCode layouts such as `.claude/skills` and `AGENTS.md`.

Skill and hook scaffolding

Adds skills, agents, hooks, and commands from the bundled library with `aspens add`.

How to get it

  1. 1Run
    npm install -g aspens
  2. 2Then in your project
    aspens doc init --recommended
  3. 3Verify what it generated
    aspens doc impact
  4. 4Or run without installing
    npx aspens doc init --recommended

README

aspens

aspens

Your CLAUDE.md stopped working. Here's why.

npm version npm downloads GitHub stars MIT License

You started with 50 clean lines. Three months later it's 200, and Claude ignores half of them. Adding more rules doesn't fix it. The file got too big for the agent to follow, and it goes stale every time the code changes.

aspens replaces the monolith with scoped skill files (~35 lines each) generated from your actual import graph. Each skill activates only when the agent touches that part of the codebase. A post-commit hook keeps them in sync automatically. The agent reads 35 focused lines instead of 200 sprawling ones, and actually follows them.

Works with Claude Code, Codex, or OpenCode.

Install

npm install -g aspens

Then in your project:

aspens doc init --recommended

Verify what it generated:

aspens doc impact

Or run without installing:

npx aspens doc init --recommended

aspens demo

Before / After

Before aspens — one file tries to cover everything:

  • Agent starts cold, spends 10-20 tool calls exploring your codebase every session
  • CLAUDE.md grows until the agent stops following it
  • Documentation drifts out of date within days of any refactor
  • Agent misses conventions, duplicates existing code, ignores architectural boundaries

After aspens — scoped skills generated from your import graph:

  • Agent loads only the skill for the domain it's working in (~35 lines, 100% followed)
  • doc sync updates affected skills automatically on every commit
  • doc impact proves freshness and coverage so you know context matches the code
  • Agent reuses existing code because skills surface the right key files

What Are Skills?

Skills are short markdown files that give coding agents the repo context they actually need: key files, conventions, patterns, and critical rules. They activate when the agent works in that part of the codebase.

---
name: billing
description: Stripe billing integration — subscriptions, usage tracking, webhooks
---

## Activation

This skill triggers when editing billing/payment-related files:
- `**/billing*.ts`
- `**/stripe*.ts`

---

You are working on **billing, Stripe integration, and usage limits**.

## Key Files
- `src/services/billing/stripe.ts` — Stripe SDK wrapper
- `src/services/billing/usage.ts` — Usage counters and limit checks

## Key Concepts
- **Webhook-driven:** Subscription state changes come from Stripe webhooks, not API calls
- **Usage gating:** `checkLimit(userId, type)` returns structured 429 error data

## Critical Rules
- Webhook endpoint has NO auth middleware — verified by Stripe signature only
- Cancel = `cancel_at_period_end: true` (user keeps access until period end)

Target Support

Aspens supports multiple agent environments through output targets:

  • claude: CLAUDE.md + .claude/skills + Claude hooks
  • codex: AGENTS.md + .agents/skills + directory AGENTS.md
  • opencode: AGENTS.md + .claude/skills
  • we are working on adding more agents and tools - ask or contribute!

Commands

aspens doc init

Generate agent context from the repo. Scans the codebase, discovers architecture and feature domains, then writes instructions and skills.

--recommended is the fastest path to automatically generate the default settings but you can also do it manually:

$ aspens doc init

  ◇ Scanned my-app (fullstack)
    Languages: typescript, javascript
    Frameworks: nextjs, react, tailwind, prisma
    Import graph: 247 files, 892 edges

  ◇ Discovered 8 feature domains:
      auth, courses, billing, profile, ...

  + .claude/skills/base/skill.md
  + .claude/skills/auth/skill.md
  + .claude/skills/billing/skill.md
  ...

  10 created | 4m 32s
OptionDescription
--recommendedUse recommended target, strategy, and generation mode
--dry-runPreview without writing files
--forceOverwrite existing skills
--timeout <seconds>Backend timeout (default: 300)
--mode <mode>all, chunked, or base-only (skips interactive prompt)
--strategy <strategy>improve, rewrite, or skip for existing docs
--domains <list>Additional domains to include (comma-separated)
--no-graphSkip import graph analysis
--model <model>Model for the selected backend
--verboseShow backend reads/activity in real time
--target <target>Output target: claude, codex, or opencode
--backend <backend>Generation backend: claude, codex, or opencode

aspens doc impact

Check your context's health and coverage, keeping up with the codebase. Checks for:

  • Instructions and skills present per target
  • Domain coverage vs detected repo domains
  • Top hub files surfaced in root guidance
  • Whether generated context is older than the newest source changes

aspens doc sync

This may be the most important command. Keeps generated context from drifting. Reads recent git changes, maps them to affected skills, and updates only what changed.

$ aspens doc sync

  ◆ aspens doc sync

  ◇ 4 files changed

    src/services/billing/stripe.ts
    src/services/billing/usage.ts
    src/components/billing/PricingPage.tsx
    package.json

  ℹ Skills that may need updates: billing, base

  ◇ Analyzing changes and updating skills...
  ◇ 1 file(s) to update

  ~ .claude/skills/billing/skill.md

  1 file(s) updated
OptionDescription
--commits <n>Number of commits to analyze (default: 1)
--refreshReview all skills against current codebase (no git diff needed)
--install-hookInstall git post-commit auto-sync
--remove-hookRemove the git post-commit auto-sync hook
--dry-runPreview without writing files
--no-graphSkip import graph analysis
--timeout <seconds>Backend timeout (default: 300)
--model <model>Model for the selected backend
--verboseShow backend reads/activity in real time

aspens doc graph

Rebuild the import graph cache. Runs automatically during doc init and doc sync, but you can trigger it manually.

aspens doc graph

aspens add <type> [name]

Add individual components from the bundled library, or create custom skills.

aspens add agent all              # Add all 11 AI agents
aspens add agent code-reviewer    # Add a specific agent
aspens add agent --list           # Browse available agents
aspens add hook skill-activation  # Add auto-triggering hooks
aspens add command dev-docs       # Add slash commands
aspens add skill my-convention    # Scaffold a custom skill
aspens add skill release --from dev/release.md  # Generate from a reference doc
aspens add skill --list           # Show existing skills
OptionDescription
--listBrowse available components
--from <file>Generate a skill from a reference document (skills only)
--forceOverwrite existing skills

aspens customize agents

Inject your project's tech stack, conventions, and file paths into installed Claude agents.

aspens customize agents
aspens customize agents --dry-run
OptionDescription
--dry-runPreview without writing files
--timeout <seconds>Claude timeout (default: 300)
--model <model>Claude model (e.g., sonnet, opus, haiku)
--verboseShow what Claude is doing

aspens save-tokens

Install token-saving session settings — statusline telemetry, prompt guards, precompact handoffs, and session rotation.

aspens save-tokens               # Interactive install
aspens save-tokens --recommended # No-prompt install
aspens save-tokens --remove      # Uninstall

How It Works

  1. Scanner — detects tech stack, frameworks, structure, and domains. Deterministic, no LLM, instant.
  2. Import Graph — parses imports across JS/TS/Python, resolves aliases, finds hub files and coupling.
  3. Discovery — 2 parallel LLM passes explore the codebase: one finds feature domains, the other analyzes architecture.
  4. Generation — writes concise skills guided by the graph + discovery findings. Up to 3 domains in parallel.
  5. Sync — on each commit, reads the diff, identifies affected skills, and updates only what changed.

Requirements

License

MIT — see LICENSE.

Contributing

See CONTRIBUTING.md.

Files in the repo

Repository payload21 top-level entries
  • .agents
  • .aspens
  • .claude
  • .github
  • bin
  • demo
  • docs
  • src
  • tests
  • .aspens.json
  • .coderabbit.yaml
  • .gitignore
  • AGENTS.md
  • aspens-logo.png
  • CHANGELOG.md
  • CLAUDE.md
  • CONTRIBUTING.md
  • LICENSE
  • package-lock.json
  • package.json
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

🪨 why use many token when few token do trick — Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k