8000 GitHub - jagrat7/better-ai: A CLI tool for adding relevant skills and mcps to your project · GitHub
[go: up one dir, main page]

Skip to content
jagrat7Public

About

A CLI tool for adding relevant skills and mcps to your project

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Repository files navigation

bttrai

npm version license status alpha view on npmx.dev

Overview

A CLI that installs and manages your AI dependencies (MCP servers and skills) for your coding agent(s). It uses skills and add-mcp CLIs under the hood.

npx bttrai i <package>

Why better-ai

This initially started because I was too lazy to add individual skills and MCP installs for my individual projects, and as a result I was unnecessarily inflating my context window (system prompt) by installing everything globally. Research like this paper has shown that overloaded system prompts hurt performance. By scoping installs to the project level, bttrai keeps your context window lean and relevant.

bttrai runs an exhaustive, freshest-source-first search for the skills your dependencies actually ship. Check out the contributing guide for more info. For each dependency, bttrai runs a freshest-source-first search — a local node_modules scan, then live repo discovery (npm repository field and GitHub search), then registry-pinned GitHub fetches, falling back to the hand-maintained skills registry only when GitHub is unavailable. MCP servers are currently only matched directly against the static registry, but I have future plans to dynamically discover MCP servers like skills.

Usage

Install the bttrai skill:

npx skills@latest add jagrat7/better-ai 

install — add a package and its matching extras

Installs the named package(s) with your project's package manager, then the MCP servers + skills that match them.

# Install a package AND its matching MCP servers + skills
npx bttrai install ai
npx bttrai install ai zod

# Native package-manager flags go AFTER `--` (forwarded verbatim)
npx bttrai install ai -- -D
npx bttrai install ai@5 -- --save-exact

# Target a different project directory
npx bttrai install ai --project ./my-app

# Scope which extras get installed
npx bttrai install ai --mcp
npx bttrai install ai --skills

# Non-interactive (CI)
npx bttrai install ai --auto --agent cursor

preset — install a named bundle (no detection)

Installs only the MCP servers + skills defined in a preset — no stack detection runs.

npx bttrai preset frontend

config — manage the config file

# Open the config file to pin agents or edit presets
npx bttrai config

detect — scan a project and install matches

Detects your stack and installs every matching MCP server + skill. Currently not as exhaustive as the install command, as it only looks for direct matches in the registry. WIP

# Detect and install matches in the current directory
npx bttrai detect

# Run against a different project directory
npx bttrai detect ./my-app

# Auto-approve — agents resolve automatically (no --agent needed)
npx bttrai detect --auto

# ...or pin specific agents for this run
npx bttrai detect --auto --agent cursor claude-code

# Scope which extras get installed
npx bttrai detect --skills
npx bttrai detect --mcp

# Print matches without installing anything
npx bttrai detect --list

# Emit a runnable `print` command per matched skill (for agents)
npx bttrai detect --print

# Detect skills for a single dependency instead of the whole stack
npx bttrai detect --dep zod

# Output JSON for scripts/automation (no execution)
npx bttrai detect --json

print — fetch a skill's SKILL.md (or a reference file) from its source

Print a skill straight to stdout so an agent can read it into context without installing anything. The default is the skill's SKILL.md; pass a file path to fetch a specific reference within the skill.

# Print a skill's SKILL.md from its source repo (owner/repo + skill name)
npx bttrai print vercel/ai ai-sdk

# Print a specific reference file within the skill
npx bttrai print vercel/ai ai-sdk references/common-errors.md

# Machine-readable output
npx bttrai print vercel/ai ai-sdk --json

Commands

Command Alias Description
bttrai detect bttrai d Detect matching MCP servers and skills, then install them
bttrai install bttrai i Install a package and its matching MCP servers + skills
bttrai print bttrai prs Print a skill's SKILL.md (or a reference file) from its source
bttrai preset <name> — Install a named preset's MCP servers + skills (no detection)
bttrai config — Open the config file (creates it if missing) to pin agents

Options

Option Applies to Description
<path> detect Target a different project directory
<name> preset Name of a preset defined in config
--project <path> install Target a different project directory
--help all Show command usage and available options
<source> <skill> [file] print Source repo, skill name, optional file (default SKILL.md)
--list detect Print matches only, install nothing
--print detect Emit a runnable print command per matched skill
--dep <name> detect Detect skills for a single dependency
--json detect, print, install, preset Output machine-readable JSON (no execution)
--auto detect, install, preset Skip prompts and auto-select detected matches
--agent <name> detect, install, preset Choose one or more agents to install into
--skills detect, install, preset Only include skills
--mcp detect, install, preset Only include MCP servers

detect takes the project directory as a positional argument (bttrai detect ./my-app); install takes it as the --project flag, since its positional slot holds the package names.

For bttrai install, native package-manager flags (-D, --save-exact, …) must come after -- — everything past -- is forwarded verbatim to the detected package manager (npm install, bun add, pnpm add, yarn add, deno add npm:). Tokens before -- are parsed by bttrai, and the package names are read from them to install matching MCP servers + skills.

Important

--auto no longer needs --agent — agents resolve automatically (see Config). Pass --agent only to override the targets for a run. I still wouldn't recommend --auto unless you're sure.

Config

By default agents resolve automatically and nothing about agents is stored. You only need a config file if you want to pin a fixed set of agents (or, later, define presets). The file lives in your OS user config dir:

OS Path
Linux ~/.config/bttrai/config.json
macOS ~/Library/Application Support/bttrai/config.json
Windows %APPDATA%\bttrai\config.json

Note

Only tested on Linux so far.

Set BTTRAI_CONFIG to override the path. Run bttrai config to open (and lazily create) it.

{
  "autoAgents": true, // resolve agents automatically; `agents` is ignored
  "agents": [], // used only when autoAgents:false — bttrai reads, never writes it
  "editor": "nvim", // optional — editor for `bttrai config` (wins over $EDITOR)
  "presets": {
    "frontend": {
      // registry keys/names, OR raw entries (see Presets below)
      "mcp": ["https://mcp.sentry.dev/mcp"],
      "skills": ["neondatabase/agent-skills#neon-auth"],
    },
  },
}

bttrai config opens the file in: editor from config → $EDITOR → the OS default text editor → (failing that) it just prints the path.

Agent resolution order: --agent (always wins) → autoAgents ? auto-detect : agents → prompt. Pin agents by setting "autoAgents": false and listing canonical names (cursor, claude-code, github-copilot, vscode) in agents. The config is validated on every run; an invalid file stops the run (in a terminal it offers to open / reset / abort, otherwise it prints the errors and exits non-zero).

Presets

Presets are reusable bundles of MCP servers + skills defined under presets in the config. bttrai preset <name> installs only that preset's extras — no detection runs. Presets do not contain agents — those resolve normally. It honors --auto, --agent, --skills, and --mcp; an unknown preset name fails with a friendly error listing the available presets.

Each mcp/skills entry is either a registry reference or a raw entry used verbatim:

Field Registry reference Raw entry
mcp a registry key (shadcn) a target URL or command (https://mcp.sentry.dev/mcp, npx -y some-mcp)
skills a skill name (ai-sdk) a source repo with explicit skills (owner/repo#skill-a,skill-b)

A raw mcp URL infers its transport (http, or sse for a /sse endpoint) and a name from the host; a raw skills source must name the skills to install from it (#skill-a,skill-b). Registry references are validated against the registry on load; raw entries only need valid shape.

Notes

  • By default, bttrai is intended to install skills and MCPs in your current project/directory.
  • Some agents only have global MCP installations, so in those cases the install may need to be global instead of project-level.
  • If your project prefers bun, pnpm, yarn, or deno but that runner is not available, bttrai falls back to npx automatically.

About

A CLI tool for adding relevant skills and mcps to your project

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages

0