claude-toolkit 0.1.9
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 +126 -0
- package/bin/cli.ts +112 -0
- package/core/agents/ct-code-reviewer.md +123 -0
- package/core/agents/ct-github-workflow.md +137 -0
- package/core/commands/ct/code-quality.md +59 -0
- package/core/commands/ct/onboard.md +84 -0
- package/core/commands/ct/pr-review.md +104 -0
- package/core/commands/ct/pr-summary.md +59 -0
- package/core/commands/ct/proto-check.md +74 -0
- package/core/commands/ct/ticket.md +71 -0
- package/core/hooks/skill-eval.js +381 -0
- package/core/hooks/skill-eval.sh +35 -0
- package/core/hooks/skill-rules.schema.json +112 -0
- package/core/skills/systematic-debugging/SKILL.md +44 -0
- package/core/skills/testing-patterns/SKILL.md +52 -0
- package/core/skills/typescript-conventions/SKILL.md +57 -0
- package/core/skills/verification-before-completion/SKILL.md +42 -0
- package/docs/README.md +49 -0
- package/docs/agents/code-reviewer.md +76 -0
- package/docs/agents/github-workflow.md +98 -0
- package/docs/best-practices/solidjs/README.md +43 -0
- package/docs/best-practices/solidjs/anti-patterns.md +166 -0
- package/docs/best-practices/solidjs/component-patterns.md +131 -0
- package/docs/best-practices/solidjs/context-and-global-state.md +131 -0
- package/docs/best-practices/solidjs/control-flow.md +124 -0
- package/docs/best-practices/solidjs/data-fetching.md +205 -0
- package/docs/best-practices/solidjs/effects-and-lifecycle.md +113 -0
- package/docs/best-practices/solidjs/performance.md +100 -0
- package/docs/best-practices/solidjs/props-patterns.md +100 -0
- package/docs/best-practices/solidjs/reactivity-model.md +104 -0
- package/docs/best-practices/solidjs/signals-and-state.md +78 -0
- package/docs/best-practices/solidjs/stores-and-nested-state.md +111 -0
- package/docs/best-practices/solidjs/typescript-integration.md +186 -0
- package/docs/best-practices/typescript/README.md +45 -0
- package/docs/best-practices/typescript/any-and-unknown.md +73 -0
- package/docs/best-practices/typescript/deriving-vs-decoupling.md +83 -0
- package/docs/best-practices/typescript/discriminated-unions.md +75 -0
- package/docs/best-practices/typescript/enums-alternatives.md +72 -0
- package/docs/best-practices/typescript/essential-patterns.md +119 -0
- package/docs/best-practices/typescript/generics-patterns.md +105 -0
- package/docs/best-practices/typescript/micro-opinions.md +87 -0
- package/docs/best-practices/typescript/runtime-validation.md +62 -0
- package/docs/best-practices/typescript/satisfies-operator.md +100 -0
- package/docs/best-practices/typescript/tsconfig-cheat-sheet.md +129 -0
- package/docs/best-practices/typescript/type-organization.md +64 -0
- package/docs/best-practices/typescript/type-vs-interface.md +80 -0
- package/docs/commands/code-quality.md +42 -0
- package/docs/commands/onboard.md +72 -0
- package/docs/commands/pr-review.md +102 -0
- package/docs/commands/pr-summary.md +50 -0
- package/docs/commands/proto-check.md +59 -0
- package/docs/commands/ticket.md +56 -0
- package/docs/skills/systematic-debugging.md +70 -0
- package/docs/skills/testing-patterns.md +89 -0
- package/docs/skills/typescript-conventions.md +137 -0
- package/docs/skills/verification-before-completion.md +91 -0
- package/docs/stacks/cloudflare-d1-kv.md +110 -0
- package/docs/stacks/i18n-typesafe.md +141 -0
- package/docs/stacks/protobuf-contracts.md +85 -0
- package/docs/stacks/rust-wasm-patterns.md +106 -0
- package/docs/stacks/solidjs-patterns.md +110 -0
- package/docs/stacks/vanilla-extract-patterns.md +115 -0
- package/package.json +58 -0
- package/src/generator.ts +317 -0
- package/src/index.ts +30 -0
- package/src/types.ts +85 -0
- package/src/utils.ts +53 -0
- package/stacks/cloudflare/skills/cloudflare-d1-kv/SKILL.md +84 -0
- package/stacks/cloudflare/stack.json +26 -0
- package/stacks/i18n-typesafe/skills/i18n-typesafe/SKILL.md +64 -0
- package/stacks/i18n-typesafe/stack.json +25 -0
- package/stacks/protobuf/skills/protobuf-contracts/SKILL.md +78 -0
- package/stacks/protobuf/stack.json +25 -0
- package/stacks/rust-wasm/skills/rust-wasm-patterns/SKILL.md +76 -0
- package/stacks/rust-wasm/stack.json +26 -0
- package/stacks/solidjs/skills/solidjs-patterns/SKILL.md +66 -0
- package/stacks/solidjs/stack.json +52 -0
- package/stacks/vanilla-extract/skills/vanilla-extract-patterns/SKILL.md +76 -0
- package/stacks/vanilla-extract/stack.json +40 -0
- package/templates/claude-toolkit.config.ts +34 -0
- package/templates/configs/biome.base.json +35 -0
- package/templates/configs/tsconfig.base.json +16 -0
- package/templates/skill-rules.base.json +98 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.9 (2026-04-04)
|
|
4
|
+
|
|
5
|
+
- docs: add Zod/Valibot runtime validation section to SolidJS data fetching
|
|
6
|
+
|
|
7
|
+
## 0.1.8 (2026-04-04)
|
|
8
|
+
|
|
9
|
+
- docs: cross-reference best practices and fix markdown lint warnings
|
|
10
|
+
|
|
11
|
+
## 0.1.7 (2026-04-04)
|
|
12
|
+
|
|
13
|
+
- docs: add SolidJS best practices collection
|
|
14
|
+
|
|
15
|
+
## 0.1.6 (2026-04-04)
|
|
16
|
+
|
|
17
|
+
- docs: add Matt Pocock's TypeScript best practices collection
|
|
18
|
+
|
|
19
|
+
## 0.1.5 (2026-04-04)
|
|
20
|
+
|
|
21
|
+
- fix: guard post-commit hook against amend, rebase, cherry-pick, and merge
|
|
22
|
+
|
|
23
|
+
## 0.1.4 (2026-04-04)
|
|
24
|
+
|
|
25
|
+
- refactor: namespace commands under ct/ and prefix agents with ct-
|
|
26
|
+
|
|
27
|
+
## 0.1.3 (2026-04-04)
|
|
28
|
+
|
|
29
|
+
- fix: production readiness — remove private flag, add LICENSE, fix cross-platform hook
|
|
30
|
+
|
|
31
|
+
## 0.1.2 (2026-04-04)
|
|
32
|
+
|
|
33
|
+
- chore: add auto-versioning with changelog on every commit
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## 0.1.1 (2026-04-04)
|
|
37
|
+
|
|
38
|
+
- chore: add auto-versioning with changelog on every commit
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 william-queant
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
# claude-toolkit
|
|
2
|
+
|
|
3
|
+
Reusable Claude Code configuration toolkit with stack-specific connectors.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install as a dev dependency
|
|
9
|
+
bun add -d claude-toolkit
|
|
10
|
+
|
|
11
|
+
# Scaffold config and generate .claude/
|
|
12
|
+
bunx claude-toolkit init
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## How It Works
|
|
16
|
+
|
|
17
|
+
1. You define a `claude-toolkit.config.ts` at your project root
|
|
18
|
+
2. The toolkit generates a `.claude/` directory with skills, hooks, commands, and agents
|
|
19
|
+
3. Claude Code picks up the generated config automatically
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
import { defineConfig } from 'claude-toolkit'
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
stacks: ['solidjs', 'rust-wasm', 'cloudflare', 'protobuf'],
|
|
26
|
+
packageManager: 'bun',
|
|
27
|
+
hooks: {
|
|
28
|
+
formatter: 'bun run prettier --write',
|
|
29
|
+
testRunner: 'bun run vitest run',
|
|
30
|
+
typeCheck: 'bun run tsc --noEmit',
|
|
31
|
+
extraChecks: ['cargo check --target wasm32-unknown-unknown'],
|
|
32
|
+
},
|
|
33
|
+
git: {
|
|
34
|
+
branchPrefix: 'wq',
|
|
35
|
+
protectedBranches: ['main'],
|
|
36
|
+
},
|
|
37
|
+
})
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## CLI Commands
|
|
41
|
+
|
|
42
|
+
| Command | Description |
|
|
43
|
+
|---------|-------------|
|
|
44
|
+
| `bunx claude-toolkit init` | Scaffold config file and generate `.claude/` |
|
|
45
|
+
| `bunx claude-toolkit sync` | Regenerate `.claude/` from config (after toolkit update) |
|
|
46
|
+
| `bunx claude-toolkit help` | Show available commands |
|
|
47
|
+
|
|
48
|
+
## Available Stacks
|
|
49
|
+
|
|
50
|
+
| Stack | Skills Added |
|
|
51
|
+
|-------|-------------|
|
|
52
|
+
| `solidjs` | SolidJS reactivity, signals, components |
|
|
53
|
+
| `vanilla-extract` | Type-safe CSS, sprinkles, recipes, themes |
|
|
54
|
+
| `rust-wasm` | Rust WASM for Cloudflare Workers |
|
|
55
|
+
| `protobuf` | Protocol Buffers, code generation, contracts |
|
|
56
|
+
| `cloudflare` | D1 database, KV cache, Wrangler |
|
|
57
|
+
| `i18n-typesafe` | typesafe-i18n internationalization |
|
|
58
|
+
|
|
59
|
+
## Core Features (always included)
|
|
60
|
+
|
|
61
|
+
- **Skill Evaluation Engine** — Analyzes prompts and suggests relevant skills
|
|
62
|
+
- **Main Branch Protection** — Prevents accidental edits on protected branches
|
|
63
|
+
- **Auto-formatting** — Formats files after edits
|
|
64
|
+
- **Auto-testing** — Runs related tests when test files change
|
|
65
|
+
- **Type checking** — Checks TypeScript types on save
|
|
66
|
+
|
|
67
|
+
### Core Skills
|
|
68
|
+
|
|
69
|
+
- `ct-systematic-debugging` — Four-phase debugging methodology
|
|
70
|
+
- `ct-testing-patterns` — TDD workflow and patterns
|
|
71
|
+
- `ct-typescript-conventions` — TypeScript strict mode best practices
|
|
72
|
+
- `ct-verification-before-completion` — Evidence-based completion claims
|
|
73
|
+
|
|
74
|
+
### Core Commands
|
|
75
|
+
|
|
76
|
+
- `/ct:code-quality` — Run lint, typecheck, format checks
|
|
77
|
+
- `/ct:pr-review` — Review a PR using project standards
|
|
78
|
+
- `/ct:pr-summary` — Generate PR summary from branch
|
|
79
|
+
- `/ct:onboard` — Onboard yourself to a codebase area
|
|
80
|
+
- `/ct:ticket` — Work end-to-end on a ticket
|
|
81
|
+
- `/ct:proto-check` — Validate protobuf definitions
|
|
82
|
+
|
|
83
|
+
### Core Agents
|
|
84
|
+
|
|
85
|
+
- `ct-code-reviewer` — Senior code reviewer (Opus)
|
|
86
|
+
- `ct-github-workflow` — Git workflow assistant (Sonnet)
|
|
87
|
+
|
|
88
|
+
## Project Setup
|
|
89
|
+
|
|
90
|
+
Add `.claude/` to your `.gitignore` (it's generated, not tracked):
|
|
91
|
+
|
|
92
|
+
```gitignore
|
|
93
|
+
# Claude Code (generated by claude-toolkit)
|
|
94
|
+
.claude/
|
|
95
|
+
CLAUDE.local.md
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Track the config file and CLAUDE.md:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
claude-toolkit.config.ts # tracked — your project's Claude config
|
|
102
|
+
CLAUDE.md # tracked — project-specific documentation
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Documentation
|
|
106
|
+
|
|
107
|
+
Full reference documentation for all skills, commands, and agents is available in the [`docs/`](docs/README.md) directory.
|
|
108
|
+
|
|
109
|
+
## Versioning
|
|
110
|
+
|
|
111
|
+
The patch version auto-increments on every commit via a post-commit hook. `CHANGELOG.md` is updated automatically with the commit message.
|
|
112
|
+
|
|
113
|
+
To bump major or minor versions manually:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
bun version major # 0.1.x → 1.0.0
|
|
117
|
+
bun version minor # 0.1.x → 0.2.0
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Development
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
git clone https://github.com/william-queant/claude-toolkit.git
|
|
124
|
+
cd claude-toolkit
|
|
125
|
+
bun install
|
|
126
|
+
```
|
package/bin/cli.ts
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
#!/usr/bin/env bun
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* claude-toolkit CLI
|
|
5
|
+
*
|
|
6
|
+
* Commands:
|
|
7
|
+
* init — Scaffold config file and generate .claude/
|
|
8
|
+
* sync — Regenerate .claude/ from existing config
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
12
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
13
|
+
import { join, resolve } from "node:path";
|
|
14
|
+
import { generate } from "../src/generator.js";
|
|
15
|
+
import type { ClaudeToolkitConfig } from "../src/types.js";
|
|
16
|
+
|
|
17
|
+
const CONFIG_FILENAME = "claude-toolkit.config.ts";
|
|
18
|
+
|
|
19
|
+
async function loadConfig(projectDir: string): Promise<ClaudeToolkitConfig> {
|
|
20
|
+
const configPath = join(projectDir, CONFIG_FILENAME);
|
|
21
|
+
if (!existsSync(configPath)) {
|
|
22
|
+
throw new Error(
|
|
23
|
+
`Config not found: ${configPath}\nRun "claude-toolkit init" first.`,
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
const module = await import(configPath);
|
|
27
|
+
return module.default as ClaudeToolkitConfig;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
async function init(projectDir: string): Promise<void> {
|
|
31
|
+
const configPath = join(projectDir, CONFIG_FILENAME);
|
|
32
|
+
|
|
33
|
+
if (existsSync(configPath)) {
|
|
34
|
+
console.log(`Config already exists: ${configPath}`);
|
|
35
|
+
console.log("Running sync instead...");
|
|
36
|
+
return sync(projectDir);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// Copy starter config
|
|
40
|
+
const templatePath = join(
|
|
41
|
+
import.meta.dirname,
|
|
42
|
+
"..",
|
|
43
|
+
"templates",
|
|
44
|
+
"claude-toolkit.config.ts",
|
|
45
|
+
);
|
|
46
|
+
if (existsSync(templatePath)) {
|
|
47
|
+
const template = await readFile(templatePath, "utf-8");
|
|
48
|
+
await writeFile(configPath, template, "utf-8");
|
|
49
|
+
console.log(`Created ${CONFIG_FILENAME}`);
|
|
50
|
+
} else {
|
|
51
|
+
// Inline fallback
|
|
52
|
+
const defaultConfig = `import { defineConfig } from 'claude-toolkit'
|
|
53
|
+
|
|
54
|
+
export default defineConfig({
|
|
55
|
+
stacks: [],
|
|
56
|
+
packageManager: 'bun',
|
|
57
|
+
hooks: {
|
|
58
|
+
formatter: 'bun run prettier --write',
|
|
59
|
+
testRunner: 'bun run vitest run',
|
|
60
|
+
typeCheck: 'bun run tsc --noEmit',
|
|
61
|
+
},
|
|
62
|
+
git: {
|
|
63
|
+
branchPrefix: 'dev',
|
|
64
|
+
protectedBranches: ['main'],
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
`;
|
|
68
|
+
await writeFile(configPath, defaultConfig, "utf-8");
|
|
69
|
+
console.log(`Created ${CONFIG_FILENAME}`);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Generate
|
|
73
|
+
return sync(projectDir);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function sync(projectDir: string): Promise<void> {
|
|
77
|
+
const config = await loadConfig(projectDir);
|
|
78
|
+
await generate(projectDir, config);
|
|
79
|
+
console.log("Sync complete.");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// CLI entry
|
|
83
|
+
const args = process.argv.slice(2);
|
|
84
|
+
const command = args[0];
|
|
85
|
+
const projectDir = resolve(args[1] ?? ".");
|
|
86
|
+
|
|
87
|
+
switch (command) {
|
|
88
|
+
case "init":
|
|
89
|
+
await init(projectDir);
|
|
90
|
+
break;
|
|
91
|
+
case "sync":
|
|
92
|
+
await sync(projectDir);
|
|
93
|
+
break;
|
|
94
|
+
case undefined:
|
|
95
|
+
case "help":
|
|
96
|
+
console.log(`
|
|
97
|
+
claude-toolkit — Reusable Claude Code configuration
|
|
98
|
+
|
|
99
|
+
Commands:
|
|
100
|
+
init Scaffold config file and generate .claude/
|
|
101
|
+
sync Regenerate .claude/ from config
|
|
102
|
+
help Show this message
|
|
103
|
+
|
|
104
|
+
Usage:
|
|
105
|
+
bunx claude-toolkit init [project-dir]
|
|
106
|
+
bunx claude-toolkit sync [project-dir]
|
|
107
|
+
`);
|
|
108
|
+
break;
|
|
109
|
+
default:
|
|
110
|
+
console.error(`Unknown command: ${command}`);
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Code Reviewer"
|
|
3
|
+
description: "Senior code reviewer with stack-aware analysis"
|
|
4
|
+
model: opus
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Code Reviewer Agent
|
|
8
|
+
|
|
9
|
+
You are a senior code reviewer. Your job is to review code changes thoroughly, providing actionable feedback organized by severity. You adapt your review criteria to the project's stack and conventions.
|
|
10
|
+
|
|
11
|
+
## Review Process
|
|
12
|
+
|
|
13
|
+
1. **Read the full diff** and all changed files in their entirety. Understand the context surrounding each change, not just the changed lines.
|
|
14
|
+
|
|
15
|
+
2. **Identify the stack** by reading project config files. Adapt your review criteria accordingly (e.g., React-specific checks for React projects, SQL injection checks for projects with raw queries).
|
|
16
|
+
|
|
17
|
+
3. **Apply the review checklist** to every changed file.
|
|
18
|
+
|
|
19
|
+
4. **Compile findings** with clear severity levels and specific file/line references.
|
|
20
|
+
|
|
21
|
+
## Review Checklist
|
|
22
|
+
|
|
23
|
+
### Logic Correctness (Critical)
|
|
24
|
+
- Off-by-one errors in loops and slices
|
|
25
|
+
- Incorrect boolean logic or inverted conditions
|
|
26
|
+
- Unhandled edge cases (empty arrays, null, undefined, zero, negative)
|
|
27
|
+
- Race conditions in concurrent code
|
|
28
|
+
- Incorrect state transitions
|
|
29
|
+
- Unreachable or dead code
|
|
30
|
+
|
|
31
|
+
### Type Safety (Warning)
|
|
32
|
+
- Use of `any`, `unknown` casts, or `as` assertions without narrowing
|
|
33
|
+
- Missing null/undefined checks before property access
|
|
34
|
+
- Implicit type coercions that could cause bugs
|
|
35
|
+
- Generic types that are too broad or too narrow
|
|
36
|
+
- Missing discriminated union exhaustiveness checks
|
|
37
|
+
|
|
38
|
+
### Error Handling (Critical)
|
|
39
|
+
- Swallowed errors (empty catch blocks, ignored promise rejections)
|
|
40
|
+
- Error messages that lack context (no stack trace, no input values)
|
|
41
|
+
- Missing cleanup in error paths (unclosed connections, leaked resources)
|
|
42
|
+
- Errors that crash the process instead of being handled gracefully
|
|
43
|
+
- Missing error boundaries or fallback UI
|
|
44
|
+
|
|
45
|
+
### Performance (Warning)
|
|
46
|
+
- Unnecessary re-renders (missing memoization, unstable references)
|
|
47
|
+
- N+1 query patterns in database access
|
|
48
|
+
- Missing pagination on unbounded queries
|
|
49
|
+
- Synchronous operations that should be async
|
|
50
|
+
- Memory leaks (event listeners not removed, intervals not cleared)
|
|
51
|
+
- Large objects copied unnecessarily
|
|
52
|
+
|
|
53
|
+
### Security (Critical)
|
|
54
|
+
- SQL injection (string concatenation in queries)
|
|
55
|
+
- XSS (unsanitized user input rendered as HTML)
|
|
56
|
+
- Command injection (user input in shell commands)
|
|
57
|
+
- Missing authentication or authorization checks
|
|
58
|
+
- Secrets or tokens in code, logs, or error messages
|
|
59
|
+
- CORS misconfiguration
|
|
60
|
+
- Missing rate limiting on sensitive endpoints
|
|
61
|
+
|
|
62
|
+
### Testing (Warning)
|
|
63
|
+
- New behavior without corresponding tests
|
|
64
|
+
- Tests that test implementation details instead of behavior
|
|
65
|
+
- Missing edge case tests (error paths, boundary values)
|
|
66
|
+
- Flaky test patterns (timing dependencies, shared state)
|
|
67
|
+
- Test descriptions that don't describe the expected behavior
|
|
68
|
+
|
|
69
|
+
### Naming and Readability (Suggestion)
|
|
70
|
+
- Misleading or ambiguous names
|
|
71
|
+
- Abbreviations that harm readability
|
|
72
|
+
- Functions that do too many things (should be split)
|
|
73
|
+
- Deeply nested code that should be flattened
|
|
74
|
+
- Comments that describe "what" instead of "why"
|
|
75
|
+
|
|
76
|
+
## Output Format
|
|
77
|
+
|
|
78
|
+
```markdown
|
|
79
|
+
## Code Review
|
|
80
|
+
|
|
81
|
+
**Reviewed:** {files or PR description}
|
|
82
|
+
**Verdict:** APPROVE | REQUEST_CHANGES | COMMENT
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
### Critical ({count})
|
|
87
|
+
|
|
88
|
+
**{file}:{line}** - {title}
|
|
89
|
+
> {explanation of the issue and why it matters}
|
|
90
|
+
```suggestion
|
|
91
|
+
{suggested fix if applicable}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
### Warnings ({count})
|
|
97
|
+
|
|
98
|
+
**{file}:{line}** - {title}
|
|
99
|
+
> {explanation}
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
### Suggestions ({count})
|
|
104
|
+
|
|
105
|
+
**{file}:{line}** - {title}
|
|
106
|
+
> {explanation}
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### Looks Good
|
|
111
|
+
- {positive observations about the code}
|
|
112
|
+
|
|
113
|
+
### Summary
|
|
114
|
+
{1-3 sentence overall assessment. Be direct.}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Principles
|
|
118
|
+
|
|
119
|
+
- **Be specific.** "This could be improved" is useless. "This catch block on line 42 swallows the database connection error, making it impossible to debug connection failures in production" is useful.
|
|
120
|
+
- **Distinguish severity honestly.** Not everything is critical. Not everything is a suggestion. Get the severity right.
|
|
121
|
+
- **Acknowledge good work.** If the code is well-structured, say so. Reviews that only list problems are demoralizing and incomplete.
|
|
122
|
+
- **Stay in scope.** Review the changes, not the entire codebase. Pre-existing issues are out of scope unless the PR makes them worse.
|
|
123
|
+
- **Offer alternatives, not just objections.** If you flag a problem, suggest a fix or a direction.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "GitHub Workflow"
|
|
3
|
+
description: "Git workflow assistant for branching, commits, and PRs"
|
|
4
|
+
model: sonnet
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# GitHub Workflow Agent
|
|
8
|
+
|
|
9
|
+
You are a Git workflow assistant. You help with branch management, commit formatting, and pull request creation following consistent conventions.
|
|
10
|
+
|
|
11
|
+
## Branch Naming
|
|
12
|
+
|
|
13
|
+
Create branches using the format: `{prefix}/{short-description}`
|
|
14
|
+
|
|
15
|
+
| Prefix | Use Case | Example |
|
|
16
|
+
|------------|---------------------------------|--------------------------------|
|
|
17
|
+
| `feat` | New feature | `feat/user-avatar-upload` |
|
|
18
|
+
| `fix` | Bug fix | `fix/login-redirect-loop` |
|
|
19
|
+
| `chore` | Maintenance, deps, config | `chore/upgrade-eslint-9` |
|
|
20
|
+
| `refactor` | Code restructuring | `refactor/extract-auth-service` |
|
|
21
|
+
| `docs` | Documentation only | `docs/api-authentication` |
|
|
22
|
+
| `test` | Test additions or fixes | `test/payment-edge-cases` |
|
|
23
|
+
| `hotfix` | Urgent production fix | `hotfix/null-crash-checkout` |
|
|
24
|
+
|
|
25
|
+
Rules:
|
|
26
|
+
- Use lowercase with hyphens (no underscores, no camelCase)
|
|
27
|
+
- Keep descriptions under 4 words
|
|
28
|
+
- Be specific enough to identify the work at a glance
|
|
29
|
+
|
|
30
|
+
## Conventional Commits
|
|
31
|
+
|
|
32
|
+
Format: `{type}({scope}): {description}`
|
|
33
|
+
|
|
34
|
+
### Types
|
|
35
|
+
|
|
36
|
+
| Type | When |
|
|
37
|
+
|------------|---------------------------------------------|
|
|
38
|
+
| `feat` | New feature visible to users |
|
|
39
|
+
| `fix` | Bug fix |
|
|
40
|
+
| `refactor` | Code change with no behavior difference |
|
|
41
|
+
| `test` | Adding or updating tests |
|
|
42
|
+
| `docs` | Documentation changes |
|
|
43
|
+
| `chore` | Build, CI, dependency updates |
|
|
44
|
+
| `perf` | Performance improvement |
|
|
45
|
+
| `style` | Formatting, whitespace (no logic change) |
|
|
46
|
+
|
|
47
|
+
### Examples
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
feat(auth): add JWT refresh token rotation
|
|
51
|
+
fix(cart): prevent duplicate items on rapid clicks
|
|
52
|
+
refactor(api): extract validation middleware from route handlers
|
|
53
|
+
test(payments): add edge cases for partial refunds
|
|
54
|
+
chore(deps): upgrade next.js to 15.1
|
|
55
|
+
perf(search): add database index for full-text queries
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Rules
|
|
59
|
+
- **Scope** is optional but encouraged. Use the module or feature area.
|
|
60
|
+
- **Description** starts lowercase, uses imperative mood ("add" not "added" or "adds").
|
|
61
|
+
- **Body** (optional): Explain "why" not "what". The diff shows the what.
|
|
62
|
+
- **Breaking changes**: Add `!` after type/scope: `feat(api)!: change auth response format`
|
|
63
|
+
|
|
64
|
+
## PR Creation Workflow
|
|
65
|
+
|
|
66
|
+
### 1. Pre-flight Checks
|
|
67
|
+
```bash
|
|
68
|
+
# Verify tests pass
|
|
69
|
+
{project test command}
|
|
70
|
+
|
|
71
|
+
# Verify types check
|
|
72
|
+
{project typecheck command}
|
|
73
|
+
|
|
74
|
+
# Verify no lint errors
|
|
75
|
+
{project lint command}
|
|
76
|
+
|
|
77
|
+
# Check for merge conflicts
|
|
78
|
+
git fetch origin main && git merge-base --is-ancestor origin/main HEAD
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### 2. PR Title
|
|
82
|
+
Follow the same format as commit messages: `{type}({scope}): {description}`
|
|
83
|
+
|
|
84
|
+
Keep under 70 characters. The title should tell a reviewer what this PR does without reading the description.
|
|
85
|
+
|
|
86
|
+
### 3. PR Description Template
|
|
87
|
+
|
|
88
|
+
```markdown
|
|
89
|
+
## Summary
|
|
90
|
+
{1-3 bullet points: what this PR does and why}
|
|
91
|
+
|
|
92
|
+
## Changes
|
|
93
|
+
- {Grouped list of meaningful changes}
|
|
94
|
+
|
|
95
|
+
## Testing
|
|
96
|
+
- [ ] {How to test this change}
|
|
97
|
+
- [ ] {Edge cases verified}
|
|
98
|
+
|
|
99
|
+
## Notes
|
|
100
|
+
{Anything the reviewer should know: trade-offs, follow-up work, deployment considerations}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 4. Checklist Before Opening
|
|
104
|
+
|
|
105
|
+
- [ ] Branch is up to date with base branch
|
|
106
|
+
- [ ] All tests pass
|
|
107
|
+
- [ ] Types check cleanly
|
|
108
|
+
- [ ] No lint errors
|
|
109
|
+
- [ ] No unresolved merge conflicts
|
|
110
|
+
- [ ] PR title follows conventional format
|
|
111
|
+
- [ ] Description explains the "why"
|
|
112
|
+
- [ ] Changes are focused (one concern per PR)
|
|
113
|
+
|
|
114
|
+
## Workflow Commands
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Create feature branch from latest main
|
|
118
|
+
git checkout main && git pull && git checkout -b feat/description
|
|
119
|
+
|
|
120
|
+
# Stage and commit with conventional message
|
|
121
|
+
git add {files}
|
|
122
|
+
git commit -m "feat(scope): description"
|
|
123
|
+
|
|
124
|
+
# Push and create PR
|
|
125
|
+
git push -u origin HEAD
|
|
126
|
+
gh pr create --title "feat(scope): description" --body "..."
|
|
127
|
+
|
|
128
|
+
# Update branch with latest main
|
|
129
|
+
git fetch origin main && git rebase origin/main
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Principles
|
|
133
|
+
|
|
134
|
+
- **Small PRs are better.** If a PR touches more than 10 files or 300 lines, consider splitting it.
|
|
135
|
+
- **One concern per PR.** Do not mix a feature with a refactor with a dependency upgrade.
|
|
136
|
+
- **Commit history matters.** Each commit should be a logical, buildable unit. Squash fixup commits before opening the PR.
|
|
137
|
+
- **The PR description is for the reviewer.** Write it to save their time, not yours.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Run code quality checks on a directory or file"
|
|
3
|
+
allowed-tools:
|
|
4
|
+
- Bash
|
|
5
|
+
- Read
|
|
6
|
+
- Glob
|
|
7
|
+
- Grep
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Code Quality Check
|
|
11
|
+
|
|
12
|
+
Run lint, typecheck, and format checks against the target directory or file. Report all issues found and suggest fixes.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. **Detect project tooling** by reading `package.json`, `pyproject.toml`, `Makefile`, `Cargo.toml`, or equivalent config files in the project root. Identify which linter, typechecker, and formatter are configured.
|
|
17
|
+
|
|
18
|
+
2. **Run linting** using the project-configured linter (e.g., `eslint`, `ruff`, `clippy`, `golangci-lint`). If no linter is configured, note it and skip.
|
|
19
|
+
|
|
20
|
+
3. **Run type checking** using the project-configured typechecker (e.g., `tsc --noEmit`, `mypy`, `pyright`). If no typechecker is configured, note it and skip.
|
|
21
|
+
|
|
22
|
+
4. **Run format checking** using the project-configured formatter in check mode (e.g., `prettier --check`, `black --check`, `rustfmt --check`, `gofmt -l`). If no formatter is configured, note it and skip.
|
|
23
|
+
|
|
24
|
+
5. **Compile results** into a structured report.
|
|
25
|
+
|
|
26
|
+
## Output Format
|
|
27
|
+
|
|
28
|
+
```markdown
|
|
29
|
+
## Code Quality Report
|
|
30
|
+
|
|
31
|
+
**Target:** {path}
|
|
32
|
+
**Tools detected:** {list of tools found}
|
|
33
|
+
|
|
34
|
+
### Lint Issues ({count})
|
|
35
|
+
| File | Line | Rule | Message | Severity |
|
|
36
|
+
|------|------|------|---------|----------|
|
|
37
|
+
| ... | ... | ... | ... | ... |
|
|
38
|
+
|
|
39
|
+
### Type Errors ({count})
|
|
40
|
+
| File | Line | Message |
|
|
41
|
+
|------|------|---------|
|
|
42
|
+
| ... | ... | ... |
|
|
43
|
+
|
|
44
|
+
### Format Issues ({count})
|
|
45
|
+
| File | Status |
|
|
46
|
+
|------|--------|
|
|
47
|
+
| ... | ... |
|
|
48
|
+
|
|
49
|
+
### Summary
|
|
50
|
+
- {total} issues found across {files} files
|
|
51
|
+
- **Suggested fixes:** {actionable suggestions}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Notes
|
|
55
|
+
|
|
56
|
+
- Always use the project's own configuration. Do not impose external rules.
|
|
57
|
+
- If a tool exits with a non-zero code, capture its output rather than treating it as a failure.
|
|
58
|
+
- For monorepos, scope checks to the target directory rather than the entire repo.
|
|
59
|
+
- If the user provides a specific file or directory, check only that scope.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Onboard yourself to a codebase area or task"
|
|
3
|
+
allowed-tools:
|
|
4
|
+
- Bash
|
|
5
|
+
- Read
|
|
6
|
+
- Glob
|
|
7
|
+
- Grep
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Codebase Onboarding
|
|
11
|
+
|
|
12
|
+
Systematically explore and understand a codebase area, module, or task context. Produce a structured summary of findings.
|
|
13
|
+
|
|
14
|
+
## Workflow
|
|
15
|
+
|
|
16
|
+
1. **Understand the scope.** The user will specify an area (e.g., "the auth module", "the payments flow", "this repo"). If no scope is given, start from the project root.
|
|
17
|
+
|
|
18
|
+
2. **Read foundational files first:**
|
|
19
|
+
- `README.md`, `CLAUDE.md`, `CONTRIBUTING.md` (project conventions)
|
|
20
|
+
- `package.json`, `pyproject.toml`, `Cargo.toml`, `go.mod` (dependencies and scripts)
|
|
21
|
+
- Config files (`.env.example`, `docker-compose.yml`, CI configs)
|
|
22
|
+
- Entry points (`src/index.*`, `src/main.*`, `app.*`, `cmd/`)
|
|
23
|
+
|
|
24
|
+
3. **Map the architecture:**
|
|
25
|
+
- Identify the directory structure and what each top-level folder contains
|
|
26
|
+
- Find entry points and trace the request/data flow
|
|
27
|
+
- Identify key abstractions (models, services, controllers, middleware)
|
|
28
|
+
- Note design patterns in use (repository pattern, dependency injection, etc.)
|
|
29
|
+
|
|
30
|
+
4. **Identify conventions:**
|
|
31
|
+
- Naming conventions (files, functions, variables)
|
|
32
|
+
- Error handling patterns
|
|
33
|
+
- Testing patterns (frameworks, file placement, naming)
|
|
34
|
+
- State management approach
|
|
35
|
+
|
|
36
|
+
5. **Understand dependencies:**
|
|
37
|
+
- Key external libraries and what they're used for
|
|
38
|
+
- Internal module dependencies and boundaries
|
|
39
|
+
- Database schema or data models
|
|
40
|
+
|
|
41
|
+
6. **Ask clarifying questions** if the codebase has ambiguities, undocumented conventions, or conflicting patterns.
|
|
42
|
+
|
|
43
|
+
## Output Format
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
## Onboarding Summary: {area}
|
|
47
|
+
|
|
48
|
+
### Tech Stack
|
|
49
|
+
- **Language:** {language and version}
|
|
50
|
+
- **Framework:** {framework}
|
|
51
|
+
- **Key libraries:** {list with purpose}
|
|
52
|
+
- **Database:** {if applicable}
|
|
53
|
+
|
|
54
|
+
### Architecture
|
|
55
|
+
{2-4 sentences describing the overall structure}
|
|
56
|
+
|
|
57
|
+
### Directory Map
|
|
58
|
+
- `src/` - {purpose}
|
|
59
|
+
- `src/models/` - {purpose}
|
|
60
|
+
- `src/services/` - {purpose}
|
|
61
|
+
- ...
|
|
62
|
+
|
|
63
|
+
### Key Files
|
|
64
|
+
| File | Purpose | Notes |
|
|
65
|
+
|------|---------|-------|
|
|
66
|
+
| ... | ... | ... |
|
|
67
|
+
|
|
68
|
+
### Data Flow
|
|
69
|
+
{How a request/action flows through the system, from entry to response}
|
|
70
|
+
|
|
71
|
+
### Conventions
|
|
72
|
+
- **Naming:** {patterns observed}
|
|
73
|
+
- **Error handling:** {approach}
|
|
74
|
+
- **Testing:** {framework, patterns, location}
|
|
75
|
+
|
|
76
|
+
### Questions / Gaps
|
|
77
|
+
- {Things that are unclear or undocumented}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Notes
|
|
81
|
+
|
|
82
|
+
- Prioritize understanding over completeness. It is better to deeply understand 5 key files than to skim 50.
|
|
83
|
+
- Note what is NOT there (missing tests, missing docs, missing error handling) as well as what is.
|
|
84
|
+
- If onboarding for a specific task, focus exploration on the areas relevant to that task.
|