Skip to content

Commit d65e57c

Browse files
authored
Merge pull request #33 from BuilderIO/fix/create-command-include-skills
fix(template): replace broken skills symlink with real files
2 parents cc2979a + 677d428 commit d65e57c

File tree

35 files changed

+3294
-1
lines changed

35 files changed

+3294
-1
lines changed

packages/core/src/templates/default/.agents/skills

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
name: capture-learnings
3+
description: >-
4+
Capture and apply accumulated knowledge in learnings.md. Use when the user
5+
corrects a mistake, when debugging reveals unexpected behavior, or when an
6+
architectural decision should be recorded for future reference.
7+
user-invocable: false
8+
---
9+
10+
# Capture Learnings
11+
12+
This is background knowledge, not a slash command. Read `learnings.md` before starting significant work. Update it when you discover something worth remembering.
13+
14+
## When to Capture
15+
16+
Use judgment, not rules. Capture when:
17+
18+
- **Surprising behavior** — Something didn't work as expected and you figured out why
19+
- **Repeated friction** — You hit the same issue twice; write it down so there's no third time
20+
- **Architectural decisions** — Why something is done a certain way (the "why" isn't in the code)
21+
- **API/library quirks** — Undocumented behavior, version-specific gotchas
22+
- **Performance insights** — What's slow and what fixed it
23+
24+
Don't capture:
25+
26+
- Things that are obvious from reading the code
27+
- Standard language/framework behavior
28+
- Temporary debugging notes
29+
30+
## Format
31+
32+
Add entries to `learnings.md` at the project root. Match the existing format — typically a heading per topic with a brief explanation:
33+
34+
```markdown
35+
## [Topic]
36+
37+
[What you learned and why it matters. Keep it to 2-3 sentences.]
38+
```
39+
40+
## Graduation
41+
42+
When a learning is referenced repeatedly, it's outgrowing `learnings.md`. Propose adding it to the relevant skill or creating a new skill via `create-skill`.
43+
44+
- Updating `learnings.md` is a Tier 1 modification (data — auto-apply)
45+
- Updating a SKILL.md based on learnings is Tier 2 (source — verify after)
46+
47+
## Related Skills
48+
49+
- **self-modifying-code** — Learnings.md updates are Tier 1; skill updates are Tier 2
50+
- **create-skill** — When a learning graduates, create a skill from it
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
name: create-skill
3+
description: >-
4+
How to create new skills for an agent-native app. Use when adding a new
5+
skill, documenting a pattern the agent should follow, or creating reusable
6+
guidance for the agent.
7+
---
8+
9+
# Create a Skill
10+
11+
## When to Use
12+
13+
Create a new skill when:
14+
15+
- There's a pattern the agent should follow repeatedly
16+
- A workflow needs step-by-step guidance
17+
- You want to scaffold files from a template
18+
19+
Don't create a skill when:
20+
21+
- The guidance already exists in another skill (extend it instead)
22+
- You're documenting something the agent already knows (e.g., how to write TypeScript)
23+
- The guidance is a one-off — put it in `AGENTS.md` or `learnings.md` instead
24+
25+
## 5-Question Interview
26+
27+
Before writing the skill, answer these:
28+
29+
1. **What should this skill enable?** — The core purpose in one sentence.
30+
2. **Which agent-native rule does it serve?** — Rule 1 (files), Rule 2 (delegate), Rule 3 (scripts), Rule 4 (SSE), Rule 5 (self-modify), or "utility."
31+
3. **When should it trigger?** — Describe the situations in natural language. Be slightly pushy — over-triggering is better than under-triggering.
32+
4. **What type of skill?** — Pattern, Workflow, or Generator (see templates below).
33+
5. **Does it need supporting files?** — References (read-only context) or none. Keep it minimal.
34+
35+
## Skill Types and Templates
36+
37+
### Pattern (architectural rule)
38+
39+
For documenting how things should be done:
40+
41+
```markdown
42+
---
43+
name: my-pattern
44+
description: >-
45+
[Under 40 words. When should this trigger?]
46+
---
47+
48+
# [Pattern Name]
49+
50+
## Rule
51+
52+
[One sentence: what must be true]
53+
54+
## Why
55+
56+
[Why this rule exists]
57+
58+
## How
59+
60+
[How to follow it, with code examples]
61+
62+
## Don't
63+
64+
[Common violations]
65+
66+
## Related Skills
67+
68+
[Which skills compose with this one]
69+
```
70+
71+
### Workflow (step-by-step)
72+
73+
For multi-step implementation tasks:
74+
75+
```markdown
76+
---
77+
name: my-workflow
78+
description: >-
79+
[Under 40 words. When should this trigger?]
80+
---
81+
82+
# [Workflow Name]
83+
84+
## Prerequisites
85+
86+
[What must be in place first]
87+
88+
## Steps
89+
90+
[Numbered steps with code examples]
91+
92+
## Verification
93+
94+
[How to confirm it worked]
95+
96+
## Troubleshooting
97+
98+
[Common issues and fixes]
99+
100+
## Related Skills
101+
```
102+
103+
### Generator (scaffolding)
104+
105+
For creating files from templates:
106+
107+
```markdown
108+
---
109+
name: my-generator
110+
description: >-
111+
[Under 40 words. When should this trigger?]
112+
---
113+
114+
# [Generator Name]
115+
116+
## Usage
117+
118+
[How to invoke — what args/inputs are needed]
119+
120+
## What Gets Created
121+
122+
[List of files and their purpose]
123+
124+
## Template
125+
126+
[The template content with placeholders]
127+
128+
## After Generation
129+
130+
[What to do next — wire up SSE, add routes, etc.]
131+
132+
## Related Skills
133+
```
134+
135+
## Naming Conventions
136+
137+
- Hyphen-case only: `[a-z0-9-]`, max 64 characters
138+
- Pattern skills: descriptive names (`files-as-database`, `delegate-to-agent`)
139+
- Workflow/generator skills: verb-noun (`create-script`, `capture-learnings`)
140+
141+
## Tips
142+
143+
- **Keep descriptions under 40 words** — They're loaded into context on every conversation.
144+
- **Keep SKILL.md under 500 lines** — Move detailed content to `references/` files.
145+
- **Use standard markdown headings** — No XML tags or custom formats.
146+
147+
## Anti-Patterns
148+
149+
- **Inline LLM calls** — Skills must not call LLMs directly (violates Rule 2)
150+
- **Database patterns** — Skills must not introduce databases (violates Rule 1)
151+
- **Ignoring SSE** — If a skill creates data files, mention wiring up `useFileWatcher`
152+
- **Vague descriptions** — "Helps with development" won't trigger. Be specific about _when_.
153+
- **Pure documentation** — Skills should guide action, not just explain concepts
154+
155+
## File Structure
156+
157+
```
158+
.agents/skills/my-skill/
159+
├── SKILL.md # Main skill (required)
160+
└── references/ # Optional supporting context
161+
└── detailed-guide.md
162+
```
163+
164+
## Related Skills
165+
166+
- **capture-learnings** — When a learning graduates to reusable guidance, create a skill
167+
- **self-modifying-code** — The agent can create new skills (Tier 2 modification)
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
name: delegate-to-agent
3+
description: >-
4+
How to delegate all AI work to the agent chat. Use when delegating AI work
5+
from UI or scripts to the agent, when tempted to add inline LLM calls, or
6+
when sending messages to the agent from application code.
7+
---
8+
9+
# Delegate All AI to the Agent
10+
11+
## Rule
12+
13+
The UI and server never call an LLM directly. All AI work is delegated to the agent through the chat bridge.
14+
15+
## Why
16+
17+
The agent is the single AI interface. It has context about the full project, can read/write any file, and can run scripts. Inline LLM calls bypass this — they create a shadow AI that doesn't know what the agent knows and can't coordinate with it.
18+
19+
## How
20+
21+
**From the UI (client):**
22+
23+
```ts
24+
import { sendToAgentChat } from "@agent-native/core";
25+
26+
sendToAgentChat({
27+
message: "Generate a summary of this document",
28+
context: documentContent, // optional hidden context (not shown in chat UI)
29+
submit: true, // auto-submit to the agent
30+
});
31+
```
32+
33+
**From scripts (Node):**
34+
35+
```ts
36+
import { agentChat } from "@agent-native/core";
37+
38+
agentChat.submit("Process the uploaded images and create thumbnails");
39+
```
40+
41+
**From the UI, detecting when agent is done:**
42+
43+
```ts
44+
import { useAgentChatGenerating } from "@agent-native/core";
45+
46+
function MyComponent() {
47+
const isGenerating = useAgentChatGenerating();
48+
// Show loading state while agent is working
49+
}
50+
```
51+
52+
## `submit` vs Prefill
53+
54+
The `submit` option controls whether the message is sent automatically or placed in the chat input for user review:
55+
56+
| `submit` value | Behavior | Use when |
57+
| -------------- | --------------------------------------- | ----------------------------------------------------------------------------------- |
58+
| `true` | Auto-submits to the agent immediately | Routine operations the user has already approved |
59+
| `false` | Prefills the chat input for user review | High-stakes operations (deleting data, modifying code, API calls with side effects) |
60+
| omitted | Uses the project's default setting | General-purpose delegation |
61+
62+
```ts
63+
// Auto-submit: routine operation
64+
sendToAgentChat({ message: "Update the project summary", submit: true });
65+
66+
// Prefill: let user review before sending
67+
sendToAgentChat({
68+
message: "Delete all projects older than 30 days",
69+
submit: false,
70+
});
71+
```
72+
73+
## Don't
74+
75+
- Don't `import Anthropic from "@anthropic-ai/sdk"` in client or server code
76+
- Don't `import OpenAI from "openai"` in client or server code
77+
- Don't make direct API calls to any LLM provider
78+
- Don't use AI SDK functions like `generateText()`, `streamText()`, etc.
79+
- Don't build "AI features" that bypass the agent chat
80+
81+
## Exception
82+
83+
Scripts may call external APIs (image generation, search, etc.) — but the AI reasoning and orchestration still goes through the agent. A script is a tool the agent uses, not a replacement for the agent.
84+
85+
## Related Skills
86+
87+
- **scripts** — The agent invokes scripts via `pnpm script <name>` to perform complex operations
88+
- **self-modifying-code** — The agent operates through the chat bridge to make code changes
89+
- **files-as-database** — The agent writes results to data files after processing requests
90+
- **sse-file-watcher** — The UI updates automatically when the agent writes files

0 commit comments

Comments
 (0)