@plaited/development-skills 0.4.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{.claude → .plaited}/rules/accuracy.md +3 -10
- package/{.claude → .plaited}/rules/code-review.md +2 -41
- package/.plaited/rules/git-workflow.md +36 -0
- package/.plaited/rules/module-organization.md +92 -0
- package/{.claude → .plaited}/rules/testing.md +81 -1
- package/package.json +3 -2
- package/src/lsp-analyze.ts +2 -2
- package/src/lsp-find.ts +15 -34
- package/src/lsp-hover.ts +2 -2
- package/src/lsp-references.ts +2 -2
- package/src/lsp-symbols.ts +2 -2
- package/src/resolve-file-path.ts +18 -28
- package/src/scaffold-rules.ts +148 -204
- package/src/tests/resolve-file-path.spec.ts +90 -51
- package/src/tests/scaffold-rules.spec.ts +148 -118
- package/.claude/commands/lsp-analyze.md +0 -66
- package/.claude/commands/lsp-find.md +0 -51
- package/.claude/commands/lsp-hover.md +0 -48
- package/.claude/commands/lsp-refs.md +0 -55
- package/.claude/commands/scaffold-rules.md +0 -221
- package/.claude/commands/validate-skill.md +0 -29
- package/.claude/rules/git-workflow.md +0 -66
- package/.claude/skills/code-documentation/SKILL.md +0 -47
- package/.claude/skills/code-documentation/references/internal-templates.md +0 -113
- package/.claude/skills/code-documentation/references/maintenance.md +0 -164
- package/.claude/skills/code-documentation/references/public-api-templates.md +0 -100
- package/.claude/skills/code-documentation/references/type-documentation.md +0 -116
- package/.claude/skills/code-documentation/references/workflow.md +0 -60
- package/.claude/skills/scaffold-rules/SKILL.md +0 -97
- package/.claude/skills/typescript-lsp/SKILL.md +0 -239
- package/.claude/skills/validate-skill/SKILL.md +0 -105
- /package/{.claude → .plaited}/rules/bun-apis.md +0 -0
- /package/{.claude → .plaited}/rules/github.md +0 -0
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
# Documentation Maintenance
|
|
2
|
-
|
|
3
|
-
Guidelines for maintaining documentation hygiene: synchronizing TSDoc with code, removing non-compliant comments, and handling orphaned documentation.
|
|
4
|
-
|
|
5
|
-
## Comment Policy
|
|
6
|
-
|
|
7
|
-
### Allowed Comments
|
|
8
|
-
|
|
9
|
-
1. **TSDoc comment blocks** following project standards
|
|
10
|
-
2. **TODO comments**: `// TODO: description of future work`
|
|
11
|
-
3. **FIXME comments**: `// FIXME: description of issue to fix`
|
|
12
|
-
|
|
13
|
-
### Remove These Comments
|
|
14
|
-
|
|
15
|
-
1. **Performance notes**: `// Performance: this is O(n)`
|
|
16
|
-
2. **Update timestamps**: `// Updated 2024-12-15 to fix bug`
|
|
17
|
-
3. **Historical notes**: `// This used to use Array.filter`
|
|
18
|
-
4. **Implementation notes**: `// Hack to work around limitation`
|
|
19
|
-
5. **Inline explanations**: `// Loop through items and process`
|
|
20
|
-
6. **Rationale comments**: `// We do this because...`
|
|
21
|
-
|
|
22
|
-
### Convert to TSDoc
|
|
23
|
-
|
|
24
|
-
Valuable information from inline comments should be moved to TSDoc `@remarks`:
|
|
25
|
-
|
|
26
|
-
```typescript
|
|
27
|
-
// This function is O(n) because it iterates all items
|
|
28
|
-
// We use a for-loop instead of .filter for better performance
|
|
29
|
-
|
|
30
|
-
// ↓ CONVERT TO ↓
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @internal
|
|
34
|
-
* Processes items with linear complexity.
|
|
35
|
-
*
|
|
36
|
-
* @remarks
|
|
37
|
-
* - Complexity: O(n) where n is number of items
|
|
38
|
-
* - Uses for-loop instead of .filter for performance
|
|
39
|
-
*/
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## Synchronization Tasks
|
|
43
|
-
|
|
44
|
-
### Parameter Sync
|
|
45
|
-
|
|
46
|
-
```typescript
|
|
47
|
-
// OUT OF SYNC:
|
|
48
|
-
/**
|
|
49
|
-
* @param name - User name
|
|
50
|
-
* @param age - User age
|
|
51
|
-
*/
|
|
52
|
-
function createUser({ username, age }: UserData) { ... }
|
|
53
|
-
|
|
54
|
-
// FIXED:
|
|
55
|
-
/**
|
|
56
|
-
* @param options - User data
|
|
57
|
-
* @param options.username - User's username
|
|
58
|
-
* @param options.age - User's age
|
|
59
|
-
*/
|
|
60
|
-
function createUser({ username, age }: UserData) { ... }
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
### Return Type Sync
|
|
64
|
-
|
|
65
|
-
```typescript
|
|
66
|
-
// OUT OF SYNC:
|
|
67
|
-
/**
|
|
68
|
-
* @returns User object
|
|
69
|
-
*/
|
|
70
|
-
function getUser(): Promise<User> { ... }
|
|
71
|
-
|
|
72
|
-
// FIXED:
|
|
73
|
-
/**
|
|
74
|
-
* @returns Promise resolving to User object
|
|
75
|
-
*/
|
|
76
|
-
function getUser(): Promise<User> { ... }
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
### Generic Parameter Sync
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
// OUT OF SYNC:
|
|
83
|
-
/**
|
|
84
|
-
* @template T - Generic type
|
|
85
|
-
*/
|
|
86
|
-
function process<T extends BaseType>() { ... }
|
|
87
|
-
|
|
88
|
-
// FIXED:
|
|
89
|
-
/**
|
|
90
|
-
* @template T - Type extending BaseType for processing
|
|
91
|
-
*/
|
|
92
|
-
function process<T extends BaseType>() { ... }
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Orphaned Documentation
|
|
96
|
-
|
|
97
|
-
When TSDoc comments reference code that no longer exists:
|
|
98
|
-
|
|
99
|
-
1. **Deleted functions/types**: Remove the entire TSDoc block
|
|
100
|
-
2. **Moved code**: Report the TSDoc location and ask where code moved to
|
|
101
|
-
3. **Invalid @see references**: Remove `@see` tags referencing deleted code
|
|
102
|
-
4. **Uncertain**: If confidence < 95%, report for manual review
|
|
103
|
-
|
|
104
|
-
**Examples:**
|
|
105
|
-
|
|
106
|
-
```typescript
|
|
107
|
-
// ORPHANED: Function deleted, TSDoc remains
|
|
108
|
-
/**
|
|
109
|
-
* @deprecated Use newFunction instead
|
|
110
|
-
* @param x - Input value
|
|
111
|
-
*/
|
|
112
|
-
// <--- Nothing here, function was deleted
|
|
113
|
-
|
|
114
|
-
// ACTION: Remove entire TSDoc block
|
|
115
|
-
|
|
116
|
-
// INVALID REFERENCE: @see points to deleted code
|
|
117
|
-
/**
|
|
118
|
-
* Processes user data.
|
|
119
|
-
* @see {@link validateInput} - Function no longer exists
|
|
120
|
-
* @see {@link sanitizeData} - Still exists
|
|
121
|
-
*/
|
|
122
|
-
function processUser(data: UserData) { ... }
|
|
123
|
-
|
|
124
|
-
// ACTION: Remove @see for validateInput, keep sanitizeData reference
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## Maintenance Process
|
|
128
|
-
|
|
129
|
-
When cleaning documentation in a file or directory:
|
|
130
|
-
|
|
131
|
-
1. **Scan for comments**
|
|
132
|
-
- Identify all comment types (TSDoc, inline, TODO/FIXME)
|
|
133
|
-
- Classify each comment (KEEP, REMOVE, CONVERT)
|
|
134
|
-
|
|
135
|
-
2. **Remove non-compliant**
|
|
136
|
-
- Delete performance notes, timestamps, historical notes
|
|
137
|
-
- Remove inline explanations and implementation details
|
|
138
|
-
|
|
139
|
-
3. **Remove orphaned TSDoc**
|
|
140
|
-
- Delete TSDoc blocks for deleted functions/types
|
|
141
|
-
- Remove invalid @see references to deleted code
|
|
142
|
-
- Report uncertain cases for manual review
|
|
143
|
-
|
|
144
|
-
4. **Update TSDoc blocks**
|
|
145
|
-
- Sync parameter names and types
|
|
146
|
-
- Update return type descriptions
|
|
147
|
-
- Verify generic parameter documentation
|
|
148
|
-
|
|
149
|
-
5. **Convert valuable inline to TSDoc**
|
|
150
|
-
- Move complexity notes to @remarks
|
|
151
|
-
- Move important context to @remarks
|
|
152
|
-
|
|
153
|
-
6. **Validate completeness**
|
|
154
|
-
- All public exports have TSDoc
|
|
155
|
-
- All public APIs have @param/@returns
|
|
156
|
-
- Types have @property for all properties
|
|
157
|
-
- @internal marker on non-public code
|
|
158
|
-
|
|
159
|
-
## Safety Guidelines
|
|
160
|
-
|
|
161
|
-
1. **Start small** - Test on one file before batch processing
|
|
162
|
-
2. **Review changes** - Examine diffs before committing
|
|
163
|
-
3. **Preserve TODOs** - Never remove TODO/FIXME comments
|
|
164
|
-
4. **No code changes** - Only modify comments and TSDoc
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
# Public API Templates
|
|
2
|
-
|
|
3
|
-
## Public API Functions
|
|
4
|
-
|
|
5
|
-
```typescript
|
|
6
|
-
/**
|
|
7
|
-
* Concise one-line description of functionality.
|
|
8
|
-
* Extended explanation providing context, use cases, and when to use this.
|
|
9
|
-
*
|
|
10
|
-
* @template T - Description of generic type parameter and constraints
|
|
11
|
-
* @param paramName - Parameter purpose, constraints, and expected values
|
|
12
|
-
* @returns Description of return value, what it represents, and guarantees
|
|
13
|
-
*
|
|
14
|
-
* @remarks
|
|
15
|
-
* - Key behavioral characteristics
|
|
16
|
-
* - Important execution details
|
|
17
|
-
* - Performance considerations (with Big-O if relevant)
|
|
18
|
-
* - Common pitfalls or gotchas
|
|
19
|
-
* - Threading/async behavior if applicable
|
|
20
|
-
*
|
|
21
|
-
* @throws {ErrorType} When and why this error occurs
|
|
22
|
-
*
|
|
23
|
-
* @see {@link RelatedFunction} for related functionality
|
|
24
|
-
* @see {@link RelatedType} for type details
|
|
25
|
-
* @since 1.0.0
|
|
26
|
-
*/
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
## Public Types
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
/**
|
|
33
|
-
* Description of what this type represents in the API.
|
|
34
|
-
* When and why to use this type.
|
|
35
|
-
*
|
|
36
|
-
* @template T - Generic parameter description and constraints
|
|
37
|
-
* @property propName - What this property controls or represents
|
|
38
|
-
* @property optionalProp - Purpose and when to include this property
|
|
39
|
-
*
|
|
40
|
-
* @remarks
|
|
41
|
-
* - Type constraints and relationships
|
|
42
|
-
* - Common usage patterns
|
|
43
|
-
* - Integration with other types
|
|
44
|
-
*
|
|
45
|
-
* @see {@link RelatedType} for related type definitions
|
|
46
|
-
* @since 1.0.0
|
|
47
|
-
*/
|
|
48
|
-
export type TypeName<T> = {
|
|
49
|
-
propName: string;
|
|
50
|
-
optionalProp?: number;
|
|
51
|
-
}
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
## Behavioral Programming Functions
|
|
55
|
-
|
|
56
|
-
**CRITICAL:** For behavioral programming APIs (bSync, bThread, behavioral, useBehavioral), always use factory functions in documentation - never raw `yield` statements.
|
|
57
|
-
|
|
58
|
-
```typescript
|
|
59
|
-
/**
|
|
60
|
-
* Creates a behavioral thread for coordinating async operations.
|
|
61
|
-
* Explain the coordination pattern and synchronization approach.
|
|
62
|
-
*
|
|
63
|
-
* @param config - Thread configuration options
|
|
64
|
-
* @returns Configured behavioral thread
|
|
65
|
-
*
|
|
66
|
-
* @remarks
|
|
67
|
-
* - Thread execution model (sequential through sync points)
|
|
68
|
-
* - Event coordination semantics
|
|
69
|
-
* - Blocking precedence rules
|
|
70
|
-
* - Repetition behavior
|
|
71
|
-
* - Integration with trigger/feedback mechanisms
|
|
72
|
-
*
|
|
73
|
-
* @see {@link bSync} for creating sync points
|
|
74
|
-
* @see {@link behavioral} for program setup
|
|
75
|
-
* @see {@link Idioms} for synchronization options
|
|
76
|
-
* @since 1.0.0
|
|
77
|
-
*/
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
## Deprecated Code
|
|
81
|
-
|
|
82
|
-
```typescript
|
|
83
|
-
/**
|
|
84
|
-
* @deprecated Use {@link NewFunction} instead. Will be removed in v8.0.
|
|
85
|
-
*
|
|
86
|
-
* Migration path: [Brief guidance on how to migrate]
|
|
87
|
-
*
|
|
88
|
-
* @see {@link NewFunction}
|
|
89
|
-
*/
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
## Required Elements by Context
|
|
93
|
-
|
|
94
|
-
### All Public APIs Must Include
|
|
95
|
-
|
|
96
|
-
- One-line description + extended context
|
|
97
|
-
- `@param` for all parameters
|
|
98
|
-
- `@returns` for return values
|
|
99
|
-
- `@remarks` section with behavioral notes
|
|
100
|
-
- `@see` tags to related APIs
|
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
# Type Documentation Guidelines
|
|
2
|
-
|
|
3
|
-
**IMPORTANT**: This project prefers `type` over `interface` in both code and TSDoc comments. Always use `type` declarations unless there's a specific need for interface features like declaration merging.
|
|
4
|
-
|
|
5
|
-
## Type Analysis Process
|
|
6
|
-
|
|
7
|
-
When documenting types, use the **typescript-lsp** skill for accurate type discovery:
|
|
8
|
-
|
|
9
|
-
1. **Analyze type structure** using typescript-lsp:
|
|
10
|
-
- Run `lsp-symbols` to list all type definitions in a file
|
|
11
|
-
- Run `lsp-hover` on the type to get the full signature
|
|
12
|
-
- Identify all properties and their types
|
|
13
|
-
- Find optional vs required properties
|
|
14
|
-
- Trace generic type parameters
|
|
15
|
-
- Identify union and intersection types
|
|
16
|
-
|
|
17
|
-
2. **Find type relationships** using typescript-lsp:
|
|
18
|
-
- Run `lsp-references` to find all usages of the type
|
|
19
|
-
- Run `lsp-find` to search for related types by name pattern
|
|
20
|
-
- What types does this extend or implement?
|
|
21
|
-
- What types reference this type?
|
|
22
|
-
- What utility types are derived from this?
|
|
23
|
-
- Are there branded/nominal types involved?
|
|
24
|
-
|
|
25
|
-
3. **Discover usage patterns:**
|
|
26
|
-
- How is this type constructed?
|
|
27
|
-
- What validation occurs?
|
|
28
|
-
- Are there Zod schemas associated?
|
|
29
|
-
- What are the common configurations?
|
|
30
|
-
|
|
31
|
-
4. **Document from analysis:**
|
|
32
|
-
- Property purposes from usage context
|
|
33
|
-
- Constraints from validation/tests
|
|
34
|
-
- Relationships from type dependencies
|
|
35
|
-
- Patterns from real usage in framework code, stories, and test files
|
|
36
|
-
|
|
37
|
-
## Type Documentation Requirements
|
|
38
|
-
|
|
39
|
-
All TypeScript type patterns (complex objects, unions, functions, mapped types, recursive types, etc.) should follow standard TSDoc format with these conventions:
|
|
40
|
-
|
|
41
|
-
### Core Requirements
|
|
42
|
-
|
|
43
|
-
- **Always use `type` over `interface`** (unless extending a single interface for branding)
|
|
44
|
-
- **Include `@property`** for all properties with: purpose, constraints, and when to use
|
|
45
|
-
- **Document `@template`** parameters with: constraint, purpose, and where it flows
|
|
46
|
-
- **Add `@remarks`** for: validation rules, constraints, common patterns, performance notes
|
|
47
|
-
- **Cross-reference** related types, factory functions, type guards, and Zod schemas using `@see`
|
|
48
|
-
- **Mark internal types** with `@internal` for non-public APIs
|
|
49
|
-
|
|
50
|
-
### Zod Schema Integration
|
|
51
|
-
|
|
52
|
-
When types have associated Zod schemas, document validation in `@remarks`:
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
/**
|
|
56
|
-
* @remarks
|
|
57
|
-
* Validation:
|
|
58
|
-
* - Schema: {@link ConfigSchema}
|
|
59
|
-
* - Required fields: [list]
|
|
60
|
-
* - Optional fields: [list]
|
|
61
|
-
* - Default values: [from schema defaults]
|
|
62
|
-
*/
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Property Documentation
|
|
66
|
-
|
|
67
|
-
**Required for each property:**
|
|
68
|
-
```typescript
|
|
69
|
-
@property propName - [Purpose] [Constraints] [When to use]
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
**Discovery sources:**
|
|
73
|
-
1. From usage: How the property is accessed/used
|
|
74
|
-
2. From tests: What values are tested, edge cases
|
|
75
|
-
3. From validation: Zod schemas, type guards
|
|
76
|
-
4. From defaults: Default values in code
|
|
77
|
-
|
|
78
|
-
## Generic Type Parameters
|
|
79
|
-
|
|
80
|
-
**Always document with:**
|
|
81
|
-
```typescript
|
|
82
|
-
@template T - [Constraint] [Purpose] [Where it flows]
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
**Discovery process:**
|
|
86
|
-
1. Find where T is used in type body
|
|
87
|
-
2. Identify constraints (extends clauses)
|
|
88
|
-
3. Trace how T flows through type
|
|
89
|
-
4. Note variance (in/out if relevant)
|
|
90
|
-
|
|
91
|
-
## Cross-Referencing Types
|
|
92
|
-
|
|
93
|
-
**Always link:**
|
|
94
|
-
- Related types (subtypes, supertypes)
|
|
95
|
-
- Factory functions that create instances
|
|
96
|
-
- Type guards that check instances
|
|
97
|
-
- Validation schemas
|
|
98
|
-
- Consumer functions/classes
|
|
99
|
-
|
|
100
|
-
**Format:**
|
|
101
|
-
```typescript
|
|
102
|
-
/**
|
|
103
|
-
* @see {@link ParentType} for base type definition
|
|
104
|
-
* @see {@link createInstance} for creating valid instances
|
|
105
|
-
* @see {@link isInstanceOf} for runtime type checking
|
|
106
|
-
* @see {@link InstanceSchema} for validation schema
|
|
107
|
-
* @see {@link Consumer} for primary consumer
|
|
108
|
-
*/
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Required Elements for All Types
|
|
112
|
-
|
|
113
|
-
- Description of what it represents
|
|
114
|
-
- `@property` documentation for all properties
|
|
115
|
-
- `@template` for generic parameters
|
|
116
|
-
- `@remarks` for constraints and patterns
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# TSDoc Generation Workflow
|
|
2
|
-
|
|
3
|
-
When creating or updating TSDoc comments, follow this systematic exploration process.
|
|
4
|
-
|
|
5
|
-
**Prerequisite**: Use the **typescript-lsp** skill for type verification throughout this workflow. The LSP tools provide accurate type information directly from the TypeScript compiler.
|
|
6
|
-
|
|
7
|
-
## Phase 1: Type & Interface Analysis
|
|
8
|
-
|
|
9
|
-
1. **Identify the target** (function, type, class, or module)
|
|
10
|
-
2. **Analyze type signatures** using typescript-lsp:
|
|
11
|
-
- Run `lsp-symbols` to get file structure overview
|
|
12
|
-
- Run `lsp-hover` on the target to get exact type signatures
|
|
13
|
-
- Parameter types and constraints
|
|
14
|
-
- Return types
|
|
15
|
-
- Generic type parameters
|
|
16
|
-
- Type relationships and dependencies
|
|
17
|
-
3. **Trace type dependencies:**
|
|
18
|
-
- Run `lsp-references` to find what depends on this type
|
|
19
|
-
- What types does this depend on?
|
|
20
|
-
- What types depend on this?
|
|
21
|
-
- Are there related utility types?
|
|
22
|
-
|
|
23
|
-
## Phase 2: Usage Reference Discovery
|
|
24
|
-
|
|
25
|
-
1. **Find all usage locations** using typescript-lsp:
|
|
26
|
-
- Run `lsp-references` on the target symbol
|
|
27
|
-
- Run `lsp-find` to search for related patterns
|
|
28
|
-
- Identify calling patterns
|
|
29
|
-
- Note common usage contexts
|
|
30
|
-
2. **Analyze integration points:**
|
|
31
|
-
- How is this used in the architecture?
|
|
32
|
-
- What modules consume this?
|
|
33
|
-
- What are the typical call chains?
|
|
34
|
-
|
|
35
|
-
## Phase 3: Test & Story Analysis
|
|
36
|
-
|
|
37
|
-
1. **Review test files** (`.test.ts`, `.spec.ts`):
|
|
38
|
-
- What behaviors are tested?
|
|
39
|
-
- What edge cases are covered?
|
|
40
|
-
- What scenarios are validated?
|
|
41
|
-
2. **Review story files** (`.stories.tsx`):
|
|
42
|
-
- How is this used in practice?
|
|
43
|
-
- What real-world scenarios exist?
|
|
44
|
-
- What configurations are demonstrated?
|
|
45
|
-
|
|
46
|
-
## Phase 4: Documentation Generation
|
|
47
|
-
|
|
48
|
-
1. **Synthesize findings** from phases 1-3
|
|
49
|
-
2. **Apply appropriate TSDoc template** from this skill
|
|
50
|
-
3. **Cross-reference related APIs** using `@see` tags
|
|
51
|
-
4. **Document discovered constraints** in `@remarks`
|
|
52
|
-
5. **Note performance characteristics** if evident from usage
|
|
53
|
-
6. **Identify limitations** found in tests or usage patterns
|
|
54
|
-
|
|
55
|
-
## Templates
|
|
56
|
-
|
|
57
|
-
After completing the workflow phases, apply the appropriate template:
|
|
58
|
-
- @public-api-templates.md - Public-facing APIs
|
|
59
|
-
- @internal-templates.md - Internal code and modules
|
|
60
|
-
- @type-documentation.md - Type documentation
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: scaffold-rules
|
|
3
|
-
description: Scaffold development rules for AI coding agents. Auto-invoked when user asks about setting up rules, coding conventions, or configuring their AI agent environment.
|
|
4
|
-
license: ISC
|
|
5
|
-
compatibility: Requires bun
|
|
6
|
-
allowed-tools: Glob, Read, Write, Edit, AskUserQuestion
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Scaffold Rules
|
|
10
|
-
|
|
11
|
-
Scaffold and merge development rules adapted to different AI coding agent environments.
|
|
12
|
-
|
|
13
|
-
## Purpose
|
|
14
|
-
|
|
15
|
-
Use this skill when the user wants to:
|
|
16
|
-
- Set up development rules or coding conventions
|
|
17
|
-
- Configure their AI coding agent (Claude Code, Cursor, Copilot, etc.)
|
|
18
|
-
- Add or update project guidelines
|
|
19
|
-
- Standardize conventions across a team
|
|
20
|
-
|
|
21
|
-
## Supported Agents
|
|
22
|
-
|
|
23
|
-
| Agent | Config Location | Format |
|
|
24
|
-
|-------|-----------------|--------|
|
|
25
|
-
| Claude Code | `.claude/rules/*.md` | Separate markdown files |
|
|
26
|
-
| Cursor | `.cursorrules` or `.cursor/rules/*.md` | Single or multi-file |
|
|
27
|
-
| GitHub Copilot | `.github/copilot-instructions.md` | Single file |
|
|
28
|
-
| Windsurf | `.windsurfrules` | Single file |
|
|
29
|
-
| Cline/Roo | `.clinerules` | Single file |
|
|
30
|
-
| Aider | `.aider.conf.yml` | YAML config |
|
|
31
|
-
|
|
32
|
-
## Rule Categories
|
|
33
|
-
|
|
34
|
-
### Bun APIs
|
|
35
|
-
Prefer Bun's native APIs over Node.js equivalents:
|
|
36
|
-
- `Bun.file()` over `fs` APIs
|
|
37
|
-
- `Bun.$` for shell commands
|
|
38
|
-
- `Bun.write()` for file writes
|
|
39
|
-
- `import.meta.dir` for current directory
|
|
40
|
-
|
|
41
|
-
### Git Workflow
|
|
42
|
-
Commit conventions and version control:
|
|
43
|
-
- Conventional commit prefixes: `feat:`, `fix:`, `refactor:`, `docs:`, `chore:`, `test:`
|
|
44
|
-
- Multi-line commit message formatting
|
|
45
|
-
- Agent-specific sandbox workarounds
|
|
46
|
-
|
|
47
|
-
### GitHub CLI
|
|
48
|
-
Prefer `gh` CLI for GitHub operations:
|
|
49
|
-
- PR review and creation patterns
|
|
50
|
-
- Issue management
|
|
51
|
-
- JSON output field references
|
|
52
|
-
- Authentication benefits over WebFetch
|
|
53
|
-
|
|
54
|
-
### TypeScript Conventions
|
|
55
|
-
Code style standards:
|
|
56
|
-
- Prefer `type` over `interface`
|
|
57
|
-
- No `any` types (use `unknown` with type guards)
|
|
58
|
-
- Arrow functions preferred
|
|
59
|
-
- Object parameter pattern for 2+ parameters
|
|
60
|
-
- PascalCase for types, `PascalCaseSchema` suffix for Zod schemas
|
|
61
|
-
|
|
62
|
-
### Testing Patterns
|
|
63
|
-
Bun test runner conventions:
|
|
64
|
-
- Use `test()` instead of `it()`
|
|
65
|
-
- `*.spec.ts` file naming
|
|
66
|
-
- No conditionals around assertions
|
|
67
|
-
- Assert existence before checking values
|
|
68
|
-
|
|
69
|
-
## Merge Behavior
|
|
70
|
-
|
|
71
|
-
**Always scans existing rules first.** When existing rules are found:
|
|
72
|
-
|
|
73
|
-
1. **Analyze overlap** - Identify sections covering same topics
|
|
74
|
-
2. **Propose merge** - Show what would be added/changed
|
|
75
|
-
3. **User approval** - Ask before modifying:
|
|
76
|
-
- Keep existing (skip new content)
|
|
77
|
-
- Merge (add missing sections)
|
|
78
|
-
- Replace entirely
|
|
79
|
-
|
|
80
|
-
This ensures the command never overwrites user customizations without consent.
|
|
81
|
-
|
|
82
|
-
## Agent Adaptations
|
|
83
|
-
|
|
84
|
-
Content is adapted based on agent capabilities:
|
|
85
|
-
|
|
86
|
-
- **Sandbox awareness**: Include/exclude sandbox workarounds based on agent
|
|
87
|
-
- **Tool references**: Adjust tool names (e.g., "Bash tool" → "terminal")
|
|
88
|
-
- **Format**: Single file vs multi-file based on agent convention
|
|
89
|
-
- **Length**: Condense for agents with size limits
|
|
90
|
-
|
|
91
|
-
## Usage
|
|
92
|
-
|
|
93
|
-
Run the `/scaffold-rules` command to interactively scaffold rules, or invoke when user asks about:
|
|
94
|
-
- "Set up coding conventions"
|
|
95
|
-
- "Configure my AI agent"
|
|
96
|
-
- "Add development rules"
|
|
97
|
-
- "What rules should I have?"
|