Skip to content

Commit 46c59d6

Browse files
committed
chore: add commandkit skills
1 parent 69b5e0d commit 46c59d6

File tree

110 files changed

+5389
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+5389
-0
lines changed

AGENTS.md

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
# AGENTS.md
2+
3+
This file is the operational guide for coding agents working in the
4+
CommandKit monorepo.
5+
6+
## Repository layout
7+
8+
- Monorepo managed with `pnpm` workspaces + Turborepo.
9+
- Workspace roots:
10+
- `packages/*` - published/core packages
11+
- `apps/*` - first-party apps (docs site, test bot, etc.)
12+
- Key project used as real-world reference:
13+
- `apps/test-bot` - practical CommandKit usage patterns (plugins,
14+
JSX components, tasks, workflow, ratelimit, i18n, sharding manager
15+
pattern)
16+
17+
## First source of truth for agents
18+
19+
Use the skills in `skills/` first, then confirm with code and docs.
20+
21+
- Skills index: `skills/README.md`
22+
- Core framework skill: `skills/commandkit/SKILL.md`
23+
- Plugin development skill:
24+
`skills/commandkit-plugin-development/SKILL.md`
25+
26+
Each skill includes:
27+
28+
- `SKILL.md` with activation guidance and reference/tool tables
29+
- `references/*.md` with implementation details and best practices
30+
- optional `tools/*.mjs` helper generators/validators
31+
32+
## CommandKit conventions to preserve
33+
34+
When editing CommandKit projects (especially `apps/test-bot`),
35+
preserve convention-based discovery:
36+
37+
- Config file at root: `commandkit.config.ts` (or `.js`)
38+
- App entrypoint: `src/app.ts` (exports discord.js client)
39+
- Commands: `src/app/commands/**`
40+
- Events: `src/app/events/**`
41+
- Optional feature paths:
42+
- i18n: `src/app/locales/**`
43+
- tasks: `src/app/tasks/**`
44+
- workflow: `src/workflows/**`
45+
- ratelimit runtime config: `ratelimit.ts`
46+
- sharding manager: `src/sharding-manager.ts`
47+
48+
Important middleware naming conventions:
49+
50+
- `+global-middleware.ts`
51+
- `+middleware.ts`
52+
- `+<command>.middleware.ts`
53+
54+
## Preferred implementation workflow
55+
56+
1. Identify the target package/app and relevant skill in `skills/`.
57+
2. Read the corresponding `references/*.md` for exact patterns.
58+
3. Mirror existing local conventions (from nearby files) before
59+
introducing new structures.
60+
4. Make minimal, focused changes.
61+
5. Validate with the appropriate command(s).
62+
63+
## Validation commands
64+
65+
From repo root:
66+
67+
- Install deps: `pnpm install`
68+
- Build packages: `pnpm build`
69+
- Type-check packages: `pnpm check-types`
70+
- Format codebase: `pnpm format`
71+
- Check formatting only: `pnpm prettier:check`
72+
73+
For app-level verification (example test bot):
74+
75+
- `pnpm --filter test-bot dev`
76+
- `pnpm --filter test-bot build`
77+
- `pnpm --filter test-bot start`
78+
79+
## Documentation and guide alignment
80+
81+
When adding or changing behavior, keep docs alignment in mind:
82+
83+
- Guide docs: `apps/website/docs/guide/**`
84+
- API reference docs: `apps/website/docs/api-reference/**`
85+
86+
If you add new user-facing behavior in packages, update the relevant
87+
guide and/or API reference pages.
88+
89+
## Plugin development guidance
90+
91+
For creating CommandKit plugins:
92+
93+
- Runtime plugin patterns:
94+
`skills/commandkit-plugin-development/references/01-runtime-plugin-basics.md`
95+
- Runtime hook mapping:
96+
`skills/commandkit-plugin-development/references/02-runtime-hooks-reference.md`
97+
- Compiler transforms:
98+
`skills/commandkit-plugin-development/references/03-compiler-plugin-transform.md`
99+
- Template extension hooks:
100+
`skills/commandkit-plugin-development/references/04-template-registration.md`
101+
- Rolldown integration:
102+
`skills/commandkit-plugin-development/references/05-rolldown-plugins.md`
103+
104+
## Safety and quality rules
105+
106+
- Do not introduce APIs that are not already present in the
107+
codebase/docs unless explicitly asked.
108+
- Do not break convention-based file discovery paths.
109+
- Keep changes backward-compatible unless the task explicitly requires
110+
a breaking change.
111+
- Prefer explicit error handling in runtime hooks and long-running
112+
workflows.
113+
- For interactive JSX components, use valid interaction patterns
114+
(`onClick` for interactive buttons, link buttons with `url` +
115+
`ButtonStyle.Link`).
116+
117+
## Git hygiene
118+
119+
- Do not revert unrelated user changes.
120+
- Keep commits scoped and descriptive when asked to commit.
121+
- Avoid destructive git operations unless explicitly requested.

skills/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# CommandKit Skills Index
2+
3+
This directory contains self-contained skills for public CommandKit
4+
packages and development workflows.
5+
6+
Each skill folder includes:
7+
8+
- `SKILL.md` for activation and execution behavior
9+
- `README.md` for human-facing scope and usage notes
10+
- `references/*.md` for feature-specific snippets, filesystem
11+
expectations, important details, and best practices
12+
- optional `tools/*.mjs` JavaScript helpers with shebang for
13+
repeatable utility tasks
14+
15+
`SKILL.md` files include tabular indexes for references and tools,
16+
with name + description columns.
17+
18+
## Included skills
19+
20+
- `skills/commandkit`
21+
- `skills/create-commandkit`
22+
- `skills/commandkit-ai`
23+
- `skills/commandkit-analytics`
24+
- `skills/commandkit-cache`
25+
- `skills/commandkit-devtools`
26+
- `skills/commandkit-i18n`
27+
- `skills/commandkit-legacy-migration`
28+
- `skills/commandkit-queue`
29+
- `skills/commandkit-ratelimit`
30+
- `skills/commandkit-redis`
31+
- `skills/commandkit-tasks`
32+
- `skills/commandkit-workflow`
33+
- `skills/commandkit-plugin-development`
34+
35+
## Excluded internal packages
36+
37+
- `@commandkit/devtools-ui` (private internal UI package)
38+
- `tsconfig` (private internal tooling package)
39+
40+
## Legacy policy
41+
42+
`@commandkit/legacy` is represented only by a migration-focused skill.
43+
It should be used to move existing projects to modern CommandKit
44+
patterns, not to encourage new legacy adoption.

skills/commandkit-ai/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# commandkit-ai skill
2+
3+
Specialized skill for implementing AI features with `@commandkit/ai`.
4+
5+
## Use this skill when
6+
7+
- enabling AI plugin support in CommandKit
8+
- building natural language command flows
9+
- registering/executing AI tools
10+
- debugging AI response or execution behavior
11+
12+
## Typical inputs
13+
14+
- target AI behavior
15+
- model/provider constraints
16+
- desired tool integration
17+
18+
## Expected outputs
19+
20+
- plugin/config updates
21+
- command-level implementation changes
22+
- practical error handling and fallback strategy

skills/commandkit-ai/SKILL.md

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
name: commandkit-ai
3+
version: 1.2.0
4+
author: neplextech
5+
emoji: '🤖'
6+
tags:
7+
- commandkit
8+
- ai
9+
- tools
10+
- llm
11+
description: >
12+
Build AI-powered command flows with @commandkit/ai. Use for model
13+
selection, message filtering, schema-backed AI commands, and safe
14+
tool-calling behavior.
15+
---
16+
17+
# CommandKit AI Plugin
18+
19+
## Activation guidance
20+
21+
Use when implementing natural-language command execution or AI tool
22+
orchestration.
23+
24+
## Required filesystem expectations
25+
26+
- plugin registration in `commandkit.config.ts`
27+
- AI runtime config in `src/ai.ts` or `src/ai.js`
28+
- AI-enabled command files in `src/app/commands/**`
29+
30+
## Execution workflow
31+
32+
1. Register `ai()` plugin.
33+
2. Configure `configureAI()` in `src/ai.*`.
34+
3. Implement `aiConfig` schema and `ai` command handlers.
35+
4. Add tool registration and robust error handling.
36+
5. Validate trigger filter, permissions, and response safety.
37+
38+
## Guardrails
39+
40+
- Never hardcode API keys.
41+
- Treat AI output as untrusted input for sensitive operations.
42+
- Keep tool descriptions explicit and narrow.
43+
44+
## Reference index
45+
46+
| Name | Description |
47+
| --------------------------------------- | -------------------------------------------------------------- |
48+
| `references/00-filesystem-structure.md` | File layout and export expectations for AI-enabled projects. |
49+
| `references/01-plugin-setup.md` | Minimal plugin wiring in config. |
50+
| `references/02-configure-ai-model.md` | Model selection, message filters, and runtime option patterns. |
51+
| `references/03-ai-command-schema.md` | Typed schema + AI command implementation pattern. |
52+
| `references/04-custom-tools.md` | Tool creation and safe exposure patterns. |
53+
54+
## Tool index
55+
56+
| Name | Description |
57+
| ---------------------------------------- | --------------------------------------------------------------------- |
58+
| `tools/generate-ai-command-template.mjs` | Prints a starter AI command template with schema and handler exports. |
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# 00 filesystem structure
2+
3+
## Purpose
4+
5+
Define required filesystem layout so feature discovery and runtime bootstrapping work reliably.
6+
7+
## When to use
8+
9+
Use when creating a new project, enabling a plugin, or debugging why files are not discovered.
10+
11+
## Filesystem
12+
13+
```txt
14+
project/
15+
commandkit.config.ts
16+
src/
17+
ai.ts
18+
app/
19+
commands/
20+
```
21+
22+
## Example
23+
24+
```txt
25+
project/
26+
commandkit.config.ts
27+
src/
28+
ai.ts
29+
app/
30+
commands/
31+
```
32+
33+
## Important details
34+
35+
- Use exact API/export names shown in the example.
36+
- Keep filesystem placement aligned with enabled plugins and feature expectations.
37+
- Preserve deterministic behavior and explicit error handling in implementation code.
38+
39+
## Best practices
40+
41+
- Keep snippets as baseline patterns and adapt them to real command names and data models.
42+
- Validate external inputs and permission boundaries before side effects.
43+
- Keep setup deterministic so startup behavior is stable across environments.
44+
45+
## Common mistakes
46+
47+
- Creating feature files in arbitrary folders not discovered by CommandKit.
48+
- Renaming key directories without matching framework conventions.
49+
- Missing root config file while expecting auto-discovery to work.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# 01 plugin setup
2+
3+
## Purpose
4+
5+
Show minimal plugin registration pattern.
6+
7+
## When to use
8+
9+
Use when implementing or reviewing this feature in a CommandKit-based project.
10+
11+
## Filesystem
12+
13+
```txt
14+
project/
15+
commandkit.config.ts
16+
src/
17+
ai.ts
18+
app/
19+
commands/
20+
```
21+
22+
## Example
23+
24+
```ts
25+
import { defineConfig } from 'commandkit';
26+
import { ai } from '@commandkit/ai';
27+
28+
export default defineConfig({
29+
plugins: [ai()],
30+
});
31+
```
32+
33+
## Important details
34+
35+
- Use exact API/export names shown in the example.
36+
- Keep filesystem placement aligned with enabled plugins and feature expectations.
37+
- Preserve deterministic behavior and explicit error handling in implementation code.
38+
39+
## Best practices
40+
41+
- Keep snippets as baseline patterns and adapt them to real command names and data models.
42+
- Validate external inputs and permission boundaries before side effects.
43+
- Keep setup deterministic so startup behavior is stable across environments.
44+
45+
## Common mistakes
46+
47+
- Skipping validation for user-provided inputs before side effects.
48+
- Changing structure/config without verifying companion files.
49+
- Copying snippets without adapting identifiers and environment values.

0 commit comments

Comments
 (0)