@erclx/aitk 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +99 -0
- package/claude/.claude-plugin/plugin.json +19 -0
- package/claude/skills/bash-script/SKILL.md +96 -0
- package/claude/skills/bash-script/references/patterns.md +349 -0
- package/claude/skills/ci-workflow/SKILL.md +52 -0
- package/claude/skills/ci-workflow/references/workflows.md +74 -0
- package/claude/skills/claude-address-review/SKILL.md +107 -0
- package/claude/skills/claude-autoship/SKILL.md +137 -0
- package/claude/skills/claude-design-extract/SKILL.md +69 -0
- package/claude/skills/claude-design-propose/SKILL.md +75 -0
- package/claude/skills/claude-diagram/SKILL.md +126 -0
- package/claude/skills/claude-docs/SKILL.md +204 -0
- package/claude/skills/claude-feature/REQUIREMENT.md +35 -0
- package/claude/skills/claude-feature/SKILL.md +148 -0
- package/claude/skills/claude-groundwork/SKILL.md +148 -0
- package/claude/skills/claude-groundwork/references/folder-format.md +107 -0
- package/claude/skills/claude-memory-capture/SKILL.md +80 -0
- package/claude/skills/claude-memory-review/REQUIREMENT.md +37 -0
- package/claude/skills/claude-memory-review/SKILL.md +206 -0
- package/claude/skills/claude-orchestrate/SKILL.md +125 -0
- package/claude/skills/claude-pr-review/SKILL.md +150 -0
- package/claude/skills/claude-review/SKILL.md +136 -0
- package/claude/skills/claude-roadmap/SKILL.md +61 -0
- package/claude/skills/claude-roadmap/references/roadmap.md +52 -0
- package/claude/skills/claude-screencast/SKILL.md +160 -0
- package/claude/skills/claude-seed-sync/SKILL.md +141 -0
- package/claude/skills/claude-slides-draft/SKILL.md +62 -0
- package/claude/skills/claude-standards-audit/REQUIREMENT.md +33 -0
- package/claude/skills/claude-standards-audit/SKILL.md +79 -0
- package/claude/skills/claude-standards-audit/references/branch.md +49 -0
- package/claude/skills/claude-standards-audit/references/pr.md +124 -0
- package/claude/skills/claude-tasks/SKILL.md +123 -0
- package/claude/skills/claude-ui-test/SKILL.md +75 -0
- package/claude/skills/claude-ux-audit/SKILL.md +78 -0
- package/claude/skills/claude-worktree/SKILL.md +79 -0
- package/claude/skills/cli-script/SKILL.md +47 -0
- package/claude/skills/cli-script/references/template.md +43 -0
- package/claude/skills/create-rule/SKILL.md +68 -0
- package/claude/skills/create-skill/REQUIREMENT.md +30 -0
- package/claude/skills/create-skill/SKILL.md +24 -0
- package/claude/skills/create-snippet/SKILL.md +28 -0
- package/claude/skills/create-snippet/references/snippets.md +57 -0
- package/claude/skills/create-standard/SKILL.md +31 -0
- package/claude/skills/create-standard/references/standard.md +52 -0
- package/claude/skills/docs-sync/SKILL.md +87 -0
- package/claude/skills/git-branch/REQUIREMENT.md +38 -0
- package/claude/skills/git-branch/SKILL.md +60 -0
- package/claude/skills/git-branch/references/branch.md +49 -0
- package/claude/skills/git-commit/REQUIREMENT.md +33 -0
- package/claude/skills/git-commit/SKILL.md +51 -0
- package/claude/skills/git-commit/references/commit.md +63 -0
- package/claude/skills/git-followup/REQUIREMENT.md +38 -0
- package/claude/skills/git-followup/SKILL.md +35 -0
- package/claude/skills/git-issue/REQUIREMENT.md +38 -0
- package/claude/skills/git-issue/SKILL.md +69 -0
- package/claude/skills/git-issue/references/issue.md +84 -0
- package/claude/skills/git-pr/REQUIREMENT.md +37 -0
- package/claude/skills/git-pr/SKILL.md +119 -0
- package/claude/skills/git-pr/references/branch.md +49 -0
- package/claude/skills/git-pr/references/pr.md +124 -0
- package/claude/skills/git-ship/REQUIREMENT.md +34 -0
- package/claude/skills/git-ship/SKILL.md +39 -0
- package/claude/skills/git-split/REQUIREMENT.md +38 -0
- package/claude/skills/git-split/SKILL.md +160 -0
- package/claude/skills/git-split/references/branch.md +49 -0
- package/claude/skills/git-split/references/pr.md +124 -0
- package/claude/skills/git-stage/REQUIREMENT.md +36 -0
- package/claude/skills/git-stage/SKILL.md +74 -0
- package/claude/skills/git-stage/references/commit.md +63 -0
- package/claude/skills/git-worktree/REQUIREMENT.md +37 -0
- package/claude/skills/git-worktree/SKILL.md +120 -0
- package/claude/skills/migration-claude-md/SKILL.md +74 -0
- package/claude/skills/migration-context/SKILL.md +93 -0
- package/claude/skills/migration-standards/SKILL.md +75 -0
- package/claude/skills/project-commands/SKILL.md +73 -0
- package/claude/skills/session-resume/SKILL.md +36 -0
- package/claude/skills/setup-gov/SKILL.md +71 -0
- package/claude/skills/setup-indexes/SKILL.md +148 -0
- package/claude/skills/setup-init/SKILL.md +114 -0
- package/claude/skills/setup-plugins/SKILL.md +81 -0
- package/claude/skills/setup-plugins/references/plugin-catalog.md +53 -0
- package/claude/skills/setup-verify/SKILL.md +51 -0
- package/claude/skills/systematic-debugging/SKILL.md +70 -0
- package/claude/skills/toolkit-cli/SKILL.md +38 -0
- package/claude/skills/toolkit-feedback/SKILL.md +80 -0
- package/claude/skills/toolkit-operator/SKILL.md +45 -0
- package/claude/skills/toolkit-triage/SKILL.md +63 -0
- package/claude/skills/youtube-transcripts/SKILL.md +34 -0
- package/docs/agents.md +371 -0
- package/docs/ai-workflow.md +157 -0
- package/docs/index.md +20 -0
- package/docs/operating-model.md +106 -0
- package/docs/target-projects.md +183 -0
- package/docs/visual-design-workflow.md +136 -0
- package/docs/zshrc-aliases.md +65 -0
- package/governance/rules/claude/500-prose.md +12 -0
- package/governance/rules/claude/510-context.md +16 -0
- package/governance/rules/claude/520-wireframes.md +12 -0
- package/governance/rules/claude/530-requirements.md +11 -0
- package/governance/rules/claude/540-architecture.md +11 -0
- package/governance/rules/claude/550-design.md +11 -0
- package/governance/rules/claude/555-tasks.md +12 -0
- package/governance/rules/claude/560-diagrams.md +11 -0
- package/governance/rules/claude/570-skill.md +18 -0
- package/governance/rules/claude/580-readme.md +11 -0
- package/governance/rules/claude/590-rule-authoring.md +12 -0
- package/governance/rules/core/000-constitution.md +30 -0
- package/governance/rules/core/010-testing.md +35 -0
- package/governance/rules/core/020-concurrency.md +22 -0
- package/governance/rules/core/030-error-handling.md +31 -0
- package/governance/rules/core/040-performance.md +20 -0
- package/governance/rules/core/050-logging.md +20 -0
- package/governance/rules/core/060-naming.md +19 -0
- package/governance/rules/core/070-planning.md +13 -0
- package/governance/rules/core/080-config-comments.md +22 -0
- package/governance/rules/framework/200-react.md +51 -0
- package/governance/rules/framework/210-astro.md +41 -0
- package/governance/rules/framework/220-fastapi.md +43 -0
- package/governance/rules/framework/230-nextjs.md +48 -0
- package/governance/rules/framework/250-tailwind.md +32 -0
- package/governance/rules/framework/260-shadcn.md +34 -0
- package/governance/rules/lang/100-typescript.md +40 -0
- package/governance/rules/lang/110-python.md +42 -0
- package/governance/rules/lib/300-testing-ts.md +38 -0
- package/governance/rules/lib/310-zod.md +25 -0
- package/governance/rules/lib/320-tanstack-query.md +32 -0
- package/governance/rules/lib/330-testing-py.md +44 -0
- package/governance/rules/lib/340-pydantic.md +38 -0
- package/governance/rules/lib/350-security-web.md +31 -0
- package/governance/rules/ui/400-ui.md +34 -0
- package/governance/rules/ui/410-a11y.md +44 -0
- package/governance/rules/ui/420-forms.md +34 -0
- package/governance/rules/ui/430-ux-completeness.md +62 -0
- package/governance/stacks/astro.toml +2 -0
- package/governance/stacks/base.toml +2 -0
- package/governance/stacks/node.toml +2 -0
- package/governance/stacks/python-fastapi.toml +2 -0
- package/governance/stacks/python.toml +2 -0
- package/governance/stacks/react.toml +2 -0
- package/package.json +67 -0
- package/scripts/config.sh +11 -0
- package/scripts/core/bootstrap.sh +81 -0
- package/scripts/core/check-plugin-boundary.sh +45 -0
- package/scripts/core/check-skill-paths.sh +25 -0
- package/scripts/core/clean.sh +36 -0
- package/scripts/core/install-check.sh +93 -0
- package/scripts/core/regen-claude-copies.sh +26 -0
- package/scripts/core/regen-indexes.sh +10 -0
- package/scripts/core/regen-skill-references.sh +27 -0
- package/scripts/core/snapshot.sh +132 -0
- package/scripts/core/update.sh +35 -0
- package/scripts/core/verify.sh +201 -0
- package/scripts/docs/list.sh +129 -0
- package/scripts/gov/list.sh +234 -0
- package/scripts/lib/frontmatter.sh +30 -0
- package/scripts/lib/gov.sh +14 -0
- package/scripts/lib/sandbox-fixtures.sh +109 -0
- package/scripts/lib/sandbox-git.sh +73 -0
- package/scripts/lib/tooling.sh +24 -0
- package/scripts/lib/ui.sh +173 -0
- package/scripts/lib/worktree.sh +20 -0
- package/scripts/manage-sandbox.sh +453 -0
- package/scripts/snippets/create.sh +156 -0
- package/scripts/standards/list.sh +91 -0
- package/scripts/tooling/create.sh +109 -0
- package/scripts/tooling/ref.sh +141 -0
- package/scripts/tooling/verify.sh +179 -0
- package/snippets/claude/decision-memo.md +39 -0
- package/snippets/claude/feature-recap.md +19 -0
- package/snippets/claude/figma-steps.md +18 -0
- package/snippets/claude/orchestrator-resume.md +23 -0
- package/snippets/claude/orchestrator-sweep.md +10 -0
- package/snippets/compact-summary.md +5 -0
- package/snippets/create-snippet.md +7 -0
- package/snippets/decision-help.md +6 -0
- package/snippets/meta-prompt.md +14 -0
- package/snippets/research-prompt.md +7 -0
- package/snippets/session-notes.md +11 -0
- package/snippets/snippets.toml +6 -0
- package/snippets/step-by-step.md +10 -0
- package/snippets/web-research.md +21 -0
- package/src/claude/gitignore.ts +51 -0
- package/src/claude/seeds-list.ts +47 -0
- package/src/claude/seeds.ts +124 -0
- package/src/claude/settings.ts +151 -0
- package/src/cli-run.ts +43 -0
- package/src/cli.ts +111 -0
- package/src/commands/claude.ts +349 -0
- package/src/commands/design.ts +39 -0
- package/src/commands/docs.ts +59 -0
- package/src/commands/feedback-format.ts +23 -0
- package/src/commands/feedback.ts +103 -0
- package/src/commands/gov.ts +268 -0
- package/src/commands/indexes.ts +182 -0
- package/src/commands/init.ts +117 -0
- package/src/commands/pass-through.ts +39 -0
- package/src/commands/sandbox.ts +315 -0
- package/src/commands/slides.ts +106 -0
- package/src/commands/snippets.ts +236 -0
- package/src/commands/standards.ts +89 -0
- package/src/commands/sync.ts +211 -0
- package/src/commands/tasks.ts +185 -0
- package/src/commands/tooling.ts +432 -0
- package/src/commands/transcripts.ts +48 -0
- package/src/commands/wiki.ts +101 -0
- package/src/copy.ts +30 -0
- package/src/design/parse.ts +79 -0
- package/src/design/render.ts +170 -0
- package/src/docs/read.ts +59 -0
- package/src/exec.ts +17 -0
- package/src/frontmatter.ts +13 -0
- package/src/github-format.ts +13 -0
- package/src/github.ts +20 -0
- package/src/gov/adapter.ts +73 -0
- package/src/gov/install.ts +103 -0
- package/src/gov/payload.ts +39 -0
- package/src/gov/stacks.ts +124 -0
- package/src/indexes/frontmatter.ts +46 -0
- package/src/indexes/regen.ts +84 -0
- package/src/indexes/render.ts +181 -0
- package/src/indexes/walk.ts +111 -0
- package/src/init/flags.ts +66 -0
- package/src/init/plan.ts +128 -0
- package/src/init/run.ts +46 -0
- package/src/init/steps.ts +91 -0
- package/src/sandbox/coverage.ts +115 -0
- package/src/sandbox/expect.ts +412 -0
- package/src/slides/layouts.ts +391 -0
- package/src/slides/open.ts +18 -0
- package/src/slides/parse.ts +84 -0
- package/src/slides/render.ts +88 -0
- package/src/slides/styles.ts +44 -0
- package/src/snippets/adapter.ts +34 -0
- package/src/snippets/categories.ts +59 -0
- package/src/snippets/install.ts +125 -0
- package/src/snippets/list.ts +32 -0
- package/src/snippets/presets.ts +50 -0
- package/src/standards/adapter.ts +51 -0
- package/src/standards/index-refresh.ts +44 -0
- package/src/standards/install.ts +52 -0
- package/src/sync/check.ts +269 -0
- package/src/sync/engine.ts +416 -0
- package/src/sync/git.ts +204 -0
- package/src/sync/stamp.ts +202 -0
- package/src/sync/target.ts +79 -0
- package/src/sync/workflow.ts +201 -0
- package/src/target.ts +43 -0
- package/src/tasks/archive.ts +304 -0
- package/src/tooling/gitignore.ts +122 -0
- package/src/tooling/inject.ts +214 -0
- package/src/tooling/list.ts +39 -0
- package/src/tooling/manifest.ts +178 -0
- package/src/tooling/package.ts +166 -0
- package/src/tooling/scan.ts +186 -0
- package/src/transcripts/fetch.ts +156 -0
- package/src/transcripts/metadata.ts +54 -0
- package/src/transcripts/vtt.ts +114 -0
- package/src/ui.ts +187 -0
- package/src/wiki/init.ts +85 -0
- package/standards/architecture.md +41 -0
- package/standards/bundled/branch.md +49 -0
- package/standards/bundled/commit.md +63 -0
- package/standards/bundled/issue.md +84 -0
- package/standards/bundled/pr.md +124 -0
- package/standards/bundled/roadmap.md +52 -0
- package/standards/bundled/snippets.md +57 -0
- package/standards/bundled/standard.md +52 -0
- package/standards/context.md +132 -0
- package/standards/design.md +31 -0
- package/standards/diagrams.md +55 -0
- package/standards/index.md +21 -0
- package/standards/prose.md +122 -0
- package/standards/readme.md +163 -0
- package/standards/requirements.md +61 -0
- package/standards/rule.md +79 -0
- package/standards/skill.md +257 -0
- package/standards/tasks.md +140 -0
- package/standards/versioning.md +47 -0
- package/standards/wireframes.md +67 -0
- package/tooling/astro/configs/astro.config.mjs +17 -0
- package/tooling/astro/configs/eslint.config.js +79 -0
- package/tooling/astro/configs/playwright.config.ts +25 -0
- package/tooling/astro/configs/tsconfig.json +12 -0
- package/tooling/astro/configs/vitest.config.ts +22 -0
- package/tooling/astro/manifest.toml +32 -0
- package/tooling/astro/reference.md +60 -0
- package/tooling/base/configs/.editorconfig +5 -0
- package/tooling/base/configs/.github/pull_request_template.md +18 -0
- package/tooling/base/configs/.github/workflows/verify.yml +35 -0
- package/tooling/base/configs/.husky/commit-msg +1 -0
- package/tooling/base/configs/.husky/post-merge +61 -0
- package/tooling/base/configs/.husky/post-rewrite +21 -0
- package/tooling/base/configs/.husky/pre-commit +1 -0
- package/tooling/base/configs/.husky/pre-push +1 -0
- package/tooling/base/configs/.prettierrc +12 -0
- package/tooling/base/configs/.shellcheckrc +1 -0
- package/tooling/base/configs/.vscode/extensions.json +9 -0
- package/tooling/base/configs/.vscode/settings.json +3 -0
- package/tooling/base/configs/commitlint.config.js +11 -0
- package/tooling/base/configs/scripts/clean.sh +45 -0
- package/tooling/base/configs/scripts/update.sh +49 -0
- package/tooling/base/configs/scripts/verify.sh +64 -0
- package/tooling/base/manifest.toml +32 -0
- package/tooling/base/reference.md +114 -0
- package/tooling/base/seeds/.claude/context/ci.md +27 -0
- package/tooling/base/seeds/.claude/context/development.md +32 -0
- package/tooling/base/seeds/.cspell/project-terms.txt +0 -0
- package/tooling/base/seeds/.cspell/tech-stack.txt +19 -0
- package/tooling/base/seeds/.lintstagedrc +8 -0
- package/tooling/base/seeds/.prettierignore +0 -0
- package/tooling/base/seeds/cspell.json +20 -0
- package/tooling/claude/manifest.toml +11 -0
- package/tooling/claude/reference.md +62 -0
- package/tooling/claude/seeds/.claude/ARCHITECTURE.md +13 -0
- package/tooling/claude/seeds/.claude/DESIGN.md +62 -0
- package/tooling/claude/seeds/.claude/REQUIREMENTS.md +18 -0
- package/tooling/claude/seeds/.claude/context/index.md +8 -0
- package/tooling/claude/seeds/.claude/hooks/index-reminder.sh +43 -0
- package/tooling/claude/seeds/.claude/hooks/scratch-guard.sh +45 -0
- package/tooling/claude/seeds/.claude/hooks/standards-audit.sh +61 -0
- package/tooling/claude/seeds/.claude/hooks/tasks-index.sh +60 -0
- package/tooling/claude/seeds/.claude/settings.json +39 -0
- package/tooling/claude/seeds/.claude/tasks/index.md +8 -0
- package/tooling/claude/seeds/.claude/wireframes/index.md +8 -0
- package/tooling/claude/seeds/CLAUDE.md +87 -0
- package/tooling/claude/user/settings.template.json +10 -0
- package/tooling/claude/user/statusline-command.sh +53 -0
- package/tooling/python/configs/.coveragerc +14 -0
- package/tooling/python/configs/.python-version +1 -0
- package/tooling/python/configs/mypy.ini +6 -0
- package/tooling/python/configs/pytest.ini +4 -0
- package/tooling/python/configs/ruff.toml +15 -0
- package/tooling/python/configs/scripts/verify.sh +77 -0
- package/tooling/python/manifest.toml +16 -0
- package/tooling/python/reference.md +66 -0
- package/tooling/python/seeds/.cspell/tech-stack.txt +19 -0
- package/tooling/python/seeds/tests/test_smoke.py +2 -0
- package/tooling/vite-react/configs/playwright.config.ts +25 -0
- package/tooling/vite-react/configs/tsconfig.json +35 -0
- package/tooling/vite-react/configs/vite.config.ts +14 -0
- package/tooling/vite-react/configs/vitest.config.ts +26 -0
- package/tooling/vite-react/manifest.toml +21 -0
- package/tooling/vite-react/reference.md +55 -0
- package/tooling/vite-react/seeds/.cspell/project-terms.txt +1 -0
- package/tooling/vite-react/seeds/.cspell/tech-stack.txt +1 -0
- package/tooling/web/configs/.github/workflows/verify.yml +134 -0
- package/tooling/web/configs/.vscode/extensions.json +13 -0
- package/tooling/web/configs/.vscode/settings.json +10 -0
- package/tooling/web/configs/e2e/home.spec.ts +6 -0
- package/tooling/web/configs/e2e/screenshot.ts +41 -0
- package/tooling/web/configs/eslint.config.js +82 -0
- package/tooling/web/configs/scripts/screenshot.sh +28 -0
- package/tooling/web/configs/scripts/verify.sh +80 -0
- package/tooling/web/configs/src/test/setup.ts +8 -0
- package/tooling/web/manifest.toml +57 -0
- package/tooling/web/reference.md +95 -0
- package/tooling/web/seeds/.cspell/tech-stack.txt +18 -0
- package/tsconfig.json +14 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Zshrc aliases for Claude Code
|
|
3
|
+
description: Shell aliases that shorten common Claude Code invocations
|
|
4
|
+
category: Workflow
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Zshrc aliases for Claude Code
|
|
8
|
+
|
|
9
|
+
Claude Code auto-discovers the toolkit plugin from `claude/.claude-plugin/plugin.json` when run inside the toolkit repository. Outside the toolkit, that discovery does not fire, so a separate set of aliases bakes in `--plugin-dir` explicitly. Two parallel sets cover both cases.
|
|
10
|
+
|
|
11
|
+
## The aliases
|
|
12
|
+
|
|
13
|
+
`bun run bootstrap` installs this block. It owns the canonical copy in `scripts/core/bootstrap.sh`, appends it to `~/.zshrc` wrapped in the two marker comments below, and sets `TOOLKIT` to the cloned path. The markers are how a re-run recognizes its own block and skips.
|
|
14
|
+
|
|
15
|
+
A block installed by hand before the managed one has no markers. Bootstrap detects that case through the `alias clp=` line instead, warns, and leaves the block untouched rather than appending a second copy. To switch over, delete the hand-rolled block and re-run the bootstrap.
|
|
16
|
+
|
|
17
|
+
```zsh
|
|
18
|
+
# >>> aitk aliases >>>
|
|
19
|
+
TOOLKIT="/path/to/toolkit"
|
|
20
|
+
|
|
21
|
+
alias cl='claude'
|
|
22
|
+
alias clr='cl -r'
|
|
23
|
+
alias clc='cl -c'
|
|
24
|
+
alias clw='cl -w'
|
|
25
|
+
alias cls='cl --model sonnet'
|
|
26
|
+
|
|
27
|
+
alias clp='claude --plugin-dir $TOOLKIT/claude'
|
|
28
|
+
alias clpc='clp -c'
|
|
29
|
+
alias clps='clp --model sonnet'
|
|
30
|
+
# <<< aitk aliases <<<
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
The block sits after any `PATH` mutations and the `claude` CLI install. Zsh expands aliases recursively on the first word, so `clr`, `clc`, `clw`, and `cls` inherit their base through `cl`, and `clpc` and `clps` inherit `--plugin-dir` through `clp`. `$TOOLKIT` expands at invocation time, so updating the variable and re-sourcing reroutes all `clp` calls without touching the alias definitions.
|
|
34
|
+
|
|
35
|
+
## What each one does
|
|
36
|
+
|
|
37
|
+
`cl` through `cls` carry no explicit plugin dir. Use them inside the toolkit repository, where Claude Code auto-discovers the plugin from `claude/.claude-plugin/plugin.json`. Loading `--plugin-dir` on top of auto-discovery registers every skill twice and produces duplicate entries in the slash command list.
|
|
38
|
+
|
|
39
|
+
- `cl`: plain session in the current directory
|
|
40
|
+
- `clr`: opens the `/resume` picker scoped to the current directory. Trailing arguments filter by name. `clr auth` limits results to sessions containing "auth".
|
|
41
|
+
- `clc`: jumps straight into the most recent session for the current directory. No picker. Faster than `clr` when the terminal closed and you want back into the same session.
|
|
42
|
+
- `clw`: creates a worktree under `.claude/worktrees/<name>/` on a fresh branch and starts a Claude Code session in it. Pass the worktree name as the trailing arg: `clw feat-auth`.
|
|
43
|
+
- `cls`: pins the session to Sonnet instead of the default Opus. Use for routine work where Opus cost is not justified.
|
|
44
|
+
|
|
45
|
+
`clp`, `clpc`, and `clps` bake in `--plugin-dir`. Use them outside the toolkit repository, where auto-discovery does not fire.
|
|
46
|
+
|
|
47
|
+
- `clp`: session with the toolkit plugin loaded explicitly
|
|
48
|
+
- `clpc`: jumps straight into the most recent session for the current directory with the plugin loaded. The `clp` mirror of `clc`.
|
|
49
|
+
- `clps`: `clp` pinned to Sonnet
|
|
50
|
+
|
|
51
|
+
## When to use which
|
|
52
|
+
|
|
53
|
+
Use `cl` by default when working in the toolkit repository. Auto-discovery loads the plugin and the two-key alias keeps it short.
|
|
54
|
+
|
|
55
|
+
Use `clp` in any other repository where you want the toolkit skills available. Without the flag, those repos do not load the plugin.
|
|
56
|
+
|
|
57
|
+
Use `cls` or `clps` to save Opus usage on routine sessions. Switch mid-session with `/model` to avoid restarting.
|
|
58
|
+
|
|
59
|
+
Use `clw <name>` for features that will take more than one session. A worktree isolates the branch, the transcripts, and the `/resume` history. See [Claude Code and git worktrees](../wiki/claude-worktrees.md) for fan-out rules.
|
|
60
|
+
|
|
61
|
+
Use `clc` to resume the last session without a picker. Use `clr` when you have several sessions and need to pick by name or recency. Outside the toolkit repo, `clpc` is the same shortcut as `clc` with the plugin loaded.
|
|
62
|
+
|
|
63
|
+
## Why not a function
|
|
64
|
+
|
|
65
|
+
A function with subcommand dispatch (`cl r`, `cl c`, `cl w foo`) was considered and rejected. It loses shell completion and adds a layer of indirection. Separate aliases are self-contained and the shared `cl`/`clp` prefixes make them easy to recall.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Route markdown edits to the prose standard for voice, structure, formatting, and punctuation
|
|
3
|
+
paths:
|
|
4
|
+
- '**/*.md'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Markdown prose standards
|
|
8
|
+
|
|
9
|
+
## Authority
|
|
10
|
+
|
|
11
|
+
- Follow `.claude/standards/prose.md` for all prose: voice, structure, formatting, language, and banned punctuation. It is the single source.
|
|
12
|
+
- Read it before a substantial prose edit. Do not work the bans from memory.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Route .claude/context edits to the context-entry standard and the consult-first workflow
|
|
3
|
+
paths:
|
|
4
|
+
- '.claude/context/**'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Context entry standards
|
|
8
|
+
|
|
9
|
+
## Before editing
|
|
10
|
+
|
|
11
|
+
- Before non-trivial work in a domain, read its `.claude/context/<domain>.md` entry. Use `.claude/context/index.md` to find it.
|
|
12
|
+
- Leave the entry conforming when work in its domain changes what it describes.
|
|
13
|
+
|
|
14
|
+
## Authority
|
|
15
|
+
|
|
16
|
+
- Follow `.claude/standards/context.md` for entry shape: frontmatter, sections, length, and what goes in. It is the single source.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Route .claude/wireframes edits to the wireframe standard for layout and interaction intent
|
|
3
|
+
paths:
|
|
4
|
+
- '.claude/wireframes/**'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Wireframe standards
|
|
8
|
+
|
|
9
|
+
## Authority
|
|
10
|
+
|
|
11
|
+
- Follow `.claude/standards/wireframes.md` for layout and interaction intent: ASCII layout, region labels, variants, copy, and what moves to `.claude/context/`. It is the single source.
|
|
12
|
+
- A wireframe carries layout and intent, not implementation. Read the standard before adding or revising a surface.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Route .claude/REQUIREMENTS.md edits to the requirements standard for product scope and goals
|
|
3
|
+
paths:
|
|
4
|
+
- '.claude/REQUIREMENTS.md'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Requirements standards
|
|
8
|
+
|
|
9
|
+
## Authority
|
|
10
|
+
|
|
11
|
+
- Follow `.claude/standards/requirements.md` for what belongs in the problem, goals, non-goals, MVP features, tech stack, and constraints. It is the single source.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Route .claude/ARCHITECTURE.md edits to the architecture standard for system decisions and risks
|
|
3
|
+
paths:
|
|
4
|
+
- '.claude/ARCHITECTURE.md'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Architecture standards
|
|
8
|
+
|
|
9
|
+
## Authority
|
|
10
|
+
|
|
11
|
+
- Follow `.claude/standards/architecture.md` for the overview, named decision entries, and risks. It is the single source.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Route .claude/DESIGN.md edits to the design standard for visual intent and token tables
|
|
3
|
+
paths:
|
|
4
|
+
- '.claude/DESIGN.md'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Design standards
|
|
8
|
+
|
|
9
|
+
## Authority
|
|
10
|
+
|
|
11
|
+
- Follow `.claude/standards/design.md` for visual intent, the token tables, and the render contract. It is the single source.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Route .claude/tasks/ edits to the tasks standard for filenames, frontmatter, and task file format
|
|
3
|
+
paths:
|
|
4
|
+
- '.claude/tasks/**'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Tasks standards
|
|
8
|
+
|
|
9
|
+
## Authority
|
|
10
|
+
|
|
11
|
+
- Follow `.claude/standards/tasks.md` for filenames, frontmatter, what belongs, and the task file format. It is the single source.
|
|
12
|
+
- Never hand-edit `.claude/tasks/index.md`. A hook regenerates it from sibling frontmatter.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Route .claude/DIAGRAMS.md edits to the diagrams standard for Mermaid conventions
|
|
3
|
+
paths:
|
|
4
|
+
- '.claude/DIAGRAMS.md'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Diagrams standards
|
|
8
|
+
|
|
9
|
+
## Authority
|
|
10
|
+
|
|
11
|
+
- Follow `.claude/standards/diagrams.md` for Mermaid diagram layout, labeling, and narrative. It is the single source.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Route skill edits to the authoring standard and the requirement consult-first workflow
|
|
3
|
+
paths:
|
|
4
|
+
- '.claude/skills/**/SKILL.md'
|
|
5
|
+
- 'claude/skills/**/SKILL.md'
|
|
6
|
+
- '.claude/skills/**/REQUIREMENT.md'
|
|
7
|
+
- 'claude/skills/**/REQUIREMENT.md'
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Skill standards
|
|
11
|
+
|
|
12
|
+
## Before editing
|
|
13
|
+
|
|
14
|
+
- Read the skill's sibling `REQUIREMENT.md` when one exists. If the change closes no gap it states, change the requirement first or drop the change.
|
|
15
|
+
|
|
16
|
+
## Authority
|
|
17
|
+
|
|
18
|
+
- Follow `.claude/standards/skill.md` for skill structure, frontmatter fields, and invocation rules. It is the single source.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Route README edits to the readme standard for structure, sections, and content conventions
|
|
3
|
+
paths:
|
|
4
|
+
- '**/README.md'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# README standards
|
|
8
|
+
|
|
9
|
+
## Authority
|
|
10
|
+
|
|
11
|
+
- Follow `.claude/standards/readme.md` for structure, required and optional sections, heading hierarchy, and what to link out rather than inline. It is the single source.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce frontmatter, body shape, and voice for governance rule files
|
|
3
|
+
paths:
|
|
4
|
+
- '.claude/rules/**/*.md'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Rule authoring standards
|
|
8
|
+
|
|
9
|
+
## Authority
|
|
10
|
+
|
|
11
|
+
- Follow `.claude/standards/rule.md` for rule frontmatter, body shape, and voice. It is the single source.
|
|
12
|
+
- Read it before writing or editing a rule. Do not work the shape from memory.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Define senior architect persona and core philosophy
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Role persona
|
|
6
|
+
|
|
7
|
+
You are a Senior Principal Architect.
|
|
8
|
+
Your primary directive is to maintain long-term system health over short-term convenience.
|
|
9
|
+
|
|
10
|
+
## Readability and simplicity
|
|
11
|
+
|
|
12
|
+
- Optimize for readability. Code is read far more than it is written.
|
|
13
|
+
- Code must be self-documenting through clear naming and explicit structure.
|
|
14
|
+
- Comments are permitted ONLY to explain intent, never logic.
|
|
15
|
+
- Prefer the simplest implementation that satisfies the requirement (KISS).
|
|
16
|
+
|
|
17
|
+
## Design philosophy
|
|
18
|
+
|
|
19
|
+
- Implement only the functionality required for the immediate task (YAGNI).
|
|
20
|
+
- Extract shared logic into single-purpose utilities. Never duplicate behavior across modules (DRY).
|
|
21
|
+
- Each function, module, and component should have a single reason to change (SRP).
|
|
22
|
+
- Apply SRP to directories: once a folder mixes distinct roles and grows past a handful of files, split it into subfolders by role.
|
|
23
|
+
- Favor composition over inheritance.
|
|
24
|
+
- Prioritize native platform capabilities over third-party libraries.
|
|
25
|
+
|
|
26
|
+
## Data integrity
|
|
27
|
+
|
|
28
|
+
- Favor explicit behavior over implicit magic or conventions.
|
|
29
|
+
- Ensure data and configuration reside in designated Single Source of Truth locations.
|
|
30
|
+
- Treat data as immutable unless mutation is explicitly required.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce universal testing standards and best practices
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Testing standards
|
|
6
|
+
|
|
7
|
+
## Test structure
|
|
8
|
+
|
|
9
|
+
- Structure tests using the Arrange, Act, Assert (AAA) pattern.
|
|
10
|
+
- Each test should verify a single behavior.
|
|
11
|
+
- Do not use conditional logic or loops within test bodies.
|
|
12
|
+
|
|
13
|
+
## Test focus
|
|
14
|
+
|
|
15
|
+
- Test user-visible behavior rather than implementation details.
|
|
16
|
+
- Do not test private functions or internal state directly.
|
|
17
|
+
- Cover critical paths and edge cases.
|
|
18
|
+
- Do not target arbitrary coverage percentages.
|
|
19
|
+
|
|
20
|
+
## Organization and isolation
|
|
21
|
+
|
|
22
|
+
- Group related tests using the framework's nesting mechanism.
|
|
23
|
+
- Keep nesting shallow (max 2 levels).
|
|
24
|
+
- Ensure tests are independent with no shared side effects.
|
|
25
|
+
- Clean up side effects and restore state after each test.
|
|
26
|
+
|
|
27
|
+
## Test data and async
|
|
28
|
+
|
|
29
|
+
- Use factory functions or builders for test data over inline object literals.
|
|
30
|
+
- Always await async operations.
|
|
31
|
+
- Do not fire-and-forget promises in tests.
|
|
32
|
+
|
|
33
|
+
## Verification
|
|
34
|
+
|
|
35
|
+
- Do not use snapshot testing for verification.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce safe concurrency and async operation patterns
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Concurrency standards
|
|
6
|
+
|
|
7
|
+
## Async lifecycle
|
|
8
|
+
|
|
9
|
+
- Make async operations cancellable. Clean up on scope exit or caller cancellation.
|
|
10
|
+
- Coordinate dependent async operations explicitly. Document execution order.
|
|
11
|
+
- Set explicit timeouts on all external async operations.
|
|
12
|
+
- Do not fire-and-forget async operations without cleanup handlers.
|
|
13
|
+
- Batch independent async operations. Do not run them sequentially when parallelizable.
|
|
14
|
+
|
|
15
|
+
## Race conditions
|
|
16
|
+
|
|
17
|
+
- Do not ignore race conditions in concurrent flows.
|
|
18
|
+
- Protect shared mutable state with locks, queues, or single-writer patterns.
|
|
19
|
+
|
|
20
|
+
## Failure handling
|
|
21
|
+
|
|
22
|
+
- Handle partial failures in batched operations independently. Do not fail the entire batch for a single error.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce consistent error handling patterns
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Error handling standards
|
|
6
|
+
|
|
7
|
+
## Boundary validation
|
|
8
|
+
|
|
9
|
+
- Validate inputs at system boundaries. Reject invalid data immediately.
|
|
10
|
+
- Do not use exceptions for control flow.
|
|
11
|
+
|
|
12
|
+
## Error classification
|
|
13
|
+
|
|
14
|
+
- Distinguish expected failures (validation, not found) from unexpected failures (null reference, network timeout).
|
|
15
|
+
- Return structured error types for recoverable failures.
|
|
16
|
+
- Propagate exceptions for programmer errors.
|
|
17
|
+
|
|
18
|
+
## Error propagation
|
|
19
|
+
|
|
20
|
+
- Handle errors at the layer with enough context to respond meaningfully.
|
|
21
|
+
- Do not catch and rethrow without adding value.
|
|
22
|
+
- Do not silently ignore errors.
|
|
23
|
+
|
|
24
|
+
## Error reporting
|
|
25
|
+
|
|
26
|
+
- Include actionable context in error messages.
|
|
27
|
+
- Never expose internal implementation details in error messages.
|
|
28
|
+
|
|
29
|
+
## Retry behavior
|
|
30
|
+
|
|
31
|
+
- Retry only idempotent operations with bounded attempts and backoff.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce performance constraints and optimization patterns
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Performance standards
|
|
6
|
+
|
|
7
|
+
## Resource loading
|
|
8
|
+
|
|
9
|
+
- Lazy load resources at architectural boundaries, not inline.
|
|
10
|
+
- Do not import entire modules when subsets are sufficient.
|
|
11
|
+
|
|
12
|
+
## Execution efficiency
|
|
13
|
+
|
|
14
|
+
- Defer non-critical work until after primary output completes.
|
|
15
|
+
- Do not fetch data inside loops.
|
|
16
|
+
|
|
17
|
+
## Data handling
|
|
18
|
+
|
|
19
|
+
- Paginate or stream unbounded data sets.
|
|
20
|
+
- Do not optimize without measurement.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce structured logging and observability
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Logging standards
|
|
6
|
+
|
|
7
|
+
## Log coverage
|
|
8
|
+
|
|
9
|
+
- Log state transitions at boundaries (requests received, external calls made, errors encountered).
|
|
10
|
+
- Do not log in performance-critical code paths.
|
|
11
|
+
|
|
12
|
+
## Log format
|
|
13
|
+
|
|
14
|
+
- Use structured formats with consistent metadata (timestamp, severity, correlation ID).
|
|
15
|
+
- Emit logs at appropriate severity: critical for failures, informational for significant events.
|
|
16
|
+
|
|
17
|
+
## Log safety
|
|
18
|
+
|
|
19
|
+
- Do not log credentials, tokens, or personally identifiable information.
|
|
20
|
+
- Log observable behavior, not implementation details.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce consistent naming semantics across all code
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Naming standards
|
|
6
|
+
|
|
7
|
+
## Semantics
|
|
8
|
+
|
|
9
|
+
- Prefer descriptive names over abbreviations: `getUserProfile` over `getUP`.
|
|
10
|
+
- Name functions as actions describing what they do: `fetchUser`, `calculateTotal`.
|
|
11
|
+
- Prefix booleans with `is`, `has`, `should`, or `can`: `isLoading`, `hasAccess`.
|
|
12
|
+
- Avoid negative boolean names: `isEnabled` over `isNotDisabled`.
|
|
13
|
+
- Prefix event handlers with `handle`: `handleClick`, `handleSubmit`.
|
|
14
|
+
- Name collections as plurals: `users`.
|
|
15
|
+
- Name items as singulars: `user`.
|
|
16
|
+
|
|
17
|
+
## Test naming
|
|
18
|
+
|
|
19
|
+
- Name tests with descriptive phrases that state the expected behavior.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce planning standards before implementation
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Planning standards
|
|
6
|
+
|
|
7
|
+
## Planning
|
|
8
|
+
|
|
9
|
+
- Analyze requests and output a numbered implementation plan before execution.
|
|
10
|
+
- Challenge ambiguous or over-engineered requests before implementation.
|
|
11
|
+
- Propose the simplest solution that satisfies the requirement before implementing complex patterns.
|
|
12
|
+
- Write or update tests as part of every implementation plan.
|
|
13
|
+
- Do not modify code without a confirmed plan.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Keep comments terse in dotfiles, config, and workflow files
|
|
3
|
+
paths:
|
|
4
|
+
- '**/.env*'
|
|
5
|
+
- '**/.gitignore'
|
|
6
|
+
- '**/.dockerignore'
|
|
7
|
+
- '**/.editorconfig'
|
|
8
|
+
- '**/Dockerfile*'
|
|
9
|
+
- '**/*.config.*'
|
|
10
|
+
- '**/*.json'
|
|
11
|
+
- '**/*.yml'
|
|
12
|
+
- '**/*.yaml'
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
# Config comment standards
|
|
16
|
+
|
|
17
|
+
## Comments
|
|
18
|
+
|
|
19
|
+
- Keep each comment to one short line. Do not wrap a single key in a multi-line explanation.
|
|
20
|
+
- Prefer a one-word category label over a sentence for a group header.
|
|
21
|
+
- Match the comment density of the surrounding file. Do not add a verbose comment next to terse ones.
|
|
22
|
+
- Comment what a key does or its allowed values. Do not restate the key name.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce opinionated React architecture and component patterns
|
|
3
|
+
paths:
|
|
4
|
+
- '**/*.tsx'
|
|
5
|
+
- '**/*.ts'
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# React architecture standards
|
|
9
|
+
|
|
10
|
+
## Export conventions
|
|
11
|
+
|
|
12
|
+
- Use named exports exclusively for components and hooks.
|
|
13
|
+
- Do not use default exports.
|
|
14
|
+
|
|
15
|
+
## Project structure
|
|
16
|
+
|
|
17
|
+
- Place domain logic in `src/features/` and restrict `src/components/` to shared UI.
|
|
18
|
+
- Do not place feature-specific components in the global components folder.
|
|
19
|
+
- Import environment variables only from the validated configuration module.
|
|
20
|
+
|
|
21
|
+
## Component patterns
|
|
22
|
+
|
|
23
|
+
- Use function declarations for components over arrow functions.
|
|
24
|
+
- Define TypeScript interfaces for props immediately above the component.
|
|
25
|
+
- Use `<>` shorthand for fragments unless key prop is required.
|
|
26
|
+
- Use stable, unique keys for list items over array index.
|
|
27
|
+
- Extract components when JSX exceeds a single responsibility.
|
|
28
|
+
|
|
29
|
+
## State and effects
|
|
30
|
+
|
|
31
|
+
- Encapsulate data fetching and complex effects in custom hooks.
|
|
32
|
+
- Use `useMemo` for derived state over `useEffect`.
|
|
33
|
+
- Do not call `setState` inside `useEffect` to sync derived state. The `react-hooks/set-state-in-effect` lint enforces this.
|
|
34
|
+
- Compare the previous value during render and call `setState` from the render body when it changes, over syncing in an effect.
|
|
35
|
+
- Lift the state to a parent and reset the child with a `key` prop, over running a reset effect in the child.
|
|
36
|
+
- Return a sentinel (`undefined` or a `useSyncExternalStore` placeholder) from hooks that hydrate asynchronously and gate consumers on it, over running a hydration effect.
|
|
37
|
+
|
|
38
|
+
## Memoization
|
|
39
|
+
|
|
40
|
+
- Memoize components receiving non-primitive props with `React.memo`.
|
|
41
|
+
- Use `useCallback` for handler props passed to children.
|
|
42
|
+
|
|
43
|
+
## Composition and props
|
|
44
|
+
|
|
45
|
+
- Avoid prop drilling beyond 2 levels. Use context or composition.
|
|
46
|
+
|
|
47
|
+
## Error boundaries and Suspense
|
|
48
|
+
|
|
49
|
+
- Place error boundaries at route level.
|
|
50
|
+
- Place Suspense at data-fetching boundaries.
|
|
51
|
+
- Do not use a single root-level error boundary as the only safety net.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce astro static-first architecture with explicit island opt-in
|
|
3
|
+
paths:
|
|
4
|
+
- '**/*.astro'
|
|
5
|
+
- 'src/pages/**'
|
|
6
|
+
- 'src/layouts/**'
|
|
7
|
+
- 'src/content/**'
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Astro standards
|
|
11
|
+
|
|
12
|
+
## Static first
|
|
13
|
+
|
|
14
|
+
- Write pages and components as `.astro` unless interactivity requires a framework island.
|
|
15
|
+
- Do not add a framework integration until the first island needs it.
|
|
16
|
+
- Prefer server-rendered content over client-fetched data.
|
|
17
|
+
|
|
18
|
+
## Islands
|
|
19
|
+
|
|
20
|
+
- Apply `client:*` directives on the component boundary, not on parents.
|
|
21
|
+
- Prefer `client:visible` or `client:idle` over `client:load`. Use `client:load` only for above-the-fold interactivity.
|
|
22
|
+
- Keep islands leaf-level. Do not wrap layout chrome in a framework component to enable nested islands.
|
|
23
|
+
|
|
24
|
+
## Routing and layouts
|
|
25
|
+
|
|
26
|
+
- Place routes in `src/pages/`. Use `[param].astro` for dynamic segments and `[...rest].astro` for catch-alls.
|
|
27
|
+
- Extract shared chrome into `src/layouts/` and compose pages with a `<Layout>` wrapper.
|
|
28
|
+
|
|
29
|
+
## Content
|
|
30
|
+
|
|
31
|
+
- Use content collections in `src/content/` with a `config.ts` schema for any repeated structured content.
|
|
32
|
+
- Access collection entries via `getCollection` and `getEntry` over direct file imports.
|
|
33
|
+
|
|
34
|
+
## Styles and assets
|
|
35
|
+
|
|
36
|
+
- Component styles are scoped by default. Use `is:global` only in layouts for reset or base styles.
|
|
37
|
+
- Import images from `src/assets/` to get optimization. Use `public/` only for untouched static files.
|
|
38
|
+
|
|
39
|
+
## Environment
|
|
40
|
+
|
|
41
|
+
- Read environment variables via `import.meta.env`. Prefix client-exposed variables with `PUBLIC_`.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce FastAPI router, dependency injection, and async handler patterns
|
|
3
|
+
paths:
|
|
4
|
+
- '**/*.py'
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# FastAPI standards
|
|
8
|
+
|
|
9
|
+
## Project structure
|
|
10
|
+
|
|
11
|
+
- Mount routes through `APIRouter` modules. Do not register handlers directly on `FastAPI()`.
|
|
12
|
+
- Group routers by feature under `src/<pkg>/api/` and include them from the root app factory.
|
|
13
|
+
- Use an `app_factory()` callable over a module-level `app = FastAPI()` for testability.
|
|
14
|
+
|
|
15
|
+
## Handlers
|
|
16
|
+
|
|
17
|
+
- Define path operations as `async def` unless the handler is purely CPU-bound.
|
|
18
|
+
- Do not perform blocking I/O inside `async def`. Use async clients or `run_in_threadpool`.
|
|
19
|
+
- Annotate path, query, and body parameters explicitly. Do not rely on `**kwargs`.
|
|
20
|
+
- Return pydantic models and set `response_model=` on the decorator for serialization control.
|
|
21
|
+
|
|
22
|
+
## Dependency injection
|
|
23
|
+
|
|
24
|
+
- Express shared logic (auth, db sessions, settings) as `Depends(...)` over decorators or globals.
|
|
25
|
+
- Use `Annotated[T, Depends(...)]` over default-value `Depends()` for reusable dependencies.
|
|
26
|
+
- Scope db sessions per request via a generator dependency that yields then closes.
|
|
27
|
+
|
|
28
|
+
## Lifespan and configuration
|
|
29
|
+
|
|
30
|
+
- Use the `lifespan` context manager for startup and shutdown over deprecated `@app.on_event`.
|
|
31
|
+
- Load settings via `pydantic_settings.BaseSettings`, injected through a cached dependency.
|
|
32
|
+
|
|
33
|
+
## Errors
|
|
34
|
+
|
|
35
|
+
- Raise `HTTPException` for client-facing errors with explicit status codes.
|
|
36
|
+
- Register `@app.exception_handler` mappings for domain exceptions over per-route try/except.
|
|
37
|
+
- Do not leak internal exception messages. Map to safe summaries at the boundary.
|
|
38
|
+
|
|
39
|
+
## Validation and security
|
|
40
|
+
|
|
41
|
+
- Validate request bodies through pydantic models. Do not parse `Request.json()` manually.
|
|
42
|
+
- Apply `dependencies=[Depends(auth)]` at the router or app level for cross-cutting auth.
|
|
43
|
+
- Configure CORS, trusted hosts, and HTTPS redirects through middleware, not per-route checks.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce Next.js App Router structure, server/client boundaries, and built-in primitives
|
|
3
|
+
paths:
|
|
4
|
+
- '**/*.tsx'
|
|
5
|
+
- '**/*.ts'
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Next.js standards
|
|
9
|
+
|
|
10
|
+
## App Router structure
|
|
11
|
+
|
|
12
|
+
- Use the App Router under `app/`. Do not introduce `pages/` in new code.
|
|
13
|
+
- Use route segment files for their documented purpose: `page.tsx` for routes, `layout.tsx` for shared shells, `loading.tsx` for Suspense fallbacks, `error.tsx` for error boundaries, `route.ts` for HTTP handlers.
|
|
14
|
+
|
|
15
|
+
## Server and client components
|
|
16
|
+
|
|
17
|
+
- Default to Server Components. Add `"use client"` only when the file needs state, effects, browser APIs, or event handlers.
|
|
18
|
+
- Place `"use client"` at the leaf, not at the layout. Push the boundary as deep as possible.
|
|
19
|
+
- Do not import server-only modules (`fs`, db clients, secrets) from a client component. Mark server-only modules with `import "server-only"`.
|
|
20
|
+
- Pass serializable props across the server/client boundary. Do not pass functions or class instances.
|
|
21
|
+
|
|
22
|
+
## Data fetching
|
|
23
|
+
|
|
24
|
+
- Fetch data in Server Components or Route Handlers. Do not fetch in client components when a server alternative exists.
|
|
25
|
+
- Set explicit caching on `fetch`: `cache: "force-cache"`, `cache: "no-store"`, or `next: { revalidate: <seconds> }`. Do not rely on defaults.
|
|
26
|
+
- Use `revalidatePath` or `revalidateTag` for invalidation over manual refetch loops.
|
|
27
|
+
|
|
28
|
+
## Server Actions
|
|
29
|
+
|
|
30
|
+
- Mark Server Actions with `"use server"` at the top of the file or function.
|
|
31
|
+
- Validate Server Action inputs with a Zod schema before use. The client/server boundary is implicit and easy to miss.
|
|
32
|
+
- Return serializable values. Do not return Response or stream objects from a Server Action.
|
|
33
|
+
|
|
34
|
+
## Route handlers
|
|
35
|
+
|
|
36
|
+
- Place HTTP endpoints in `app/**/route.ts`. Do not add `pages/api/`.
|
|
37
|
+
- Export named methods (`GET`, `POST`, ...). Return `NextResponse` over raw `Response` for typed helpers.
|
|
38
|
+
- Read params from the function signature (`{ params }`), not from the request URL.
|
|
39
|
+
|
|
40
|
+
## Built-in primitives
|
|
41
|
+
|
|
42
|
+
- Use `next/link` over `<a>` for internal navigation. Use `next/image` over `<img>` for raster images. Use `next/font` over manual `<link>` tags for fonts.
|
|
43
|
+
- Set explicit `width` and `height` (or `fill`) on `next/image`. Do not omit dimensions.
|
|
44
|
+
|
|
45
|
+
## Metadata and environment
|
|
46
|
+
|
|
47
|
+
- Export `metadata` or `generateMetadata` from `layout.tsx` or `page.tsx` over manual `<head>` injection.
|
|
48
|
+
- Prefix browser-exposed env vars with `NEXT_PUBLIC_`. Never read unprefixed server-only env vars from a client component.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Enforce Tailwind CSS v4 utility patterns, theme tokens, dark mode, and custom styles
|
|
3
|
+
paths:
|
|
4
|
+
- '**/*.tsx'
|
|
5
|
+
- '**/*.jsx'
|
|
6
|
+
- '**/*.html'
|
|
7
|
+
- '**/*.css'
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Tailwind CSS v4 standards
|
|
11
|
+
|
|
12
|
+
## Theme variables
|
|
13
|
+
|
|
14
|
+
- Use `@theme` for design tokens that generate utility classes.
|
|
15
|
+
- Use `:root` for plain CSS variables with no utility counterpart.
|
|
16
|
+
- Define dark mode color overrides in `.dark { }` at root level over `@layer base`.
|
|
17
|
+
- Always pair light and dark utilities explicitly: `bg-white dark:bg-gray-900`.
|
|
18
|
+
|
|
19
|
+
## Layout and spacing
|
|
20
|
+
|
|
21
|
+
- Use `flex` and `grid` for all layouts.
|
|
22
|
+
- Never use floats or absolute positioning for flow.
|
|
23
|
+
- Use `gap-*` for sibling spacing over margins.
|
|
24
|
+
- Use `size-*` over `w-* h-*` for equal dimensions.
|
|
25
|
+
- Mobile-first: default styles apply to mobile. Use `sm:` and up to override.
|
|
26
|
+
|
|
27
|
+
## Class application
|
|
28
|
+
|
|
29
|
+
- Use `cn()` from `@/lib/utils` for all conditional class application.
|
|
30
|
+
- Do not use the `!` important modifier.
|
|
31
|
+
- Do not use inline `style` props for static styling. Use arbitrary values (`bg-[#316ff6]`) instead.
|
|
32
|
+
- Use inline styles only for dynamic values from JS/API or to set CSS variables for utility consumption.
|