self-evolve-framework 1.1.0 → 1.2.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/package.json +1 -1
- package/template/skills/impeccable/SKILL.md +174 -47
- package/template/skills/impeccable/agents/impeccable_asset_producer.toml +92 -0
- package/template/skills/impeccable/agents/impeccable_manual_edit_applier.toml +95 -0
- package/template/skills/impeccable/agents/openai.yaml +4 -0
- package/template/skills/impeccable/reference/adapt.md +311 -0
- package/template/skills/impeccable/reference/animate.md +201 -0
- package/template/skills/impeccable/reference/audit.md +133 -0
- package/template/skills/impeccable/reference/bolder.md +113 -0
- package/template/skills/impeccable/reference/brand.md +108 -0
- package/template/skills/impeccable/reference/clarify.md +288 -0
- package/template/skills/impeccable/reference/codex.md +105 -0
- package/template/skills/impeccable/reference/colorize.md +257 -0
- package/template/skills/impeccable/reference/craft.md +123 -0
- package/template/skills/impeccable/reference/critique.md +790 -0
- package/template/skills/impeccable/reference/delight.md +302 -0
- package/template/skills/impeccable/reference/distill.md +111 -0
- package/template/skills/impeccable/reference/document.md +429 -0
- package/template/skills/impeccable/reference/extract.md +69 -0
- package/template/skills/impeccable/reference/harden.md +347 -0
- package/template/skills/impeccable/reference/hooks.md +90 -0
- package/template/skills/impeccable/reference/init.md +172 -0
- package/template/skills/impeccable/reference/interaction-design.md +189 -0
- package/template/skills/impeccable/reference/layout.md +161 -0
- package/template/skills/impeccable/reference/live.md +720 -0
- package/template/skills/impeccable/reference/onboard.md +234 -0
- package/template/skills/impeccable/reference/optimize.md +258 -0
- package/template/skills/impeccable/reference/overdrive.md +130 -0
- package/template/skills/impeccable/reference/polish.md +241 -0
- package/template/skills/impeccable/reference/product.md +60 -0
- package/template/skills/impeccable/reference/quieter.md +99 -0
- package/template/skills/impeccable/reference/shape.md +165 -0
- package/template/skills/impeccable/reference/typeset.md +279 -0
- package/template/skills/impeccable/scripts/command-metadata.json +94 -0
- package/template/skills/impeccable/scripts/context-signals.mjs +225 -0
- package/template/skills/impeccable/scripts/context.mjs +961 -0
- package/template/skills/impeccable/scripts/critique-storage.mjs +242 -0
- package/template/skills/impeccable/scripts/detect-csp.mjs +198 -0
- package/template/skills/impeccable/scripts/detect.mjs +21 -0
- package/template/skills/impeccable/scripts/detector/browser/injected/index.mjs +1937 -0
- package/template/skills/impeccable/scripts/detector/cli/main.mjs +290 -0
- package/template/skills/impeccable/scripts/detector/design-system.mjs +750 -0
- package/template/skills/impeccable/scripts/detector/detect-antipatterns-browser.js +5138 -0
- package/template/skills/impeccable/scripts/detector/detect-antipatterns.mjs +50 -0
- package/template/skills/impeccable/scripts/detector/engines/browser/detect-url.mjs +277 -0
- package/template/skills/impeccable/scripts/detector/engines/regex/detect-text.mjs +568 -0
- package/template/skills/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +1015 -0
- package/template/skills/impeccable/scripts/detector/engines/static-html/detect-html.mjs +234 -0
- package/template/skills/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +189 -0
- package/template/skills/impeccable/scripts/detector/findings.mjs +12 -0
- package/template/skills/impeccable/scripts/detector/node/file-system.mjs +198 -0
- package/template/skills/impeccable/scripts/detector/profile/profiler.mjs +166 -0
- package/template/skills/impeccable/scripts/detector/registry/antipatterns.mjs +448 -0
- package/template/skills/impeccable/scripts/detector/rules/checks.mjs +2671 -0
- package/template/skills/impeccable/scripts/detector/shared/color.mjs +124 -0
- package/template/skills/impeccable/scripts/detector/shared/constants.mjs +101 -0
- package/template/skills/impeccable/scripts/detector/shared/inline-ignores.mjs +148 -0
- package/template/skills/impeccable/scripts/detector/shared/page.mjs +7 -0
- package/template/skills/impeccable/scripts/hook-admin.mjs +661 -0
- package/template/skills/impeccable/scripts/hook-before-edit.mjs +476 -0
- package/template/skills/impeccable/scripts/hook-lib.mjs +1632 -0
- package/template/skills/impeccable/scripts/hook.mjs +61 -0
- package/template/skills/impeccable/scripts/lib/design-parser.mjs +842 -0
- package/template/skills/impeccable/scripts/lib/impeccable-config.mjs +638 -0
- package/template/skills/impeccable/scripts/lib/impeccable-paths.mjs +128 -0
- package/template/skills/impeccable/scripts/lib/is-generated.mjs +69 -0
- package/template/skills/impeccable/scripts/lib/target-args.mjs +42 -0
- package/template/skills/impeccable/scripts/live/browser-script-parts.mjs +49 -0
- package/template/skills/impeccable/scripts/live/completion.mjs +19 -0
- package/template/skills/impeccable/scripts/live/event-validation.mjs +137 -0
- package/template/skills/impeccable/scripts/live/insert-ui.mjs +458 -0
- package/template/skills/impeccable/scripts/live/manual-apply.mjs +939 -0
- package/template/skills/impeccable/scripts/live/manual-edit-routes.mjs +357 -0
- package/template/skills/impeccable/scripts/live/manual-edits-buffer.mjs +152 -0
- package/template/skills/impeccable/scripts/live/session-store.mjs +289 -0
- package/template/skills/impeccable/scripts/live/svelte-component.mjs +826 -0
- package/template/skills/impeccable/scripts/live/sveltekit-adapter.mjs +274 -0
- package/template/skills/impeccable/scripts/live/ui-core.mjs +180 -0
- package/template/skills/impeccable/scripts/live/vocabulary.mjs +36 -0
- package/template/skills/impeccable/scripts/live-accept.mjs +812 -0
- package/template/skills/impeccable/scripts/live-browser-dom.js +146 -0
- package/template/skills/impeccable/scripts/live-browser-session.js +123 -0
- package/template/skills/impeccable/scripts/live-browser.js +11173 -0
- package/template/skills/impeccable/scripts/live-commit-manual-edits.mjs +1241 -0
- package/template/skills/impeccable/scripts/live-complete.mjs +75 -0
- package/template/skills/impeccable/scripts/live-copy-edit-agent.mjs +683 -0
- package/template/skills/impeccable/scripts/live-discard-manual-edits.mjs +51 -0
- package/template/skills/impeccable/scripts/live-inject.mjs +583 -0
- package/template/skills/impeccable/scripts/live-insert.mjs +272 -0
- package/template/skills/impeccable/scripts/live-manual-edit-evidence.mjs +363 -0
- package/template/skills/impeccable/scripts/live-poll.mjs +384 -0
- package/template/skills/impeccable/scripts/live-resume.mjs +94 -0
- package/template/skills/impeccable/scripts/live-server.mjs +1135 -0
- package/template/skills/impeccable/scripts/live-status.mjs +61 -0
- package/template/skills/impeccable/scripts/live-target.mjs +30 -0
- package/template/skills/impeccable/scripts/live-wrap.mjs +894 -0
- package/template/skills/impeccable/scripts/live.mjs +297 -0
- package/template/skills/impeccable/scripts/modern-screenshot.umd.js +14 -0
- package/template/skills/impeccable/scripts/palette.mjs +633 -0
- package/template/skills/impeccable/scripts/pin.mjs +214 -0
- package/template/rules/CodeGraph.mdc +0 -23
- package/template/rules/Svelte_5.mdc +0 -167
- package/template/rules/Svelte_Flow.mdc +0 -176
- package/template/rules/Tailwind_CSS_v4.mdc +0 -187
- package/template/rules/Tauri.mdc +0 -145
- package/template/rules/app-error-pattern.mdc +0 -65
- package/template/rules/invoke-safe-pattern.mdc +0 -53
- package/template/rules/js.mdc +0 -10
- package/template/rules/powershell.mdc +0 -9
- package/template/rules//346/227/245/345/277/227.mdc +0 -15
- package/template/rules//350/257/267/346/261/202.mdc +0 -49
- package/template/skills/caveman/SKILL.md +0 -49
- package/template/skills/check/SKILL.md +0 -393
- package/template/skills/check/agents/reviewer-architecture.md +0 -39
- package/template/skills/check/agents/reviewer-security.md +0 -39
- package/template/skills/check/references/persona-catalog.md +0 -56
- package/template/skills/check/references/project-context.md +0 -120
- package/template/skills/check/references/public-reply.md +0 -14
- package/template/skills/check/scripts/audit_signals.py +0 -666
- package/template/skills/check/scripts/run-tests.sh +0 -19
- package/template/skills/design/SKILL.md +0 -173
- package/template/skills/design/references/design-aesthetic-quality.md +0 -67
- package/template/skills/design/references/design-data-viz.md +0 -34
- package/template/skills/design/references/design-reference.md +0 -295
- package/template/skills/design/references/design-tokens.md +0 -45
- package/template/skills/design/references/design-traps.md +0 -43
- package/template/skills/design-an-interface/SKILL.md +0 -94
- package/template/skills/diagnose/SKILL.md +0 -117
- package/template/skills/diagnose/scripts/hitl-loop.template.sh +0 -41
- package/template/skills/edit-article/SKILL.md +0 -14
- package/template/skills/git-guardrails-claude-code/SKILL.md +0 -95
- package/template/skills/git-guardrails-claude-code/scripts/block-dangerous-git.sh +0 -25
- package/template/skills/grill-me/SKILL.md +0 -10
- package/template/skills/grill-with-docs/ADR-FORMAT.md +0 -47
- package/template/skills/grill-with-docs/CONTEXT-FORMAT.md +0 -60
- package/template/skills/grill-with-docs/SKILL.md +0 -88
- package/template/skills/handoff/SKILL.md +0 -15
- package/template/skills/health/SKILL.md +0 -260
- package/template/skills/health/agents/inspector-context.md +0 -119
- package/template/skills/health/agents/inspector-control.md +0 -84
- package/template/skills/health/agents/inspector-maintainability.md +0 -55
- package/template/skills/health/scripts/check-agent-context.sh +0 -5
- package/template/skills/health/scripts/check-doc-refs.sh +0 -8
- package/template/skills/health/scripts/check-maintainability.sh +0 -8
- package/template/skills/health/scripts/check-verifier-output.sh +0 -5
- package/template/skills/health/scripts/check_agent_context.py +0 -444
- package/template/skills/health/scripts/check_doc_refs.py +0 -110
- package/template/skills/health/scripts/check_maintainability.py +0 -635
- package/template/skills/health/scripts/check_verifier_output.py +0 -116
- package/template/skills/health/scripts/collect-data.sh +0 -751
- package/template/skills/hunt/SKILL.md +0 -232
- package/template/skills/hunt/references/failure-patterns.md +0 -138
- package/template/skills/hunt/references/ime-unicode.md +0 -58
- package/template/skills/hunt/references/logging-techniques.md +0 -72
- package/template/skills/hunt/references/rendering-debug.md +0 -34
- package/template/skills/improve-codebase-architecture/DEEPENING.md +0 -37
- package/template/skills/improve-codebase-architecture/HTML-REPORT.md +0 -123
- package/template/skills/improve-codebase-architecture/INTERFACE-DESIGN.md +0 -44
- package/template/skills/improve-codebase-architecture/LANGUAGE.md +0 -53
- package/template/skills/improve-codebase-architecture/SKILL.md +0 -81
- package/template/skills/learn/SKILL.md +0 -140
- package/template/skills/migrate-to-shoehorn/SKILL.md +0 -118
- package/template/skills/obsidian-vault/SKILL.md +0 -59
- package/template/skills/prototype/LOGIC.md +0 -79
- package/template/skills/prototype/SKILL.md +0 -30
- package/template/skills/prototype/UI.md +0 -112
- package/template/skills/qa/SKILL.md +0 -130
- package/template/skills/read/SKILL.md +0 -141
- package/template/skills/read/references/read-methods.md +0 -129
- package/template/skills/read/scripts/fetch.sh +0 -106
- package/template/skills/read/scripts/fetch_feishu.py +0 -251
- package/template/skills/read/scripts/fetch_local.py +0 -218
- package/template/skills/read/scripts/fetch_weixin.py +0 -107
- package/template/skills/request-refactor-plan/SKILL.md +0 -68
- package/template/skills/review/SKILL.md +0 -78
- package/template/skills/rust-auto-fix/SKILL.md +0 -94
- package/template/skills/scaffold-exercises/SKILL.md +0 -106
- package/template/skills/sdd-dev/SKILL.md +0 -114
- package/template/skills/setup-matt-pocock-skills/SKILL.md +0 -121
- package/template/skills/setup-matt-pocock-skills/domain.md +0 -51
- package/template/skills/setup-matt-pocock-skills/issue-tracker-github.md +0 -22
- package/template/skills/setup-matt-pocock-skills/issue-tracker-gitlab.md +0 -23
- package/template/skills/setup-matt-pocock-skills/issue-tracker-local.md +0 -19
- package/template/skills/setup-matt-pocock-skills/triage-labels.md +0 -15
- package/template/skills/setup-pre-commit/SKILL.md +0 -91
- package/template/skills/svelte-warnings-fix/SKILL.md +0 -94
- package/template/skills/tauri-nsis-installer-icon/SKILL.md +0 -92
- package/template/skills/tauri-nsis-installer-icon/references/tauri-nsis-schema.md +0 -71
- package/template/skills/tb/SKILL.md +0 -62
- package/template/skills/tdd/SKILL.md +0 -109
- package/template/skills/tdd/deep-modules.md +0 -33
- package/template/skills/tdd/interface-design.md +0 -31
- package/template/skills/tdd/mocking.md +0 -59
- package/template/skills/tdd/refactoring.md +0 -10
- package/template/skills/tdd/tests.md +0 -61
- package/template/skills/teach/GLOSSARY-FORMAT.md +0 -35
- package/template/skills/teach/LEARNING-RECORD-FORMAT.md +0 -46
- package/template/skills/teach/MISSION-FORMAT.md +0 -31
- package/template/skills/teach/RESOURCES-FORMAT.md +0 -32
- package/template/skills/teach/SKILL.md +0 -91
- package/template/skills/think/SKILL.md +0 -184
- package/template/skills/to-issues/SKILL.md +0 -83
- package/template/skills/to-prd/SKILL.md +0 -74
- package/template/skills/triage/AGENT-BRIEF.md +0 -168
- package/template/skills/triage/OUT-OF-SCOPE.md +0 -101
- package/template/skills/triage/SKILL.md +0 -103
- package/template/skills/ubiquitous-language/SKILL.md +0 -93
- package/template/skills/ver/SKILL.md +0 -62
- package/template/skills/write/SKILL.md +0 -209
- package/template/skills/write/references/write-en.md +0 -199
- package/template/skills/write/references/write-product-localization.md +0 -43
- package/template/skills/write/references/write-zh-bilingual.md +0 -59
- package/template/skills/write/references/write-zh-prose.md +0 -50
- package/template/skills/write/references/write-zh-release-notes.md +0 -40
- package/template/skills/write/references/write-zh.md +0 -721
- package/template/skills/write-a-skill/SKILL.md +0 -117
- package/template/skills/writing-beats/SKILL.md +0 -52
- package/template/skills/writing-fragments/SKILL.md +0 -75
- package/template/skills/writing-shape/SKILL.md +0 -64
- package/template/skills/zoom-out/SKILL.md +0 -7
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
# Issue tracker: GitLab
|
|
2
|
-
|
|
3
|
-
Issues and PRDs for this repo live as GitLab issues. Use the [`glab`](https://gitlab.com/gitlab-org/cli) CLI for all operations.
|
|
4
|
-
|
|
5
|
-
## Conventions
|
|
6
|
-
|
|
7
|
-
- **Create an issue**: `glab issue create --title "..." --description "..."`. Use a heredoc for multi-line descriptions. Pass `--description -` to open an editor.
|
|
8
|
-
- **Read an issue**: `glab issue view <number> --comments`. Use `-F json` for machine-readable output.
|
|
9
|
-
- **List issues**: `glab issue list -F json` with appropriate `--label` filters.
|
|
10
|
-
- **Comment on an issue**: `glab issue note <number> --message "..."`. GitLab calls comments "notes".
|
|
11
|
-
- **Apply / remove labels**: `glab issue update <number> --label "..."` / `--unlabel "..."`. Multiple labels can be comma-separated or by repeating the flag.
|
|
12
|
-
- **Close**: `glab issue close <number>`. `glab issue close` does not accept a closing comment, so post the explanation first with `glab issue note <number> --message "..."`, then close.
|
|
13
|
-
- **Merge requests**: GitLab calls PRs "merge requests". Use `glab mr create`, `glab mr view`, `glab mr note`, etc. — the same shape as `gh pr ...` with `mr` in place of `pr` and `note`/`--message` in place of `comment`/`--body`.
|
|
14
|
-
|
|
15
|
-
Infer the repo from `git remote -v` — `glab` does this automatically when run inside a clone.
|
|
16
|
-
|
|
17
|
-
## When a skill says "publish to the issue tracker"
|
|
18
|
-
|
|
19
|
-
Create a GitLab issue.
|
|
20
|
-
|
|
21
|
-
## When a skill says "fetch the relevant ticket"
|
|
22
|
-
|
|
23
|
-
Run `glab issue view <number> --comments`.
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Issue tracker: Local Markdown
|
|
2
|
-
|
|
3
|
-
Issues and PRDs for this repo live as markdown files in `.scratch/`.
|
|
4
|
-
|
|
5
|
-
## Conventions
|
|
6
|
-
|
|
7
|
-
- One feature per directory: `.scratch/<feature-slug>/`
|
|
8
|
-
- The PRD is `.scratch/<feature-slug>/PRD.md`
|
|
9
|
-
- Implementation issues are `.scratch/<feature-slug>/issues/<NN>-<slug>.md`, numbered from `01`
|
|
10
|
-
- Triage state is recorded as a `Status:` line near the top of each issue file (see `triage-labels.md` for the role strings)
|
|
11
|
-
- Comments and conversation history append to the bottom of the file under a `## Comments` heading
|
|
12
|
-
|
|
13
|
-
## When a skill says "publish to the issue tracker"
|
|
14
|
-
|
|
15
|
-
Create a new file under `.scratch/<feature-slug>/` (creating the directory if needed).
|
|
16
|
-
|
|
17
|
-
## When a skill says "fetch the relevant ticket"
|
|
18
|
-
|
|
19
|
-
Read the file at the referenced path. The user will normally pass the path or the issue number directly.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# Triage Labels
|
|
2
|
-
|
|
3
|
-
The skills speak in terms of five canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker.
|
|
4
|
-
|
|
5
|
-
| Label in mattpocock/skills | Label in our tracker | Meaning |
|
|
6
|
-
| -------------------------- | -------------------- | ---------------------------------------- |
|
|
7
|
-
| `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue |
|
|
8
|
-
| `needs-info` | `needs-info` | Waiting on reporter for more information |
|
|
9
|
-
| `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent |
|
|
10
|
-
| `ready-for-human` | `ready-for-human` | Requires human implementation |
|
|
11
|
-
| `wontfix` | `wontfix` | Will not be actioned |
|
|
12
|
-
|
|
13
|
-
When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table.
|
|
14
|
-
|
|
15
|
-
Edit the right-hand column to match whatever vocabulary you actually use.
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: setup-pre-commit
|
|
3
|
-
description: Set up Husky pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Setup Pre-Commit Hooks
|
|
7
|
-
|
|
8
|
-
## What This Sets Up
|
|
9
|
-
|
|
10
|
-
- **Husky** pre-commit hook
|
|
11
|
-
- **lint-staged** running Prettier on all staged files
|
|
12
|
-
- **Prettier** config (if missing)
|
|
13
|
-
- **typecheck** and **test** scripts in the pre-commit hook
|
|
14
|
-
|
|
15
|
-
## Steps
|
|
16
|
-
|
|
17
|
-
### 1. Detect package manager
|
|
18
|
-
|
|
19
|
-
Check for `package-lock.json` (npm), `pnpm-lock.yaml` (pnpm), `yarn.lock` (yarn), `bun.lockb` (bun). Use whichever is present. Default to npm if unclear.
|
|
20
|
-
|
|
21
|
-
### 2. Install dependencies
|
|
22
|
-
|
|
23
|
-
Install as devDependencies:
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
husky lint-staged prettier
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### 3. Initialize Husky
|
|
30
|
-
|
|
31
|
-
```bash
|
|
32
|
-
npx husky init
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
This creates `.husky/` dir and adds `prepare: "husky"` to package.json.
|
|
36
|
-
|
|
37
|
-
### 4. Create `.husky/pre-commit`
|
|
38
|
-
|
|
39
|
-
Write this file (no shebang needed for Husky v9+):
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
npx lint-staged
|
|
43
|
-
npm run typecheck
|
|
44
|
-
npm run test
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
**Adapt**: Replace `npm` with detected package manager. If repo has no `typecheck` or `test` script in package.json, omit those lines and tell the user.
|
|
48
|
-
|
|
49
|
-
### 5. Create `.lintstagedrc`
|
|
50
|
-
|
|
51
|
-
```json
|
|
52
|
-
{
|
|
53
|
-
"*": "prettier --ignore-unknown --write"
|
|
54
|
-
}
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### 6. Create `.prettierrc` (if missing)
|
|
58
|
-
|
|
59
|
-
Only create if no Prettier config exists. Use these defaults:
|
|
60
|
-
|
|
61
|
-
```json
|
|
62
|
-
{
|
|
63
|
-
"useTabs": false,
|
|
64
|
-
"tabWidth": 2,
|
|
65
|
-
"printWidth": 80,
|
|
66
|
-
"singleQuote": false,
|
|
67
|
-
"trailingComma": "es5",
|
|
68
|
-
"semi": true,
|
|
69
|
-
"arrowParens": "always"
|
|
70
|
-
}
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### 7. Verify
|
|
74
|
-
|
|
75
|
-
- [ ] `.husky/pre-commit` exists and is executable
|
|
76
|
-
- [ ] `.lintstagedrc` exists
|
|
77
|
-
- [ ] `prepare` script in package.json is `"husky"`
|
|
78
|
-
- [ ] `prettier` config exists
|
|
79
|
-
- [ ] Run `npx lint-staged` to verify it works
|
|
80
|
-
|
|
81
|
-
### 8. Commit
|
|
82
|
-
|
|
83
|
-
Stage all changed/created files and commit with message: `Add pre-commit hooks (husky + lint-staged + prettier)`
|
|
84
|
-
|
|
85
|
-
This will run through the new pre-commit hooks — a good smoke test that everything works.
|
|
86
|
-
|
|
87
|
-
## Notes
|
|
88
|
-
|
|
89
|
-
- Husky v9+ doesn't need shebangs in hook files
|
|
90
|
-
- `prettier --ignore-unknown` skips files Prettier can't parse (images, etc.)
|
|
91
|
-
- The pre-commit runs lint-staged first (fast, staged-only), then full typecheck and tests
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: fix:svelte-warnings
|
|
3
|
-
description: Read vite-plugin-svelte diagnostics from the IDE and automatically fix detected issues (a11y, unused CSS, deprecated syntax). Use when the user mentions vite-plugin-svelte warnings, Svelte a11y errors, unused CSS selectors, Svelte build warnings, or asks to fix Svelte component issues from vite build output.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Svelte Warnings Fix
|
|
7
|
-
|
|
8
|
-
## Quick start
|
|
9
|
-
|
|
10
|
-
```svelte
|
|
11
|
-
<!-- ✅ 正确修复:加 ARIA 属性 -->
|
|
12
|
-
<div role="dialog" aria-modal="true" tabindex="-1" onclick={handler}>
|
|
13
|
-
|
|
14
|
-
<!-- ✅ 不可避免时用 svelte-ignore -->
|
|
15
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
16
|
-
<div onclick={(e) => e.stopPropagation()}>
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Diagnostics collection (dual channel)
|
|
20
|
-
|
|
21
|
-
1. **Fast path** — `read_lints(paths="d:/code/sheetflow/src")` 读 IDE 实时诊断(~0s)
|
|
22
|
-
2. **Fallback** — 如果 read_lints 未捕获到,运行 `npm run build 2>&1` 取构建输出
|
|
23
|
-
|
|
24
|
-
Diagnostics 按类型分类:
|
|
25
|
-
- **A11y** — `a11y_no_static_element_interactions`, `a11y_interactive_supports_focus`, `a11y_click_events_have_key_events` 等
|
|
26
|
-
- **Unused CSS** — `Unused CSS selector "..."`
|
|
27
|
-
- **Deprecated syntax** — Svelte 5 迁移提示
|
|
28
|
-
- **Type errors** — TS 编译失败
|
|
29
|
-
|
|
30
|
-
## Fix order & verification
|
|
31
|
-
|
|
32
|
-
批量处理同类问题,而非逐条 rebuild:
|
|
33
|
-
|
|
34
|
-
```
|
|
35
|
-
Collect all A11y warnings → fix all → rebuild once to verify
|
|
36
|
-
Collect all unused CSS → fix all → rebuild once to verify
|
|
37
|
-
Collect all type errors → fix all → rebuild once to verify
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
每类修复后只用一次 `npm run build` 验证,而非每条警告 rebuild 一次。
|
|
41
|
-
|
|
42
|
-
## Fix rules by category
|
|
43
|
-
|
|
44
|
-
### 1. A11y issues
|
|
45
|
-
|
|
46
|
-
参照表决定修复方式:
|
|
47
|
-
|
|
48
|
-
| 警告 | 正确修复 | svelte-ignore 条件 |
|
|
49
|
-
|------|---------|-------------------|
|
|
50
|
-
| `a11y_no_static_element_interactions` | 加 `role` 属性 | 当元素仅用于 stopPropagation 包装时 |
|
|
51
|
-
| `a11y_interactive_supports_focus` | 加 `tabindex="-1"` 或 `tabindex="0"` | 元素不可聚焦(纯装饰) |
|
|
52
|
-
| `a11y_click_events_have_key_events` | 加 `onkeydown` 处理器 | 当 click 仅用于非交互场景时 |
|
|
53
|
-
| `a11y_no_noninteractive_element_interactions` | 替换为非交互元素或加 role | 很少需要 ignore |
|
|
54
|
-
|
|
55
|
-
Svelte 5 的 `svelte-ignore` 注释格式:
|
|
56
|
-
|
|
57
|
-
```svelte
|
|
58
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
59
|
-
<div onclick={handler}>
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
> **原则**:优先正确修复(加 role/tabindex/aria-label),仅在确实不可避免时用 `svelte-ignore`。
|
|
63
|
-
|
|
64
|
-
### 2. Unused CSS
|
|
65
|
-
|
|
66
|
-
- 如果选择器在 template/JS 中确实未引用 → **删除该选择器或整个 `<style>` 块**
|
|
67
|
-
- 如果只在运行时由 JS 动态添加 → 用 `:global(.selector) { }` 包裹
|
|
68
|
-
|
|
69
|
-
### 3. Deprecated syntax
|
|
70
|
-
|
|
71
|
-
严格遵循项目 Svelte 5 编码规范(工作区规则):
|
|
72
|
-
|
|
73
|
-
| 旧语法(Svelte 4) | 新语法(Svelte 5) |
|
|
74
|
-
|---|---|
|
|
75
|
-
| `export let name` | `let { name } = $props()` |
|
|
76
|
-
| `$: double = count * 2` | `let double = $derived(count * 2)` |
|
|
77
|
-
| `$: { effect }` | `$effect(() => { effect })` |
|
|
78
|
-
| `on:click` handler | `onclick` prop |
|
|
79
|
-
|
|
80
|
-
### 4. Type errors
|
|
81
|
-
|
|
82
|
-
与 `rust-auto-fix` 技能协作:Svelte 模板中的 TS 类型错误由本技能修复,.ts 文件中的由 `rust-auto-fix` 处理。
|
|
83
|
-
|
|
84
|
-
## Final report
|
|
85
|
-
|
|
86
|
-
```
|
|
87
|
-
## Svelte warnings resolved
|
|
88
|
-
|
|
89
|
-
Total warnings fixed: X
|
|
90
|
-
|
|
91
|
-
Changes made:
|
|
92
|
-
- file.svelte: fixed a11y (added role="dialog" tabindex="-1")
|
|
93
|
-
- file.svelte: removed unused CSS selector ".config-field label"
|
|
94
|
-
```
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: tauri-nsis-installer-icon
|
|
3
|
-
description: Configure Tauri 2 NSIS installer icon. This skill should be used when modifying the Windows NSIS installer to use a custom icon instead of the Tauri default.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Tauri NSIS Installer Icon Configuration
|
|
7
|
-
|
|
8
|
-
## Purpose
|
|
9
|
-
|
|
10
|
-
Tauri 2 separates app icon from installer icon. The `bundle.icon` configures the executable icon; the NSIS installer uses its own icon defined in `bundle.windows.nsis.installerIcon`. Without this configuration, NSIS defaults to a generic icon.
|
|
11
|
-
|
|
12
|
-
## Procedure
|
|
13
|
-
|
|
14
|
-
### 1. Ask user about language
|
|
15
|
-
|
|
16
|
-
Ask whether the installer should show Chinese UI. If yes, set `displayLanguageSelector` to false (auto-detect) or leave unset (default auto-detect based on system locale). NSIS ships built-in Chinese language files so no extra files are needed.
|
|
17
|
-
|
|
18
|
-
### 2. Ask user about headerImage
|
|
19
|
-
|
|
20
|
-
Ask whether to replace the default header image in the installer wizard.
|
|
21
|
-
|
|
22
|
-
| Field | Format | Size | Location |
|
|
23
|
-
|-------|--------|------|----------|
|
|
24
|
-
| `headerImage` | BMP (Windows bitmap) | 150 x 57 px | Any path under `src-tauri/`, e.g. `icons/installer-header.bmp` |
|
|
25
|
-
|
|
26
|
-
If the user provides a PNG, convert it to BMP before placing in the project. The image sits at the top of each installer page.
|
|
27
|
-
|
|
28
|
-
### 3. Ask user about sidebarImage
|
|
29
|
-
|
|
30
|
-
Ask whether to replace the default sidebar/banner image on the Welcome and Finish pages.
|
|
31
|
-
|
|
32
|
-
| Field | Format | Size | Location |
|
|
33
|
-
|-------|--------|------|----------|
|
|
34
|
-
| `sidebarImage` | BMP (Windows bitmap) | 164 x 314 px | Any path under `src-tauri/`, e.g. `icons/installer-sidebar.bmp` |
|
|
35
|
-
|
|
36
|
-
If the user provides a PNG, convert it to BMP before placing in the project.
|
|
37
|
-
|
|
38
|
-
### 4. Ask user about install mode
|
|
39
|
-
|
|
40
|
-
Ask `installMode`: "currentUser" (per-user, no admin required) is the default. Use "both" to allow the user to choose per-user or per-machine during installation.
|
|
41
|
-
|
|
42
|
-
### 5. Ensure icon file exists
|
|
43
|
-
|
|
44
|
-
Place a valid `.ico` file in `src-tauri/icons/`. The ICO should contain multiple sizes (e.g., 32x32, 256x256). Verify with:
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
node -e "const fs=require('fs');const b=fs.readFileSync('src-tauri/icons/icon.ico').subarray(0,6);console.log(b[0]===0&&b[1]===0&&b[2]===1&&b[3]===0?'Valid ICO':'Unknown')"
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### 6. Add NSIS config to `src-tauri/tauri.conf.json`
|
|
51
|
-
|
|
52
|
-
```json
|
|
53
|
-
{
|
|
54
|
-
"bundle": {
|
|
55
|
-
"icon": ["icons/icon.ico", "icons/32x32.png", "icons/128x128.png", "icons/128x128@2x.png"],
|
|
56
|
-
"windows": {
|
|
57
|
-
"nsis": {
|
|
58
|
-
"installerIcon": "icons/icon.ico",
|
|
59
|
-
"headerImage": "icons/installer-header.bmp",
|
|
60
|
-
"sidebarImage": "icons/installer-sidebar.bmp",
|
|
61
|
-
"installMode": "currentUser"
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Remove `headerImage` / `sidebarImage` lines if the user chose not to customize them. Remove `installMode` if the default "currentUser" is acceptable.
|
|
69
|
-
|
|
70
|
-
### 7. Rebuild
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
tauri build
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
The NSIS script is generated at `src-tauri/target/.../release/nsis/x64/installer.nsi`. Verify the generated script contains:
|
|
77
|
-
- `!define INSTALLERICON "icons/icon.ico"` and `!define MUI_ICON "icons/icon.ico"`
|
|
78
|
-
- `!define HEADERIMAGE "icons/installer-header.bmp"` (if configured)
|
|
79
|
-
- `!define SIDEBARIMAGE "icons/installer-sidebar.bmp"` (if configured)
|
|
80
|
-
- `!define INSTALLMODE "currentUser"`
|
|
81
|
-
|
|
82
|
-
## Schema Reference
|
|
83
|
-
|
|
84
|
-
See `references/tauri-nsis-schema.md` for the full `bundle.windows.nsis` schema.
|
|
85
|
-
|
|
86
|
-
## Common Pitfalls
|
|
87
|
-
|
|
88
|
-
- `bundle.icon` does NOT affect the NSIS installer — a separate `installerIcon` field is required.
|
|
89
|
-
- The `.ico` file must be a valid ICO file (not a renamed PNG).
|
|
90
|
-
- Paths are relative to `src-tauri/`, not the project root.
|
|
91
|
-
- The NSIS script is auto-generated during `tauri build`; editing `installer.nsi` directly is overwritten on rebuild.
|
|
92
|
-
- `headerImage` and `sidebarImage` must be BMP format; PNG will cause build failure. Convert via ImageMagick: `magick convert input.png bmp:output.bmp`.
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
# Tauri 2 `bundle.windows.nsis` Schema
|
|
2
|
-
|
|
3
|
-
Extracted from Tauri 2 official config schema. Paths are relative to `src-tauri/`.
|
|
4
|
-
|
|
5
|
-
## Full Bundle Windows Config
|
|
6
|
-
|
|
7
|
-
```json
|
|
8
|
-
{
|
|
9
|
-
"bundle": {
|
|
10
|
-
"windows": {
|
|
11
|
-
"digestAlgorithm": "sha256",
|
|
12
|
-
"certificateThumbprint": null,
|
|
13
|
-
"timestampUrl": null,
|
|
14
|
-
"tsp": false,
|
|
15
|
-
"webviewInstallMode": {
|
|
16
|
-
"type": "downloadBootstrapper"
|
|
17
|
-
},
|
|
18
|
-
"nsis": {
|
|
19
|
-
"installerIcon": "icons/icon.ico",
|
|
20
|
-
"installMode": "currentUser",
|
|
21
|
-
"languages": null,
|
|
22
|
-
"template": null,
|
|
23
|
-
"displayLanguageSelector": false,
|
|
24
|
-
"startMenuFolder": null,
|
|
25
|
-
"headerImage": null,
|
|
26
|
-
"sidebarImage": null,
|
|
27
|
-
"customHeight": null,
|
|
28
|
-
"customWidth": null
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## NSIS Fields Detail
|
|
36
|
-
|
|
37
|
-
| Field | Type | Default | Description |
|
|
38
|
-
|-------|------|---------|-------------|
|
|
39
|
-
| `installerIcon` | string (path) | — | ICO file for the NSIS installer |
|
|
40
|
-
| `installMode` | `"currentUser"` or `"both"` | `"currentUser"` | Install scope: per-user (no admin) or user-selectable |
|
|
41
|
-
| `displayLanguageSelector` | boolean | false | Show language selector in installer |
|
|
42
|
-
| `languages` | string[] | null | Custom NSIS language files |
|
|
43
|
-
| `template` | string (path) | null | Custom NSIS template file |
|
|
44
|
-
| `startMenuFolder` | string | null | Start menu folder name |
|
|
45
|
-
| `headerImage` | string (path) | null | BMP for installer header (150 x 57 px) |
|
|
46
|
-
| `sidebarImage` | string (path) | null | BMP for installer sidebar (164 x 314 px) |
|
|
47
|
-
| `customHeight` | number | null | Custom installer window height |
|
|
48
|
-
| `customWidth` | number | null | Custom installer window width |
|
|
49
|
-
|
|
50
|
-
## Image Format Requirements
|
|
51
|
-
|
|
52
|
-
| Image | Format | Dimensions | Location in Installer |
|
|
53
|
-
|-------|--------|-----------|----------------------|
|
|
54
|
-
| `installerIcon` | ICO | Multi-resolution | Taskbar / title bar |
|
|
55
|
-
| `headerImage` | BMP | 150 x 57 px | Top of each installer page |
|
|
56
|
-
| `sidebarImage` | BMP | 164 x 314 px | Welcome / Finish page left panel |
|
|
57
|
-
|
|
58
|
-
### BMP Conversion (if user provides PNG)
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
# ImageMagick
|
|
62
|
-
magick convert input.png -resize 150x57 bmp:src-tauri/icons/installer-header.bmp
|
|
63
|
-
magick convert input.png -resize 164x314 bmp:src-tauri/icons/installer-sidebar.bmp
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## ICO Requirements
|
|
67
|
-
|
|
68
|
-
- Must be a valid `.ico` file (not a renamed `.png`)
|
|
69
|
-
- Recommended: include 32x32, 256x256 sizes
|
|
70
|
-
- 85 KB+ typically indicates a well-formed multi-resolution ICO
|
|
71
|
-
- Verify header: first 4 bytes `00 00 01 00` (reserved + type=ico + count=1)
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sync-docs
|
|
3
|
-
description: |
|
|
4
|
-
Synchronize project documentation files (README.md, AGENTS.md, CLAUDE.md, CONTEXT.md, RULES.md)
|
|
5
|
-
to ensure consistency. This skill should be used when the user asks to "同步项目文档",
|
|
6
|
-
"update project constraints", "sync-docs", or when project structure or conventions change.
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
# Sync Project Documentation (sync-docs)
|
|
10
|
-
|
|
11
|
-
Keep README.md, AGENTS.md, CLAUDE.md, CONTEXT.md, and RULES.md consistent with each other and with the current codebase state.
|
|
12
|
-
|
|
13
|
-
## Purpose
|
|
14
|
-
|
|
15
|
-
These files serve different but overlapping roles:
|
|
16
|
-
|
|
17
|
-
| File | Role | Audience |
|
|
18
|
-
|------|------|----------|
|
|
19
|
-
| README.md | Project overview & quick start | New developers |
|
|
20
|
-
| AGENTS.md | AI agent project guidance & build commands | AI assistants & developers |
|
|
21
|
-
| CLAUDE.md | AI agent constraints & rules | AI assistants |
|
|
22
|
-
| CONTEXT.md | Architecture decisions & history | Developers & AI |
|
|
23
|
-
| RULES.md | Detailed coding rules & conventions | All developers & AI |
|
|
24
|
-
|
|
25
|
-
When the project evolves (new modules, refactoring, new conventions), all may need updating.
|
|
26
|
-
|
|
27
|
-
## Process
|
|
28
|
-
|
|
29
|
-
### Step 1: Read all five files
|
|
30
|
-
|
|
31
|
-
Read README.md, AGENTS.md, CLAUDE.md, CONTEXT.md, and RULES.md.
|
|
32
|
-
|
|
33
|
-
### Step 2: Read the codebase for changes
|
|
34
|
-
|
|
35
|
-
Check for discrepancies:
|
|
36
|
-
- New modules in `src-tauri/src/` not listed in README project structure
|
|
37
|
-
- New pages in `src/pages/` not listed in README
|
|
38
|
-
- Build commands or dependencies that changed in package.json/Cargo.toml
|
|
39
|
-
- New architectural decisions since last CONTEXT.md update
|
|
40
|
-
- New rules or conventions since last CLAUDE.md / RULES.md update
|
|
41
|
-
|
|
42
|
-
### Step 3: Identify inconsistencies
|
|
43
|
-
|
|
44
|
-
Compare across files:
|
|
45
|
-
- Module lists should match across README and CLAUDE
|
|
46
|
-
- AGENTS.md build commands and known issues should match README.md and CONTEXT.md
|
|
47
|
-
- RULES.md should be the authoritative source for coding rules referenced by CLAUDE.md
|
|
48
|
-
- Architecture decisions in CONTEXT should reflect current state
|
|
49
|
-
- Version number should be consistent everywhere
|
|
50
|
-
|
|
51
|
-
### Step 4: Update files
|
|
52
|
-
|
|
53
|
-
Apply minimal targeted edits using `replace_in_file`. Priority order:
|
|
54
|
-
1. README.md — project structure and commands
|
|
55
|
-
2. AGENTS.md — project guidance, build commands, known issues
|
|
56
|
-
3. CLAUDE.md — module structure and rules summary
|
|
57
|
-
4. RULES.md — detailed coding rules and conventions
|
|
58
|
-
5. CONTEXT.md — ADR records and known issues
|
|
59
|
-
|
|
60
|
-
### Step 5: Commit
|
|
61
|
-
|
|
62
|
-
`docs: sync README/AGENTS/CLAUDE/CONTEXT/RULES after project changes`
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: tdd
|
|
3
|
-
description: Test-driven development with red-green-refactor loop. Use when user wants to build features or fix bugs using TDD, mentions "red-green-refactor", wants integration tests, or asks for test-first development.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Test-Driven Development
|
|
7
|
-
|
|
8
|
-
## Philosophy
|
|
9
|
-
|
|
10
|
-
**Core principle**: Tests should verify behavior through public interfaces, not implementation details. Code can change entirely; tests shouldn't.
|
|
11
|
-
|
|
12
|
-
**Good tests** are integration-style: they exercise real code paths through public APIs. They describe _what_ the system does, not _how_ it does it. A good test reads like a specification - "user can checkout with valid cart" tells you exactly what capability exists. These tests survive refactors because they don't care about internal structure.
|
|
13
|
-
|
|
14
|
-
**Bad tests** are coupled to implementation. They mock internal collaborators, test private methods, or verify through external means (like querying a database directly instead of using the interface). The warning sign: your test breaks when you refactor, but behavior hasn't changed. If you rename an internal function and tests fail, those tests were testing implementation, not behavior.
|
|
15
|
-
|
|
16
|
-
See [tests.md](tests.md) for examples and [mocking.md](mocking.md) for mocking guidelines.
|
|
17
|
-
|
|
18
|
-
## Anti-Pattern: Horizontal Slices
|
|
19
|
-
|
|
20
|
-
**DO NOT write all tests first, then all implementation.** This is "horizontal slicing" - treating RED as "write all tests" and GREEN as "write all code."
|
|
21
|
-
|
|
22
|
-
This produces **crap tests**:
|
|
23
|
-
|
|
24
|
-
- Tests written in bulk test _imagined_ behavior, not _actual_ behavior
|
|
25
|
-
- You end up testing the _shape_ of things (data structures, function signatures) rather than user-facing behavior
|
|
26
|
-
- Tests become insensitive to real changes - they pass when behavior breaks, fail when behavior is fine
|
|
27
|
-
- You outrun your headlights, committing to test structure before understanding the implementation
|
|
28
|
-
|
|
29
|
-
**Correct approach**: Vertical slices via tracer bullets. One test → one implementation → repeat. Each test responds to what you learned from the previous cycle. Because you just wrote the code, you know exactly what behavior matters and how to verify it.
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
WRONG (horizontal):
|
|
33
|
-
RED: test1, test2, test3, test4, test5
|
|
34
|
-
GREEN: impl1, impl2, impl3, impl4, impl5
|
|
35
|
-
|
|
36
|
-
RIGHT (vertical):
|
|
37
|
-
RED→GREEN: test1→impl1
|
|
38
|
-
RED→GREEN: test2→impl2
|
|
39
|
-
RED→GREEN: test3→impl3
|
|
40
|
-
...
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
## Workflow
|
|
44
|
-
|
|
45
|
-
### 1. Planning
|
|
46
|
-
|
|
47
|
-
When exploring the codebase, use the project's domain glossary so that test names and interface vocabulary match the project's language, and respect ADRs in the area you're touching.
|
|
48
|
-
|
|
49
|
-
Before writing any code:
|
|
50
|
-
|
|
51
|
-
- [ ] Confirm with user what interface changes are needed
|
|
52
|
-
- [ ] Confirm with user which behaviors to test (prioritize)
|
|
53
|
-
- [ ] Identify opportunities for [deep modules](deep-modules.md) (small interface, deep implementation)
|
|
54
|
-
- [ ] Design interfaces for [testability](interface-design.md)
|
|
55
|
-
- [ ] List the behaviors to test (not implementation steps)
|
|
56
|
-
- [ ] Get user approval on the plan
|
|
57
|
-
|
|
58
|
-
Ask: "What should the public interface look like? Which behaviors are most important to test?"
|
|
59
|
-
|
|
60
|
-
**You can't test everything.** Confirm with the user exactly which behaviors matter most. Focus testing effort on critical paths and complex logic, not every possible edge case.
|
|
61
|
-
|
|
62
|
-
### 2. Tracer Bullet
|
|
63
|
-
|
|
64
|
-
Write ONE test that confirms ONE thing about the system:
|
|
65
|
-
|
|
66
|
-
```
|
|
67
|
-
RED: Write test for first behavior → test fails
|
|
68
|
-
GREEN: Write minimal code to pass → test passes
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
This is your tracer bullet - proves the path works end-to-end.
|
|
72
|
-
|
|
73
|
-
### 3. Incremental Loop
|
|
74
|
-
|
|
75
|
-
For each remaining behavior:
|
|
76
|
-
|
|
77
|
-
```
|
|
78
|
-
RED: Write next test → fails
|
|
79
|
-
GREEN: Minimal code to pass → passes
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Rules:
|
|
83
|
-
|
|
84
|
-
- One test at a time
|
|
85
|
-
- Only enough code to pass current test
|
|
86
|
-
- Don't anticipate future tests
|
|
87
|
-
- Keep tests focused on observable behavior
|
|
88
|
-
|
|
89
|
-
### 4. Refactor
|
|
90
|
-
|
|
91
|
-
After all tests pass, look for [refactor candidates](refactoring.md):
|
|
92
|
-
|
|
93
|
-
- [ ] Extract duplication
|
|
94
|
-
- [ ] Deepen modules (move complexity behind simple interfaces)
|
|
95
|
-
- [ ] Apply SOLID principles where natural
|
|
96
|
-
- [ ] Consider what new code reveals about existing code
|
|
97
|
-
- [ ] Run tests after each refactor step
|
|
98
|
-
|
|
99
|
-
**Never refactor while RED.** Get to GREEN first.
|
|
100
|
-
|
|
101
|
-
## Checklist Per Cycle
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
[ ] Test describes behavior, not implementation
|
|
105
|
-
[ ] Test uses public interface only
|
|
106
|
-
[ ] Test would survive internal refactor
|
|
107
|
-
[ ] Code is minimal for this test
|
|
108
|
-
[ ] No speculative features added
|
|
109
|
-
```
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# Deep Modules
|
|
2
|
-
|
|
3
|
-
From "A Philosophy of Software Design":
|
|
4
|
-
|
|
5
|
-
**Deep module** = small interface + lots of implementation
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
┌─────────────────────┐
|
|
9
|
-
│ Small Interface │ ← Few methods, simple params
|
|
10
|
-
├─────────────────────┤
|
|
11
|
-
│ │
|
|
12
|
-
│ │
|
|
13
|
-
│ Deep Implementation│ ← Complex logic hidden
|
|
14
|
-
│ │
|
|
15
|
-
│ │
|
|
16
|
-
└─────────────────────┘
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
**Shallow module** = large interface + little implementation (avoid)
|
|
20
|
-
|
|
21
|
-
```
|
|
22
|
-
┌─────────────────────────────────┐
|
|
23
|
-
│ Large Interface │ ← Many methods, complex params
|
|
24
|
-
├─────────────────────────────────┤
|
|
25
|
-
│ Thin Implementation │ ← Just passes through
|
|
26
|
-
└─────────────────────────────────┘
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
When designing interfaces, ask:
|
|
30
|
-
|
|
31
|
-
- Can I reduce the number of methods?
|
|
32
|
-
- Can I simplify the parameters?
|
|
33
|
-
- Can I hide more complexity inside?
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
# Interface Design for Testability
|
|
2
|
-
|
|
3
|
-
Good interfaces make testing natural:
|
|
4
|
-
|
|
5
|
-
1. **Accept dependencies, don't create them**
|
|
6
|
-
|
|
7
|
-
```typescript
|
|
8
|
-
// Testable
|
|
9
|
-
function processOrder(order, paymentGateway) {}
|
|
10
|
-
|
|
11
|
-
// Hard to test
|
|
12
|
-
function processOrder(order) {
|
|
13
|
-
const gateway = new StripeGateway();
|
|
14
|
-
}
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
2. **Return results, don't produce side effects**
|
|
18
|
-
|
|
19
|
-
```typescript
|
|
20
|
-
// Testable
|
|
21
|
-
function calculateDiscount(cart): Discount {}
|
|
22
|
-
|
|
23
|
-
// Hard to test
|
|
24
|
-
function applyDiscount(cart): void {
|
|
25
|
-
cart.total -= discount;
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
3. **Small surface area**
|
|
30
|
-
- Fewer methods = fewer tests needed
|
|
31
|
-
- Fewer params = simpler test setup
|