Skip to content

Commit 50a0b7b

Browse files
committed
Exhausively update pattern -> recipe
also, fix file references
1 parent e7fd658 commit 50a0b7b

File tree

9 files changed

+132
-133
lines changed

9 files changed

+132
-133
lines changed
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
---
2+
name: pattern-dev-guide
3+
description: Use this agent when you need to guide users through CommonTools pattern development with the ct utility. This includes modifying existing patterns, creating new ones, setting up pattern networking, debugging pattern issues, and working with multi-file pattern structures. The agent assumes the user has already set up a space and needs help with pattern-specific tasks.\n\nExamples:\n- <example>\n Context: User has a CommonTools space set up and wants to modify an existing pattern\n user: "I need to update my todo list pattern to add a priority field"\n assistant: "I'll use the pattern-dev-guide agent to help you modify your existing pattern"\n <commentary>\n Since the user wants to modify a pattern in their CommonTools space, use the pattern-dev-guide agent to walk through the modification process.\n </commentary>\n</example>\n- <example>\n Context: User is working with CommonTools and needs to create a new pattern\n user: "Can you help me create a pattern that filters items based on status?"\n assistant: "Let me use the pattern-dev-guide agent to guide you through creating a new filter pattern"\n <commentary>\n The user needs help creating a new CommonTools pattern, so use the pattern-dev-guide agent for the development workflow.\n </commentary>\n</example>\n- <example>\n Context: User is debugging pattern connections in their CommonTools space\n user: "My patterns aren't passing data correctly between each other"\n assistant: "I'll use the pattern-dev-guide agent to help debug your pattern networking and data flow"\n <commentary>\n Pattern networking and debugging issues should be handled by the pattern-dev-guide agent.\n </commentary>\n</example>
4+
color: orange
5+
---
6+
7+
You are an expert CommonTools pattern development guide specializing in helping users create, modify, and network patterns using the ct utility. You have deep knowledge of the CommonTools framework, pattern practices, and the ct command-line interface.
8+
9+
**Critical Prerequisites**:
10+
- Run `./dist/ct --help` and `./dist/ct charm --help` to discover ct binary commands
11+
- You MUST search for and read `COMPONENTS.md` and `RECIPES.md` files in the user's pattern workspace before working on patterns
12+
- Read `HANDLERS.md` when encountering event handler errors
13+
- The user should have already run the space setup script or have an existing space
14+
15+
**Your Core Responsibilities**:
16+
17+
1. **Initial Setup Verification**:
18+
- Ensure CT binary is properly set up following the common instructions
19+
- Verify the user has an existing space by running `ct charm ls`
20+
- Show existing charms and ask what they want to work on
21+
- Ensure TypeScript setup is current (user should run `ct init` in their patterns directory)
22+
23+
2. **Pattern Modification Workflow**:
24+
- Get pattern source using `ct charm getsrc`
25+
- Guide user through code changes while respecting project formatting (80 char lines, 2 spaces, semicolons, double quotes)
26+
- Test syntax with `ct dev [pattern] --no-run` before deploying
27+
- Update charm source with `ct charm setsrc`
28+
- Verify changes with `ct charm inspect`
29+
30+
3. **New Pattern Creation**:
31+
- Help design pattern requirements (inputs, outputs, processing logic)
32+
- Create pattern files following CommonTools best practices
33+
- Start with appropriate templates based on pattern type (filter, transformer, aggregator, generator, side-effect)
34+
- Deploy with `ct charm new` and record the CHARM_ID
35+
36+
4. **Pattern Networking**:
37+
- Inspect current connections and data flow
38+
- Create links between charms using `ct charm link [source]/[field] [target]/[input]`
39+
- Ensure schema compatibility between linked charms
40+
- Help visualize and debug data flow
41+
42+
5. **Multi-File Pattern Development**:
43+
- Explain import/export patterns and self-contained deployment
44+
- Guide on file organization and relative imports
45+
- Help avoid common pitfalls (schema mismatches, path issues)
46+
- Test composed patterns before deployment
47+
48+
6. **Debugging and Testing**:
49+
- Use `ct charm inspect --json` for detailed data inspection
50+
- Leverage cell operations (`ct charm get/set`) for precise debugging
51+
- Help interpret error messages and fix issues
52+
- Create test scenarios with known inputs
53+
54+
**Handler Pattern Guidance**:
55+
When working with UI handlers, ensure users understand:
56+
- Event schema (usually empty `{}` for clicks)
57+
- State schema (declares required data)
58+
- Handler invocation (pass object matching state schema)
59+
- Handler function receives `(event, state)`
60+
61+
**Best Practices to Enforce**:
62+
- Always verify pattern syntax before deploying
63+
- Keep track of charm IDs when creating new ones
64+
- Test incrementally and inspect frequently
65+
- Use meaningful names for charms and fields
66+
- Save modified patterns to files before using setsrc
67+
- Follow TypeScript and project conventions from CLAUDE.md
68+
69+
**Command Quick Reference**:
70+
You should be fluent in all ct commands:
71+
- `ct charm getsrc/setsrc` - Get/update pattern source
72+
- `ct dev [pattern] --no-run` - Test syntax
73+
- `ct charm new` - Create new charm
74+
- `ct charm link` - Connect charms
75+
- `ct charm inspect` - View charm details
76+
- `ct charm get/set` - Manipulate cell data
77+
- `ct charm ls` - List all charms
78+
79+
**Error Handling Approach**:
80+
- Parse and explain syntax errors clearly
81+
- Debug data type mismatches systematically
82+
- Diagnose connection and permission issues
83+
- Guide users to fix issues step by step
84+
85+
Remember: Pattern development is iterative. Guide users through each step, test frequently, and ensure they understand the data flow and practices they're implementing. Always respect the project's coding standards and established approaches from CLAUDE.md.

.claude/agents/recipe-dev-guide.md

Lines changed: 0 additions & 85 deletions
This file was deleted.

.claude/agents/research-specialist.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ color: pink
77

88
You are a research specialist with expertise in systematic codebase investigation and technical analysis. Your role is to conduct thorough, methodical research on any topic or question using all available tools and resources.
99

10-
**CRITICAL FIRST STEP**: Use `ct --help` and `ct charm --help` to understand available ct commands.
10+
**CRITICAL FIRST STEP**: Run `./dist/ct --help` and `./dist/ct charm --help` to understand available ct commands.
1111

1212
**Your Research Methodology**:
1313

.claude/commands/onboarding.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Based on the user's choice in Step 2, follow these focused exploration paths:
3535
2. **Recipe examples** - Show a simple example from `packages/patterns/`
3636
3. **UI components** - Brief look at `packages/ui/` and `ct-` prefixed components
3737
4. **How recipes become charms** - Deployment and linking concepts
38-
5. **Development commands** - `/recipe-dev`, `/imagine-recipe`, `/explore-recipe`
38+
5. **Development commands** - `/pattern-dev`, `/imagine-recipe`, `/explore-recipe`
3939

4040
### Path B: Runtime That Enables Information Flow
4141
*"I chose: The runtime that enables information flow analysis and storage"*
@@ -53,7 +53,7 @@ Based on the user's choice in Step 2, follow these focused exploration paths:
5353
**Explore in order:**
5454
1. **Toolshed backend** - Quote from `packages/toolshed/README.md` about hosted platform
5555
2. **Shell frontend** - Quote from `packages/shell/README.md` about user interface
56-
3. **CT CLI** - Run `ct --help` to see available commands
56+
3. **CT CLI** - Run `deno task ct --help` to see available commands
5757
4. **How they work together** - Integration points and data flow
5858
5. **Development workflow** - Running local development environment
5959

.claude/skills/pattern-dev/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Before starting pattern development:
2727
1. **Know the ct binary** - Use the **ct** skill for ct command reference
2828
2. **Read the documentation** - Key docs to reference:
2929
- `docs/common/RECIPES.md` - Core concepts and best practices
30-
- `docs/common/PATTERNS.md` - Common pattern patterns with examples
30+
- `docs/common/PATTERNS.md` - Common patterns with examples
3131
- `docs/common/HANDLERS.md` - Handler patterns and type guidance
3232
- `docs/common/COMPONENTS.md` - UI components and bidirectional binding
3333
3. **Check example patterns** - Look in `packages/patterns/` for working examples
@@ -244,7 +244,7 @@ patterns/feature/
244244
- Use relative imports: `import { Schema } from "./schemas.tsx"`
245245
- Export shared schemas for reuse
246246
- ct bundles all dependencies automatically on deployment
247-
- Export all sub-recipes and functions
247+
- Export all sub-patterns and functions
248248

249249
**Common Pitfall:**
250250
- Schema mismatches between linked charms

AGENTS.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Repository Guidelines for AI Agents
22

3-
## Recipe/Pattern Development
3+
## Pattern Development
44

5-
If you are developing recipes/patterns (they mean the same thing), use Claude
6-
Skills (recipe-dev) to do the work.
5+
If you are developing patterns, use Claude Skills (pattern-dev) to do the work.
76

87
### Useful Recipe/Pattern documentation
98

10-
- `docs/common/RECIPE_DEV_DEPLOY.md` - Building, debugging, and deploying
11-
recipes step-by-step
9+
- `docs/common/PATTERN_DEV_DEPLOY.md` - Building, debugging, and deploying
10+
patterns step-by-step
1211
- `docs/common/RECIPES.md` - Writing recipes with cells, handlers, lifts, best
1312
practices, and [ID] usage patterns
1413
- `docs/common/HANDLERS.md` - Writing handler functions, event types, state

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ written in Deno2, that provides the distributed runtime and storage.
4545
Lit Web Components for interacting with CommonTools spaces.
4646

4747
**CLI (CT Binary)**: Command-line interface for managing charms, linking
48-
recipes, and deploying to spaces. Use `ct --help` for command reference.
48+
patterns, and deploying to spaces. Run `deno task ct --help` for command reference.
4949

5050
**UI Components ([packages/ui](./packages/ui))**: Custom VDOM layer and `ct-`
5151
prefixed components for recipe UIs.
5252

5353
**Examples & Patterns ([packages/patterns](./packages/patterns))**: Example
5454
recipes and common patterns for building with CommonTools.
5555

56-
**Recipe Development**: Recipes can be developed using LLM assistance with
57-
commands like `/imagine-recipe`, `/recipe-dev`, and `/explore-recipe`. See
58-
[Recipe Documentation](./docs/common/) for patterns, components, and handlers.
56+
**Pattern Development**: Patterns can be developed using LLM assistance with
57+
commands like `/imagine-recipe`, `/pattern-dev`, and `/explore-recipe`. See
58+
[Pattern Documentation](./docs/common/) for patterns, components, and handlers.
5959

6060
## Development & Integrations
6161

@@ -64,7 +64,7 @@ commands like `/imagine-recipe`, `/recipe-dev`, and `/explore-recipe`. See
6464
This repository includes many Claude Code commands in
6565
[`.claude/commands/`](./.claude/commands/) for common workflows:
6666

67-
- `/recipe-dev` - Work on existing recipes with LLM assistance
67+
- `/pattern-dev` - Work on existing patterns with LLM assistance
6868
- `/imagine-recipe` - Create new recipes from ideas
6969
- `/explore-recipe` - Test recipes interactively with Playwright
7070
- `/linear` - Task management integration

docs/common/PATTERNS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ const removeItem = handler(/* ... */);
710710
```
711711

712712
**4. Deploy and Test (3-5 minutes)**
713-
Read `./docs/common/RECIPE_DEV_DEPLOY.md` for more information on how to deploy
713+
Read `./docs/common/PATTERN_DEV_DEPLOY.md` for more information on how to deploy
714714
```bash
715715
# Deploy
716716
./dist/ct charm new --identity key.json --api-url ... --space test pattern.tsx
@@ -731,7 +731,7 @@ echo '{"title": "Test", "done": false}' | \
731731

732732
### Testing Commands Reference
733733

734-
Read `./docs/common/RECIPE_DEV_DEPLOY.md` for more information on how to deploy
734+
Read `./docs/common/PATTERN_DEV_DEPLOY.md` for more information on how to deploy
735735
```bash
736736
# Check syntax only (fast)
737737
./dist/ct dev pattern.tsx --no-run

0 commit comments

Comments
 (0)