Skip to content

Commit 6c4d24d

Browse files
committed
new skills
1 parent 5e938b7 commit 6c4d24d

26 files changed

Lines changed: 1372 additions & 9 deletions

File tree

.factory-plugin/marketplace.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,24 @@
3535
"description": "Autonomous experiment loop for optimization research. Try an idea, measure it, keep what works, discard what doesn't, repeat. Works standalone or as a mission worker.",
3636
"source": "./plugins/autoresearch",
3737
"category": "research"
38+
},
39+
{
40+
"name": "typescript",
41+
"description": "Opinionated TypeScript and React patterns: ban `as` assertions, replace useEffect with derived state, and fix knip unused exports",
42+
"source": "./plugins/typescript",
43+
"category": "quality"
44+
},
45+
{
46+
"name": "debugging",
47+
"description": "Inspect runtime behavior: HTTP interception, traffic capture, and wire-level debugging for CLIs and services",
48+
"source": "./plugins/debugging",
49+
"category": "productivity"
50+
},
51+
{
52+
"name": "code-review",
53+
"description": "Pull request lifecycle skills: create PRs with consistent conventions and follow up on them until merge-ready",
54+
"source": "./plugins/code-review",
55+
"category": "productivity"
3856
}
3957
]
4058
}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.factory/

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Core skills for essential functionalities and integrations. Pre-installed by the
3131
**Skills:**
3232

3333
- `review` - Review code changes and identify high-confidence, actionable bugs. Includes systematic analysis patterns for null safety, async/await, security, concurrency, API contracts, and more. Used by both the CLI `/review` command and the CI action.
34+
- `simplify` - Parallel code review across reuse, quality, and efficiency axes
3435

3536
### droid-control
3637

@@ -44,7 +45,7 @@ See [plugins/droid-control/README.md](plugins/droid-control/README.md) for detai
4445

4546
### security-engineer
4647

47-
Security review, threat modeling, and vulnerability validation skills.
48+
Security review, threat modeling, vulnerability validation, and patch generation skills.
4849

4950
**Skills:**
5051

@@ -53,6 +54,33 @@ Security review, threat modeling, and vulnerability validation skills.
5354
- `commit-security-scan` - Scan commits/PRs for security vulnerabilities
5455
- `vulnerability-validation` - Validate and confirm security findings
5556

57+
### typescript
58+
59+
Opinionated TypeScript and React patterns for safer, cleaner code.
60+
61+
**Skills:**
62+
63+
- `ban-type-assertions` - Ban `as` casts and replace them with compiler-verified alternatives (zod, control-flow narrowing)
64+
- `no-use-effect` - Five replacement patterns for `useEffect` (derived state, query libraries, event handlers, `useMountEffect`, `key`)
65+
- `fix-knip-unused-exports` - Fix every category of knip "Unused exports" violation
66+
67+
### debugging
68+
69+
Inspect runtime behavior: HTTP interception, traffic capture, and wire-level debugging for CLIs and services.
70+
71+
**Skills:**
72+
73+
- `http-toolkit-intercept` - Intercept and debug HTTP traffic from a Bun/Node CLI via HTTP Toolkit
74+
75+
### code-review
76+
77+
Pull request lifecycle skills: open, triage, and follow up on PRs with consistent conventions.
78+
79+
**Skills:**
80+
81+
- `create-pr` - Open a PR with Conventional Commits title, templated body, and local verification gates
82+
- `follow-up-on-pr` - Rebase, address reviewer comments, fix CI, and push an existing PR to merge-ready state
83+
5684
### droid-evolved
5785

5886
Skills for continuous learning and improvement.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "code-review",
3+
"description": "Pull request lifecycle skills: create PRs with consistent conventions and follow up on them until merge-ready",
4+
"author": {
5+
"name": "Factory",
6+
"email": "support@factory.ai"
7+
}
8+
}

plugins/code-review/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# code-review
2+
3+
Pull request lifecycle skills: open, triage, and follow up on PRs with consistent conventions.
4+
5+
## Skills
6+
7+
### `create-pr`
8+
9+
Open a PR with Conventional Commits title, a templated body, local verification (lint/typecheck/tests), and an optional linked ticket. Use when the user asks to "create a PR," "open a PR," or "put code up for review."
10+
11+
### `follow-up-on-pr`
12+
13+
Take over an existing PR: rebase on the base branch, address reviewer comments, fix CI failures, and push updates to a merge-ready state. Accepts a PR URL or number as input.
14+
15+
## Install
16+
17+
```bash
18+
droid plugin install code-review@factory-plugins
19+
```
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
---
2+
name: create-pr
3+
description: Create a pull request with Conventional Commits formatting, a templated body, and local verification. Use when the user asks to create a PR, open a PR, submit changes for review, or put code up for review.
4+
---
5+
6+
# Create Pull Request
7+
8+
Create a PR with proper conventions: local verification, Conventional Commits title, a templated body, and an optional linked ticket.
9+
10+
## Prerequisites
11+
12+
Before starting, verify:
13+
1. Current branch has commits not on the base branch (`git log origin/<base-branch>..HEAD --oneline`)
14+
2. Branch is pushed to remote (`git push -u origin HEAD` if not)
15+
3. No uncommitted changes that should be included (`git status`)
16+
17+
## Workflow
18+
19+
### 1. Understand the Changes
20+
21+
Run in parallel:
22+
```bash
23+
git log origin/<base-branch>..HEAD --oneline
24+
git diff origin/<base-branch>..HEAD --stat
25+
```
26+
27+
Determine:
28+
- **What changed**: Which apps/packages were modified
29+
- **Change type**: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `perf`, `ci`, `build`, `revert`
30+
- **Scope**: Primary workspace affected (use directory name or `monorepo` for cross-cutting changes)
31+
- **Is this a code change?**: If the PR modifies code (not only docs, markdown, or config-only changes), run the local verification checklist in step 2 before creating the PR.
32+
33+
### 2. Local Verification (for code changes)
34+
35+
**Skip this step** if the PR only touches documentation, markdown files, or other non-code files. For any change that touches `.ts`, `.tsx`, `.js`, `.jsx`, `.css`, or similar source files, run these checks locally before creating the PR.
36+
37+
Use a filter flag (turbo `--filter`, nx `--projects`, pnpm `--filter`) to target only the affected workspaces when possible — it is faster than running the whole repo.
38+
39+
#### Typecheck
40+
```bash
41+
# Repo-wide
42+
npm run typecheck
43+
# Filtered to affected workspaces (preferred — faster)
44+
npm run typecheck -- --filter=<workspace1> --filter=<workspace2>
45+
```
46+
47+
#### Lint
48+
```bash
49+
# Autofix (preferred — fixes formatting + lint in one pass)
50+
npm run fix
51+
# Or filtered
52+
npm run fix -- --filter=<workspace>
53+
# Lint-only (no autofix)
54+
npm run lint
55+
```
56+
57+
#### Tests
58+
```bash
59+
# Repo-wide (slow — runs all workspaces)
60+
npm run test
61+
# Filtered to affected workspaces (preferred)
62+
npm run test -- --filter=<workspace>
63+
```
64+
65+
#### Additional checks (run when relevant)
66+
- **Knip** (unused exports): `npm run knip` — always run if you added/removed exports.
67+
- **Depcheck**: `npm run depcheck` — run if you changed dependencies.
68+
- **Lockfile**: If you modified any `package.json`, run `npm install` at repo root and commit any `package-lock.json` changes. CI fails if the lockfile is out of date.
69+
- **OpenAPI / codegen**: If your backend has an OpenAPI spec or generated client, regenerate and commit any changes.
70+
- **Stylelint**: `npm run stylelint` — run if you changed CSS/style files.
71+
72+
Substitute your package manager and check names if you do not use npm / turbo.
73+
74+
### 3. Link to a Ticket (optional)
75+
76+
If your org uses an issue tracker, ask the user whether to:
77+
- **Create a new ticket**: Use the appropriate tool (Linear, Jira, GitHub Issues, etc.)
78+
- **Link an existing ticket**: Ask for the identifier (e.g. `TEAM-1234`, `JIRA-567`, `#42`)
79+
- **Skip**: Only if user explicitly says no ticket is needed
80+
81+
Most CI systems can be configured to require the ticket identifier in the PR body. Follow your org's convention.
82+
83+
### 4. Format PR Title
84+
85+
Follow Conventional Commits: `type(scope): description`
86+
87+
- `type`: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`, `perf`, `ci`, `build`, `revert`
88+
- `scope`: Workspace name from your `apps/*` or `packages/*` directories, or `monorepo` / `repo` for cross-cutting changes. Multiple scopes can be comma-separated: `fix(a, b, c): ...`
89+
90+
Examples:
91+
- `feat(web): add dark mode toggle`
92+
- `fix(cli, daemon): load shell env at entrypoint`
93+
- `chore(repo): bump dependencies`
94+
95+
### 5. Generate PR Body
96+
97+
Fill in all sections from your PR template. A typical template has four sections:
98+
99+
```markdown
100+
## Description
101+
102+
<concise summary of what changed and why>
103+
104+
## Related Issue
105+
106+
Closes TEAM-XXXX
107+
<!-- or: Part of TEAM-XXXX -->
108+
109+
## Potential Risk & Impact
110+
111+
<list risks, performance implications, technical debt>
112+
<!-- Use "N/A" only if truly no risk -->
113+
114+
## How Has This Been Tested?
115+
116+
<describe testing performed: unit tests, manual testing, typecheck, lint>
117+
```
118+
119+
### 6. Create the PR
120+
121+
```bash
122+
gh pr create \
123+
--base <base-branch> \
124+
--head <branch-name> \
125+
--title "<type>(<scope>): <description>" \
126+
--body "<generated body>"
127+
```
128+
129+
If the body is long, write it to a temp file and use `--body-file`:
130+
```bash
131+
gh pr create --base <base-branch> --head <branch> --title "..." --body-file /tmp/pr-body.md
132+
```
133+
134+
### 7. Report Result
135+
136+
Return the PR URL to the user.
137+
138+
## CI Checks Reference (template)
139+
140+
These are typical checks that run on every PR. Map them to your repo's actual commands when adapting this skill.
141+
142+
### Always-run checks
143+
| Check | What it does | Local equivalent |
144+
|---|---|---|
145+
| **Typecheck** | `npm run typecheck` | `npm run typecheck` (or `--filter=<workspace>`) |
146+
| **ESLint** | `npm run lint` | `npm run lint` or `npm run fix` |
147+
| **Prettier** | `npm exec prettier -- --check .` | `npm run format` (to fix) |
148+
| **Stylelint** | `npm run stylelint` | `npm run stylelint` |
149+
| **Depcheck** | `npm run depcheck` | `npm run depcheck` |
150+
| **Tests** | `turbo run test` (or equivalent) | `npm run test -- --filter=<workspace>` |
151+
| **Knip** | `npm run knip` | `npm run knip` |
152+
| **Lockfile** | Fails if `npm install` would modify `package-lock.json` | Run `npm install` and commit lockfile |
153+
| **PR Conventions** | Validates branch name, semantic title, ticket presence | Follow the formatting rules above |
154+
155+
### Conditional checks (run only when affected files change)
156+
- **OpenAPI validation**: Triggered by backend API/spec changes. Regenerate locally.
157+
- **Desktop/mobile build**: Triggered when those apps are affected.
158+
- **E2E tests**: Triggered when the consumer app is affected.
159+
160+
### Typical PR conventions CI enforces
161+
- **Branch name**: Max length, allowed characters (e.g. `[A-Za-z0-9/-]`).
162+
- **Title**: Conventional Commits format with a valid scope.
163+
- **Ticket reference**: PR body must contain a ticket identifier (often skipped for `chore:` and `revert:` types).
164+
165+
## Common Mistakes to Avoid
166+
167+
- **Wrong base branch**: Use the branch your org takes PRs into (e.g. `dev`, `main`, `develop`).
168+
- **Missing scope**: PR title CI check often requires a valid scope.
169+
- **Missing ticket reference**: Description must reference your ticket ID for CI to pass (except `chore:`/`revert:`).
170+
- **Forgetting to push**: Branch must be on remote before `gh pr create`.
171+
- **Lockfile drift**: Always run `npm install` and commit `package-lock.json` after dependency changes.
172+
- **Skipping local checks on code PRs**: Typecheck, lint, and tests should be run locally before sending out code changes to catch issues early and avoid CI round-trips.
173+
- **Uncommitted OpenAPI spec / generated client**: After backend API changes, regenerate and commit.

0 commit comments

Comments
 (0)