@martinffx/atelier 0.1.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/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/README.md +285 -0
- package/agents/architect.md +38 -0
- package/agents/oracle.md +40 -0
- package/agents/recon.md +39 -0
- package/dist/atelier.js +33082 -0
- package/package.json +44 -0
- package/skills/code-conventional-commit/SKILL.md +134 -0
- package/skills/code-conventional-commit/evals/evals.json +23 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-0/with_skill/outputs/commit-message.txt +4 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-0/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-1/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-1/with_skill/outputs/validation-result.txt +16 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-2/with_skill/outputs/commit-message.txt +8 -0
- package/skills/code-conventional-commit/workspace/iteration-1/eval-2/with_skill/outputs/eval_metadata.json +6 -0
- package/skills/code-conventional-commit/workspace/iteration-1/report.html +1325 -0
- package/skills/code-debug/SKILL.md +271 -0
- package/skills/code-debug/references/language-tools.md +139 -0
- package/skills/code-debug/references/techniques.md +117 -0
- package/skills/code-docs/SKILL.md +171 -0
- package/skills/code-docs/references/api-docs.md +116 -0
- package/skills/code-docs/references/changelog.md +64 -0
- package/skills/code-docs/references/readme-structure.md +94 -0
- package/skills/code-git-worktrees/SKILL.md +218 -0
- package/skills/code-perf/SKILL.md +163 -0
- package/skills/code-perf/references/common-bottlenecks.md +124 -0
- package/skills/code-perf/references/optimization-patterns.md +167 -0
- package/skills/code-perf/references/profiling-tools.md +126 -0
- package/skills/code-review/SKILL.md +78 -0
- package/skills/code-review/references/output.md +200 -0
- package/skills/code-review/references/reviewers.md +719 -0
- package/skills/code-review/references/rq.md +357 -0
- package/skills/code-review/references/rs.md +30 -0
- package/skills/code-security/SKILL.md +183 -0
- package/skills/code-security/references/owasp-top-10.md +129 -0
- package/skills/code-security/references/security-tools.md +102 -0
- package/skills/code-security/references/vulnerability-patterns.md +129 -0
- package/skills/code-stacked-commit/SKILL.md +155 -0
- package/skills/code-subagents/SKILL.md +184 -0
- package/skills/code-subagents/references/code-quality-reviewer-prompt.md +48 -0
- package/skills/code-subagents/references/implementor-prompt.md +79 -0
- package/skills/code-subagents/references/spec-reviewer-prompt.md +62 -0
- package/skills/oracle-architect/SKILL.md +246 -0
- package/skills/oracle-architect/references/api-design.md +345 -0
- package/skills/oracle-architect/references/data-modeling.md +318 -0
- package/skills/oracle-architect/references/ddd-patterns.md +247 -0
- package/skills/oracle-challenge/SKILL.md +126 -0
- package/skills/oracle-testing/SKILL.md +237 -0
- package/skills/oracle-testing/references/anti-patterns.md +618 -0
- package/skills/oracle-testing/references/boundaries.md +579 -0
- package/skills/oracle-testing/references/core-testing.md +691 -0
- package/skills/oracle-testing/references/edge-testing.md +794 -0
- package/skills/oracle-testing/references/stub-driven-tdd.md +322 -0
- package/skills/oracle-thinkdeep/SKILL.md +164 -0
- package/skills/python-architecture/SKILL.md +148 -0
- package/skills/python-architecture/references/data-modeling.md +558 -0
- package/skills/python-architecture/references/ddd.md +569 -0
- package/skills/python-architecture/references/functional-core.md +337 -0
- package/skills/python-build-tools/SKILL.md +153 -0
- package/skills/python-build-tools/references/basedpyright.md +321 -0
- package/skills/python-build-tools/references/ruff.md +225 -0
- package/skills/python-build-tools/references/uv.md +257 -0
- package/skills/python-fastapi/SKILL.md +184 -0
- package/skills/python-fastapi/references/api-design.md +563 -0
- package/skills/python-fastapi/references/dependencies.md +479 -0
- package/skills/python-fastapi/references/middleware.md +475 -0
- package/skills/python-fastapi/references/validation.md +497 -0
- package/skills/python-modern-python/SKILL.md +201 -0
- package/skills/python-modern-python/references/async.md +76 -0
- package/skills/python-modern-python/references/pattern-matching.md +89 -0
- package/skills/python-modern-python/references/typing.md +96 -0
- package/skills/python-monorepo/SKILL.md +146 -0
- package/skills/python-monorepo/references/docker.md +515 -0
- package/skills/python-monorepo/references/namespace-packages.md +426 -0
- package/skills/python-monorepo/references/workspace-config.md +341 -0
- package/skills/python-sqlalchemy/SKILL.md +119 -0
- package/skills/python-sqlalchemy/references/async.md +51 -0
- package/skills/python-sqlalchemy/references/models.md +67 -0
- package/skills/python-sqlalchemy/references/queries.md +57 -0
- package/skills/python-temporal/SKILL.md +128 -0
- package/skills/python-temporal/references/patterns.md +87 -0
- package/skills/python-temporal/references/testing.md +54 -0
- package/skills/python-testing/SKILL.md +161 -0
- package/skills/python-testing/references/boundaries.md +449 -0
- package/skills/python-testing/references/mocking.md +449 -0
- package/skills/python-testing/references/pytest.md +524 -0
- package/skills/spec-brainstorm/SKILL.md +325 -0
- package/skills/spec-finish/SKILL.md +159 -0
- package/skills/spec-implement/SKILL.md +296 -0
- package/skills/spec-orchestrator/SKILL.md +156 -0
- package/skills/spec-plan/SKILL.md +248 -0
- package/skills/typescript-api-design/SKILL.md +396 -0
- package/skills/typescript-api-design/references/error-responses.md +469 -0
- package/skills/typescript-build-tools/SKILL.md +447 -0
- package/skills/typescript-build-tools/references/biome.md +436 -0
- package/skills/typescript-build-tools/references/bun.md +432 -0
- package/skills/typescript-build-tools/references/turborepo.md +426 -0
- package/skills/typescript-build-tools/references/vitest.md +518 -0
- package/skills/typescript-drizzle-orm/SKILL.md +398 -0
- package/skills/typescript-drizzle-orm/references/cloudflare.md +392 -0
- package/skills/typescript-drizzle-orm/references/entity-pattern.md +412 -0
- package/skills/typescript-drizzle-orm/references/postgresql.md +191 -0
- package/skills/typescript-drizzle-orm/references/repository-pattern.md +479 -0
- package/skills/typescript-drizzle-orm/references/sqlite.md +291 -0
- package/skills/typescript-dynamodb-toolbox/SKILL.md +370 -0
- package/skills/typescript-dynamodb-toolbox/references/entity-layer.md +574 -0
- package/skills/typescript-dynamodb-toolbox/references/error-handling.md +495 -0
- package/skills/typescript-dynamodb-toolbox/references/modeling.md +332 -0
- package/skills/typescript-dynamodb-toolbox/references/repository-layer.md +631 -0
- package/skills/typescript-dynamodb-toolbox/references/testing.md +718 -0
- package/skills/typescript-dynamodb-toolbox/references/transactions.md +423 -0
- package/skills/typescript-effect-ts/SKILL.md +341 -0
- package/skills/typescript-effect-ts/references/core.md +412 -0
- package/skills/typescript-effect-ts/references/error-handling.md +468 -0
- package/skills/typescript-effect-ts/references/resources.md +476 -0
- package/skills/typescript-effect-ts/references/schema.md +536 -0
- package/skills/typescript-effect-ts/references/services.md +461 -0
- package/skills/typescript-fastify/SKILL.md +405 -0
- package/skills/typescript-fastify/references/plugins.md +329 -0
- package/skills/typescript-fastify/references/typeid.md +315 -0
- package/skills/typescript-functional-patterns/SKILL.md +402 -0
- package/skills/typescript-functional-patterns/references/adts.md +497 -0
- package/skills/typescript-functional-patterns/references/branded-types.md +542 -0
- package/skills/typescript-functional-patterns/references/migration-guide.md +695 -0
- package/skills/typescript-functional-patterns/references/option-result.md +585 -0
- package/skills/typescript-testing/SKILL.md +353 -0
- package/skills/typescript-testing/references/mocking.md +675 -0
- package/skills/typescript-testing/references/msw.md +852 -0
- package/skills/typescript-testing/references/snapshot-testing.md +774 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# API Documentation Tools
|
|
2
|
+
|
|
3
|
+
## TypeScript/JavaScript
|
|
4
|
+
|
|
5
|
+
### TypeDoc
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install --save-dev typedoc
|
|
9
|
+
|
|
10
|
+
# Generate
|
|
11
|
+
npx typedoc --out docs src/index.ts
|
|
12
|
+
|
|
13
|
+
# Options
|
|
14
|
+
--entryPoints src/
|
|
15
|
+
--out docs/
|
|
16
|
+
--name "My Project"
|
|
17
|
+
--theme default
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### JSDoc
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install --save-dev jsdoc
|
|
24
|
+
|
|
25
|
+
# Generate
|
|
26
|
+
npx jsdoc src/ -d docs/
|
|
27
|
+
|
|
28
|
+
# Config (jsdoc.json)
|
|
29
|
+
{
|
|
30
|
+
"source": {
|
|
31
|
+
"includePattern": ".+\\.js(doc)?$"
|
|
32
|
+
},
|
|
33
|
+
"opts": {
|
|
34
|
+
"destination": "./docs/"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Python
|
|
42
|
+
|
|
43
|
+
### Sphinx
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pip install sphinx
|
|
47
|
+
|
|
48
|
+
# Initialize
|
|
49
|
+
sphinx-quickstart
|
|
50
|
+
|
|
51
|
+
# Build
|
|
52
|
+
make html
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### pdoc
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
pip install pdoc
|
|
59
|
+
|
|
60
|
+
# Generate
|
|
61
|
+
pdoc --output-dir docs src/
|
|
62
|
+
pdoc --logo logo.png src/ # With logo
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Go
|
|
68
|
+
|
|
69
|
+
### godoc
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Install
|
|
73
|
+
go install golang.org/x/tools/cmd/godoc@latest
|
|
74
|
+
|
|
75
|
+
# Run locally
|
|
76
|
+
godoc -http=:6060
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### swag (OpenAPI)
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
go install github.com/swaggo/swag/cmd/swag@latest
|
|
83
|
+
|
|
84
|
+
# Generate from annotations
|
|
85
|
+
swag init -g cmd/server/main.go
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## OpenAPI/Swagger
|
|
91
|
+
|
|
92
|
+
### tools
|
|
93
|
+
|
|
94
|
+
- swagger-cli validate
|
|
95
|
+
- @apidevtools/swagger-cli
|
|
96
|
+
- redoc CLI
|
|
97
|
+
|
|
98
|
+
### Annotations Example
|
|
99
|
+
|
|
100
|
+
```javascript
|
|
101
|
+
/**
|
|
102
|
+
* @openapi
|
|
103
|
+
* /users:
|
|
104
|
+
* get:
|
|
105
|
+
* summary: List users
|
|
106
|
+
* responses:
|
|
107
|
+
* 200:
|
|
108
|
+
* description: User list
|
|
109
|
+
* content:
|
|
110
|
+
* application/json:
|
|
111
|
+
* schema:
|
|
112
|
+
* type: array
|
|
113
|
+
* items:
|
|
114
|
+
* $ref: '#/components/schemas/User'
|
|
115
|
+
*/
|
|
116
|
+
```
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Changelog Format
|
|
2
|
+
|
|
3
|
+
## Keep a Changelog
|
|
4
|
+
|
|
5
|
+
Follow: https://keepachangelog.com
|
|
6
|
+
|
|
7
|
+
## Format
|
|
8
|
+
|
|
9
|
+
```markdown
|
|
10
|
+
# Changelog
|
|
11
|
+
|
|
12
|
+
All notable changes to this project will be documented in this file.
|
|
13
|
+
|
|
14
|
+
## [Unreleased]
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- New feature
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Changed behavior
|
|
21
|
+
|
|
22
|
+
### Deprecated
|
|
23
|
+
- Soon-to-be removed feature
|
|
24
|
+
|
|
25
|
+
### Removed
|
|
26
|
+
- Now removed feature
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
- Bug fix
|
|
30
|
+
|
|
31
|
+
### Security
|
|
32
|
+
- Security improvement
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Version Template
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
## [1.0.0] - 2024-01-15
|
|
39
|
+
|
|
40
|
+
### Added
|
|
41
|
+
- Users can now authenticate via OAuth
|
|
42
|
+
- New /api/users/:id endpoint
|
|
43
|
+
|
|
44
|
+
### Changed
|
|
45
|
+
- Authentication now uses JWT tokens
|
|
46
|
+
|
|
47
|
+
### Fixed
|
|
48
|
+
- Fixed race condition in user creation
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Rules
|
|
52
|
+
|
|
53
|
+
1. One version per section
|
|
54
|
+
2. Chronological order (newest first)
|
|
55
|
+
3. Link to issues/pr
|
|
56
|
+
4. Mention breaking changes
|
|
57
|
+
5. Use imperative mood
|
|
58
|
+
|
|
59
|
+
## Example Entry
|
|
60
|
+
|
|
61
|
+
```markdown
|
|
62
|
+
### Added
|
|
63
|
+
- Add user profile endpoint (#123, @username)
|
|
64
|
+
```
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# README Structure
|
|
2
|
+
|
|
3
|
+
## Quick Template
|
|
4
|
+
|
|
5
|
+
```markdown
|
|
6
|
+
# Project Name
|
|
7
|
+
|
|
8
|
+
One-sentence description.
|
|
9
|
+
|
|
10
|
+
[](link)
|
|
11
|
+
[](link)
|
|
12
|
+
[](link)
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- Feature 1
|
|
17
|
+
- Feature 2
|
|
18
|
+
- Feature 3
|
|
19
|
+
|
|
20
|
+
## Quick Start
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npm install package-name
|
|
24
|
+
npm start
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
### Prerequisites
|
|
30
|
+
|
|
31
|
+
- Node.js 18+
|
|
32
|
+
- npm 9+
|
|
33
|
+
|
|
34
|
+
### Steps
|
|
35
|
+
|
|
36
|
+
1. Clone repo
|
|
37
|
+
2. Install deps: npm install
|
|
38
|
+
3. Configure: cp .env.example .env
|
|
39
|
+
4. Run: npm run dev
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
const pkg = require('package-name');
|
|
45
|
+
|
|
46
|
+
pkg.doSomething();
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## API
|
|
50
|
+
|
|
51
|
+
See [API Documentation](docs/api.md).
|
|
52
|
+
|
|
53
|
+
## Configuration
|
|
54
|
+
|
|
55
|
+
| Env | Description | Default |
|
|
56
|
+
|-----|-------------|---------|
|
|
57
|
+
| PORT | Server port | 3000 |
|
|
58
|
+
| DB_URL | Database connection | localhost |
|
|
59
|
+
|
|
60
|
+
## Development
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
npm run dev # Start dev server
|
|
64
|
+
npm test # Run tests
|
|
65
|
+
npm run lint # Lint
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Contributing
|
|
69
|
+
|
|
70
|
+
1. Fork
|
|
71
|
+
2. Branch: feature/my-feature
|
|
72
|
+
3. Commit
|
|
73
|
+
4. PR
|
|
74
|
+
|
|
75
|
+
## License
|
|
76
|
+
|
|
77
|
+
MIT
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Sections to Include
|
|
81
|
+
|
|
82
|
+
| Section | Required | Description |
|
|
83
|
+
|---------|----------|-------------|
|
|
84
|
+
| Title + Badges | Yes | Project name, version, status |
|
|
85
|
+
| Description | Yes | What it does |
|
|
86
|
+
| Features | Yes | Key capabilities |
|
|
87
|
+
| Quick Start | Yes | 3-5 commands |
|
|
88
|
+
| Installation | No | Detailed setup |
|
|
89
|
+
| Usage | No | Code examples |
|
|
90
|
+
| API | No | For libraries |
|
|
91
|
+
| Configuration | No | Env vars, settings |
|
|
92
|
+
| Development | No | Dev commands |
|
|
93
|
+
| Contributing | No | How to contribute |
|
|
94
|
+
| License | Yes | Open source license |
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-git-worktrees
|
|
3
|
+
description: Use when starting feature work that needs isolation from current workspace - creates isolated git worktrees with smart directory selection and safety verification. Triggers on worktree, git worktree, isolated workspace, or creating a new branch for feature work.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Using Git Worktrees
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Git worktrees create isolated workspaces sharing the same repository, allowing work on multiple branches simultaneously without switching.
|
|
12
|
+
|
|
13
|
+
**Core principle:** Systematic directory selection + safety verification = reliable isolation.
|
|
14
|
+
|
|
15
|
+
**Announce at start:** "I'm using the using-git-worktrees skill to set up an isolated workspace."
|
|
16
|
+
|
|
17
|
+
## Directory Selection Process
|
|
18
|
+
|
|
19
|
+
Follow this priority order:
|
|
20
|
+
|
|
21
|
+
### 1. Check Existing Directories
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Check in priority order
|
|
25
|
+
ls -d .worktrees 2>/dev/null # Preferred (hidden)
|
|
26
|
+
ls -d worktrees 2>/dev/null # Alternative
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**If found:** Use that directory. If both exist, `.worktrees` wins.
|
|
30
|
+
|
|
31
|
+
### 2. Check AGENTS.md
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
grep -i "worktree.*director" AGENTS.md 2>/dev/null
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**If preference specified:** Use it without asking.
|
|
38
|
+
|
|
39
|
+
### 3. Ask User
|
|
40
|
+
|
|
41
|
+
If no directory exists and no AGENTS.md preference:
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
No worktree directory found. Where should I create worktrees?
|
|
45
|
+
|
|
46
|
+
1. .worktrees/ (project-local, hidden)
|
|
47
|
+
2. ~/.config/superpowers/worktrees/<project-name>/ (global location)
|
|
48
|
+
|
|
49
|
+
Which would you prefer?
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Safety Verification
|
|
53
|
+
|
|
54
|
+
### For Project-Local Directories (.worktrees or worktrees)
|
|
55
|
+
|
|
56
|
+
**MUST verify directory is ignored before creating worktree:**
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Check if directory is ignored (respects local, global, and system gitignore)
|
|
60
|
+
git check-ignore -q .worktrees 2>/dev/null || git check-ignore -q worktrees 2>/dev/null
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**If NOT ignored:**
|
|
64
|
+
|
|
65
|
+
Per Jesse's rule "Fix broken things immediately":
|
|
66
|
+
1. Add appropriate line to .gitignore
|
|
67
|
+
2. Commit the change
|
|
68
|
+
3. Proceed with worktree creation
|
|
69
|
+
|
|
70
|
+
**Why critical:** Prevents accidentally committing worktree contents to repository.
|
|
71
|
+
|
|
72
|
+
### For Global Directory (~/.config/superpowers/worktrees)
|
|
73
|
+
|
|
74
|
+
No .gitignore verification needed - outside project entirely.
|
|
75
|
+
|
|
76
|
+
## Creation Steps
|
|
77
|
+
|
|
78
|
+
### 1. Detect Project Name
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
project=$(basename "$(git rev-parse --show-toplevel)")
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 2. Create Worktree
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Determine full path
|
|
88
|
+
case $LOCATION in
|
|
89
|
+
.worktrees|worktrees)
|
|
90
|
+
path="$LOCATION/$BRANCH_NAME"
|
|
91
|
+
;;
|
|
92
|
+
~/.config/superpowers/worktrees/*)
|
|
93
|
+
path="~/.config/superpowers/worktrees/$project/$BRANCH_NAME"
|
|
94
|
+
;;
|
|
95
|
+
esac
|
|
96
|
+
|
|
97
|
+
# Create worktree with new branch
|
|
98
|
+
git worktree add "$path" -b "$BRANCH_NAME"
|
|
99
|
+
cd "$path"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 3. Run Project Setup
|
|
103
|
+
|
|
104
|
+
Auto-detect and run appropriate setup:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Node.js
|
|
108
|
+
if [ -f package.json ]; then npm install; fi
|
|
109
|
+
|
|
110
|
+
# Rust
|
|
111
|
+
if [ -f Cargo.toml ]; then cargo build; fi
|
|
112
|
+
|
|
113
|
+
# Python
|
|
114
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
115
|
+
if [ -f pyproject.toml ]; then poetry install; fi
|
|
116
|
+
|
|
117
|
+
# Go
|
|
118
|
+
if [ -f go.mod ]; then go mod download; fi
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 4. Verify Clean Baseline
|
|
122
|
+
|
|
123
|
+
Run tests to ensure worktree starts clean:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Examples - use project-appropriate command
|
|
127
|
+
npm test
|
|
128
|
+
cargo test
|
|
129
|
+
pytest
|
|
130
|
+
go test ./...
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**If tests fail:** Report failures, ask whether to proceed or investigate.
|
|
134
|
+
|
|
135
|
+
**If tests pass:** Report ready.
|
|
136
|
+
|
|
137
|
+
### 5. Report Location
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
Worktree ready at <full-path>
|
|
141
|
+
Tests passing (<N> tests, 0 failures)
|
|
142
|
+
Ready to implement <feature-name>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Quick Reference
|
|
146
|
+
|
|
147
|
+
| Situation | Action |
|
|
148
|
+
|-----------|--------|
|
|
149
|
+
| `.worktrees/` exists | Use it (verify ignored) |
|
|
150
|
+
| `worktrees/` exists | Use it (verify ignored) |
|
|
151
|
+
| Both exist | Use `.worktrees/` |
|
|
152
|
+
| Neither exists | Check AGENTS.md → Ask user |
|
|
153
|
+
| Directory not ignored | Add to .gitignore + commit |
|
|
154
|
+
| Tests fail during baseline | Report failures + ask |
|
|
155
|
+
| No package.json/Cargo.toml | Skip dependency install |
|
|
156
|
+
|
|
157
|
+
## Common Mistakes
|
|
158
|
+
|
|
159
|
+
### Skipping ignore verification
|
|
160
|
+
|
|
161
|
+
- **Problem:** Worktree contents get tracked, pollute git status
|
|
162
|
+
- **Fix:** Always use `git check-ignore` before creating project-local worktree
|
|
163
|
+
|
|
164
|
+
### Assuming directory location
|
|
165
|
+
|
|
166
|
+
- **Problem:** Creates inconsistency, violates project conventions
|
|
167
|
+
- **Fix:** Follow priority: existing > AGENTS.md > ask
|
|
168
|
+
|
|
169
|
+
### Proceeding with failing tests
|
|
170
|
+
|
|
171
|
+
- **Problem:** Can't distinguish new bugs from pre-existing issues
|
|
172
|
+
- **Fix:** Report failures, get explicit permission to proceed
|
|
173
|
+
|
|
174
|
+
### Hardcoding setup commands
|
|
175
|
+
|
|
176
|
+
- **Problem:** Breaks on projects using different tools
|
|
177
|
+
- **Fix:** Auto-detect from project files (package.json, etc.)
|
|
178
|
+
|
|
179
|
+
## Example Workflow
|
|
180
|
+
|
|
181
|
+
```
|
|
182
|
+
You: I'm using the using-git-worktrees skill to set up an isolated workspace.
|
|
183
|
+
|
|
184
|
+
[Check .worktrees/ - exists]
|
|
185
|
+
[Verify ignored - git check-ignore confirms .worktrees/ is ignored]
|
|
186
|
+
[Create worktree: git worktree add .worktrees/auth -b feature/auth]
|
|
187
|
+
[Run npm install]
|
|
188
|
+
[Run npm test - 47 passing]
|
|
189
|
+
|
|
190
|
+
Worktree ready at /Users/jesse/myproject/.worktrees/auth
|
|
191
|
+
Tests passing (47 tests, 0 failures)
|
|
192
|
+
Ready to implement auth feature
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Red Flags
|
|
196
|
+
|
|
197
|
+
**Never:**
|
|
198
|
+
- Create worktree without verifying it's ignored (project-local)
|
|
199
|
+
- Skip baseline test verification
|
|
200
|
+
- Proceed with failing tests without asking
|
|
201
|
+
- Assume directory location when ambiguous
|
|
202
|
+
- Skip AGENTS.md check
|
|
203
|
+
|
|
204
|
+
**Always:**
|
|
205
|
+
- Follow directory priority: existing > AGENTS.md > ask
|
|
206
|
+
- Verify directory is ignored for project-local
|
|
207
|
+
- Auto-detect and run project setup
|
|
208
|
+
- Verify clean test baseline
|
|
209
|
+
|
|
210
|
+
## Integration
|
|
211
|
+
|
|
212
|
+
**Called by:**
|
|
213
|
+
- Any skill needing isolated workspace for feature work
|
|
214
|
+
- When user explicitly requests worktree setup
|
|
215
|
+
- Before long-running implementation tasks that could pollute current workspace
|
|
216
|
+
|
|
217
|
+
**Pairs with:**
|
|
218
|
+
- `stacked-commit` - Use worktrees when managing stacked commits across multiple branches
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-perf
|
|
3
|
+
description: >
|
|
4
|
+
Performance profiling and optimization. Use when code is slow, has memory issues, or needs
|
|
5
|
+
optimization. Triggers on "slow", "performance", "optimize", "memory leak", "profiling",
|
|
6
|
+
"bottleneck", or any performance-related concern.
|
|
7
|
+
user-invocable: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Code Perf
|
|
11
|
+
|
|
12
|
+
Performance profiling and optimization workflow.
|
|
13
|
+
|
|
14
|
+
## The Golden Rule
|
|
15
|
+
|
|
16
|
+
**Never optimize without profiling.**
|
|
17
|
+
|
|
18
|
+
You don't know where the bottleneck is until you measure. Making changes without
|
|
19
|
+
profiling wastes time and often makes things worse.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Workflow
|
|
24
|
+
|
|
25
|
+
### 1. Profile
|
|
26
|
+
|
|
27
|
+
Measure the current performance.
|
|
28
|
+
|
|
29
|
+
**Questions:**
|
|
30
|
+
- What's slow? (endpoint, operation, page load)
|
|
31
|
+
- How slow? (latency, throughput)
|
|
32
|
+
- Under what conditions? (load, data size)
|
|
33
|
+
|
|
34
|
+
**Tools:**
|
|
35
|
+
- Browser DevTools (Performance tab)
|
|
36
|
+
- Node clinic.js
|
|
37
|
+
- Python cProfile
|
|
38
|
+
- Go pprof
|
|
39
|
+
|
|
40
|
+
### 2. Identify
|
|
41
|
+
|
|
42
|
+
Find the hot paths.
|
|
43
|
+
|
|
44
|
+
**Look for:**
|
|
45
|
+
- Functions called many times
|
|
46
|
+
- Large memory allocations
|
|
47
|
+
- Blocking I/O
|
|
48
|
+
- Unnecessary computations
|
|
49
|
+
|
|
50
|
+
### 3. Optimize
|
|
51
|
+
|
|
52
|
+
Apply the right optimization pattern.
|
|
53
|
+
|
|
54
|
+
### 4. Verify
|
|
55
|
+
|
|
56
|
+
Re-profile to confirm improvement.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Common Bottlenecks
|
|
61
|
+
|
|
62
|
+
See references/common-bottlenecks.md for detailed patterns:
|
|
63
|
+
|
|
64
|
+
| Pattern | Symptom | Solution |
|
|
65
|
+
|---------|---------|----------|
|
|
66
|
+
| N+1 | Multiple DB queries | Eager load, batch |
|
|
67
|
+
| Memory leak | Growing RSS | Clear caches, weak refs |
|
|
68
|
+
| Blocking I/O | Thread blocked | Async, worker pool |
|
|
69
|
+
| Unnecessary work | CPU high | Skip redundant calc |
|
|
70
|
+
| Large data | Slow serialization | Pagination, streams |
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Optimization Patterns
|
|
75
|
+
|
|
76
|
+
See references/optimization-patterns.md for:
|
|
77
|
+
|
|
78
|
+
### Caching
|
|
79
|
+
|
|
80
|
+
```javascript
|
|
81
|
+
// Before: every call hits DB
|
|
82
|
+
const user = await db.users.find(id);
|
|
83
|
+
|
|
84
|
+
// After: cache
|
|
85
|
+
const cacheKey = `user:${id}`;
|
|
86
|
+
let user = await redis.get(cacheKey);
|
|
87
|
+
if (!user) {
|
|
88
|
+
user = await db.users.find(id);
|
|
89
|
+
await redis.set(cacheKey, user, 'EX', 300);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Lazy Loading
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
// Before: load everything
|
|
97
|
+
const allUsers = await db.users.findMany();
|
|
98
|
+
|
|
99
|
+
// After: paginate
|
|
100
|
+
const users = await db.users.findMany({
|
|
101
|
+
take: 20,
|
|
102
|
+
skip: page * 20
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Connection Pooling
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
// Before: new connection each time
|
|
110
|
+
const client = new Client();
|
|
111
|
+
await client.connect();
|
|
112
|
+
|
|
113
|
+
// After: pool
|
|
114
|
+
const pool = new Pool({ max: 20 });
|
|
115
|
+
// Use pool.query() throughout
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Profiling Tools
|
|
121
|
+
|
|
122
|
+
See references/profiling-tools.md for:
|
|
123
|
+
|
|
124
|
+
### Node.js
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# CPU profiling
|
|
128
|
+
node --prof app.js
|
|
129
|
+
|
|
130
|
+
# Memory
|
|
131
|
+
node --inspect app.js # Chrome DevTools
|
|
132
|
+
|
|
133
|
+
# clinic.js
|
|
134
|
+
npx clinic doctor -- node app.js
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
### Python
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# cProfile
|
|
141
|
+
python -m cProfile -o profile.prof app.py
|
|
142
|
+
|
|
143
|
+
# view with: python -m cProfile -s cumulative app.py
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Go
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# pprof
|
|
150
|
+
go test -cpuprofile=cpu.prof
|
|
151
|
+
go tool pprof cpu.prof
|
|
152
|
+
|
|
153
|
+
# Web interface
|
|
154
|
+
go tool pprof -http=:8080 cpu.prof
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Skill Loading
|
|
160
|
+
|
|
161
|
+
- If optimization involves queries → load python-sqlalchemy or typescript-drizzle-orm
|
|
162
|
+
- If memory issues → load for heap snapshots
|
|
163
|
+
- If database → load appropriate database skill
|