@minhduydev/mdpi 0.4.1 → 0.6.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/dist/index.js +4 -2
- package/dist/template/.pi/AGENTS.md +1 -1
- package/dist/template/.pi/README.md +2 -3
- package/dist/template/.pi/VERSION +1 -1
- package/dist/template/.pi/agents/explore.md +1 -1
- package/dist/template/.pi/agents/scout.md +1 -1
- package/dist/template/.pi/extensions/templates-injector.ts +35 -7
- package/dist/template/.pi/prompts/INDEX.md +3 -9
- package/dist/template/.pi/prompts/gc.md +2 -1
- package/dist/template/.pi/prompts/verify.md +24 -0
- package/dist/template/.pi/skills/INDEX.md +40 -8
- package/dist/template/.pi/skills/dcp-hygiene/SKILL.md +1 -1
- package/dist/template/.pi/skills/frontend-design/SKILL.md +1 -1
- package/dist/template/.pi/skills/frontend-design/references/animation/motion-advanced.md +88 -15
- package/dist/template/.pi/skills/frontend-design/references/animation/motion-core.md +148 -13
- package/dist/template/.pi/skills/frontend-design/references/shadcn/setup.md +127 -20
- package/dist/template/.pi/skills/nextjs-app-router/SKILL.md +334 -0
- package/dist/template/.pi/skills/nextjs-cache/SKILL.md +262 -0
- package/dist/template/.pi/skills/react-best-practices/SKILL.md +79 -1
- package/dist/template/.pi/skills/react-compiler/SKILL.md +237 -0
- package/dist/template/.pi/skills/react-hook-form/SKILL.md +374 -0
- package/dist/template/.pi/skills/react-server-actions/SKILL.md +299 -0
- package/dist/template/.pi/skills/shadcn-ui/SKILL.md +404 -0
- package/dist/template/.pi/skills/tanstack-query/SKILL.md +330 -0
- package/dist/template/.pi/skills/v0/SKILL.md +264 -0
- package/dist/template/.pi/skills/zustand/SKILL.md +333 -0
- package/package.json +1 -1
- package/dist/template/.pi/context/fallow.md +0 -137
- package/dist/template/.pi/prompts/loop-check.md +0 -87
- package/dist/template/.pi/prompts/loop-init.md +0 -157
- package/dist/template/.pi/prompts/loop-review.md +0 -90
- package/dist/template/.pi/skills/loop-audit/SKILL.md +0 -141
- package/dist/template/.pi/skills/loop-cost/SKILL.md +0 -130
- package/dist/template/.pi/skills/loop-engineering/SKILL.md +0 -175
- package/dist/template/.pi/templates/loop-github-action.yml +0 -162
- package/dist/template/.pi/templates/loop-orchestrator.sh +0 -514
- package/dist/template/.pi/templates/loop-orchestrator.test.ts +0 -332
- package/dist/template/.pi/templates/loop-orchestrator.ts +0 -936
- package/dist/template/.pi/templates/loop-state.json +0 -24
- package/dist/template/.pi/templates/loop-state.md +0 -98
- package/dist/template/.pi/templates/loop-vision.md +0 -110
package/dist/index.js
CHANGED
|
@@ -10,7 +10,7 @@ import { spawn, spawnSync } from "node:child_process";
|
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { mkdir, readdir } from "node:fs/promises";
|
|
12
12
|
//#region package.json
|
|
13
|
-
var version = "0.
|
|
13
|
+
var version = "0.6.0";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/utils/manifest.ts
|
|
16
16
|
/**
|
|
@@ -950,12 +950,14 @@ async function initCommand(options = {}) {
|
|
|
950
950
|
if (only) adaptSettingsJson(piDir, only);
|
|
951
951
|
const manifest = generateManifest(piDir, version);
|
|
952
952
|
const fileCount = Object.keys(manifest.files).length;
|
|
953
|
+
const hasSkills = !only || only.has("skills");
|
|
953
954
|
if (quiet) {
|
|
954
955
|
const subset = only ? ` subset=[${[...only].join(",")}]` : "";
|
|
955
956
|
console.log(`mdpi: installed ${fileCount} files to ${piDir} (v${version})${subset}`);
|
|
956
957
|
} else {
|
|
957
958
|
const subsetNote = only ? `Subset: ${[...only].join(", ")} (+ always-on config).\n\nsettings.json trimmed to drop references to excluded\nskills/prompts/extensions dirs.\n\nNote: mdpi upgrade compares against the FULL template —\nrun \`mdpi upgrade --check\` before applying.\n\n` : "";
|
|
958
|
-
|
|
959
|
+
const fallowHint = hasSkills ? "Fallow skill included (codebase intelligence: dead code,\nduplication, complexity). For JS/TS projects, run `/init`\nin a pi session to generate `.fallowrc.json`; other stacks skip it.\n\n" : "";
|
|
960
|
+
p.note(`Pi kit installed at:\n${piDir}\n\n${fileCount} template files tracked via manifest.\n\n` + subsetNote + fallowHint + `Next: run ${color.cyan("mdpi install")} to install the kit's npm packages,\nthen open pi in this repo to use the kit.`, "Installation complete");
|
|
959
961
|
p.outro(color.green("Ready!"));
|
|
960
962
|
}
|
|
961
963
|
}
|
|
@@ -21,7 +21,7 @@ For project-wide rules (kernel, drift signals, hard constraints, output style),
|
|
|
21
21
|
| `prompts/` | slash commands | Dispatched by primary agent |
|
|
22
22
|
| `workflows/` | DAG workflows | Executed via subagent tool |
|
|
23
23
|
| `templates/` | project context templates | Referenced via auto-inject |
|
|
24
|
-
| `context/` | reference docs (architecture
|
|
24
|
+
| `context/` | reference docs (architecture) | Manual reference only, never auto-injected |
|
|
25
25
|
| `extensions/` | TypeScript extensions | Compiled JS code, gated by pi extension SDK |
|
|
26
26
|
|
|
27
27
|
---
|
|
@@ -95,9 +95,8 @@ pi
|
|
|
95
95
|
├── scripts/ # 1 utility script
|
|
96
96
|
│ └── gc-check.sh # Structural invariants for /gc
|
|
97
97
|
│
|
|
98
|
-
├── context/ #
|
|
99
|
-
│
|
|
100
|
-
│ └── fallow.md # Fallow CLI reference
|
|
98
|
+
├── context/ # 1 reference doc
|
|
99
|
+
│ └── architecture.md # Pi 5-layer architecture
|
|
101
100
|
│
|
|
102
101
|
├── state/ # Runtime state (gitignored)
|
|
103
102
|
│ └── session-summary.{json,md}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
0.
|
|
1
|
+
0.5.0
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: explore
|
|
3
3
|
description: "Fast read-only codebase cartographer — locate files, symbols, and usage patterns with file:line evidence"
|
|
4
4
|
tools: read, grep, find, ls, bash, semantic_query, semantic_inspect, semantic_grep, semantic_show
|
|
5
|
-
model:
|
|
5
|
+
model: opencode-go/deepseek-v4-flash
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are Pi — a read-only codebase explorer.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: scout
|
|
3
3
|
description: External research specialist for library docs, API references, and real-world code patterns
|
|
4
4
|
tools: read, bash, find, ls, websearch, codesearch, context7, grepsearch, web_fetch
|
|
5
|
-
model:
|
|
5
|
+
model: opencode-go/deepseek-v4-flash
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
You are Pi — an external research specialist.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Templates Injector Extension
|
|
3
3
|
*
|
|
4
|
-
* Auto-injects project context files into system prompt.
|
|
5
4
|
* Auto-injects project context files into system prompt via pi's before_agent_start hook.
|
|
6
5
|
*
|
|
7
6
|
* Resolution: prefer the LIVE file at `.pi/{name}` (filled by /init, the project's
|
|
@@ -9,21 +8,40 @@
|
|
|
9
8
|
* when no live file exists. This keeps templates/ pristine as deliverables while
|
|
10
9
|
* ensuring real project state is what the agent actually sees.
|
|
11
10
|
*
|
|
12
|
-
* Auto-injected (always, whichever resolves):
|
|
11
|
+
* Auto-injected (always, whichever resolves) — but ONLY when not placeholder-heavy:
|
|
13
12
|
* - project.md
|
|
14
13
|
* - tech-stack.md
|
|
15
14
|
* - state.md ← the "you are here" marker; live version injected once /init fills it
|
|
16
15
|
*
|
|
17
|
-
*
|
|
16
|
+
* Placeholder-skip: at before_agent_start, blank seed templates (still full of
|
|
17
|
+
* `[Criterion]`/`[URL]`/`<!-- ... -->` markers) are skipped so they don't tax the
|
|
18
|
+
* first message. A live file with real content (few markers) still injects.
|
|
19
|
+
*
|
|
20
|
+
* DESIGN.md is NOT auto-injected — load it on demand via `/inject-template DESIGN.md`
|
|
21
|
+
* (e.g. when starting UI work).
|
|
22
|
+
*
|
|
23
|
+
* User can opt-in to inject more via /inject-template command (placeholder-skip
|
|
24
|
+
* does not apply to explicit on-demand injection).
|
|
18
25
|
*/
|
|
19
26
|
|
|
20
27
|
import * as fs from "node:fs";
|
|
21
28
|
import * as path from "node:path";
|
|
22
29
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
23
30
|
|
|
24
|
-
const ALWAYS_INJECT = ["project.md", "tech-stack.md", "state.md"
|
|
31
|
+
const ALWAYS_INJECT = ["project.md", "tech-stack.md", "state.md"];
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
// Placeholder markers that indicate a template is still a blank seed (not filled).
|
|
34
|
+
// Counted to decide whether an auto-injected file would just add noise to the
|
|
35
|
+
// first message. Threshold is intentionally low (>5) so a genuinely filled live
|
|
36
|
+
// file (a handful of incidental bracket occurrences) still injects.
|
|
37
|
+
const PLACEHOLDER_MARKER_RE = /\[(?:e\.g\.|Criterion|URL|Title|Date|slug)[^\]]*\]|<slug>|<!-- /g;
|
|
38
|
+
const PLACEHOLDER_MARKER_THRESHOLD = 5;
|
|
39
|
+
|
|
40
|
+
function readTemplate(
|
|
41
|
+
cwd: string,
|
|
42
|
+
name: string,
|
|
43
|
+
skipPlaceholders = false,
|
|
44
|
+
): string | null {
|
|
27
45
|
// Prefer live file at .pi/{name} (filled by /init — real project state);
|
|
28
46
|
// fall back to blank seed at .pi/templates/{name} when no live file exists.
|
|
29
47
|
const livePath = path.join(cwd, ".pi", name);
|
|
@@ -33,7 +51,17 @@ function readTemplate(cwd: string, name: string): string | null {
|
|
|
33
51
|
const content = fs.readFileSync(filePath, "utf-8");
|
|
34
52
|
// Strip frontmatter for injection
|
|
35
53
|
const fmMatch = content.match(/^---\n[\s\S]*?\n---\n([\s\S]*)$/);
|
|
36
|
-
|
|
54
|
+
const body = (fmMatch ? fmMatch[1] : content).trim();
|
|
55
|
+
// Auto-inject only: skip placeholder-heavy files so unfilled templates don't
|
|
56
|
+
// tax the first message. On-demand /inject-template bypasses this (default).
|
|
57
|
+
// Anchored to a closing `]` so real markdown links like `[Vercel](...)` don't
|
|
58
|
+
// count; only placeholder-shaped tokens (`[URL]`, `[Criterion 1]`, `[e.g., ...]`,
|
|
59
|
+
// `<slug>`, `<!-- `) do.
|
|
60
|
+
if (skipPlaceholders) {
|
|
61
|
+
const markers = body.match(PLACEHOLDER_MARKER_RE);
|
|
62
|
+
if (markers && markers.length > PLACEHOLDER_MARKER_THRESHOLD) return null;
|
|
63
|
+
}
|
|
64
|
+
return body;
|
|
37
65
|
}
|
|
38
66
|
|
|
39
67
|
export default function templatesInjector(pi: ExtensionAPI) {
|
|
@@ -41,7 +69,7 @@ export default function templatesInjector(pi: ExtensionAPI) {
|
|
|
41
69
|
const injected: string[] = [];
|
|
42
70
|
|
|
43
71
|
for (const name of ALWAYS_INJECT) {
|
|
44
|
-
const content = readTemplate(ctx.cwd, name);
|
|
72
|
+
const content = readTemplate(ctx.cwd, name, /* skipPlaceholders */ true);
|
|
45
73
|
if (content && content.length > 0) {
|
|
46
74
|
injected.push(`### ${name}\n\n${content}`);
|
|
47
75
|
}
|
|
@@ -4,7 +4,7 @@ purpose: Index of slash commands with purpose, when-to-use, and lifecycle positi
|
|
|
4
4
|
|
|
5
5
|
# Prompts Index
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
11 slash commands. Lifecycle is canonical; utilities attach at any phase.
|
|
8
8
|
|
|
9
9
|
## Canonical Lifecycle
|
|
10
10
|
|
|
@@ -39,9 +39,6 @@ Status: /status
|
|
|
39
39
|
| `/gc` | Fallow analysis + quality grades + optional cleanup PRs | Maintenance cadence; not during active feature work | `[--dry-run] [--apply] [--scope <dir>]` | Maintenance |
|
|
40
40
|
| `/status` | Show active feature, progress tail, blockers | Orient at session start or when unsure | `[--full]` | Any (read-only) |
|
|
41
41
|
| `/close` | Finalize active feature, clear `.active` | Feature done/blocked/abandoned, or recover dangling `.active` | `[--done\|--blocked\|--abandoned] [--note <text>]` | Ship/Recovery |
|
|
42
|
-
| `/loop-check` | NO-GO qualification gate — refuse-list + 2-condition test + 30s checklist | Before scheduling a task as an unattended loop | `<task description> [--help]` | Define |
|
|
43
|
-
| `/loop-init` | Scaffold `.pi/loops/<name>/` from templates (VISION/STATE/SKILL) | Once a task passes /loop-check | `<name> [--help]` | Define |
|
|
44
|
-
| `/loop-review` | Maker/checker gate — verifier subagent runs the gate, emits ACCEPT/REJECT | After a maker run, before ship | `<loop-name> [--help]` | Review |
|
|
45
42
|
|
|
46
43
|
## When to use what
|
|
47
44
|
|
|
@@ -57,9 +54,6 @@ Status: /status
|
|
|
57
54
|
| "Where am I / what's the state" | `/status` |
|
|
58
55
|
| Feature done but `/ship` left `.active` dangling | `/close --done` |
|
|
59
56
|
| Maintenance / dead code sweep | `/gc --dry-run` |
|
|
60
|
-
| Qualify a task as an unattended loop (refuse-list + 2-condition test) | `/loop-check "<task>"` (Define) |
|
|
61
|
-
| Scaffold a loop after /loop-check returns GO | `/loop-init <name>` (Define) |
|
|
62
|
-
| Maker/checker gate on a loop run before shipping | `/loop-review <name>` (Review) |
|
|
63
57
|
|
|
64
58
|
## Conventions (shared across commands)
|
|
65
59
|
|
|
@@ -73,6 +67,6 @@ Status: /status
|
|
|
73
67
|
|
|
74
68
|
## Related
|
|
75
69
|
|
|
76
|
-
- `skills/INDEX.md` — task → skill routing (
|
|
70
|
+
- `skills/INDEX.md` — task → skill routing (67 skills)
|
|
77
71
|
- `workflows/INDEX.md` — 6 DAG workflows invoked by commands
|
|
78
|
-
- `templates/` —
|
|
72
|
+
- `templates/` — 12 template files (PRD, plan body, state, roadmap, etc.)
|
|
@@ -41,8 +41,9 @@ This command delegates to the `garbage-collection` workflow via the `run_workflo
|
|
|
41
41
|
|
|
42
42
|
1. **Run Fallow scan:**
|
|
43
43
|
```bash
|
|
44
|
-
npx fallow --format json --quiet
|
|
44
|
+
npx fallow --format json --quiet || true
|
|
45
45
|
```
|
|
46
|
+
> Append `|| true`: exit 1 means "issues found" (normal for GC), not a runtime error. Only exit 2 (invalid config/parse) is a real failure — see `fallow` skill Agent Rule 2.
|
|
46
47
|
2. Extract findings: dead code, duplication, complexity hotspots, unused exports
|
|
47
48
|
|
|
48
49
|
### Phase 2: Quality Grade Update
|
|
@@ -41,6 +41,7 @@ Check implementation against PRD before shipping.
|
|
|
41
41
|
| `verification-before-completion` | Always | Evidence-before-claims; phantom detection; verification cache protocol; Worker Distrust Protocol |
|
|
42
42
|
| `code-review-and-quality` | Phase 4 coherence check | Cross-reference artifacts for correctness |
|
|
43
43
|
| `testing-anti-patterns` | Phase 3 after tests pass | Detect mock-only tests, production pollution, and fragile assertions |
|
|
44
|
+
| `fallow` | Phase 2b (advisory) | Changed-file structural risk — dead code, complexity, duplication introduced by this change. Non-blocking. |
|
|
44
45
|
| `dcp-hygiene` | Phase 5 Report | Compress the closed gate output (typecheck/lint/test) when `compress` is available |
|
|
45
46
|
|
|
46
47
|
## Phase 0: Verification Cache
|
|
@@ -84,6 +85,7 @@ Report results with mode column:
|
|
|
84
85
|
| Lint | PASS | incremental | 0.3s |
|
|
85
86
|
| Test | PASS | incremental | 1.2s |
|
|
86
87
|
| Build | SKIP | — | — |
|
|
88
|
+
| Fallow | ADVISORY | new-only | 0.8s |
|
|
87
89
|
```
|
|
88
90
|
|
|
89
91
|
After all gates pass, load `testing-anti-patterns` skill and audit tests for mock-only coverage, fragile assertions, and production code pollution.
|
|
@@ -92,6 +94,27 @@ If `--fix` flag provided, run the project's auto-fix command (e.g., `npm run lin
|
|
|
92
94
|
|
|
93
95
|
**After all gates pass**, record to verification cache per `verification-before-completion` skill's cache protocol.
|
|
94
96
|
|
|
97
|
+
### Phase 2b: Structural Risk Advisory (fallow)
|
|
98
|
+
|
|
99
|
+
After the hard gates pass, run a **non-blocking** structural-risk scan over the change set. This surfaces dead code, complexity, and duplication **introduced by this change** — it never blocks `/verify` or `/ship`.
|
|
100
|
+
|
|
101
|
+
Load the `fallow` skill. Determine the PR base, then run the changed-file audit:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
BASE=$(git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main 2>/dev/null || echo "HEAD~1")
|
|
105
|
+
npx fallow audit --base "$BASE" --gate new-only --format json --quiet 2>/dev/null || true
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
> `--gate new-only` restricts to issues introduced since `$BASE` so pre-existing findings don't noise the report. `|| true` + `2>/dev/null`: exit 1 = issues found (normal), exit 2 = real error. If fallow is not installed, the project is not JS/TS, or there is no git base, this step is a **silent no-op** — never block on it.
|
|
109
|
+
|
|
110
|
+
Parse the JSON `verdict` (`pass` | `warn` | `fail`) and `issues[]`. Report as the **ADVISORY** row in the Phase 2 table above.
|
|
111
|
+
|
|
112
|
+
**Blocking policy — never blocks:**
|
|
113
|
+
- Fallow findings are logged to `.pi/artifacts/$SLUG/progress.md` as advisory and surfaced in the Phase 5 Report under "Structural risk (advisory)".
|
|
114
|
+
- They are candidates for a follow-up `/gc --scope <path>` or `/fix` — NOT a ship blocker.
|
|
115
|
+
|
|
116
|
+
**Escalate (agent judgment, still no auto-block):** if verdict is `fail` with >5 NEW issues or any NEW circular dependency / architecture boundary violation, surface it prominently to the user and suggest running `/gc --scope <path>` before shipping.
|
|
117
|
+
|
|
95
118
|
## Phase 3: Coherence (skip with --quick)
|
|
96
119
|
|
|
97
120
|
Cross-reference artifacts for contradictions:
|
|
@@ -155,3 +178,4 @@ Append to `.pi/artifacts/$SLUG/progress.md`: `Verification: [PASS|PARTIAL|FAIL]
|
|
|
155
178
|
- `verification-before-completion` — evidence gate, cache protocol, phantom detection, Worker Distrust Protocol (all phases)
|
|
156
179
|
- `code-review-and-quality` — coherence cross-reference (Phase 3)
|
|
157
180
|
- `testing-anti-patterns` — mock-only test detection (Phase 2 post-gate)
|
|
181
|
+
- `fallow` — changed-file structural risk advisory, non-blocking (Phase 2b)
|
|
@@ -17,17 +17,22 @@ When the agent edits files matching these patterns, the listed skills auto-load.
|
|
|
17
17
|
|
|
18
18
|
| File pattern | Auto-load skill(s) | Why |
|
|
19
19
|
|-------------|-------------------|-----|
|
|
20
|
-
| `*.ts,*.tsx,*.jsx` | `react-best-practices`, `deep-module-design` | TypeScript/React best practices + structural quality |
|
|
20
|
+
| `*.ts,*.tsx,*.jsx` | `react-best-practices`, `deep-module-design`, `react-compiler` | TypeScript/React best practices + structural quality |
|
|
21
|
+
| `**/actions.ts`, `**/actions/**` | `react-server-actions` | Server Actions + useActionState patterns |
|
|
22
|
+
| `**/app/**/page.tsx`, `**/app/**/layout.tsx` | `nextjs-app-router`, `nextjs-cache` | App Router conventions + caching |
|
|
23
|
+
| `**/stores/**`, `**/store.ts` | `zustand` | Zustand state management patterns |
|
|
24
|
+
| `**/hooks/use-query*.ts`, `**/queries/**` | `tanstack-query` | TanStack Query hooks and patterns |
|
|
25
|
+
| `**/forms/**` with `useForm`, `zodResolver` | `react-hook-form` | React Hook Form + Zod patterns |
|
|
21
26
|
| `*.swift,*.swiftui` | `swift-concurrency`, `swiftui-expert-skill` | Swift patterns + concurrency safety |
|
|
22
27
|
| `*.test.*,*.spec.*,__tests__/**` | `test-driven-development`, `testing-anti-patterns` | Test-first discipline + mock hygiene |
|
|
23
28
|
| `*.sql,migrations/**` | `supabase-postgres-best-practices` | Query performance + RLS |
|
|
24
29
|
| `.github/workflows/**,Dockerfile,docker-compose*.yml` | `ci-cd-and-automation` | Pipeline design + caching |
|
|
25
30
|
| `.pi/skills/*/SKILL.md` | `writing-skills` | Skill authoring best practices |
|
|
26
|
-
|
|
31
|
+
|
|
27
32
|
| `*.css,*.scss,*.less` | `baseline-ui`, `frontend-design`, `design-taste-frontend` | Deslop pass + design system consistency |
|
|
28
33
|
| `*.tsx,*.jsx` | `baseline-ui`, `frontend-ui-engineering` | Deslop pass + production-quality UI standards |
|
|
29
34
|
| `*.md,docs/**,ADR*.md` | `documentation-and-adrs` | Doc structure + ADR format |
|
|
30
|
-
| `.pi/**/DESIGN.md` | `frontend-design`, `design-taste-frontend` | Project design identity — load aesthetic skills when DESIGN.md is edited |
|
|
35
|
+
| `.pi/**/DESIGN.md` | `frontend-design`, `design-taste-frontend` | Project design identity — load aesthetic skills when DESIGN.md is edited. NOTE: DESIGN.md is no longer auto-injected; load it into context on demand via `/inject-template DESIGN.md` when starting UI work. |
|
|
31
36
|
|
|
32
37
|
---
|
|
33
38
|
|
|
@@ -42,6 +47,7 @@ When the user's prompt contains these keywords (case-insensitive), the listed sk
|
|
|
42
47
|
| performance, slow, latency, optimize, profile, bundle size | `performance-optimization` |
|
|
43
48
|
| bug, fix, error, crash, broken, debug, trace | `debugging-and-error-recovery`, `root-cause-tracing` |
|
|
44
49
|
| refactor, cleanup, simplify, clean code, complex | `code-cleanup`, `code-simplification`, `deep-module-design` |
|
|
50
|
+
| dead code, duplication, circular dependency, unused exports, unused dependencies, complexity hotspot, codebase health, fallow | `fallow` |
|
|
45
51
|
| test, spec, verify, assert, coverage, TDD | `test-driven-development`, `testing-anti-patterns` |
|
|
46
52
|
| review, audit, quality, check, PR | `code-review-and-quality`, `agent-code-quality-gate` |
|
|
47
53
|
| design, UI, component, style, layout, CSS, tailwind, DESIGN.md, design identity, design token, brand identity | `frontend-design`, `design-taste-frontend` |
|
|
@@ -65,10 +71,19 @@ When the user's prompt contains these keywords (case-insensitive), the listed sk
|
|
|
65
71
|
| payment, subscription, license, billing, checkout | `polar` |
|
|
66
72
|
| Figma, design token, mockup, screenshot to code | `figma`, `mockup-to-code` |
|
|
67
73
|
| Jira, Confluence, Atlassian, issue, ticket | `jira` |
|
|
74
|
+
| v0, v0.sh, v0.dev, AI UI generator, Vercel v0, v0 component, v0 generate | `v0` |
|
|
75
|
+
| shadcn, shadcn/ui, shadcn-ui, shadcn ui, shadcn component, shadcn add | `shadcn-ui` |
|
|
76
|
+
| Server Actions, useActionState, useOptimistic, useFormStatus, 'use server', form action, progressive enhancement | `react-server-actions` |
|
|
77
|
+
| App Router, layout.tsx, page.tsx, parallel routes, intercepting routes, route groups, async params, template.tsx, loading.tsx | `nextjs-app-router` |
|
|
78
|
+
| use cache, cacheLife, cacheTag, revalidateTag, revalidatePath, Next.js cache, connection() | `nextjs-cache` |
|
|
79
|
+
| React Compiler, auto-memoize, babel-plugin-react-compiler, useMemo, useCallback, memoization | `react-compiler` |
|
|
80
|
+
| TanStack Query, React Query, useQuery, useMutation, optimistic update, infinite query, prefetch | `tanstack-query` |
|
|
81
|
+
| Zustand, state management, global state, create store, useShallow, immer, persist, devtools | `zustand` |
|
|
82
|
+
| React Hook Form, useForm, zodResolver, Controller, useFieldArray, form validation, conditional fields | `react-hook-form` |
|
|
68
83
|
| browser, e2e, screenshot, playwright, chrome | `playwright`, `chrome-devtools`, `browser-testing-with-devtools` |
|
|
69
84
|
| dependency, package, library, npm, PyPI, source | `opensrc` |
|
|
70
85
|
| scrape, crawl, webclaw, bot protection, 403, webfetch fail, extract web content, web scraping | `webclaw` |
|
|
71
|
-
|
|
86
|
+
|
|
72
87
|
| Swift, iOS, macOS, actor, async/await, Sendable | `swift-concurrency`, `swiftui-expert-skill`, `core-data-expert` |
|
|
73
88
|
|
|
74
89
|
---
|
|
@@ -111,9 +126,7 @@ When the user's prompt contains these keywords (case-insensitive), the listed sk
|
|
|
111
126
|
| `dcp-hygiene` | At command/phase closure — compress closed exploratory work-streams via pi-dcp when `compress` is available; no-ops if DCP absent | All | Low |
|
|
112
127
|
| `memory-system` | Understanding/leveraging pi-hermes-memory — auto-flywheel, tools, commands, when to use memory_search vs vcc_recall | All | Low |
|
|
113
128
|
| `doubt-driven-development` | In-flight adversarial review of non-trivial decisions before they stand | Build | Medium |
|
|
114
|
-
|
|
115
|
-
| `loop-audit` | Scoring a project's loop-readiness 0-100 + L0/L1/L2/L3; L3 gated on proven run | Review | Low |
|
|
116
|
-
| `loop-cost` | Estimating tokens/day + daily cap + early-exit flag before approving a loop budget | Plan | Low |
|
|
129
|
+
|
|
117
130
|
|
|
118
131
|
### Implementation
|
|
119
132
|
|
|
@@ -155,7 +168,14 @@ When the user's prompt contains these keywords (case-insensitive), the listed sk
|
|
|
155
168
|
| `mockup-to-code` | Converting UI mockups, screenshots, Figma/Sketch designs into code | Build | Medium |
|
|
156
169
|
| `oklch-color-workflow` | Complete OKLCH color system — syntax, palette generation, contrast, Tailwind v4 | Build | Low |
|
|
157
170
|
| `production-hardening` | Production hardening — i18n, error states, edge cases, cross-browser | Ship | High |
|
|
158
|
-
| `react-best-practices` | Writing, reviewing, or refactoring React/Next.js code for performance | Build | Medium |
|
|
171
|
+
| `react-best-practices` | Writing, reviewing, or refactoring React 19 / Next.js 16 code for performance | Build | Medium |
|
|
172
|
+
| `react-server-actions` | Building forms, mutations, data writes with React 19 Server Actions | Build | Medium |
|
|
173
|
+
| `nextjs-app-router` | Building Next.js App Router pages — layouts, routes, RSC boundaries | Build | Medium |
|
|
174
|
+
| `nextjs-cache` | Next.js 16 caching — `use cache`, cacheLife, cacheTag, revalidation | Build | Medium |
|
|
175
|
+
| `react-compiler` | Enabling, debugging, optimizing with the React Compiler | Build | Low |
|
|
176
|
+
| `tanstack-query` | Data fetching, caching, mutations with TanStack Query v5 | Build | Medium |
|
|
177
|
+
| `zustand` | Global/shared state management with Zustand v5 | Build | Medium |
|
|
178
|
+
| `react-hook-form` | Building forms with React Hook Form v7 + Zod v3 | Build | Medium |
|
|
159
179
|
| `redesign-existing-projects` | Upgrading an existing website or app's visual design | Build | High |
|
|
160
180
|
| `ui-craft-principles` | 16 craft principles — concentric radius, optical alignment, interruptible animations | Build | Low |
|
|
161
181
|
| `ui-quality-audit` | 5-dimension UI quality scoring (0-4) with P0-P3 severity tags | Review | Medium |
|
|
@@ -197,6 +217,8 @@ When the user's prompt contains these keywords (case-insensitive), the listed sk
|
|
|
197
217
|
| `opensrc` | Understanding how a library works internally, debugging dependency issues | Build | Low |
|
|
198
218
|
| `pdf-extract` | Extracting text, images, tables, or metadata from PDF files | Build | Low |
|
|
199
219
|
| `webclaw` | When webfetch returns 403 or bot protection errors | Build | Low |
|
|
220
|
+
| `v0` | Using v0 (v0.app by Vercel) for AI-powered UI generation, prompt engineering, CLI/SDK integration | Build | Medium |
|
|
221
|
+
| `shadcn-ui` | Setting up, configuring, or adding shadcn/ui components — CLI v4, presets, skills, registries | Build | Medium |
|
|
200
222
|
| `gemini-large-context` | Analyzing large codebases, comparing multiple files exceeding typical context limits | Plan | Low |
|
|
201
223
|
| `fallow` | Codebase intelligence — quality, dead code, duplication, complexity hotspots | Review | Low |
|
|
202
224
|
|
|
@@ -227,8 +249,18 @@ Maps user intent to skill(s). `→` = sequential pipeline (execute in order). `+
|
|
|
227
249
|
| "I'm stuck" / "not sure what to do" | `behavioral-kernel` + `using-agent-skills` | All | Low |
|
|
228
250
|
| "which skill to use" / "what skill for" | `using-agent-skills` | Define | Low |
|
|
229
251
|
| "create UI" / "build component" / "design page" | `frontend-design` + `design-taste-frontend` | Build | Medium |
|
|
252
|
+
| "generate with v0" / "v0 component" / "v0 prompt" / "AI generate UI" | `v0` + `frontend-design` | Build | Medium |
|
|
253
|
+
| "add shadcn components" / "shadcn init" / "setup shadcn" / "shadcn/ui setup" | `shadcn-ui` + `frontend-design` | Build | Medium |
|
|
254
|
+
| "Server Action" / "useActionState" / "useOptimistic" / "'use server'" | `react-server-actions` + `nextjs-app-router` | Build | Medium |
|
|
255
|
+
| "App Router" / "layout.tsx" / "parallel route" / "intercepting route" | `nextjs-app-router` + `react-best-practices` | Build | Medium |
|
|
256
|
+
| "use cache" / "revalidateTag" / "cacheLife" / "Next.js cache" | `nextjs-cache` + `nextjs-app-router` | Build | Medium |
|
|
257
|
+
| "React Compiler" / "auto-memoize" / "useMemo unnecessary" | `react-compiler` + `react-best-practices` | Build | Low |
|
|
258
|
+
| "useQuery" / "useMutation" / "TanStack Query" / "optimistic update" | `tanstack-query` + `zustand` | Build | Medium |
|
|
259
|
+
| "Zustand" / "create store" / "useShallow" / "global state" | `zustand` + `tanstack-query` | Build | Medium |
|
|
260
|
+
| "React Hook Form" / "useForm" / "zodResolver" / "useFieldArray" | `react-hook-form` + `react-server-actions` | Build | Medium |
|
|
230
261
|
| "deploy to Cloudflare" | `cloudflare` | Ship | High |
|
|
231
262
|
| "deploy to Vercel" | `vercel-deploy-claimable` | Ship | High |
|
|
263
|
+
| "animate" / "animation" / "motion" / "framer" / "transition" | `frontend-design` (references/animation/) | Build | Low |
|
|
232
264
|
| "set up database" / "Supabase" | `supabase` + `supabase-postgres-best-practices` | Build | High |
|
|
233
265
|
| "add logging" / "monitoring" / "observability" | `observability-and-instrumentation` | Ship | Medium |
|
|
234
266
|
| "optimize context" / "agent quality degraded" / "too many tokens" | `context-engineering` | All | Low |
|
|
@@ -16,7 +16,7 @@ description: "Use at command/phase closure points to compress closed exploratory
|
|
|
16
16
|
- The `compress` tool is not registered (DCP extension not installed, or `compress.permission: "deny"`) — see No-op clause below.
|
|
17
17
|
- The work-stream is still in-flight or spans your most recent turn — DCP turn protection (last 3 turns) already refuses these; don't try.
|
|
18
18
|
- The user just asked about the content you'd be compressing — they still need it verbatim.
|
|
19
|
-
- The command is read-only/scaffold and produced almost no tool output (`/status`, `/close
|
|
19
|
+
- The command is read-only/scaffold and produced almost no tool output (`/status`, `/close`) — compressing near-empty streams wastes more tokens than it saves.
|
|
20
20
|
- Inside orchestrator workflows' phase prompts — subagents carry their own context; only the orchestrator's accumulated summaries matter, and those are bounded by "Keep under N words" per prompt.
|
|
21
21
|
|
|
22
22
|
## Core Principle
|
|
@@ -43,7 +43,7 @@ description: MUST load when building any web UI with React-based frameworks —
|
|
|
43
43
|
|
|
44
44
|
Search: `@theme`, `@container`, `OKLCH`, `mask-`, `text-shadow`
|
|
45
45
|
|
|
46
|
-
### shadcn/ui (CLI
|
|
46
|
+
### shadcn/ui (CLI v4.11)
|
|
47
47
|
|
|
48
48
|
- `./references/shadcn/setup.md` - Installation, visual styles, component list
|
|
49
49
|
- `./references/shadcn/core-components.md` - Button, Card, Dialog, Select, Tabs, Toast
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Motion Advanced
|
|
2
2
|
|
|
3
|
-
Scroll, orchestration, TypeScript, performance.
|
|
3
|
+
Scroll, orchestration, TypeScript, AnimateView, performance.
|
|
4
4
|
|
|
5
5
|
## Scroll Animations
|
|
6
6
|
|
|
7
7
|
```tsx
|
|
8
8
|
import { motion, useScroll, useTransform } from 'motion/react';
|
|
9
9
|
|
|
10
|
-
// Scroll progress
|
|
10
|
+
// Scroll progress (GPU-accelerated via ScrollTimeline API since v12.32)
|
|
11
11
|
const { scrollYProgress } = useScroll();
|
|
12
12
|
const opacity = useTransform(scrollYProgress, [0, 1], [1, 0]);
|
|
13
13
|
|
|
@@ -36,7 +36,7 @@ const scale = useTransform(scrollYProgress, [0, 0.5, 1], [0.8, 1, 0.8]);
|
|
|
36
36
|
## AnimatePresence Modes
|
|
37
37
|
|
|
38
38
|
```tsx
|
|
39
|
-
// Wait for exit before enter
|
|
39
|
+
// Wait for exit before enter (recommended for page transitions)
|
|
40
40
|
<AnimatePresence mode="wait">
|
|
41
41
|
<motion.div key={currentPage} />
|
|
42
42
|
</AnimatePresence>
|
|
@@ -50,6 +50,37 @@ const scale = useTransform(scrollYProgress, [0, 0.5, 1], [0.8, 1, 0.8]);
|
|
|
50
50
|
<AnimatePresence mode="sync" />
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
## AnimateView (New — Motion+ Early Access)
|
|
54
|
+
|
|
55
|
+
View Transitions wrapper for React. Enter/exit/update/share animations for page transitions:
|
|
56
|
+
|
|
57
|
+
```tsx
|
|
58
|
+
import { AnimateView } from 'motion/react'
|
|
59
|
+
|
|
60
|
+
<AnimateView>
|
|
61
|
+
<motion.div
|
|
62
|
+
animate={{ opacity: 1, scale: 1 }}
|
|
63
|
+
initial={{ opacity: 0, scale: 0.95 }}
|
|
64
|
+
/>
|
|
65
|
+
</AnimateView>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Built on React 19.2 `ViewTransition` component. Works alongside Next.js 16 `experimental.viewTransition`.
|
|
69
|
+
|
|
70
|
+
## arc() — Curved Motion Paths (v12.40+)
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { arc } from 'motion/react'
|
|
74
|
+
|
|
75
|
+
<motion.div
|
|
76
|
+
animate={{
|
|
77
|
+
x: 200,
|
|
78
|
+
y: -120,
|
|
79
|
+
transition: { path: arc() }
|
|
80
|
+
}}
|
|
81
|
+
/>
|
|
82
|
+
```
|
|
83
|
+
|
|
53
84
|
## Orchestration
|
|
54
85
|
|
|
55
86
|
```tsx
|
|
@@ -157,6 +188,24 @@ const prefersReduced = useReducedMotion();
|
|
|
157
188
|
|
|
158
189
|
// Use layoutRoot to isolate layout calculations
|
|
159
190
|
<motion.div layoutRoot />
|
|
191
|
+
|
|
192
|
+
// Axis-locked layout (v12.35+) — cheaper than full layout
|
|
193
|
+
<motion.div layout="x" />
|
|
194
|
+
|
|
195
|
+
// Custom anchor point (v12.38+)
|
|
196
|
+
<motion.div layoutAnchor={{ x: 0.5, y: 0.5 }} />
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
## CSS Color Support (v12.35+)
|
|
200
|
+
|
|
201
|
+
Motion now supports modern CSS color formats:
|
|
202
|
+
- `oklch()`, `oklab()`, `lab()`, `lch()`
|
|
203
|
+
- `color-mix()`, `light-dark()`
|
|
204
|
+
|
|
205
|
+
```tsx
|
|
206
|
+
<motion.div
|
|
207
|
+
animate={{ backgroundColor: 'oklch(0.65 0.22 250)' }}
|
|
208
|
+
/>
|
|
160
209
|
```
|
|
161
210
|
|
|
162
211
|
## Common Patterns
|
|
@@ -171,18 +220,28 @@ const prefersReduced = useReducedMotion();
|
|
|
171
220
|
/>
|
|
172
221
|
```
|
|
173
222
|
|
|
174
|
-
### Page transitions
|
|
223
|
+
### Page transitions (Next.js App Router)
|
|
175
224
|
```tsx
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
225
|
+
// app/template.tsx
|
|
226
|
+
'use client'
|
|
227
|
+
import { AnimatePresence, motion } from 'motion/react'
|
|
228
|
+
import { usePathname } from 'next/navigation'
|
|
229
|
+
|
|
230
|
+
export default function Template({ children }) {
|
|
231
|
+
const pathname = usePathname()
|
|
232
|
+
return (
|
|
233
|
+
<AnimatePresence mode="wait" initial={false}>
|
|
234
|
+
<motion.main
|
|
235
|
+
key={pathname}
|
|
236
|
+
initial={{ opacity: 0, x: 20 }}
|
|
237
|
+
animate={{ opacity: 1, x: 0 }}
|
|
238
|
+
exit={{ opacity: 0, x: -20 }}
|
|
239
|
+
>
|
|
240
|
+
{children}
|
|
241
|
+
</motion.main>
|
|
242
|
+
</AnimatePresence>
|
|
243
|
+
)
|
|
244
|
+
}
|
|
186
245
|
```
|
|
187
246
|
|
|
188
247
|
### Expandable card
|
|
@@ -212,13 +271,27 @@ anime.js v4 still appropriate for:
|
|
|
212
271
|
- Non-React projects
|
|
213
272
|
|
|
214
273
|
```javascript
|
|
215
|
-
// anime.js for SVG morphing
|
|
216
274
|
import { animate, svg } from 'animejs';
|
|
217
275
|
animate('#path1', { d: svg.morphTo('#path2'), duration: 1 });
|
|
218
276
|
```
|
|
219
277
|
|
|
278
|
+
## Library Comparison (2026)
|
|
279
|
+
|
|
280
|
+
| Library | Bundle | React DX | Scroll | Gestures | Layout Anim |
|
|
281
|
+
|---------|--------|----------|--------|----------|-------------|
|
|
282
|
+
| **Motion** | ~85KB | 🏆 Best | Built-in | Built-in | Built-in |
|
|
283
|
+
| GSAP | ~78KB | Imperative | ScrollTrigger | Draggable | Flip plugin |
|
|
284
|
+
| React Spring | ~45KB | Good | External | ❌ | ❌ |
|
|
285
|
+
| Anime.js | ~52KB | Imperative | External | ❌ | ❌ |
|
|
286
|
+
| TailwindCSS Motion | ~5KB | Good | Built-in | ❌ | ❌ |
|
|
287
|
+
|
|
288
|
+
**Verdict**: Motion for React-first projects with complex interactions. GSAP for marketing sites with complex timelines. React Spring for physics-driven natural motion. Anime.js for SVG path animations.
|
|
289
|
+
|
|
220
290
|
## Installation
|
|
221
291
|
|
|
222
292
|
```bash
|
|
223
293
|
npm install motion
|
|
294
|
+
# or migrate from framer-motion:
|
|
295
|
+
npm uninstall framer-motion && npm install motion
|
|
296
|
+
# swap imports: "framer-motion" → "motion/react"
|
|
224
297
|
```
|