@workingpayload/agent-skills 1.0.0 → 2.0.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/APIForge/skill.md +150 -17
- package/AccessPlus/skill.md +122 -18
- package/AlgoMaster/skill.md +110 -17
- package/Architekt AI/skill.md +125 -17
- package/AuthCraft/skill.md +129 -17
- package/AutoScriptor/skill.md +122 -17
- package/BoilerCore/skill.md +121 -17
- package/BugHunter Pro/skill.md +118 -17
- package/ChangeScribe/skill.md +98 -17
- package/CodeSage/skill.md +148 -17
- package/CommitCraft/skill.md +97 -16
- package/CoverageMax/skill.md +145 -16
- package/CronGenius/skill.md +141 -16
- package/DataPolish/skill.md +126 -16
- package/DataWeaver/skill.md +135 -16
- package/DockMaster/skill.md +142 -16
- package/DocuGenie/skill.md +122 -16
- package/EdgeGuard/skill.md +144 -16
- package/EnvWizard/skill.md +140 -16
- package/ErrorMedic/skill.md +136 -16
- package/FeatureSmith/skill.md +123 -16
- package/FlexiLayout/skill.md +128 -16
- package/FlowTester/skill.md +138 -16
- package/FunctionForge/skill.md +120 -16
- package/InputShield/skill.md +128 -16
- package/IssueForge/skill.md +132 -16
- package/KubeCrafter/skill.md +133 -16
- package/LogicLens/skill.md +116 -16
- package/MockSmith/skill.md +130 -16
- package/ModelSensei/skill.md +122 -16
- package/PRMentor/skill.md +103 -32
- package/PerfDetective/skill.md +90 -32
- package/PipelinePro/skill.md +146 -32
- package/PolyglotShift/skill.md +94 -32
- package/PromptForge/skill.md +118 -32
- package/QueryPulse/skill.md +123 -32
- package/README.md +416 -329
- package/ReadMeCraft/skill.md +127 -32
- package/RefactorX/skill.md +84 -32
- package/RenderBoost/skill.md +148 -32
- package/SEOMancer/skill.md +140 -16
- package/ScrapeMaster/skill.md +157 -32
- package/SecretSniffer/skill.md +107 -16
- package/SecureScan/skill.md +114 -16
- package/ServiceSplitter/skill.md +137 -16
- package/SpeedSmith/skill.md +139 -16
- package/StackWise/skill.md +139 -16
- package/TaskOrchestrator/skill.md +119 -16
- package/TestCrafter/skill.md +142 -16
- package/TraceMind/skill.md +127 -16
- package/UISmith/skill.md +115 -16
- package/bin/cli.js +377 -0
- package/extension-extender/SKILL.md +122 -0
- package/fastapi-furious/SKILL.md +148 -0
- package/package.json +41 -28
- package/python-master/SKILL.md +108 -0
- package/react-ranger/SKILL.md +93 -0
- package/scripts/build_index.py +282 -0
- package/scripts/doctor.py +541 -0
- package/scripts/install.py +397 -0
- package/scripts/route.py +348 -0
- package/scripts/score.py +355 -0
- package/scripts/test_skill.py +473 -0
- package/scripts/validate.py +254 -0
- package/skills-routing.json +1131 -0
- package/skills.json +3261 -0
- package/Extension-Extender/SKILL.md +0 -41
- package/Extension-Extender/references/ui-guidelines.md +0 -26
- package/Fastapi-Furious/README.md +0 -16
- package/Fastapi-Furious/SKILL.md +0 -37
- package/Python-Master/README.md +0 -11
- package/Python-Master/SKILL.md +0 -37
- package/React-Ranger/README.md +0 -17
- package/React-Ranger/SKILL.md +0 -37
- package/cli.js +0 -181
- package/parse_skills.py +0 -44
- /package/{Extension-Extender → extension-extender}/assets/manifest.json +0 -0
- /package/{Extension-Extender → extension-extender}/assets/popup.css +0 -0
- /package/{Extension-Extender → extension-extender}/assets/popup.html +0 -0
- /package/{Extension-Extender → extension-extender}/assets/popup.js +0 -0
package/package.json
CHANGED
|
@@ -1,28 +1,41 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@workingpayload/agent-skills",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
5
|
-
"
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"claude",
|
|
17
|
-
"gemini",
|
|
18
|
-
"skills",
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@workingpayload/agent-skills",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "Install and run AI-powered developer skills across Claude and Gemini",
|
|
5
|
+
"bin": {
|
|
6
|
+
"agent-skills": "./bin/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"validate": "node bin/cli.js validate",
|
|
10
|
+
"score": "node bin/cli.js score",
|
|
11
|
+
"test-skills": "node bin/cli.js test",
|
|
12
|
+
"build-index": "node bin/cli.js build-index"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"ai",
|
|
16
|
+
"claude",
|
|
17
|
+
"gemini",
|
|
18
|
+
"skills",
|
|
19
|
+
"developer-tools",
|
|
20
|
+
"code-review",
|
|
21
|
+
"debugging"
|
|
22
|
+
],
|
|
23
|
+
"author": "workingpayload",
|
|
24
|
+
"license": "MIT",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/workingpayload/agent-skills"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=18"
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"bin/",
|
|
34
|
+
"scripts/",
|
|
35
|
+
"skills.json",
|
|
36
|
+
"skills-routing.json",
|
|
37
|
+
"*/skill.md",
|
|
38
|
+
"*/SKILL.md",
|
|
39
|
+
"extension-extender/assets/"
|
|
40
|
+
]
|
|
41
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: python-master
|
|
3
|
+
description: Builds, debugs, and fixes Python code using structured decision workflows with named tools (ruff, mypy, pytest, uv/poetry). Covers environment setup, testing, error handling, performance profiling, memory leak diagnosis, and dependency conflict resolution. Use when a user asks to build, fix, debug, or create Python code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Python Master
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Comprehensive Python development skill covering the full lifecycle: environment setup, building clean code, structured debugging, surgical fixing, testing, and performance optimization. Every step uses named tools with exact commands.
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
### 1. Environment Setup (Always First)
|
|
15
|
+
|
|
16
|
+
1. Check for existing environment: `.venv/`, `venv/`, or `pyproject.toml`.
|
|
17
|
+
- `pyproject.toml` exists → use `uv` (preferred) or `poetry`.
|
|
18
|
+
- Only `requirements.txt` → `python -m venv .venv && pip install -r requirements.txt`.
|
|
19
|
+
- New project → `uv init <name>` or `poetry new <name>`.
|
|
20
|
+
2. Never install into the global Python environment.
|
|
21
|
+
3. Confirm: `which python && python --version`.
|
|
22
|
+
|
|
23
|
+
### 2. Building Code
|
|
24
|
+
|
|
25
|
+
- PEP 8 compliant; type hints on all function signatures.
|
|
26
|
+
- Use `dataclasses` or `pydantic` for structured data; f-strings for formatting.
|
|
27
|
+
- One module per concern; functions under 40 lines; no global mutable state.
|
|
28
|
+
- After writing: `ruff check . --fix` → `mypy .` → `pytest -x`.
|
|
29
|
+
- **Pitfall — mutable defaults**: `def f(x=[])` shares state across calls. Use `def f(x=None): x = x or []`.
|
|
30
|
+
|
|
31
|
+
### 3. Debugging Decision Workflow
|
|
32
|
+
|
|
33
|
+
Follow in order — stop at the step that resolves the issue:
|
|
34
|
+
|
|
35
|
+
1. **Read the full traceback.** Identify file, line, and exception type.
|
|
36
|
+
2. `ImportError` / `ModuleNotFoundError` → verify venv is active, `pip show <pkg>`.
|
|
37
|
+
3. `TypeError` / `AttributeError` → add `breakpoint()` or `print(type(x), x)` before the failing line.
|
|
38
|
+
4. `KeyError` / `IndexError` → inspect data shape; use `.get()` for dicts, guard list access with `len()`.
|
|
39
|
+
5. No exception but wrong output → add `logging.debug` at function entry/exit to trace variable state.
|
|
40
|
+
6. Test was passing before → `pytest -x --tb=short` to isolate the regression.
|
|
41
|
+
7. `RecursionError` → check for missing base case or infinite mutual recursion; add `@functools.lru_cache` if memoization helps.
|
|
42
|
+
8. Once root cause is identified, **explain it before applying the fix**.
|
|
43
|
+
|
|
44
|
+
### 4. Fixing Code
|
|
45
|
+
|
|
46
|
+
- Surgical fixes only; do not rewrite files unless >60% of logic is wrong.
|
|
47
|
+
- After fixing: run `pytest path/to/test_file.py -x`.
|
|
48
|
+
- If no tests exist, write a regression test that reproduces the bug **before** fixing.
|
|
49
|
+
|
|
50
|
+
### 5. Testing
|
|
51
|
+
|
|
52
|
+
- Framework: `pytest` with tests in `tests/test_*.py`.
|
|
53
|
+
- Run: `pytest --tb=short -q` (quick), `pytest --cov=src --cov-report=term-missing` (coverage).
|
|
54
|
+
- Use `pytest.mark.parametrize` for data-driven cases; `unittest.mock.patch` / `pytest-mock` for external deps.
|
|
55
|
+
- Edge cases: empty input, `None`, boundary values, exception paths.
|
|
56
|
+
- Target: every public function has at least one happy-path and one error-path test.
|
|
57
|
+
|
|
58
|
+
### 6. Error Handling
|
|
59
|
+
|
|
60
|
+
- Specific exceptions only — never bare `except:`.
|
|
61
|
+
- I/O and network calls: `try/except` with `logging.error(msg, exc_info=True)`.
|
|
62
|
+
- Re-raise with context: `raise RuntimeError("context") from original_exc`.
|
|
63
|
+
- Define custom exceptions for domain errors: `class ValidationError(ValueError): ...`.
|
|
64
|
+
|
|
65
|
+
### 7. Performance
|
|
66
|
+
|
|
67
|
+
- **Profile first**: `python -m cProfile -s cumulative script.py | head -20`.
|
|
68
|
+
- Collections: `set` for membership, `collections.deque` for queues, `dict` over nested `if` chains.
|
|
69
|
+
- Numerical: NumPy vectorized ops over Python loops; `pandas` only for tabular structure.
|
|
70
|
+
- Async: `asyncio` with `async def` / `await`; never `time.sleep` in async code.
|
|
71
|
+
|
|
72
|
+
### 8. Advanced Diagnostics
|
|
73
|
+
|
|
74
|
+
**Memory leak diagnosis:**
|
|
75
|
+
```python
|
|
76
|
+
import tracemalloc
|
|
77
|
+
tracemalloc.start()
|
|
78
|
+
# ... run workload ...
|
|
79
|
+
for stat in tracemalloc.take_snapshot().statistics('lineno')[:10]:
|
|
80
|
+
print(stat)
|
|
81
|
+
```
|
|
82
|
+
Use `objgraph.show_most_common_types()` for reference cycles. For production: Py-Spy or Pyroscope for continuous profiling.
|
|
83
|
+
|
|
84
|
+
**Dependency conflicts:** `pip check` detects incompatible packages. Use `pip install --dry-run` to trace conflict chains. For forced versions: `constraints.txt` (`pip install -c constraints.txt`). With `uv`: `uv pip install --override`.
|
|
85
|
+
|
|
86
|
+
**Blocking calls in async code:**
|
|
87
|
+
```python
|
|
88
|
+
# CPU-bound → ProcessPoolExecutor (bypasses GIL)
|
|
89
|
+
# Blocking I/O → ThreadPoolExecutor (default)
|
|
90
|
+
loop = asyncio.get_running_loop()
|
|
91
|
+
result = await loop.run_in_executor(ProcessPoolExecutor(4), cpu_fn, data)
|
|
92
|
+
```
|
|
93
|
+
`ThreadPoolExecutor` does NOT bypass the GIL — use only for blocking I/O.
|
|
94
|
+
|
|
95
|
+
**Concurrency pitfalls:** `threading` shares the GIL — use `multiprocessing` or `ProcessPoolExecutor` for CPU parallelism. For async race conditions, use `asyncio.Lock`. For shared-memory data corruption, use `multiprocessing.Queue` or `multiprocessing.Value` with locks.
|
|
96
|
+
|
|
97
|
+
## Edge Cases
|
|
98
|
+
|
|
99
|
+
1. **Package with C extensions on Alpine Linux**: `pip install` fails with missing headers. Use `python:3.x-slim` (glibc) instead of Alpine (musl), or install build deps: `apk add gcc musl-dev`.
|
|
100
|
+
2. **Circular imports**: refactor by moving shared types to a `types.py` module, or use `TYPE_CHECKING` guard: `if TYPE_CHECKING: from module import Type`.
|
|
101
|
+
3. **`asyncio.run()` inside Jupyter**: Jupyter already runs an event loop. Use `await` directly or `nest_asyncio.apply()`.
|
|
102
|
+
|
|
103
|
+
## Output Format
|
|
104
|
+
|
|
105
|
+
When providing a fix or new code:
|
|
106
|
+
1. **Root cause**: what went wrong and why.
|
|
107
|
+
2. **Change**: the complete updated function/class (not a diff snippet).
|
|
108
|
+
3. **Verification**: exact command to confirm the fix works.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: react-ranger
|
|
3
|
+
description: Builds, debugs, and fixes React applications using TypeScript, hooks, and modern patterns (Server Components, Zustand, React Query). Includes structured debugging decision tree, testing with Vitest/RTL, accessibility checklist, and performance optimization. Use when a user asks to build, create, fix, debug, or improve React code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# React Ranger
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
Production-ready React development covering component architecture, structured debugging, state management decisions, testing with Vitest + React Testing Library, WCAG accessibility, and advanced patterns (RSC, bundle optimization, context performance).
|
|
11
|
+
|
|
12
|
+
## Workflow
|
|
13
|
+
|
|
14
|
+
### 1. Building Components
|
|
15
|
+
|
|
16
|
+
- Functional components with hooks only; no class components unless maintaining legacy.
|
|
17
|
+
- TypeScript: type all props with interfaces, never use `any`.
|
|
18
|
+
- One component per file; co-locate styles and tests alongside.
|
|
19
|
+
- `useMemo` / `useCallback` only when profiler confirms a problem — premature memoization adds complexity.
|
|
20
|
+
- **Pitfall**: object/array literals in JSX (`style={{ color: 'red' }}`) create new references every render; extract to a constant or `useMemo`.
|
|
21
|
+
|
|
22
|
+
### 2. Debugging Decision Tree
|
|
23
|
+
|
|
24
|
+
Follow in order — stop at the step that resolves the issue:
|
|
25
|
+
|
|
26
|
+
1. Open **React DevTools** → Profiler tab. Identify which component re-renders unexpectedly.
|
|
27
|
+
2. Re-render from parent → check if props are referentially stable; wrap callbacks in `useCallback`, objects in `useMemo`.
|
|
28
|
+
3. `useEffect` runs too often → audit dependency array. Every value used inside must be listed. Functions as deps must be wrapped in `useCallback`.
|
|
29
|
+
4. Stale values in `useEffect` → closure captured an old value. Add to dep array or use `useRef` for latest value without triggering re-renders.
|
|
30
|
+
5. List items behave incorrectly → verify stable, unique `key` props. Never use array index as key when items reorder.
|
|
31
|
+
6. Data fetching race conditions → use `AbortController` or `isCurrent` flag:
|
|
32
|
+
```ts
|
|
33
|
+
useEffect(() => {
|
|
34
|
+
let isCurrent = true;
|
|
35
|
+
fetchData().then(d => { if (isCurrent) setData(d); });
|
|
36
|
+
return () => { isCurrent = false; };
|
|
37
|
+
}, [dep]);
|
|
38
|
+
```
|
|
39
|
+
7. Render-phase crash → wrap routes in `ErrorBoundary` to catch without crashing the app.
|
|
40
|
+
8. Hydration mismatch (SSR/RSC) → ensure server and client render identical markup. Common causes: `Date.now()`, `Math.random()`, browser-only APIs (`window`, `localStorage`) in the initial render.
|
|
41
|
+
|
|
42
|
+
### 3. State Management Decision
|
|
43
|
+
|
|
44
|
+
| Need | Solution |
|
|
45
|
+
|------|----------|
|
|
46
|
+
| Local UI state | `useState` |
|
|
47
|
+
| Shared subtree | `useContext` + `useReducer` |
|
|
48
|
+
| Server/async state | React Query (`@tanstack/react-query`) or SWR |
|
|
49
|
+
| Global client state | Zustand (lightweight) or Redux Toolkit (large team) |
|
|
50
|
+
|
|
51
|
+
### 4. Testing (Vitest + React Testing Library)
|
|
52
|
+
|
|
53
|
+
- Location: `src/components/Foo/Foo.test.tsx` alongside component.
|
|
54
|
+
- Run: `npx vitest run` (CI) or `npx vitest` (watch).
|
|
55
|
+
- Per component: renders without crashing, interactions trigger correct state/callback, async ops use `waitFor`/`findBy*` (never `setTimeout`), error states show error UI.
|
|
56
|
+
- Use `screen.getByRole` / `getByLabelText` over `getByTestId` — role-based queries validate accessibility.
|
|
57
|
+
- Mock: `vi.mock('module-name')`.
|
|
58
|
+
|
|
59
|
+
### 5. Accessibility (a11y) Checklist
|
|
60
|
+
|
|
61
|
+
- [ ] Interactive elements keyboard focusable and operable (Enter/Space).
|
|
62
|
+
- [ ] Images: descriptive `alt`; decorative images `alt=""`.
|
|
63
|
+
- [ ] Form inputs associated with `<label>` via `htmlFor`/`id` or `aria-label`.
|
|
64
|
+
- [ ] Color not sole information channel (add icon, text, or pattern).
|
|
65
|
+
- [ ] Focus trapped in modals; returned to trigger on close.
|
|
66
|
+
- [ ] Dynamic content uses `role="alert"` or `aria-live="polite"`.
|
|
67
|
+
- [ ] Run `npx axe-core` or axe DevTools extension; resolve critical/serious violations.
|
|
68
|
+
|
|
69
|
+
### 6. React Server Components (RSC)
|
|
70
|
+
|
|
71
|
+
- In Next.js App Router, components are Server Components by default.
|
|
72
|
+
- Add `"use client"` at top of files using hooks, browser APIs, or event handlers.
|
|
73
|
+
- RSC constraints: no `useState`, `useEffect`, `useContext`. Data fetching via async/await in component body.
|
|
74
|
+
- Props across server/client boundary must be serializable — no functions, class instances, or Dates.
|
|
75
|
+
|
|
76
|
+
### 7. Performance
|
|
77
|
+
|
|
78
|
+
**Bundle analysis:** `npx vite-bundle-visualizer` (Vite) or `npx webpack-bundle-analyzer`. Check tree-shaking: `import { debounce } from 'lodash'` imports everything — use `lodash-es` or `lodash/debounce`.
|
|
79
|
+
|
|
80
|
+
**Context re-render fix:** Split context by update frequency (separate `UserContext` from `CartContext`). Wrap values in `useMemo`: `const value = useMemo(() => ({ user, login }), [user])`.
|
|
81
|
+
|
|
82
|
+
**Virtualization:** For lists >100 items, use `@tanstack/react-virtual` or `react-window` to render only visible rows.
|
|
83
|
+
|
|
84
|
+
## Edge Cases
|
|
85
|
+
|
|
86
|
+
1. **Concurrent features conflict**: `useTransition` and `Suspense` can cause unexpected loading states when combined with client-side navigation. Test transitions with slow networks (Chrome DevTools throttling).
|
|
87
|
+
2. **Third-party scripts blocking hydration**: scripts loaded via `<Script strategy="beforeInteractive">` can delay hydration. Use `afterInteractive` or `lazyOnload` unless the script is critical.
|
|
88
|
+
3. **CSS-in-JS with SSR**: libraries like `styled-components` need a server-side `ServerStyleSheet` to avoid FOUC. CSS Modules or Tailwind avoid this entirely.
|
|
89
|
+
|
|
90
|
+
## Output Format
|
|
91
|
+
|
|
92
|
+
- Provide the complete updated file for changed files.
|
|
93
|
+
- State: (a) root cause (if debugging), (b) what changed, (c) how to verify.
|
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
"""
|
|
2
|
+
build_index.py — Generate skills.json and skills-routing.json indexes.
|
|
3
|
+
|
|
4
|
+
Run from the repo root:
|
|
5
|
+
python scripts/build_index.py
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import json
|
|
11
|
+
import re
|
|
12
|
+
import sys
|
|
13
|
+
from datetime import datetime, timezone
|
|
14
|
+
from pathlib import Path
|
|
15
|
+
|
|
16
|
+
# ---------------------------------------------------------------------------
|
|
17
|
+
# Configuration
|
|
18
|
+
# ---------------------------------------------------------------------------
|
|
19
|
+
|
|
20
|
+
REPO_ROOT = Path(__file__).resolve().parent.parent
|
|
21
|
+
SKILL_FILENAMES = {"skill.md", "SKILL.md"}
|
|
22
|
+
|
|
23
|
+
CATEGORY_KEYWORDS: dict[str, list[str]] = {
|
|
24
|
+
"security": [
|
|
25
|
+
"security", "vulnerabilit", "owasp", "sast", "cve", "pentest",
|
|
26
|
+
"exploit", "injection", "xss", "csrf", "auth", "encryption",
|
|
27
|
+
"secret", "credential", "scan", "audit",
|
|
28
|
+
],
|
|
29
|
+
"testing": [
|
|
30
|
+
"test", "coverage", "jest", "pytest", "junit", "vitest",
|
|
31
|
+
"mock", "assertion", "tdd", "bdd", "e2e", "integration test",
|
|
32
|
+
"unit test", "fixture",
|
|
33
|
+
],
|
|
34
|
+
"frontend": [
|
|
35
|
+
"react", "vue", "angular", "svelte", "ui", "ux", "css",
|
|
36
|
+
"html", "component", "frontend", "browser", "dom", "tailwind",
|
|
37
|
+
"design system", "layout", "animation", "rendering", "client-side",
|
|
38
|
+
"web app",
|
|
39
|
+
],
|
|
40
|
+
"devops": [
|
|
41
|
+
"docker", "kubernetes", "k8s", "ci/cd", "pipeline", "deploy",
|
|
42
|
+
"containeriz", "helm", "terraform", "ansible", "devops",
|
|
43
|
+
"infra", "infrastructure", "cloud", "aws", "gcp", "azure",
|
|
44
|
+
"cron", "workflow", "automation",
|
|
45
|
+
],
|
|
46
|
+
"database": [
|
|
47
|
+
"database", "sql", "nosql", "postgresql", "mysql", "mongo",
|
|
48
|
+
"redis", "query", "schema", "migration", "orm", "index",
|
|
49
|
+
"data model", "db ",
|
|
50
|
+
],
|
|
51
|
+
"architecture": [
|
|
52
|
+
"architect", "microservice", "monolith", "design pattern",
|
|
53
|
+
"system design", "ddd", "event-driven", "cqrs", "saga",
|
|
54
|
+
"service mesh", "api design", "rest", "graphql", "grpc",
|
|
55
|
+
"scalab", "distributed",
|
|
56
|
+
],
|
|
57
|
+
"docs": [
|
|
58
|
+
"document", "readme", "changelog", "wiki", "api doc",
|
|
59
|
+
"openapi", "swagger", "comment", "annotation", "spec",
|
|
60
|
+
"write", "writing",
|
|
61
|
+
],
|
|
62
|
+
"git": [
|
|
63
|
+
"git", "commit", "pull request", "pr ", "branch", "merge",
|
|
64
|
+
"rebase", "diff", "repository", "version control",
|
|
65
|
+
],
|
|
66
|
+
"performance": [
|
|
67
|
+
"performance", "optim", "profil", "speed", "latency",
|
|
68
|
+
"throughput", "cache", "benchmark", "memory", "cpu",
|
|
69
|
+
"bottleneck", "render boost", "faster",
|
|
70
|
+
],
|
|
71
|
+
"ai/ml": [
|
|
72
|
+
"machine learning", "ml", "model", "neural", "llm",
|
|
73
|
+
"ai ", "nlp", "embedding", "training", "inference",
|
|
74
|
+
"prompt", "rag", "vector", "dataset",
|
|
75
|
+
],
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# ---------------------------------------------------------------------------
|
|
80
|
+
# Frontmatter parser (stdlib only — no PyYAML)
|
|
81
|
+
# ---------------------------------------------------------------------------
|
|
82
|
+
|
|
83
|
+
def parse_frontmatter(text: str) -> tuple[dict[str, str], str]:
|
|
84
|
+
"""Return (frontmatter_dict, body_text). Handles only simple key: value pairs."""
|
|
85
|
+
fm: dict[str, str] = {}
|
|
86
|
+
body = text
|
|
87
|
+
|
|
88
|
+
if text.startswith("---"):
|
|
89
|
+
# Find the closing ---
|
|
90
|
+
end = text.find("\n---", 3)
|
|
91
|
+
if end != -1:
|
|
92
|
+
fm_block = text[3:end].strip()
|
|
93
|
+
body = text[end + 4:].lstrip("\n")
|
|
94
|
+
for line in fm_block.splitlines():
|
|
95
|
+
if ":" in line:
|
|
96
|
+
key, _, value = line.partition(":")
|
|
97
|
+
fm[key.strip().lower()] = value.strip()
|
|
98
|
+
|
|
99
|
+
return fm, body
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
# ---------------------------------------------------------------------------
|
|
103
|
+
# Extraction helpers
|
|
104
|
+
# ---------------------------------------------------------------------------
|
|
105
|
+
|
|
106
|
+
def extract_triggers(description: str) -> list[str]:
|
|
107
|
+
"""Pull keywords from the phrase after 'Use when' in a description."""
|
|
108
|
+
triggers: list[str] = []
|
|
109
|
+
|
|
110
|
+
# Match "Use when <phrase>" — may end at period, comma, or end of string
|
|
111
|
+
match = re.search(r"[Uu]se when\s+(.+?)(?:\.|$)", description)
|
|
112
|
+
if not match:
|
|
113
|
+
return triggers
|
|
114
|
+
|
|
115
|
+
phrase = match.group(1)
|
|
116
|
+
|
|
117
|
+
# Strip common stop-words and split into meaningful tokens
|
|
118
|
+
stop_words = {
|
|
119
|
+
"a", "an", "the", "to", "is", "in", "on", "of", "or", "and",
|
|
120
|
+
"for", "with", "that", "this", "are", "be", "it", "as", "by",
|
|
121
|
+
"at", "from", "up", "asked", "asks", "needs", "need", "wants",
|
|
122
|
+
"want", "user", "users", "how", "has", "have", "set",
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
# Extract individual words; also keep short multi-word tech terms
|
|
126
|
+
words = re.findall(r"[a-z][a-z0-9+#\-\.]*", phrase.lower())
|
|
127
|
+
for w in words:
|
|
128
|
+
if len(w) >= 3 and w not in stop_words:
|
|
129
|
+
triggers.append(w)
|
|
130
|
+
|
|
131
|
+
# Deduplicate while preserving order
|
|
132
|
+
seen: set[str] = set()
|
|
133
|
+
unique: list[str] = []
|
|
134
|
+
for t in triggers:
|
|
135
|
+
if t not in seen:
|
|
136
|
+
seen.add(t)
|
|
137
|
+
unique.append(t)
|
|
138
|
+
|
|
139
|
+
return unique
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def auto_categorize(description: str) -> list[str]:
|
|
143
|
+
"""Return category labels whose keyword lists match the description."""
|
|
144
|
+
desc_lower = description.lower()
|
|
145
|
+
matched: list[str] = []
|
|
146
|
+
for category, keywords in CATEGORY_KEYWORDS.items():
|
|
147
|
+
if any(kw in desc_lower for kw in keywords):
|
|
148
|
+
matched.append(category)
|
|
149
|
+
return matched
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
def extract_tools(body: str) -> list[str]:
|
|
153
|
+
"""Return unique tool/command names found inside backticks."""
|
|
154
|
+
# Match `something` — filter out multi-line code fences
|
|
155
|
+
raw = re.findall(r"`([^`\n]+)`", body)
|
|
156
|
+
tools: list[str] = []
|
|
157
|
+
seen: set[str] = set()
|
|
158
|
+
for item in raw:
|
|
159
|
+
item = item.strip()
|
|
160
|
+
# Keep plausible tool names: short, no spaces (or simple flags/paths)
|
|
161
|
+
if item and len(item) <= 60 and item not in seen:
|
|
162
|
+
seen.add(item)
|
|
163
|
+
tools.append(item)
|
|
164
|
+
return tools
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
# ---------------------------------------------------------------------------
|
|
168
|
+
# Per-file processing
|
|
169
|
+
# ---------------------------------------------------------------------------
|
|
170
|
+
|
|
171
|
+
def process_skill_file(skill_file: Path) -> dict:
|
|
172
|
+
"""Parse a single skill.md / SKILL.md and return a record dict."""
|
|
173
|
+
text = skill_file.read_text(encoding="utf-8", errors="replace")
|
|
174
|
+
lines = text.splitlines()
|
|
175
|
+
line_count = len(lines)
|
|
176
|
+
has_code_examples = "```" in text
|
|
177
|
+
|
|
178
|
+
fm, body = parse_frontmatter(text)
|
|
179
|
+
|
|
180
|
+
directory = skill_file.parent.name
|
|
181
|
+
name = fm.get("name") or directory
|
|
182
|
+
description = fm.get("description", "")
|
|
183
|
+
|
|
184
|
+
# Relative path uses forward slashes for portability
|
|
185
|
+
rel_path = skill_file.relative_to(REPO_ROOT).as_posix()
|
|
186
|
+
|
|
187
|
+
triggers = extract_triggers(description)
|
|
188
|
+
categories = auto_categorize(description)
|
|
189
|
+
tools_mentioned = extract_tools(body)
|
|
190
|
+
|
|
191
|
+
return {
|
|
192
|
+
"name": name,
|
|
193
|
+
"description": description,
|
|
194
|
+
"path": rel_path,
|
|
195
|
+
"directory": directory,
|
|
196
|
+
"triggers": triggers,
|
|
197
|
+
"categories": categories,
|
|
198
|
+
"line_count": line_count,
|
|
199
|
+
"has_code_examples": has_code_examples,
|
|
200
|
+
"tools_mentioned": tools_mentioned,
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
# ---------------------------------------------------------------------------
|
|
205
|
+
# Discovery
|
|
206
|
+
# ---------------------------------------------------------------------------
|
|
207
|
+
|
|
208
|
+
def find_skill_files(root: Path) -> list[Path]:
|
|
209
|
+
"""Find all skill.md / SKILL.md files under root (one level of subdirs)."""
|
|
210
|
+
found: list[Path] = []
|
|
211
|
+
for child in sorted(root.iterdir()):
|
|
212
|
+
if not child.is_dir():
|
|
213
|
+
continue
|
|
214
|
+
# Skip hidden dirs and scripts/
|
|
215
|
+
if child.name.startswith(".") or child.name == "scripts":
|
|
216
|
+
continue
|
|
217
|
+
for fname in SKILL_FILENAMES:
|
|
218
|
+
candidate = child / fname
|
|
219
|
+
if candidate.is_file():
|
|
220
|
+
found.append(candidate)
|
|
221
|
+
break # take only the first match per directory
|
|
222
|
+
return found
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
# ---------------------------------------------------------------------------
|
|
226
|
+
# Main
|
|
227
|
+
# ---------------------------------------------------------------------------
|
|
228
|
+
|
|
229
|
+
def main() -> None:
|
|
230
|
+
skill_files = find_skill_files(REPO_ROOT)
|
|
231
|
+
|
|
232
|
+
if not skill_files:
|
|
233
|
+
print("WARNING: No skill files found under", REPO_ROOT, file=sys.stderr)
|
|
234
|
+
|
|
235
|
+
skills = [process_skill_file(f) for f in skill_files]
|
|
236
|
+
skills.sort(key=lambda s: s["name"].lower())
|
|
237
|
+
|
|
238
|
+
timestamp = datetime.now(timezone.utc).isoformat(timespec="seconds")
|
|
239
|
+
|
|
240
|
+
# --- Full index ---
|
|
241
|
+
full_index = {
|
|
242
|
+
"version": "1.0",
|
|
243
|
+
"generated_at": timestamp,
|
|
244
|
+
"skill_count": len(skills),
|
|
245
|
+
"skills": skills,
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
full_path = REPO_ROOT / "skills.json"
|
|
249
|
+
full_path.write_text(
|
|
250
|
+
json.dumps(full_index, indent=2, ensure_ascii=False),
|
|
251
|
+
encoding="utf-8",
|
|
252
|
+
)
|
|
253
|
+
print(f"Written: {full_path} ({len(skills)} skills)")
|
|
254
|
+
|
|
255
|
+
# --- Compact routing index ---
|
|
256
|
+
routing_skills = [
|
|
257
|
+
{
|
|
258
|
+
"name": s["name"],
|
|
259
|
+
"description": s["description"],
|
|
260
|
+
"categories": s["categories"],
|
|
261
|
+
"triggers": s["triggers"],
|
|
262
|
+
}
|
|
263
|
+
for s in skills
|
|
264
|
+
]
|
|
265
|
+
|
|
266
|
+
routing_index = {
|
|
267
|
+
"version": "1.0",
|
|
268
|
+
"generated_at": timestamp,
|
|
269
|
+
"skill_count": len(skills),
|
|
270
|
+
"skills": routing_skills,
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
routing_path = REPO_ROOT / "skills-routing.json"
|
|
274
|
+
routing_path.write_text(
|
|
275
|
+
json.dumps(routing_index, indent=2, ensure_ascii=False),
|
|
276
|
+
encoding="utf-8",
|
|
277
|
+
)
|
|
278
|
+
print(f"Written: {routing_path}")
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
if __name__ == "__main__":
|
|
282
|
+
main()
|