@plaited/development-skills 0.5.0 → 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 -9
- package/.plaited/rules/git-workflow.md +36 -0
- package/{.claude → .plaited}/rules/module-organization.md +1 -1
- package/{.claude → .plaited}/rules/testing.md +1 -1
- package/package.json +2 -2
- package/src/lsp-analyze.ts +1 -1
- package/src/lsp-find.ts +1 -1
- package/src/lsp-hover.ts +1 -1
- package/src/lsp-references.ts +1 -1
- package/src/lsp-symbols.ts +1 -1
- package/src/scaffold-rules.ts +148 -204
- package/src/tests/scaffold-rules.spec.ts +148 -118
- package/.claude/commands/lsp-analyze.md +0 -66
- package/.claude/commands/lsp-find.md +0 -74
- package/.claude/commands/lsp-hover.md +0 -57
- package/.claude/commands/lsp-refs.md +0 -64
- 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 -104
- package/.claude/skills/typescript-lsp/SKILL.md +0 -249
- 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,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,104 +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
|
-
### Module Organization
|
|
70
|
-
Import/export patterns for Bun/TypeScript projects:
|
|
71
|
-
- No `index.ts` files—use named re-export files matching folder names
|
|
72
|
-
- Single feature packages expose the feature file directly as main
|
|
73
|
-
- Explicit `.ts` extensions in all imports
|
|
74
|
-
- Flat re-export structure: `src/acp.ts` re-exports from `src/acp/`
|
|
75
|
-
|
|
76
|
-
## Merge Behavior
|
|
77
|
-
|
|
78
|
-
**Always scans existing rules first.** When existing rules are found:
|
|
79
|
-
|
|
80
|
-
1. **Analyze overlap** - Identify sections covering same topics
|
|
81
|
-
2. **Propose merge** - Show what would be added/changed
|
|
82
|
-
3. **User approval** - Ask before modifying:
|
|
83
|
-
- Keep existing (skip new content)
|
|
84
|
-
- Merge (add missing sections)
|
|
85
|
-
- Replace entirely
|
|
86
|
-
|
|
87
|
-
This ensures the command never overwrites user customizations without consent.
|
|
88
|
-
|
|
89
|
-
## Agent Adaptations
|
|
90
|
-
|
|
91
|
-
Content is adapted based on agent capabilities:
|
|
92
|
-
|
|
93
|
-
- **Sandbox awareness**: Include/exclude sandbox workarounds based on agent
|
|
94
|
-
- **Tool references**: Adjust tool names (e.g., "Bash tool" → "terminal")
|
|
95
|
-
- **Format**: Single file vs multi-file based on agent convention
|
|
96
|
-
- **Length**: Condense for agents with size limits
|
|
97
|
-
|
|
98
|
-
## Usage
|
|
99
|
-
|
|
100
|
-
Run the `/scaffold-rules` command to interactively scaffold rules, or invoke when user asks about:
|
|
101
|
-
- "Set up coding conventions"
|
|
102
|
-
- "Configure my AI agent"
|
|
103
|
-
- "Add development rules"
|
|
104
|
-
- "What rules should I have?"
|
|
@@ -1,249 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: typescript-lsp
|
|
3
|
-
description: Search TypeScript SYMBOLS (functions, types, classes) - NOT text. Use Glob to find files, Grep for text search, LSP for symbol search. Provides type-aware results that understand imports, exports, and relationships.
|
|
4
|
-
license: ISC
|
|
5
|
-
compatibility: Requires bun
|
|
6
|
-
allowed-tools: Bash
|
|
7
|
-
metadata:
|
|
8
|
-
file-triggers: "*.ts,*.tsx,*.js,*.jsx"
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# TypeScript LSP Skill
|
|
12
|
-
|
|
13
|
-
## Purpose
|
|
14
|
-
|
|
15
|
-
This skill provides TypeScript Language Server Protocol integration for **exploring and understanding** TypeScript/JavaScript codebases.
|
|
16
|
-
|
|
17
|
-
**IMPORTANT**: Prefer LSP tools over Grep/Glob when working with `*.ts`, `*.tsx`, `*.js`, `*.jsx` files. LSP provides type-aware results that understand imports, exports, and symbol relationships.
|
|
18
|
-
|
|
19
|
-
Use these tools to:
|
|
20
|
-
- **Explore codebases** - Find symbols, understand module structure, discover implementations
|
|
21
|
-
- **Find references** - Type-aware search across the entire codebase (better than grep for symbols)
|
|
22
|
-
- **Understand types** - Get full type signatures, generics, and documentation
|
|
23
|
-
- **Verify before editing** - Check all usages before modifying or deleting exports
|
|
24
|
-
- **Navigate code** - Jump to definitions, find implementations
|
|
25
|
-
|
|
26
|
-
## When to Use Each Tool
|
|
27
|
-
|
|
28
|
-
| Tool | Purpose |
|
|
29
|
-
|------|---------|
|
|
30
|
-
| **Glob** | Find files by pattern |
|
|
31
|
-
| **Grep** | Search text content |
|
|
32
|
-
| **lsp-find** | Search TypeScript symbols |
|
|
33
|
-
| **lsp-hover** | Get type info + TSDoc documentation |
|
|
34
|
-
| **lsp-refs** | Find all references to a symbol |
|
|
35
|
-
| **lsp-analyze** | Batch analysis of file structure |
|
|
36
|
-
|
|
37
|
-
### LSP vs Grep/Glob
|
|
38
|
-
|
|
39
|
-
| Task | Use LSP | Use Grep/Glob |
|
|
40
|
-
|------|---------|---------------|
|
|
41
|
-
| Find all usages of a function/type | ✅ `lsp-refs` | ❌ Misses re-exports, aliases |
|
|
42
|
-
| Search for a symbol by name | ✅ `lsp-find` | ❌ Matches strings, comments |
|
|
43
|
-
| Get type signature + TSDoc | ✅ `lsp-hover` | ❌ Not possible |
|
|
44
|
-
| Understand file exports | ✅ `lsp-analyze --exports` | ❌ Doesn't resolve re-exports |
|
|
45
|
-
| Find files by pattern | ❌ | ✅ `Glob` |
|
|
46
|
-
| Search non-TS files (md, json) | ❌ | ✅ `Grep` |
|
|
47
|
-
| Search for text in comments/strings | ❌ | ✅ `Grep` |
|
|
48
|
-
|
|
49
|
-
## When to Use
|
|
50
|
-
|
|
51
|
-
**Exploring code (prefer LSP):**
|
|
52
|
-
- Run `lsp-find` to search for symbols across the workspace
|
|
53
|
-
- Run `lsp-symbols` to get an overview of file structure
|
|
54
|
-
- Run `lsp-analyze --exports` to see what a module provides
|
|
55
|
-
|
|
56
|
-
**Before editing code:**
|
|
57
|
-
- Run `lsp-references` to find all usages of a symbol you plan to modify
|
|
58
|
-
- Run `lsp-hover` to verify current type signatures
|
|
59
|
-
|
|
60
|
-
**Before writing code:**
|
|
61
|
-
- Run `lsp-find` to search for similar patterns or related symbols
|
|
62
|
-
- Run `lsp-hover` on APIs you plan to use
|
|
63
|
-
|
|
64
|
-
## Path Resolution
|
|
65
|
-
|
|
66
|
-
All scripts accept three types of file paths:
|
|
67
|
-
- **Absolute paths**: `/Users/name/project/src/file.ts`
|
|
68
|
-
- **Relative paths**: `./src/file.ts` or `../other/file.ts`
|
|
69
|
-
- **Package export paths**: `my-package/src/module.ts` (resolved via `Bun.resolve()`)
|
|
70
|
-
|
|
71
|
-
Package export paths are recommended for portability and consistency with the package's exports field.
|
|
72
|
-
|
|
73
|
-
## Scripts
|
|
74
|
-
|
|
75
|
-
### Individual Scripts
|
|
76
|
-
|
|
77
|
-
#### lsp-hover
|
|
78
|
-
Get type information at a specific position.
|
|
79
|
-
|
|
80
|
-
```bash
|
|
81
|
-
bunx @plaited/development-skills lsp-hover <file> <line> <char>
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
**Arguments:**
|
|
85
|
-
- `file`: Path to TypeScript/JavaScript file
|
|
86
|
-
- `line`: Line number (0-indexed)
|
|
87
|
-
- `char`: Character position (0-indexed)
|
|
88
|
-
|
|
89
|
-
**Example:**
|
|
90
|
-
```bash
|
|
91
|
-
bunx @plaited/development-skills lsp-hover src/utils/parser.ts 42 10
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
#### lsp-symbols
|
|
95
|
-
List all symbols in a file.
|
|
96
|
-
|
|
97
|
-
```bash
|
|
98
|
-
bunx @plaited/development-skills lsp-symbols <file>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
**Example:**
|
|
102
|
-
```bash
|
|
103
|
-
bunx @plaited/development-skills lsp-symbols src/utils/parser.ts
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
#### lsp-references
|
|
107
|
-
Find all references to a symbol.
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
bunx @plaited/development-skills lsp-refs <file> <line> <char>
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
**Example:**
|
|
114
|
-
```bash
|
|
115
|
-
bunx @plaited/development-skills lsp-refs src/utils/parser.ts 42 10
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
#### lsp-find
|
|
119
|
-
Search for symbols across the workspace.
|
|
120
|
-
|
|
121
|
-
```bash
|
|
122
|
-
bunx @plaited/development-skills lsp-find <query> [context-file]
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
**Arguments:**
|
|
126
|
-
- `query`: Symbol name or partial name
|
|
127
|
-
- `context-file`: Optional file to open for project context
|
|
128
|
-
|
|
129
|
-
**Example:**
|
|
130
|
-
```bash
|
|
131
|
-
bunx @plaited/development-skills lsp-find parseConfig
|
|
132
|
-
bunx @plaited/development-skills lsp-find validateInput src/lib/validator.ts
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
### Batch Script
|
|
136
|
-
|
|
137
|
-
#### lsp-analyze
|
|
138
|
-
Perform multiple analyses in a single session for efficiency.
|
|
139
|
-
|
|
140
|
-
```bash
|
|
141
|
-
bunx @plaited/development-skills lsp-analyze <file> [options]
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
**Options:**
|
|
145
|
-
- `--symbols, -s`: List all symbols
|
|
146
|
-
- `--exports, -e`: List only exported symbols
|
|
147
|
-
- `--hover <line:char>`: Get type info (repeatable)
|
|
148
|
-
- `--refs <line:char>`: Find references (repeatable)
|
|
149
|
-
- `--all`: Run symbols + exports analysis
|
|
150
|
-
|
|
151
|
-
**Examples:**
|
|
152
|
-
```bash
|
|
153
|
-
# Get file overview
|
|
154
|
-
bunx @plaited/development-skills lsp-analyze src/utils/parser.ts --all
|
|
155
|
-
|
|
156
|
-
# Check multiple positions
|
|
157
|
-
bunx @plaited/development-skills lsp-analyze src/utils/parser.ts --hover 50:10 --hover 75:5
|
|
158
|
-
|
|
159
|
-
# Before refactoring: find all references
|
|
160
|
-
bunx @plaited/development-skills lsp-analyze src/utils/parser.ts --refs 42:10
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
## Common Workflows
|
|
164
|
-
|
|
165
|
-
### Understanding a File
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
# 1. Get exports overview
|
|
169
|
-
bunx @plaited/development-skills lsp-analyze path/to/file.ts --exports
|
|
170
|
-
|
|
171
|
-
# 2. For specific type info, hover on interesting symbols
|
|
172
|
-
bunx @plaited/development-skills lsp-hover path/to/file.ts <line> <char>
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
### Before Modifying an Export
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
# 1. Find all references first
|
|
179
|
-
bunx @plaited/development-skills lsp-refs path/to/file.ts <line> <char>
|
|
180
|
-
|
|
181
|
-
# 2. Check what depends on it
|
|
182
|
-
# Review the output to understand impact
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### Finding Patterns
|
|
186
|
-
|
|
187
|
-
```bash
|
|
188
|
-
# Search for similar implementations
|
|
189
|
-
bunx @plaited/development-skills lsp-find handleRequest
|
|
190
|
-
bunx @plaited/development-skills lsp-find parseConfig
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### Pre-Implementation Verification
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
# Before writing code that uses an API, verify its signature
|
|
197
|
-
bunx @plaited/development-skills lsp-hover path/to/api.ts <line> <char>
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
## Output Format
|
|
201
|
-
|
|
202
|
-
All scripts output JSON to stdout. Errors go to stderr.
|
|
203
|
-
|
|
204
|
-
**Hover output:**
|
|
205
|
-
```json
|
|
206
|
-
{
|
|
207
|
-
"contents": {
|
|
208
|
-
"kind": "markdown",
|
|
209
|
-
"value": "```typescript\nconst parseConfig: (options: Options) => Config\n```"
|
|
210
|
-
},
|
|
211
|
-
"range": { "start": {...}, "end": {...} }
|
|
212
|
-
}
|
|
213
|
-
```
|
|
214
|
-
|
|
215
|
-
**Symbols output:**
|
|
216
|
-
```json
|
|
217
|
-
[
|
|
218
|
-
{
|
|
219
|
-
"name": "symbolName",
|
|
220
|
-
"kind": 13,
|
|
221
|
-
"range": { "start": {...}, "end": {...} }
|
|
222
|
-
}
|
|
223
|
-
]
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
**Analyze output:**
|
|
227
|
-
```json
|
|
228
|
-
{
|
|
229
|
-
"file": "path/to/file.ts",
|
|
230
|
-
"exports": [
|
|
231
|
-
{ "name": "exportName", "kind": "Constant", "line": 139 }
|
|
232
|
-
]
|
|
233
|
-
}
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
## Performance
|
|
237
|
-
|
|
238
|
-
Each script invocation:
|
|
239
|
-
1. Starts TypeScript Language Server (~300-500ms)
|
|
240
|
-
2. Initializes LSP connection
|
|
241
|
-
3. Opens document
|
|
242
|
-
4. Performs query
|
|
243
|
-
5. Closes and stops
|
|
244
|
-
|
|
245
|
-
For multiple queries on the same file, use `lsp-analyze` to batch operations in a single session.
|
|
246
|
-
|
|
247
|
-
## Related Skills
|
|
248
|
-
|
|
249
|
-
- **code-documentation**: TSDoc standards for documentation
|