Skip to content

Commit 51300d2

Browse files
committed
new skills
1 parent 5e938b7 commit 51300d2

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-patterns",
41+
"description": "Opinionated TypeScript and React patterns: ban `as` assertions, replace useEffect with derived state, and fix knip unused exports",
42+
"source": "./plugins/typescript-patterns",
43+
"category": "quality"
44+
},
45+
{
46+
"name": "engineering-toolbox",
47+
"description": "General-purpose engineering skills: parallel code review, V8 heap analysis, GitHub Actions workflow authoring, HTTP traffic interception, and Playwright e2e testing",
48+
"source": "./plugins/engineering-toolbox",
49+
"category": "productivity"
50+
},
51+
{
52+
"name": "github-workflow",
53+
"description": "GitHub pull request lifecycle skills: create, triage, follow up on, and cut release PRs with consistent conventions",
54+
"source": "./plugins/github-workflow",
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-patterns
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+
### engineering-toolbox
68+
69+
General-purpose engineering skills that plug into any TypeScript / Node.js codebase.
70+
71+
**Skills:**
72+
73+
- `http-toolkit-intercept` - Intercept and debug HTTP traffic from a Bun/Node CLI via HTTP Toolkit
74+
75+
### github-workflow
76+
77+
GitHub pull request lifecycle skills: open, triage, follow up on, and ship release 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: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
name: simplify
3+
description: Review changed code for reuse, quality, and efficiency, then fix any issues found.
4+
---
5+
6+
# Simplify: Code Review and Cleanup
7+
8+
Review all changed files for reuse, quality, and efficiency. Fix any issues found.
9+
10+
## Phase 1: Identify Changes
11+
12+
Run `git diff` (or `git diff HEAD` if there are staged changes) to see what changed. If there are no git changes, review the most recently modified files that the user mentioned or that you edited earlier in this conversation.
13+
14+
## Phase 2: Launch Three Review Agents in Parallel
15+
16+
Use the Task tool to launch all three agents concurrently in a single message. Pass each agent the full diff so it has the complete context.
17+
18+
### Agent 1: Code Reuse Review
19+
20+
For each change:
21+
22+
1. **Search for existing utilities and helpers** that could replace newly written code. Look for similar patterns elsewhere in the codebase — common locations are utility directories, shared modules, and files adjacent to the changed ones.
23+
2. **Flag any new function that duplicates existing functionality.** Suggest the existing function to use instead.
24+
3. **Flag any inline logic that could use an existing utility** — hand-rolled string manipulation, manual path handling, custom environment checks, ad-hoc type guards, and similar patterns are common candidates.
25+
26+
### Agent 2: Code Quality Review
27+
28+
Review the same changes for hacky patterns:
29+
30+
1. **Redundant state**: state that duplicates existing state, cached values that could be derived, observers/effects that could be direct calls
31+
2. **Parameter sprawl**: adding new parameters to a function instead of generalizing or restructuring existing ones
32+
3. **Copy-paste with slight variation**: near-duplicate code blocks that should be unified with a shared abstraction
33+
4. **Leaky abstractions**: exposing internal details that should be encapsulated, or breaking existing abstraction boundaries
34+
5. **Stringly-typed code**: using raw strings where constants, enums (string unions), or branded types already exist in the codebase
35+
6. **Unnecessary JSX nesting**: wrapper Boxes/elements that add no layout value — check if inner component props (flexShrink, alignItems, etc.) already provide the needed behavior
36+
37+
### Agent 3: Efficiency Review
38+
39+
Review the same changes for efficiency:
40+
41+
1. **Unnecessary work**: redundant computations, repeated file reads, duplicate network/API calls, N+1 patterns
42+
2. **Missed concurrency**: independent operations run sequentially when they could run in parallel
43+
3. **Hot-path bloat**: new blocking work added to startup or per-request/per-render hot paths
44+
4. **Recurring no-op updates**: state/store updates inside polling loops, intervals, or event handlers that fire unconditionally — add a change-detection guard so downstream consumers aren't notified when nothing changed. Also: if a wrapper function takes an updater/reducer callback, verify it honors same-reference returns (or whatever the "no change" signal is) — otherwise callers' early-return no-ops are silently defeated
45+
5. **Unnecessary existence checks**: pre-checking file/resource existence before operating (TOCTOU anti-pattern) — operate directly and handle the error
46+
6. **Memory**: unbounded data structures, missing cleanup, event listener leaks
47+
7. **Overly broad operations**: reading entire files when only a portion is needed, loading all items when filtering for one
48+
49+
## Phase 3: Fix Issues
50+
51+
Wait for all three agents to complete. Aggregate their findings and fix each issue directly. If a finding is a false positive or not worth addressing, note it and move on — do not argue with the finding, just skip it.
52+
53+
When done, briefly summarize what was fixed (or confirm the code was already clean).
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "engineering-toolbox",
3+
"description": "General-purpose engineering skills: code review with parallel subagents, V8 heap analysis, GitHub Actions workflow authoring, HTTP traffic interception, and Playwright e2e testing",
4+
"author": {
5+
"name": "Factory",
6+
"email": "support@factory.ai"
7+
}
8+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# engineering-toolbox
2+
3+
General-purpose engineering skills that plug into any TypeScript / Node.js codebase.
4+
5+
## Skills
6+
7+
### `http-toolkit-intercept`
8+
9+
Intercept and debug HTTP traffic from a Bun- or Node-based CLI using HTTP Toolkit. Pairs the outbound proxy log with a machine-readable CLI session log so you can verify LLM API calls, backend requests, auth flows, and wire-level behavior.
10+
11+
## Install
12+
13+
```bash
14+
droid plugin install engineering-toolbox@factory-plugins
15+
```
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
---
2+
name: http-toolkit-intercept
3+
description: Intercept and debug HTTP traffic from a Bun- or Node-based CLI using HTTP Toolkit. Use when you need to inspect LLM API calls, backend requests, auth flows, or debug network-level issues.
4+
---
5+
6+
# HTTP Toolkit Intercept
7+
8+
Use this skill when you need authoritative evidence of what your CLI sent to a remote API and what it received back while verifying a code change.
9+
10+
The reliable pattern is:
11+
12+
1. Start HTTP Toolkit correctly.
13+
2. Run the CLI through the proxy in a mode that produces a machine-readable log (e.g. `--output-format json`).
14+
3. Export outbound HTTP requests from HTTP Toolkit.
15+
4. Pair the outbound HTTP export with the inbound CLI session log.
16+
17+
Do not rely on TUI screenshots alone when the question is about request payloads, auth headers, or wire-level behavior.
18+
19+
## Prerequisites / Known-Good Launch
20+
21+
### Start HTTP Toolkit
22+
23+
On Linux/headless environments, plain `httptoolkit` often fails due to sandbox/X11 issues. Prefer:
24+
25+
```bash
26+
xvfb-run --auto-servernum httptoolkit --no-sandbox
27+
```
28+
29+
If a stale server is already running on ports `45456/45457`, stop it first:
30+
31+
```bash
32+
pkill -f "HTTP Toolkit Server|httptoolkit|xvfb-run --auto-servernum httptoolkit" || true
33+
```
34+
35+
### Verify the proxy is reachable
36+
37+
```bash
38+
# HTTP Toolkit's admin API lives on port 45456/45457 by default.
39+
# Treat 200/401/403 as "reachable"; only connection failure means the server is dead.
40+
curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:45456/config
41+
```
42+
43+
## Quick Start
44+
45+
### 1. Launch your CLI with the proxy env vars set
46+
47+
The canonical Bun-friendly pattern:
48+
49+
```bash
50+
BUN_CONFIG_PROXY="http://127.0.0.1:8000" \
51+
HTTP_PROXY="http://127.0.0.1:8000" \
52+
HTTPS_PROXY="http://127.0.0.1:8000" \
53+
ALL_PROXY="http://127.0.0.1:8000" \
54+
NODE_TLS_REJECT_UNAUTHORIZED=0 \
55+
<your-cli> <args>
56+
```
57+
58+
> `NODE_TLS_REJECT_UNAUTHORIZED=0` is only appropriate for controlled local debugging. See "TLS Safety" below.
59+
60+
### 2. Capture the inbound session log
61+
62+
If your CLI supports a machine-readable output mode (e.g. `--output-format stream-json`, `--json`, `--log-level debug`), pipe it to a file:
63+
64+
```bash
65+
<your-cli> exec --output-format stream-json "your prompt" \
66+
> /tmp/cli-intercept-stdout.log 2> /tmp/cli-intercept-stderr.log
67+
```
68+
69+
### 3. Export outbound HTTP from HTTP Toolkit
70+
71+
Either:
72+
73+
- Use the HTTP Toolkit GUI export (File → Export → JSON), or
74+
- Hit the admin API directly. The exact endpoint depends on your HTTP Toolkit version; inspect DevTools in the HTTP Toolkit UI to see the requests it makes.
75+
76+
### 4. Cross-reference the two streams
77+
78+
- **Outbound HTTP** (from HTTP Toolkit): authoritative for request bodies, headers, auth tokens, retry timing.
79+
- **Inbound session log** (from the CLI): authoritative for how your code reacted to the responses.
80+
81+
Together they answer: "what did we send?" and "what did we do with the response?"
82+
83+
## What finally worked for payload verification
84+
85+
The critical correct pathways that proved reliable were:
86+
87+
1. **Use a non-interactive / exec mode, not the TUI, when verifying payloads**
88+
- Interactive TUIs are slower and much harder to analyze.
89+
- Use whatever your CLI has for scripting (`--output-format`, `--json`, `--headless`).
90+
91+
2. **Treat outbound and inbound as separate evidence sources**
92+
- HTTP Toolkit gives outbound HTTP requests.
93+
- The CLI's session log gives inbound assistant/tool behavior.
94+
- You need both to answer: "what did the model receive?" and "what did it actually do?"
95+
96+
3. **Use Bun's proxy env var explicitly**
97+
- `BUN_CONFIG_PROXY` is the important one.
98+
- Setting only `HTTP_PROXY`/`HTTPS_PROXY` is not enough for Bun.
99+
100+
4. **Disable TLS verification only for controlled local debugging when needed**
101+
- If the HTTP Toolkit CA is not trusted locally, use `NODE_TLS_REJECT_UNAUTHORIZED=0` as an escape hatch.
102+
- Prefer trusting the CA in your OS / Node trust store instead.
103+
- Never disable TLS in production repros.
104+
105+
5. **Keep runs bounded**
106+
- Long tool-heavy prompts can take time.
107+
- If you only need to prove request shape, export after the LLM request is observed — you do not always need to wait for full completion.
108+
109+
## Key Facts
110+
111+
- **Bun requires `BUN_CONFIG_PROXY`** — treat it as mandatory
112+
- **HTTP_PROXY / HTTPS_PROXY alone are silently ignored by Bun**
113+
- **HTTP Toolkit admin API is request-oriented** — outbound HTTP comes from HTTP Toolkit, inbound behavior comes from the CLI log
114+
- **TLS is verified by default**`NODE_TLS_REJECT_UNAUTHORIZED=0` is a local-dev escape hatch only
115+
116+
## Bun Proxy Gotchas
117+
118+
| Approach | Works? | Notes |
119+
|----------|--------|-------|
120+
| `BUN_CONFIG_PROXY` | Yes | Bun's official proxy env var |
121+
| `HTTP_PROXY` / `HTTPS_PROXY` | No (Bun) | Silently ignored by bun but respected by some libraries used via Bun |
122+
| `SSL_CERT_FILE` with combined CA | Unreliable | Can break on some Bun builds; verify in your local Bun version |
123+
| `NODE_TLS_REJECT_UNAUTHORIZED=0` | Local dev only | Disables TLS verification |
124+
| Running via `tsx` / Node.js | Depends on your CLI | Some CLIs have native deps (`.dylib`) that require Bun |
125+
126+
### TLS Safety Guardrails
127+
128+
- Keep TLS verification enabled whenever possible.
129+
- Prefer trusting the HTTP Toolkit CA in your local trust store instead of disabling verification.
130+
- Use `NODE_TLS_REJECT_UNAUTHORIZED=0` only for controlled local debugging in development.
131+
- Never disable TLS when intercepting production traffic.
132+
133+
## Inspecting Captured Logs
134+
135+
### Filter to LLM-call events only
136+
137+
If your CLI emits newline-delimited JSON, use `jq`:
138+
139+
```bash
140+
jq -c 'select(.type == "tool_call" or .type == "message")' /tmp/cli-intercept-stdout.log
141+
```
142+
143+
### Match outbound HTTP to inbound events
144+
145+
Sort both streams by timestamp, then interleave them. The sequence usually is:
146+
147+
```
148+
outbound POST /chat/completions (from HTTP Toolkit)
149+
inbound message role=assistant (from CLI log)
150+
inbound tool_call tool=foo (from CLI log)
151+
outbound POST /chat/completions (next turn)
152+
```
153+
154+
If a CLI log shows an outbound request that HTTP Toolkit didn't capture, that's a proxy-config bug.
155+
156+
## Troubleshooting
157+
158+
| Problem | Cause | Fix |
159+
|---------|-------|-----|
160+
| CLI hangs, no events after startup | Proxy env vars not reaching the process, or TLS verification blocking | Re-run with `BUN_CONFIG_PROXY` explicitly set; if necessary set `NODE_TLS_REJECT_UNAUTHORIZED=0` in dev |
161+
| `ECONNRESET` on every request | Using `HTTP_PROXY` not `BUN_CONFIG_PROXY` with Bun | Switch to `BUN_CONFIG_PROXY` |
162+
| TLS cert errors via proxy | MITM CA not trusted | Trust HTTP Toolkit CA locally, or use `NODE_TLS_REJECT_UNAUTHORIZED=0` in dev only |
163+
| `ERR_UNKNOWN_FILE_EXTENSION .dylib` | Running with tsx/Node on a CLI that needs Bun | Run the CLI with `bun` directly |
164+
| HTTP Toolkit API 403s on `/config` | Auth-gated config endpoint | Treat 200/401/403 as reachable; only connection failure means the server is dead |
165+
| Export has outbound data but no matching inbound events | Didn't capture the CLI log | Add `> /tmp/cli.log` redirection to the CLI launch |
166+
| HTTP Toolkit misses the first request | Started capturing after the process launched | Start HTTP Toolkit first, THEN launch the CLI |
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "github-workflow",
3+
"description": "GitHub pull request lifecycle skills: create, triage, follow up on, and cut release PRs with consistent conventions",
4+
"author": {
5+
"name": "Factory",
6+
"email": "support@factory.ai"
7+
}
8+
}

plugins/github-workflow/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# github-workflow
2+
3+
GitHub pull request lifecycle skills: open, triage, follow up on, and ship release 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 github-workflow@factory-plugins
19+
```

0 commit comments

Comments
 (0)