@dennisrongo/skills 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/LICENSE +21 -0
- package/README.md +230 -0
- package/bin/claude-skills.js +189 -0
- package/lib/install.js +111 -0
- package/lib/list.js +63 -0
- package/lib/paths.js +39 -0
- package/lib/remove.js +52 -0
- package/lib/skills.js +121 -0
- package/package.json +48 -0
- package/skills/_template/SKILL.md +34 -0
- package/skills/conventional-commits/SKILL.md +136 -0
- package/skills/diagnose/SKILL.md +140 -0
- package/skills/dotnet-onion-api/SKILL.md +267 -0
- package/skills/dotnet-onion-api/references/anti-patterns.md +155 -0
- package/skills/dotnet-onion-api/references/solution-layout.md +113 -0
- package/skills/dotnet-onion-api/references/templates/appsettings.md +75 -0
- package/skills/dotnet-onion-api/references/templates/base-controller.cs.md +90 -0
- package/skills/dotnet-onion-api/references/templates/csproj-files.md +178 -0
- package/skills/dotnet-onion-api/references/templates/dbcontext.cs.md +149 -0
- package/skills/dotnet-onion-api/references/templates/exception-middleware.cs.md +101 -0
- package/skills/dotnet-onion-api/references/templates/feature-slice.md +349 -0
- package/skills/dotnet-onion-api/references/templates/program-cs.md +171 -0
- package/skills/dotnet-onion-api/references/templates/worker-program.cs.md +166 -0
- package/skills/grill-with-docs/SKILL.md +203 -0
- package/skills/handoff/SKILL.md +155 -0
- package/skills/improve-codebase-architecture/DEEPENING.md +37 -0
- package/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +44 -0
- package/skills/improve-codebase-architecture/LANGUAGE.md +53 -0
- package/skills/improve-codebase-architecture/SKILL.md +121 -0
- package/skills/nextjs-app-router/SKILL.md +328 -0
- package/skills/nextjs-app-router/references/anti-patterns.md +203 -0
- package/skills/nextjs-app-router/references/folder-layout.md +151 -0
- package/skills/nextjs-app-router/references/good-patterns.md +212 -0
- package/skills/nextjs-app-router/references/templates/api-base.md +62 -0
- package/skills/nextjs-app-router/references/templates/api-slice.md +75 -0
- package/skills/nextjs-app-router/references/templates/auth-slice.md +95 -0
- package/skills/nextjs-app-router/references/templates/ci-and-hooks.md +94 -0
- package/skills/nextjs-app-router/references/templates/components-json.md +41 -0
- package/skills/nextjs-app-router/references/templates/env-and-utils.md +110 -0
- package/skills/nextjs-app-router/references/templates/eslint-prettier.md +82 -0
- package/skills/nextjs-app-router/references/templates/feature-slice.md +184 -0
- package/skills/nextjs-app-router/references/templates/form-with-zod.md +192 -0
- package/skills/nextjs-app-router/references/templates/middleware.md +88 -0
- package/skills/nextjs-app-router/references/templates/next-config.md +42 -0
- package/skills/nextjs-app-router/references/templates/package.md +99 -0
- package/skills/nextjs-app-router/references/templates/providers-and-store.md +79 -0
- package/skills/nextjs-app-router/references/templates/root-layout.md +146 -0
- package/skills/nextjs-app-router/references/templates/route-group-layouts.md +90 -0
- package/skills/nextjs-app-router/references/templates/tailwind-config.md +89 -0
- package/skills/nextjs-app-router/references/templates/testing.md +137 -0
- package/skills/nextjs-app-router/references/templates/tsconfig.md +40 -0
- package/skills/plan-and-build/SKILL.md +214 -0
- package/skills/pr-review/SKILL.md +132 -0
- package/skills/write-a-skill/SKILL.md +191 -0
package/lib/remove.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const kleur = require('kleur');
|
|
6
|
+
const { getInstallDir } = require('./paths');
|
|
7
|
+
const { listInstalledSkills } = require('./skills');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Remove one or more installed skills.
|
|
11
|
+
* @param {string[]} identifiers
|
|
12
|
+
* @param {object} options - { scope }
|
|
13
|
+
*/
|
|
14
|
+
function remove(identifiers, options) {
|
|
15
|
+
const { scope = 'global' } = options;
|
|
16
|
+
const installDir = getInstallDir(scope);
|
|
17
|
+
const installed = listInstalledSkills(installDir);
|
|
18
|
+
|
|
19
|
+
if (identifiers.length === 0) {
|
|
20
|
+
console.error(kleur.red('Specify at least one skill to remove (or use --all).'));
|
|
21
|
+
process.exitCode = 1;
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
for (const id of identifiers) {
|
|
26
|
+
const match = installed.find((s) => s.name === id || s.slug === id);
|
|
27
|
+
if (!match) {
|
|
28
|
+
console.error(kleur.yellow(`⊘ Not installed: ${id}`));
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
fs.rmSync(match.dir, { recursive: true, force: true });
|
|
32
|
+
console.log(kleur.green(`✓ removed`) + ` ${match.name}`);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function removeAll(options) {
|
|
37
|
+
const { scope = 'global' } = options;
|
|
38
|
+
const installDir = getInstallDir(scope);
|
|
39
|
+
const installed = listInstalledSkills(installDir);
|
|
40
|
+
|
|
41
|
+
if (installed.length === 0) {
|
|
42
|
+
console.log(kleur.yellow('No skills installed.'));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
for (const skill of installed) {
|
|
47
|
+
fs.rmSync(skill.dir, { recursive: true, force: true });
|
|
48
|
+
console.log(kleur.green(`✓ removed`) + ` ${skill.name}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = { remove, removeAll };
|
package/lib/skills.js
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('node:fs');
|
|
4
|
+
const path = require('node:path');
|
|
5
|
+
const { getLibraryDir } = require('./paths');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Parse YAML-ish frontmatter from a SKILL.md.
|
|
9
|
+
* We only need `name` and `description`, so a tiny parser is fine —
|
|
10
|
+
* no need to pull in a yaml dependency.
|
|
11
|
+
*/
|
|
12
|
+
function parseFrontmatter(content) {
|
|
13
|
+
if (!content.startsWith('---')) return {};
|
|
14
|
+
const end = content.indexOf('\n---', 3);
|
|
15
|
+
if (end === -1) return {};
|
|
16
|
+
const block = content.slice(3, end).trim();
|
|
17
|
+
|
|
18
|
+
const out = {};
|
|
19
|
+
let currentKey = null;
|
|
20
|
+
let buffer = [];
|
|
21
|
+
|
|
22
|
+
const flush = () => {
|
|
23
|
+
if (currentKey) {
|
|
24
|
+
out[currentKey] = buffer.join(' ').trim().replace(/^["']|["']$/g, '');
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
for (const rawLine of block.split('\n')) {
|
|
29
|
+
const line = rawLine.replace(/\r$/, '');
|
|
30
|
+
const match = line.match(/^([A-Za-z_][A-Za-z0-9_-]*)\s*:\s*(.*)$/);
|
|
31
|
+
if (match) {
|
|
32
|
+
flush();
|
|
33
|
+
currentKey = match[1];
|
|
34
|
+
buffer = [match[2]];
|
|
35
|
+
} else if (currentKey && line.trim()) {
|
|
36
|
+
// continuation line for multi-line values
|
|
37
|
+
buffer.push(line.trim());
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
flush();
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* List all skills bundled in this package's `skills/` directory.
|
|
46
|
+
* Returns: [{ name, description, dir }]
|
|
47
|
+
*/
|
|
48
|
+
function listLibrarySkills() {
|
|
49
|
+
const libDir = getLibraryDir();
|
|
50
|
+
if (!fs.existsSync(libDir)) return [];
|
|
51
|
+
|
|
52
|
+
const entries = fs.readdirSync(libDir, { withFileTypes: true });
|
|
53
|
+
const skills = [];
|
|
54
|
+
|
|
55
|
+
for (const entry of entries) {
|
|
56
|
+
if (!entry.isDirectory()) continue;
|
|
57
|
+
if (entry.name.startsWith('.') || entry.name.startsWith('_')) continue;
|
|
58
|
+
|
|
59
|
+
const skillDir = path.join(libDir, entry.name);
|
|
60
|
+
const skillFile = path.join(skillDir, 'SKILL.md');
|
|
61
|
+
if (!fs.existsSync(skillFile)) continue;
|
|
62
|
+
|
|
63
|
+
const content = fs.readFileSync(skillFile, 'utf8');
|
|
64
|
+
const fm = parseFrontmatter(content);
|
|
65
|
+
|
|
66
|
+
skills.push({
|
|
67
|
+
name: fm.name || entry.name,
|
|
68
|
+
description: fm.description || '(no description)',
|
|
69
|
+
dir: skillDir,
|
|
70
|
+
slug: entry.name,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* List skills installed at a given directory.
|
|
79
|
+
*/
|
|
80
|
+
function listInstalledSkills(installDir) {
|
|
81
|
+
if (!fs.existsSync(installDir)) return [];
|
|
82
|
+
|
|
83
|
+
const entries = fs.readdirSync(installDir, { withFileTypes: true });
|
|
84
|
+
const skills = [];
|
|
85
|
+
|
|
86
|
+
for (const entry of entries) {
|
|
87
|
+
if (!entry.isDirectory()) continue;
|
|
88
|
+
const skillDir = path.join(installDir, entry.name);
|
|
89
|
+
const skillFile = path.join(skillDir, 'SKILL.md');
|
|
90
|
+
if (!fs.existsSync(skillFile)) continue;
|
|
91
|
+
|
|
92
|
+
const content = fs.readFileSync(skillFile, 'utf8');
|
|
93
|
+
const fm = parseFrontmatter(content);
|
|
94
|
+
|
|
95
|
+
skills.push({
|
|
96
|
+
name: fm.name || entry.name,
|
|
97
|
+
description: fm.description || '(no description)',
|
|
98
|
+
dir: skillDir,
|
|
99
|
+
slug: entry.name,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Find a skill in the library by either its `name` frontmatter or its directory slug.
|
|
108
|
+
*/
|
|
109
|
+
function findLibrarySkill(identifier) {
|
|
110
|
+
const skills = listLibrarySkills();
|
|
111
|
+
return skills.find(
|
|
112
|
+
(s) => s.name === identifier || s.slug === identifier
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
module.exports = {
|
|
117
|
+
parseFrontmatter,
|
|
118
|
+
listLibrarySkills,
|
|
119
|
+
listInstalledSkills,
|
|
120
|
+
findLibrarySkill,
|
|
121
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dennisrongo/skills",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "A curated, fine-tunable library of Claude Code skills. Install globally or per-project via npx.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"claude-skills": "bin/claude-skills.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/",
|
|
10
|
+
"lib/",
|
|
11
|
+
"skills/",
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"test": "node --test test/cli.test.js test/skills.test.js",
|
|
17
|
+
"prepublishOnly": "npm test"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"claude",
|
|
21
|
+
"claude-code",
|
|
22
|
+
"skills",
|
|
23
|
+
"anthropic",
|
|
24
|
+
"ai",
|
|
25
|
+
"cli"
|
|
26
|
+
],
|
|
27
|
+
"author": "Dennis Rongo",
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@inquirer/prompts": "^7.0.0",
|
|
34
|
+
"kleur": "^4.1.5"
|
|
35
|
+
},
|
|
36
|
+
"repository": {
|
|
37
|
+
"type": "git",
|
|
38
|
+
"url": "git+https://github.com/dennisrongo/claude-skills.git"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/dennisrongo/claude-skills#readme",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/dennisrongo/claude-skills/issues"
|
|
43
|
+
},
|
|
44
|
+
"publishConfig": {
|
|
45
|
+
"access": "public",
|
|
46
|
+
"provenance": true
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: my-skill-name
|
|
3
|
+
description: One sentence describing what this skill does AND when to use it. Be specific about trigger phrases. Make sure to use this skill whenever the user mentions [X], [Y], or [Z], even if they don't explicitly ask for a "[skill name]".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# My Skill Name
|
|
7
|
+
|
|
8
|
+
A short paragraph explaining what this skill is and when it applies.
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
- Trigger condition 1
|
|
13
|
+
- Trigger condition 2
|
|
14
|
+
- Trigger condition 3
|
|
15
|
+
|
|
16
|
+
## Instructions
|
|
17
|
+
|
|
18
|
+
Step-by-step guidance for Claude on how to handle the task.
|
|
19
|
+
|
|
20
|
+
1. First, do X.
|
|
21
|
+
2. Then, do Y.
|
|
22
|
+
3. Finally, do Z.
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
### Example 1: [scenario]
|
|
27
|
+
|
|
28
|
+
**User:** "..."
|
|
29
|
+
|
|
30
|
+
**Claude:** [what the ideal response looks like]
|
|
31
|
+
|
|
32
|
+
## Notes
|
|
33
|
+
|
|
34
|
+
Any caveats, edge cases, or things to watch out for.
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: conventional-commits
|
|
3
|
+
description: Write git commit messages following the Conventional Commits specification, with an automatic ticket number pulled from the current branch and a project tag (API / CLIENT / CONSOLE / DB) when the project type can be detected from the diff. Use this skill whenever the user asks to write a commit message, asks for help committing changes, runs `git commit`, or mentions writing changelog entries — even if they don't explicitly say "conventional commits".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Conventional Commits
|
|
7
|
+
|
|
8
|
+
Write commit messages that follow the [Conventional Commits](https://www.conventionalcommits.org/) spec, prefixed with the ticket number (from the current branch) and the project tag (`API` / `CLIENT` / `CONSOLE` / `DB`) when those can be determined.
|
|
9
|
+
|
|
10
|
+
## Format
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
[#<ticket>] [(<PROJECT>)] <type>[(<scope>)][!]: <description>
|
|
14
|
+
|
|
15
|
+
[optional body]
|
|
16
|
+
|
|
17
|
+
[optional footer(s)]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Bracketed segments are included only when they apply (see [Branch & project context](#branch--project-context)). A fully-tagged example:
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
#12345 (CLIENT) fix: prevent modal z-index regression on settings page
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Types
|
|
27
|
+
|
|
28
|
+
- **feat** — a new feature (correlates with MINOR in semver)
|
|
29
|
+
- **fix** — a bug fix (correlates with PATCH in semver)
|
|
30
|
+
- **docs** — documentation only changes
|
|
31
|
+
- **style** — formatting, missing semicolons, etc; no code change
|
|
32
|
+
- **refactor** — code change that neither fixes a bug nor adds a feature
|
|
33
|
+
- **perf** — a code change that improves performance
|
|
34
|
+
- **test** — adding or correcting tests
|
|
35
|
+
- **build** — changes to the build system or external dependencies
|
|
36
|
+
- **ci** — changes to CI configuration files and scripts
|
|
37
|
+
- **chore** — other changes that don't modify src or test files
|
|
38
|
+
- **revert** — reverts a previous commit
|
|
39
|
+
|
|
40
|
+
## Branch & project context
|
|
41
|
+
|
|
42
|
+
Before composing the message, gather two pieces of context from the repo.
|
|
43
|
+
|
|
44
|
+
### Ticket number (from current branch)
|
|
45
|
+
|
|
46
|
+
1. Run `git rev-parse --abbrev-ref HEAD` to get the current branch name.
|
|
47
|
+
2. Take the last `/`-separated segment of the branch (so `feature/12345-fix_this_bug` becomes `12345-fix_this_bug`).
|
|
48
|
+
3. If that segment starts with one or more digits followed by `-`, `_`, or end-of-string, those leading digits are the ticket number.
|
|
49
|
+
4. If no leading numeric ID is found, **omit `#<ticket>` from the message entirely** — do not invent one and do not prompt the user for it.
|
|
50
|
+
|
|
51
|
+
Examples:
|
|
52
|
+
|
|
53
|
+
| Branch | Extracted ticket |
|
|
54
|
+
|---------------------------------|------------------|
|
|
55
|
+
| `feature/12345-fix_this_bug` | `12345` |
|
|
56
|
+
| `12345-fix_this_bug` | `12345` |
|
|
57
|
+
| `bugfix/9-typo` | `9` |
|
|
58
|
+
| `main`, `release/v2`, `feature/redesign` | (none — omit `#`) |
|
|
59
|
+
|
|
60
|
+
### Project tag
|
|
61
|
+
|
|
62
|
+
Pick ONE of `API`, `CLIENT`, `CONSOLE`, or `DB` based on what was actually changed in the diff:
|
|
63
|
+
|
|
64
|
+
- **API** — backend services, REST / GraphQL endpoints, server-side handlers. Signals: paths like `api/`, `server/`, `backend/`, `services/api/`, `apps/api/`; server framework code (Express, NestJS, FastAPI, Django, Rails, Spring); OpenAPI specs.
|
|
65
|
+
- **CLIENT** — user-facing frontend. Signals: paths like `client/`, `web/`, `frontend/`, `apps/web/`, `apps/client/`, `ui/`; `.tsx` / `.jsx` / `.vue` / `.svelte`; React / Vue / Angular / Svelte component files; user-facing CSS / Tailwind / design assets.
|
|
66
|
+
- **CONSOLE** — .NET console applications (CLIs, worker services, background tools). Signals: `.csproj` files with `<OutputType>Exe</OutputType>` or `Sdk="Microsoft.NET.Sdk"` (and NOT `Microsoft.NET.Sdk.Web`); `Program.cs` without ASP.NET / web-host bootstrap; `Microsoft.Extensions.Hosting` worker or `BackgroundService` usage; CLI libraries like `System.CommandLine`, `Spectre.Console`, `CommandLineParser`, `McMaster.Extensions.CommandLineUtils`; project names ending in `.Console`, `.Cli`, `.Worker`, or `.Tool`; paths like `console/`, `apps/console/`, `tools/`, `cli/`.
|
|
67
|
+
- **DB** — database schema, migrations, seeds, ORM models. Signals: paths like `db/`, `migrations/`, `prisma/`, `schema.prisma`, SQL files, `alembic/`, `knex/`, model-only changes.
|
|
68
|
+
|
|
69
|
+
How to decide:
|
|
70
|
+
|
|
71
|
+
1. Run `git diff --cached --name-only` (fall back to `git diff --name-only` if nothing is staged).
|
|
72
|
+
2. Match the changed paths against the signals above. If all changed files cluster under one bucket, use that tag.
|
|
73
|
+
3. If the diff genuinely spans multiple buckets, pick the dominant one (most files or largest change) and mention the secondary in the body.
|
|
74
|
+
4. If none of the four buckets fit the repo (e.g., a library, a docs-only repo, a meta-tooling project), **omit `(PROJECT)`** — same fallback rule as the missing ticket.
|
|
75
|
+
5. If two buckets are plausibly equal and you can't break the tie from the diff, ask the user which one applies. Do not guess silently.
|
|
76
|
+
|
|
77
|
+
## Rules
|
|
78
|
+
|
|
79
|
+
1. Description must be lowercase, present tense ("add" not "added"), and under 72 characters. The `#12345 (CLIENT)` prefix counts toward the 72-char header budget — keep the description tight.
|
|
80
|
+
2. No period at the end of the description.
|
|
81
|
+
3. Breaking changes get a `!` after the type / scope (e.g., `#12345 (API) feat!: drop support for Node 16`) and a `BREAKING CHANGE:` footer.
|
|
82
|
+
4. Inner `type(scope)` is optional and usually redundant once `(PROJECT)` is present. Only use it when it adds real specificity beyond the project tag (e.g., `#12345 (API) fix(auth): ...` when "auth" narrows further than "API").
|
|
83
|
+
5. Body explains the *why*, not the *what*. Wrap at 72 chars.
|
|
84
|
+
|
|
85
|
+
## Workflow
|
|
86
|
+
|
|
87
|
+
When the user asks for a commit message:
|
|
88
|
+
|
|
89
|
+
1. Get the current branch with `git rev-parse --abbrev-ref HEAD` and extract the ticket number per the rules above.
|
|
90
|
+
2. Inspect the staged diff: `git diff --cached` (or `git diff` if nothing is staged).
|
|
91
|
+
3. From the changed file paths, determine the project tag — or decide to omit it.
|
|
92
|
+
4. Categorize the change into one of the types.
|
|
93
|
+
5. Write a concise description.
|
|
94
|
+
6. If the change is non-trivial, add a body explaining the rationale.
|
|
95
|
+
7. Flag breaking changes explicitly.
|
|
96
|
+
8. Assemble the header as `[#<ticket>] [(<PROJECT>)] <type>: <description>`, including only the segments that apply.
|
|
97
|
+
|
|
98
|
+
## Examples
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
#12345 (CLIENT) fix: prevent modal z-index regression on settings page
|
|
102
|
+
|
|
103
|
+
#12345 (API) feat(auth): add OAuth2 PKCE flow for mobile clients
|
|
104
|
+
|
|
105
|
+
#987 (DB) chore: add index on users.created_at for analytics query
|
|
106
|
+
|
|
107
|
+
#42 (CONSOLE) feat: add bulk-export action to billing dashboard
|
|
108
|
+
|
|
109
|
+
(API) refactor: extract token validator into shared middleware
|
|
110
|
+
# ^ branch had no ticket — `#` omitted
|
|
111
|
+
|
|
112
|
+
#7 fix: correct off-by-one in pagination cursor
|
|
113
|
+
# ^ repo doesn't fit API / CLIENT / CONSOLE / DB — `(PROJECT)` omitted
|
|
114
|
+
|
|
115
|
+
fix: prevent race condition in cache invalidation
|
|
116
|
+
|
|
117
|
+
The previous implementation could double-invalidate when two requests
|
|
118
|
+
arrived within the lock window. Use a single atomic CAS.
|
|
119
|
+
|
|
120
|
+
Fixes #482
|
|
121
|
+
# ^ no ticket in branch, no project bucket fits — both prefixes omitted
|
|
122
|
+
|
|
123
|
+
#1024 (API) refactor!: rename `user.email` column to `user.email_address`
|
|
124
|
+
|
|
125
|
+
BREAKING CHANGE: clients reading `user.email` must update to `user.email_address`.
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Anti-patterns to avoid
|
|
129
|
+
|
|
130
|
+
- ❌ `update stuff` (no type, vague)
|
|
131
|
+
- ❌ `Fix: Bug in login page.` (capitalized, trailing period)
|
|
132
|
+
- ❌ `feat: added the ability to export CSV files` (past tense)
|
|
133
|
+
- ❌ `#12345 (CLIENT) feat: added export.` (past tense + trailing period)
|
|
134
|
+
- ❌ Inventing a ticket number when the branch doesn't have one
|
|
135
|
+
- ❌ Forcing a `(PROJECT)` tag when the diff doesn't actually map to API / CLIENT / CONSOLE / DB
|
|
136
|
+
- ✅ `#12345 (CLIENT) feat: add CSV export`
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagnose
|
|
3
|
+
description: Disciplined diagnosis loop for hard bugs and performance regressions. Reproduce → minimise → hypothesise → instrument → fix → regression-test. Use this skill whenever the user says "diagnose this", "debug this", "/diagnose", reports a bug, says something is broken / throwing / failing / flaky / hanging / leaking, or describes a performance regression — even if they don't explicitly ask for a "diagnose skill".
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Diagnose
|
|
7
|
+
|
|
8
|
+
A discipline for hard bugs. Skip phases only when explicitly justified.
|
|
9
|
+
|
|
10
|
+
When exploring the codebase, use the project's domain glossary to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.
|
|
11
|
+
|
|
12
|
+
## When to use this skill
|
|
13
|
+
|
|
14
|
+
- The user runs `/diagnose` or types "diagnose this" / "debug this".
|
|
15
|
+
- The user reports a bug or says code is broken, throwing, failing, hanging, crashing, leaking, or producing wrong output.
|
|
16
|
+
- The user describes a performance regression ("got slower", "high CPU", "timeout", "p95 climbed", "memory growing").
|
|
17
|
+
- The user shows a stack trace, error log, or failing test and asks why.
|
|
18
|
+
- A test is flaky and the user wants the underlying cause, not just a retry / skip.
|
|
19
|
+
|
|
20
|
+
Do **not** use this skill for: tiny known-cause one-line fixes, typos, or questions about how code works when nothing is actually wrong.
|
|
21
|
+
|
|
22
|
+
## Phase 1 — Build a feedback loop
|
|
23
|
+
|
|
24
|
+
**This is the skill.** Everything else is mechanical. If you have a fast, deterministic, agent-runnable pass/fail signal for the bug, you will find the cause — bisection, hypothesis-testing, and instrumentation all just consume that signal. If you don't have one, no amount of staring at code will save you.
|
|
25
|
+
|
|
26
|
+
Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
|
|
27
|
+
|
|
28
|
+
### Ways to construct one — try them in roughly this order
|
|
29
|
+
|
|
30
|
+
1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.
|
|
31
|
+
2. **Curl / HTTP script** against a running dev server.
|
|
32
|
+
3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
|
|
33
|
+
4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.
|
|
34
|
+
5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.
|
|
35
|
+
6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.
|
|
36
|
+
7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
|
|
37
|
+
8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can `git bisect run` it.
|
|
38
|
+
9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
|
|
39
|
+
10. **HITL bash script.** Last resort. If a human must click, drive _them_ with a structured prompt-and-capture loop so the signal is still machine-readable. Captured output feeds back to you.
|
|
40
|
+
|
|
41
|
+
Build the right feedback loop, and the bug is 90% fixed.
|
|
42
|
+
|
|
43
|
+
### Iterate on the loop itself
|
|
44
|
+
|
|
45
|
+
Treat the loop as a product. Once you have _a_ loop, ask:
|
|
46
|
+
|
|
47
|
+
- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)
|
|
48
|
+
- Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".)
|
|
49
|
+
- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)
|
|
50
|
+
|
|
51
|
+
A 30-second flaky loop is barely better than no loop. A 2-second deterministic loop is a debugging superpower.
|
|
52
|
+
|
|
53
|
+
### Non-deterministic bugs
|
|
54
|
+
|
|
55
|
+
The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it's debuggable.
|
|
56
|
+
|
|
57
|
+
### When you genuinely cannot build a loop
|
|
58
|
+
|
|
59
|
+
Stop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.
|
|
60
|
+
|
|
61
|
+
Do not proceed to Phase 2 until you have a loop you believe in.
|
|
62
|
+
|
|
63
|
+
## Phase 2 — Reproduce
|
|
64
|
+
|
|
65
|
+
Run the loop. Watch the bug appear.
|
|
66
|
+
|
|
67
|
+
Confirm:
|
|
68
|
+
|
|
69
|
+
- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.
|
|
70
|
+
- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).
|
|
71
|
+
- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.
|
|
72
|
+
|
|
73
|
+
Do not proceed until you reproduce the bug.
|
|
74
|
+
|
|
75
|
+
## Phase 3 — Hypothesise
|
|
76
|
+
|
|
77
|
+
Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
|
|
78
|
+
|
|
79
|
+
Each hypothesis must be **falsifiable**: state the prediction it makes.
|
|
80
|
+
|
|
81
|
+
> Format: "If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse."
|
|
82
|
+
|
|
83
|
+
If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.
|
|
84
|
+
|
|
85
|
+
**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it — proceed with your ranking if the user is AFK.
|
|
86
|
+
|
|
87
|
+
## Phase 4 — Instrument
|
|
88
|
+
|
|
89
|
+
Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.**
|
|
90
|
+
|
|
91
|
+
Tool preference:
|
|
92
|
+
|
|
93
|
+
1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.
|
|
94
|
+
2. **Targeted logs** at the boundaries that distinguish hypotheses.
|
|
95
|
+
3. Never "log everything and grep".
|
|
96
|
+
|
|
97
|
+
**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.
|
|
98
|
+
|
|
99
|
+
**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.
|
|
100
|
+
|
|
101
|
+
## Phase 5 — Fix + regression test
|
|
102
|
+
|
|
103
|
+
Write the regression test **before the fix** — but only if there is a **correct seam** for it.
|
|
104
|
+
|
|
105
|
+
A correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.
|
|
106
|
+
|
|
107
|
+
**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.
|
|
108
|
+
|
|
109
|
+
If a correct seam exists:
|
|
110
|
+
|
|
111
|
+
1. Turn the minimised repro into a failing test at that seam.
|
|
112
|
+
2. Watch it fail.
|
|
113
|
+
3. Apply the fix.
|
|
114
|
+
4. Watch it pass.
|
|
115
|
+
5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.
|
|
116
|
+
|
|
117
|
+
## Phase 6 — Cleanup + post-mortem
|
|
118
|
+
|
|
119
|
+
Required before declaring done:
|
|
120
|
+
|
|
121
|
+
- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
|
|
122
|
+
- [ ] Regression test passes (or absence of seam is documented)
|
|
123
|
+
- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)
|
|
124
|
+
- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)
|
|
125
|
+
- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns
|
|
126
|
+
|
|
127
|
+
**Then ask: what would have prevented this bug?** If the answer involves architectural change (no good test seam, tangled callers, hidden coupling), surface it as a follow-up recommendation with specifics. Make the recommendation **after** the fix is in, not before — you have more information now than when you started.
|
|
128
|
+
|
|
129
|
+
## Anti-patterns
|
|
130
|
+
|
|
131
|
+
- Jumping to a fix before building a feedback loop — you're guessing, not diagnosing.
|
|
132
|
+
- A single hypothesis becomes "the cause" without falsification — anchoring.
|
|
133
|
+
- "Added some logs" without tagging them — they survive into production.
|
|
134
|
+
- Marking the bug fixed because the symptom went away once — without re-running the loop or adding a regression test, you don't know.
|
|
135
|
+
- Treating a flaky test as flaky-by-nature and retrying — flakes are bugs with a low reproduction rate; raise the rate.
|
|
136
|
+
- Skipping the post-mortem question — same class of bug returns.
|
|
137
|
+
|
|
138
|
+
## Notes
|
|
139
|
+
|
|
140
|
+
- Adapted from Matt Pocock's `diagnose` skill — same six-phase discipline (reproduce → minimise → hypothesise → instrument → fix → regression-test), with the architectural-handoff step generalised since this library doesn't ship a paired `improve-codebase-architecture` skill.
|