Initial commit

This commit is contained in:
Zhongwei Li
2025-11-30 08:31:12 +08:00
commit 64eff6a335
4 changed files with 180 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
{
"name": "bun-skills",
"description": "Claude Code plugin",
"version": "0.0.0-2025.11.28",
"author": {
"name": "kfly8",
"email": "kentafly88@gmail.com"
},
"skills": [
"./skills"
]
}

3
README.md Normal file
View File

@@ -0,0 +1,3 @@
# bun-skills
Claude Code plugin

45
plugin.lock.json Normal file
View File

@@ -0,0 +1,45 @@
{
"$schema": "internal://schemas/plugin.lock.v1.json",
"pluginId": "gh:kfly8/claude-plugins:plugins/bun-skills",
"normalized": {
"repo": null,
"ref": "refs/tags/v20251128.0",
"commit": "5cbedad9f70f340cfd511ec2b1fe42ba9089cb8d",
"treeHash": "fe3eed77a02987c8d72a5a65c78b92ee66af1e1aa88e37a3883889c632683961",
"generatedAt": "2025-11-28T10:19:28.316174Z",
"toolVersion": "publish_plugins.py@0.2.0"
},
"origin": {
"remote": "git@github.com:zhongweili/42plugin-data.git",
"branch": "master",
"commit": "aa1497ed0949fd50e99e70d6324a29c5b34f9390",
"repoRoot": "/Users/zhongweili/projects/openmind/42plugin-data"
},
"manifest": {
"name": "bun-skills",
"description": "Claude Code plugin",
"version": null
},
"content": {
"files": [
{
"path": "README.md",
"sha256": "e5388cd04becf45fc6fcb884f2ea22d0591af3b5eaf436bd86bed538f812eb92"
},
{
"path": ".claude-plugin/plugin.json",
"sha256": "9ff1829839de5ecd8330d7d0fc40e551fd11e9a0f0f261a0b436b88e69e6a182"
},
{
"path": "skills/bun/SKILL.md",
"sha256": "88cc73013d480789bcd68a4235814b6136e7be8383ea6ffefde5185f5bcf6478"
}
],
"dirSha256": "fe3eed77a02987c8d72a5a65c78b92ee66af1e1aa88e37a3883889c632683961"
},
"security": {
"scannedAt": null,
"scannerVersion": null,
"flags": []
}
}

120
skills/bun/SKILL.md Normal file
View File

@@ -0,0 +1,120 @@
---
name: bun
description: Default to using Bun instead of Node.js for all JavaScript/TypeScript operations including running files, testing, building, and package management.
---
# Bun Runtime
Default to using Bun instead of Node.js for all JavaScript/TypeScript operations.
## Core Commands
- Use `bun <file>` instead of `node <file>` or `ts-node <file>`
- Use `bun test` instead of `jest` or `vitest`
- Use `bun build <file.html|file.ts|file.css>` instead of `webpack` or `esbuild`
- Use `bun install` instead of `npm install` or `yarn install` or `pnpm install`
- Use `bun run <script>` instead of `npm run <script>` or `yarn run <script>` or `pnpm run <script>`
- Bun automatically loads .env, so don't use dotenv.
## Built-in APIs
Prefer Bun's built-in APIs over external packages:
- `Bun.serve()` supports WebSockets, HTTPS, and routes. Don't use `express`.
- `bun:sqlite` for SQLite. Don't use `better-sqlite3`.
- `Bun.redis` for Redis. Don't use `ioredis`.
- `Bun.sql` for Postgres. Don't use `pg` or `postgres.js`.
- `WebSocket` is built-in. Don't use `ws`.
- Prefer `Bun.file` over `node:fs`'s readFile/writeFile
- `Bun.$` instead of execa.
## Testing
Use `bun test` to run tests.
```ts
import { test, expect } from "bun:test";
test("hello world", () => {
expect(1).toBe(1);
});
```
## Frontend Development
Use HTML imports with `Bun.serve()`. Don't use `vite`. HTML imports fully support React, CSS, Tailwind.
### Server Setup
```ts
import index from "./index.html"
Bun.serve({
routes: {
"/": index,
"/api/users/:id": {
GET: (req) => {
return new Response(JSON.stringify({ id: req.params.id }));
},
},
},
// optional websocket support
websocket: {
open: (ws) => {
ws.send("Hello, world!");
},
message: (ws, message) => {
ws.send(message);
},
close: (ws) => {
// handle close
}
},
development: {
hmr: true,
console: true,
}
})
```
### HTML Files
HTML files can import .tsx, .jsx or .js files directly and Bun's bundler will transpile & bundle automatically. `<link>` tags can point to stylesheets and Bun's CSS bundler will bundle.
```html
<html>
<body>
<h1>Hello, world!</h1>
<script type="module" src="./frontend.tsx"></script>
</body>
</html>
```
### Frontend Components
```tsx
import React from "react";
// import .css files directly and it works
import './index.css';
import { createRoot } from "react-dom/client";
const root = createRoot(document.body);
export default function Frontend() {
return <h1>Hello, world!</h1>;
}
root.render(<Frontend />);
```
### Running the Server
```sh
bun --hot ./index.ts
```
## Additional Resources
For more information, read the Bun API docs in `node_modules/bun-types/docs/**.md`.