@geraldmaron/construct 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +69 -0
- package/LICENSE +21 -0
- package/README.md +344 -0
- package/agents/prompts/cx-accessibility.md +29 -0
- package/agents/prompts/cx-ai-engineer.md +31 -0
- package/agents/prompts/cx-architect.md +40 -0
- package/agents/prompts/cx-business-strategist.md +25 -0
- package/agents/prompts/cx-data-analyst.md +30 -0
- package/agents/prompts/cx-data-engineer.md +32 -0
- package/agents/prompts/cx-debugger.md +27 -0
- package/agents/prompts/cx-designer.md +33 -0
- package/agents/prompts/cx-devil-advocate.md +36 -0
- package/agents/prompts/cx-docs-keeper.md +50 -0
- package/agents/prompts/cx-engineer.md +36 -0
- package/agents/prompts/cx-evaluator.md +26 -0
- package/agents/prompts/cx-explorer.md +38 -0
- package/agents/prompts/cx-legal-compliance.md +25 -0
- package/agents/prompts/cx-operations.md +28 -0
- package/agents/prompts/cx-orchestrator.md +30 -0
- package/agents/prompts/cx-platform-engineer.md +25 -0
- package/agents/prompts/cx-product-manager.md +30 -0
- package/agents/prompts/cx-qa.md +42 -0
- package/agents/prompts/cx-rd-lead.md +25 -0
- package/agents/prompts/cx-release-manager.md +31 -0
- package/agents/prompts/cx-researcher.md +31 -0
- package/agents/prompts/cx-reviewer.md +36 -0
- package/agents/prompts/cx-security.md +37 -0
- package/agents/prompts/cx-sre.md +26 -0
- package/agents/prompts/cx-test-automation.md +35 -0
- package/agents/prompts/cx-trace-reviewer.md +76 -0
- package/agents/prompts/cx-ux-researcher.md +30 -0
- package/agents/registry.json +879 -0
- package/agents/teams.json +94 -0
- package/bin/construct +613 -0
- package/commands/build/feature.md +21 -0
- package/commands/build/fix.md +20 -0
- package/commands/design/access.md +19 -0
- package/commands/design/flow.md +16 -0
- package/commands/design/ui.md +18 -0
- package/commands/measure/experiment.md +18 -0
- package/commands/measure/metrics.md +18 -0
- package/commands/measure/results.md +18 -0
- package/commands/plan/api.md +19 -0
- package/commands/plan/challenge.md +18 -0
- package/commands/plan/decide.md +20 -0
- package/commands/plan/feature.md +49 -0
- package/commands/plan/requirements.md +24 -0
- package/commands/remember/context.md +26 -0
- package/commands/remember/handoff.md +19 -0
- package/commands/remember/runbook.md +20 -0
- package/commands/review/code.md +21 -0
- package/commands/review/quality.md +19 -0
- package/commands/review/security.md +16 -0
- package/commands/ship/ready.md +19 -0
- package/commands/ship/release.md +19 -0
- package/commands/ship/status.md +18 -0
- package/commands/understand/docs.md +22 -0
- package/commands/understand/research.md +22 -0
- package/commands/understand/this.md +23 -0
- package/commands/understand/why.md +18 -0
- package/commands/work/clean.md +32 -0
- package/commands/work/drive.md +69 -0
- package/commands/work/optimize-prompts.md +46 -0
- package/commands/work/parallel-review.md +40 -0
- package/db/migrations/001_init.sql +38 -0
- package/langfuse/docker-compose.yml +82 -0
- package/lib/audit-skills.mjs +118 -0
- package/lib/auto-docs.mjs +293 -0
- package/lib/cli-commands.mjs +409 -0
- package/lib/codex-config.mjs +114 -0
- package/lib/comment-lint.mjs +191 -0
- package/lib/completions.mjs +170 -0
- package/lib/context-state.mjs +99 -0
- package/lib/cost.mjs +213 -0
- package/lib/distill.mjs +403 -0
- package/lib/efficiency.mjs +139 -0
- package/lib/env-config.mjs +53 -0
- package/lib/eval-harness.mjs +59 -0
- package/lib/features.mjs +209 -0
- package/lib/headhunt.mjs +597 -0
- package/lib/hooks/adaptive-lint.mjs +112 -0
- package/lib/hooks/agent-tracker.mjs +50 -0
- package/lib/hooks/bootstrap-guard.mjs +90 -0
- package/lib/hooks/comment-lint.mjs +26 -0
- package/lib/hooks/config-protection.mjs +52 -0
- package/lib/hooks/console-warn.mjs +43 -0
- package/lib/hooks/context-window-recovery.mjs +90 -0
- package/lib/hooks/continuation-enforcer.mjs +72 -0
- package/lib/hooks/dep-audit.mjs +155 -0
- package/lib/hooks/drive-guard.mjs +89 -0
- package/lib/hooks/edit-accumulator.mjs +36 -0
- package/lib/hooks/edit-error-recovery.mjs +46 -0
- package/lib/hooks/edit-guard.mjs +109 -0
- package/lib/hooks/env-check.mjs +80 -0
- package/lib/hooks/guard-bash.mjs +83 -0
- package/lib/hooks/mcp-audit.mjs +57 -0
- package/lib/hooks/mcp-health-check.mjs +51 -0
- package/lib/hooks/mcp-task-scope.mjs +47 -0
- package/lib/hooks/model-fallback.mjs +105 -0
- package/lib/hooks/pre-compact.mjs +212 -0
- package/lib/hooks/pre-push-gate.mjs +129 -0
- package/lib/hooks/read-tracker.mjs +129 -0
- package/lib/hooks/registry-sync.mjs +23 -0
- package/lib/hooks/scan-secrets.mjs +76 -0
- package/lib/hooks/session-start.mjs +95 -0
- package/lib/hooks/stop-notify.mjs +191 -0
- package/lib/hooks/stop-typecheck.mjs +83 -0
- package/lib/hooks/task-completed-guard.mjs +43 -0
- package/lib/hooks/teammate-idle-guard.mjs +54 -0
- package/lib/hooks/workflow-guard.mjs +62 -0
- package/lib/host-capabilities.mjs +123 -0
- package/lib/init-docs.mjs +382 -0
- package/lib/mcp/server.mjs +1123 -0
- package/lib/mcp-catalog.json +243 -0
- package/lib/mcp-manager.mjs +433 -0
- package/lib/mcp-platform-config.mjs +104 -0
- package/lib/model-router.mjs +810 -0
- package/lib/opencode-config.mjs +44 -0
- package/lib/opencode-runtime-plugin.mjs +909 -0
- package/lib/opencode-telemetry.mjs +433 -0
- package/lib/orchestration-policy.mjs +258 -0
- package/lib/prompt-composer.mjs +196 -0
- package/lib/prompt-metadata.mjs +68 -0
- package/lib/review.mjs +429 -0
- package/lib/role-preload.mjs +52 -0
- package/lib/schemas/decision.json +50 -0
- package/lib/schemas/implementation.json +51 -0
- package/lib/schemas/review-report.json +32 -0
- package/lib/schemas/test-report.json +43 -0
- package/lib/server/index.mjs +334 -0
- package/lib/server/static/app.js +841 -0
- package/lib/server/static/index.html +820 -0
- package/lib/service-manager.mjs +225 -0
- package/lib/setup.mjs +319 -0
- package/lib/status.mjs +707 -0
- package/lib/storage/backend.mjs +44 -0
- package/lib/storage/embeddings.mjs +70 -0
- package/lib/storage/hybrid-query.mjs +184 -0
- package/lib/storage/sql-store.mjs +55 -0
- package/lib/storage/state-source.mjs +101 -0
- package/lib/storage/sync.mjs +164 -0
- package/lib/storage/vector-store.mjs +59 -0
- package/lib/telemetry/backends/langfuse.mjs +58 -0
- package/lib/telemetry/backends/noop.mjs +16 -0
- package/lib/telemetry/langfuse-ingest.mjs +108 -0
- package/lib/telemetry/langfuse-model-sync.mjs +270 -0
- package/lib/telemetry/team-rollup.mjs +143 -0
- package/lib/toolkit-env.mjs +30 -0
- package/lib/validator.mjs +181 -0
- package/lib/workflow-state.mjs +794 -0
- package/package.json +53 -0
- package/personas/construct.md +94 -0
- package/platforms/claude/CLAUDE.md +30 -0
- package/platforms/claude/settings.template.json +472 -0
- package/platforms/opencode/config.template.json +65 -0
- package/platforms/opencode/plugins/construct-fallback.js +5 -0
- package/platforms/opencode/sync-config.mjs +69 -0
- package/rules/common/agents.md +55 -0
- package/rules/common/code-review.md +129 -0
- package/rules/common/coding-style.md +95 -0
- package/rules/common/comments.md +139 -0
- package/rules/common/cx-agent-routing.md +61 -0
- package/rules/common/cx-skill-routing.md +11 -0
- package/rules/common/development-workflow.md +49 -0
- package/rules/common/git-workflow.md +29 -0
- package/rules/common/hooks.md +35 -0
- package/rules/common/patterns.md +36 -0
- package/rules/common/performance.md +71 -0
- package/rules/common/security.md +34 -0
- package/rules/common/testing.md +62 -0
- package/rules/golang/coding-style.md +37 -0
- package/rules/golang/hooks.md +22 -0
- package/rules/golang/patterns.md +50 -0
- package/rules/golang/security.md +39 -0
- package/rules/golang/testing.md +36 -0
- package/rules/python/coding-style.md +47 -0
- package/rules/python/hooks.md +24 -0
- package/rules/python/patterns.md +44 -0
- package/rules/python/security.md +35 -0
- package/rules/python/testing.md +43 -0
- package/rules/swift/coding-style.md +52 -0
- package/rules/swift/hooks.md +25 -0
- package/rules/swift/patterns.md +71 -0
- package/rules/swift/security.md +38 -0
- package/rules/swift/testing.md +50 -0
- package/rules/typescript/coding-style.md +204 -0
- package/rules/typescript/hooks.md +27 -0
- package/rules/typescript/patterns.md +57 -0
- package/rules/typescript/security.md +33 -0
- package/rules/typescript/testing.md +23 -0
- package/rules/web/coding-style.md +101 -0
- package/rules/web/design-quality.md +68 -0
- package/rules/web/hooks.md +125 -0
- package/rules/web/patterns.md +84 -0
- package/rules/web/performance.md +69 -0
- package/rules/web/security.md +62 -0
- package/rules/web/testing.md +60 -0
- package/rules/zh/README.md +113 -0
- package/rules/zh/agents.md +55 -0
- package/rules/zh/code-review.md +129 -0
- package/rules/zh/coding-style.md +53 -0
- package/rules/zh/development-workflow.md +49 -0
- package/rules/zh/git-workflow.md +29 -0
- package/rules/zh/hooks.md +35 -0
- package/rules/zh/patterns.md +36 -0
- package/rules/zh/performance.md +60 -0
- package/rules/zh/security.md +34 -0
- package/rules/zh/testing.md +34 -0
- package/skills/ai/agent-dev.md +102 -0
- package/skills/ai/llm-security.md +105 -0
- package/skills/ai/ml-ops.md +169 -0
- package/skills/ai/orchestration-workflow.md +87 -0
- package/skills/ai/prompt-and-eval.md +114 -0
- package/skills/ai/prompt-optimizer.md +114 -0
- package/skills/ai/rag-system.md +104 -0
- package/skills/architecture/api-design.md +100 -0
- package/skills/architecture/caching.md +101 -0
- package/skills/architecture/cloud-native.md +97 -0
- package/skills/architecture/message-queue.md +100 -0
- package/skills/architecture/security-arch.md +105 -0
- package/skills/development/cpp.md +127 -0
- package/skills/development/go.md +129 -0
- package/skills/development/java.md +134 -0
- package/skills/development/kotlin.md +140 -0
- package/skills/development/mobile-crossplatform.md +144 -0
- package/skills/development/python.md +109 -0
- package/skills/development/rust.md +127 -0
- package/skills/development/shell.md +127 -0
- package/skills/development/swift.md +129 -0
- package/skills/development/typescript.md +129 -0
- package/skills/devops/ci-cd.md +108 -0
- package/skills/devops/containerization.md +106 -0
- package/skills/devops/cost-optimization.md +105 -0
- package/skills/devops/data-engineering.md +181 -0
- package/skills/devops/database.md +95 -0
- package/skills/devops/dependency-management.md +91 -0
- package/skills/devops/devsecops.md +96 -0
- package/skills/devops/git-workflow.md +100 -0
- package/skills/devops/incident-response.md +167 -0
- package/skills/devops/monorepo.md +87 -0
- package/skills/devops/observability.md +103 -0
- package/skills/devops/performance.md +104 -0
- package/skills/devops/testing.md +104 -0
- package/skills/docs/adr-workflow.md +32 -0
- package/skills/docs/backlog-proposal-workflow.md +19 -0
- package/skills/docs/customer-profile-workflow.md +22 -0
- package/skills/docs/evidence-ingest-workflow.md +23 -0
- package/skills/docs/init-docs.md +160 -0
- package/skills/docs/init-project.md +50 -0
- package/skills/docs/prd-workflow.md +57 -0
- package/skills/docs/prfaq-workflow.md +25 -0
- package/skills/docs/product-intelligence-review.md +22 -0
- package/skills/docs/product-intelligence-workflow.md +62 -0
- package/skills/docs/product-signal-workflow.md +27 -0
- package/skills/docs/research-workflow.md +28 -0
- package/skills/docs/runbook-workflow.md +24 -0
- package/skills/exploration/repo-map.md +297 -0
- package/skills/frameworks/django.md +159 -0
- package/skills/frameworks/nextjs.md +148 -0
- package/skills/frameworks/react.md +132 -0
- package/skills/frameworks/spring-boot.md +165 -0
- package/skills/frontend-design/accessibility.md +153 -0
- package/skills/frontend-design/component-patterns.md +111 -0
- package/skills/frontend-design/engineering.md +122 -0
- package/skills/frontend-design/state-management.md +118 -0
- package/skills/frontend-design/ui-aesthetics.md +102 -0
- package/skills/frontend-design/ux-principles.md +126 -0
- package/skills/quality-gates/review-work.md +90 -0
- package/skills/quality-gates/verify-change.md +94 -0
- package/skills/quality-gates/verify-module.md +96 -0
- package/skills/quality-gates/verify-quality.md +93 -0
- package/skills/quality-gates/verify-security.md +95 -0
- package/skills/roles/architect.ai-systems.md +37 -0
- package/skills/roles/architect.data.md +37 -0
- package/skills/roles/architect.enterprise.md +37 -0
- package/skills/roles/architect.integration.md +37 -0
- package/skills/roles/architect.md +68 -0
- package/skills/roles/architect.platform.md +37 -0
- package/skills/roles/data-analyst.experiment.md +37 -0
- package/skills/roles/data-analyst.md +68 -0
- package/skills/roles/data-analyst.product-intelligence.md +37 -0
- package/skills/roles/data-analyst.product.md +37 -0
- package/skills/roles/data-analyst.telemetry.md +37 -0
- package/skills/roles/data-engineer.pipeline.md +37 -0
- package/skills/roles/data-engineer.vector-retrieval.md +37 -0
- package/skills/roles/data-engineer.warehouse.md +37 -0
- package/skills/roles/debugger.md +68 -0
- package/skills/roles/designer.accessibility.md +43 -0
- package/skills/roles/designer.md +68 -0
- package/skills/roles/engineer.ai.md +49 -0
- package/skills/roles/engineer.data.md +49 -0
- package/skills/roles/engineer.md +85 -0
- package/skills/roles/engineer.platform.md +49 -0
- package/skills/roles/operator.docs.md +43 -0
- package/skills/roles/operator.md +68 -0
- package/skills/roles/operator.release.md +43 -0
- package/skills/roles/operator.sre.md +43 -0
- package/skills/roles/orchestrator.md +66 -0
- package/skills/roles/product-manager.ai-product.md +37 -0
- package/skills/roles/product-manager.business-strategy.md +43 -0
- package/skills/roles/product-manager.enterprise.md +37 -0
- package/skills/roles/product-manager.growth.md +37 -0
- package/skills/roles/product-manager.md +67 -0
- package/skills/roles/product-manager.platform.md +37 -0
- package/skills/roles/product-manager.product.md +37 -0
- package/skills/roles/qa.ai-eval.md +37 -0
- package/skills/roles/qa.api-contract.md +37 -0
- package/skills/roles/qa.data-pipeline.md +37 -0
- package/skills/roles/qa.md +68 -0
- package/skills/roles/qa.test-automation.md +49 -0
- package/skills/roles/qa.web-ui.md +37 -0
- package/skills/roles/researcher.explorer.md +43 -0
- package/skills/roles/researcher.md +68 -0
- package/skills/roles/researcher.ux.md +43 -0
- package/skills/roles/reviewer.devil-advocate.md +43 -0
- package/skills/roles/reviewer.evaluator.md +43 -0
- package/skills/roles/reviewer.md +68 -0
- package/skills/roles/reviewer.trace.md +43 -0
- package/skills/roles/security.ai.md +37 -0
- package/skills/roles/security.appsec.md +37 -0
- package/skills/roles/security.cloud.md +37 -0
- package/skills/roles/security.legal-compliance.md +49 -0
- package/skills/roles/security.md +68 -0
- package/skills/roles/security.privacy.md +37 -0
- package/skills/roles/security.supply-chain.md +37 -0
- package/skills/routing.md +139 -0
- package/skills/security/blue-team.md +83 -0
- package/skills/security/code-audit.md +94 -0
- package/skills/security/pentest.md +84 -0
- package/skills/security/red-team.md +81 -0
- package/skills/security/threat-intel.md +89 -0
- package/skills/security/vuln-research.md +87 -0
- package/skills/utility/clean-code.md +165 -0
- package/sync-agents.mjs +899 -0
- package/templates/docs/adr.md +27 -0
- package/templates/docs/backlog-proposal.md +26 -0
- package/templates/docs/customer-profile.md +34 -0
- package/templates/docs/evidence-brief.md +37 -0
- package/templates/docs/incident-report.md +46 -0
- package/templates/docs/memo.md +27 -0
- package/templates/docs/meta-prd.md +56 -0
- package/templates/docs/one-pager.md +24 -0
- package/templates/docs/prd-business.md +61 -0
- package/templates/docs/prd-platform.md +62 -0
- package/templates/docs/prd.md +47 -0
- package/templates/docs/prfaq.md +31 -0
- package/templates/docs/product-intelligence-report.md +31 -0
- package/templates/docs/research-brief.md +29 -0
- package/templates/docs/rfc-platform.md +60 -0
- package/templates/docs/rfc.md +46 -0
- package/templates/docs/runbook.md +33 -0
- package/templates/docs/signal-brief.md +25 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/web/design-quality.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
> This file extends [common/patterns.md](../common/patterns.md) with web-specific design-quality guidance.
|
|
7
|
+
|
|
8
|
+
# Web Design Quality Standards
|
|
9
|
+
|
|
10
|
+
## Anti-Template Policy
|
|
11
|
+
|
|
12
|
+
Do not ship generic template-looking UI. Frontend output should look intentional, opinionated, and specific to the product.
|
|
13
|
+
|
|
14
|
+
### Banned Patterns
|
|
15
|
+
|
|
16
|
+
- Default card grids with uniform spacing and no hierarchy
|
|
17
|
+
- Stock hero section with centered headline, gradient blob, and generic CTA
|
|
18
|
+
- Unmodified library defaults passed off as finished design
|
|
19
|
+
- Flat layouts with no layering, depth, or motion
|
|
20
|
+
- Uniform radius, spacing, and shadows across every component
|
|
21
|
+
- Safe gray-on-white styling with one decorative accent color
|
|
22
|
+
- Dashboard-by-numbers layouts with sidebar + cards + charts and no point of view
|
|
23
|
+
- Default font stacks used without a deliberate reason
|
|
24
|
+
|
|
25
|
+
### Required Qualities
|
|
26
|
+
|
|
27
|
+
Every meaningful frontend surface should demonstrate at least four of these:
|
|
28
|
+
|
|
29
|
+
1. Clear hierarchy through scale contrast
|
|
30
|
+
2. Intentional rhythm in spacing, not uniform padding everywhere
|
|
31
|
+
3. Depth or layering through overlap, shadows, surfaces, or motion
|
|
32
|
+
4. Typography with character and a real pairing strategy
|
|
33
|
+
5. Color used semantically, not just decoratively
|
|
34
|
+
6. Hover, focus, and active states that feel designed
|
|
35
|
+
7. Grid-breaking editorial or bento composition where appropriate
|
|
36
|
+
8. Texture, grain, or atmosphere when it fits the visual direction
|
|
37
|
+
9. Motion that clarifies flow instead of distracting from it
|
|
38
|
+
10. Data visualization treated as part of the design system, not an afterthought
|
|
39
|
+
|
|
40
|
+
## Before Writing Frontend Code
|
|
41
|
+
|
|
42
|
+
1. Pick a specific style direction. Avoid vague defaults like "clean minimal".
|
|
43
|
+
2. Define a palette intentionally.
|
|
44
|
+
3. Choose typography deliberately.
|
|
45
|
+
4. Gather at least a small set of real references.
|
|
46
|
+
5. Use Construct design/frontend skills where relevant.
|
|
47
|
+
|
|
48
|
+
## Worthwhile Style Directions
|
|
49
|
+
|
|
50
|
+
- Editorial / magazine
|
|
51
|
+
- Neo-brutalism
|
|
52
|
+
- Glassmorphism with real depth
|
|
53
|
+
- Dark luxury or light luxury with disciplined contrast
|
|
54
|
+
- Bento layouts
|
|
55
|
+
- Scrollytelling
|
|
56
|
+
- 3D integration
|
|
57
|
+
- Swiss / International
|
|
58
|
+
- Retro-futurism
|
|
59
|
+
|
|
60
|
+
Do not default to dark mode automatically. Choose the visual direction the product actually wants.
|
|
61
|
+
|
|
62
|
+
## Component Checklist
|
|
63
|
+
|
|
64
|
+
- [ ] Does it avoid looking like a default Tailwind or shadcn template?
|
|
65
|
+
- [ ] Does it have intentional hover/focus/active states?
|
|
66
|
+
- [ ] Does it use hierarchy rather than uniform emphasis?
|
|
67
|
+
- [ ] Would this look believable in a real product screenshot?
|
|
68
|
+
- [ ] If it supports both themes, do both light and dark feel intentional?
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/web/hooks.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
> This file extends [common/hooks.md](../common/hooks.md) with web-specific hook recommendations.
|
|
7
|
+
|
|
8
|
+
# Web Hooks
|
|
9
|
+
|
|
10
|
+
## Recommended PostToolUse Hooks
|
|
11
|
+
|
|
12
|
+
Prefer project-local tooling. Do not wire hooks to remote one-off package execution.
|
|
13
|
+
|
|
14
|
+
### Format on Save
|
|
15
|
+
|
|
16
|
+
Use the project's existing formatter entrypoint after edits:
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"hooks": {
|
|
21
|
+
"PostToolUse": [
|
|
22
|
+
{
|
|
23
|
+
"matcher": "Write|Edit",
|
|
24
|
+
"command": "pnpm prettier --write \"$FILE_PATH\"",
|
|
25
|
+
"description": "Format edited frontend files"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Equivalent local commands via `yarn prettier` or `npm exec prettier --` are fine when they use repo-owned dependencies.
|
|
33
|
+
|
|
34
|
+
### Lint Check
|
|
35
|
+
|
|
36
|
+
```json
|
|
37
|
+
{
|
|
38
|
+
"hooks": {
|
|
39
|
+
"PostToolUse": [
|
|
40
|
+
{
|
|
41
|
+
"matcher": "Write|Edit",
|
|
42
|
+
"command": "pnpm eslint --fix \"$FILE_PATH\"",
|
|
43
|
+
"description": "Run ESLint on edited frontend files"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Type Check
|
|
51
|
+
|
|
52
|
+
```json
|
|
53
|
+
{
|
|
54
|
+
"hooks": {
|
|
55
|
+
"PostToolUse": [
|
|
56
|
+
{
|
|
57
|
+
"matcher": "Write|Edit",
|
|
58
|
+
"command": "pnpm tsc --noEmit --pretty false",
|
|
59
|
+
"description": "Type-check after frontend edits"
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### CSS Lint
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
{
|
|
70
|
+
"hooks": {
|
|
71
|
+
"PostToolUse": [
|
|
72
|
+
{
|
|
73
|
+
"matcher": "Write|Edit",
|
|
74
|
+
"command": "pnpm stylelint --fix \"$FILE_PATH\"",
|
|
75
|
+
"description": "Lint edited stylesheets"
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## PreToolUse Hooks
|
|
83
|
+
|
|
84
|
+
### Guard File Size
|
|
85
|
+
|
|
86
|
+
Block oversized writes from tool input content, not from a file that may not exist yet:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"hooks": {
|
|
91
|
+
"PreToolUse": [
|
|
92
|
+
{
|
|
93
|
+
"matcher": "Write",
|
|
94
|
+
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const c=i.tool_input?.content||'';const lines=c.split('\\n').length;if(lines>800){console.error('[Hook] BLOCKED: File exceeds 800 lines ('+lines+' lines)');console.error('[Hook] Split into smaller modules');process.exit(2)}console.log(d)})\"",
|
|
95
|
+
"description": "Block writes that exceed 800 lines"
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Stop Hooks
|
|
103
|
+
|
|
104
|
+
### Final Build Verification
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"hooks": {
|
|
109
|
+
"Stop": [
|
|
110
|
+
{
|
|
111
|
+
"command": "pnpm build",
|
|
112
|
+
"description": "Verify the production build at session end"
|
|
113
|
+
}
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Ordering
|
|
120
|
+
|
|
121
|
+
Recommended order:
|
|
122
|
+
1. format
|
|
123
|
+
2. lint
|
|
124
|
+
3. type check
|
|
125
|
+
4. build verification
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/web/patterns.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
> This file extends [common/patterns.md](../common/patterns.md) with web-specific patterns.
|
|
7
|
+
|
|
8
|
+
# Web Patterns
|
|
9
|
+
|
|
10
|
+
## Component Composition
|
|
11
|
+
|
|
12
|
+
### Compound Components
|
|
13
|
+
|
|
14
|
+
Use compound components when related UI shares state and interaction semantics:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
<Tabs defaultValue="overview">
|
|
18
|
+
<Tabs.List>
|
|
19
|
+
<Tabs.Trigger value="overview">Overview</Tabs.Trigger>
|
|
20
|
+
<Tabs.Trigger value="settings">Settings</Tabs.Trigger>
|
|
21
|
+
</Tabs.List>
|
|
22
|
+
<Tabs.Content value="overview">...</Tabs.Content>
|
|
23
|
+
<Tabs.Content value="settings">...</Tabs.Content>
|
|
24
|
+
</Tabs>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
- Parent owns state
|
|
28
|
+
- Children consume via context
|
|
29
|
+
- Prefer this over prop drilling for complex widgets
|
|
30
|
+
|
|
31
|
+
### Render Props / Slots
|
|
32
|
+
|
|
33
|
+
- Use render props or slot patterns when behavior is shared but markup must vary
|
|
34
|
+
- Keep keyboard handling, ARIA, and focus logic in the headless layer
|
|
35
|
+
|
|
36
|
+
### Container / Presentational Split
|
|
37
|
+
|
|
38
|
+
- Container components own data loading and side effects
|
|
39
|
+
- Presentational components receive props and render UI
|
|
40
|
+
- Presentational components should stay pure
|
|
41
|
+
|
|
42
|
+
## State Management
|
|
43
|
+
|
|
44
|
+
Treat these separately:
|
|
45
|
+
|
|
46
|
+
| Concern | Tooling |
|
|
47
|
+
|---------|---------|
|
|
48
|
+
| Server state | TanStack Query, SWR, tRPC |
|
|
49
|
+
| Client state | Zustand, Jotai, signals |
|
|
50
|
+
| URL state | search params, route segments |
|
|
51
|
+
| Form state | React Hook Form or equivalent |
|
|
52
|
+
|
|
53
|
+
- Do not duplicate server state into client stores
|
|
54
|
+
- Derive values instead of storing redundant computed state
|
|
55
|
+
|
|
56
|
+
## URL As State
|
|
57
|
+
|
|
58
|
+
Persist shareable state in the URL:
|
|
59
|
+
- filters
|
|
60
|
+
- sort order
|
|
61
|
+
- pagination
|
|
62
|
+
- active tab
|
|
63
|
+
- search query
|
|
64
|
+
|
|
65
|
+
## Data Fetching
|
|
66
|
+
|
|
67
|
+
### Stale-While-Revalidate
|
|
68
|
+
|
|
69
|
+
- Return cached data immediately
|
|
70
|
+
- Revalidate in the background
|
|
71
|
+
- Prefer existing libraries instead of rolling this by hand
|
|
72
|
+
|
|
73
|
+
### Optimistic Updates
|
|
74
|
+
|
|
75
|
+
- Snapshot current state
|
|
76
|
+
- Apply optimistic update
|
|
77
|
+
- Roll back on failure
|
|
78
|
+
- Emit visible error feedback when rolling back
|
|
79
|
+
|
|
80
|
+
### Parallel Loading
|
|
81
|
+
|
|
82
|
+
- Fetch independent data in parallel
|
|
83
|
+
- Avoid parent-child request waterfalls
|
|
84
|
+
- Prefetch likely next routes or states when justified
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/web/performance.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
> This file extends [common/performance.md](../common/performance.md) with web-specific performance content.
|
|
7
|
+
|
|
8
|
+
# Web Performance Rules
|
|
9
|
+
|
|
10
|
+
## Core Web Vitals Targets
|
|
11
|
+
|
|
12
|
+
| Metric | Target |
|
|
13
|
+
|--------|--------|
|
|
14
|
+
| LCP | < 2.5s |
|
|
15
|
+
| INP | < 200ms |
|
|
16
|
+
| CLS | < 0.1 |
|
|
17
|
+
| FCP | < 1.5s |
|
|
18
|
+
| TBT | < 200ms |
|
|
19
|
+
|
|
20
|
+
## Bundle Budget
|
|
21
|
+
|
|
22
|
+
| Page Type | JS Budget (gzipped) | CSS Budget |
|
|
23
|
+
|-----------|---------------------|------------|
|
|
24
|
+
| Landing page | < 150kb | < 30kb |
|
|
25
|
+
| App page | < 300kb | < 50kb |
|
|
26
|
+
| Microsite | < 80kb | < 15kb |
|
|
27
|
+
|
|
28
|
+
## Loading Strategy
|
|
29
|
+
|
|
30
|
+
1. Inline critical above-the-fold CSS where justified
|
|
31
|
+
2. Preload the hero image and primary font only
|
|
32
|
+
3. Defer non-critical CSS or JS
|
|
33
|
+
4. Dynamically import heavy libraries
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
const gsapModule = await import('gsap');
|
|
37
|
+
const { ScrollTrigger } = await import('gsap/ScrollTrigger');
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Image Optimization
|
|
41
|
+
|
|
42
|
+
- Explicit `width` and `height`
|
|
43
|
+
- `loading="eager"` plus `fetchpriority="high"` for hero media only
|
|
44
|
+
- `loading="lazy"` for below-the-fold assets
|
|
45
|
+
- Prefer AVIF or WebP with fallbacks
|
|
46
|
+
- Never ship source images far beyond rendered size
|
|
47
|
+
|
|
48
|
+
## Font Loading
|
|
49
|
+
|
|
50
|
+
- Max two font families unless there is a clear exception
|
|
51
|
+
- `font-display: swap`
|
|
52
|
+
- Subset where possible
|
|
53
|
+
- Preload only the truly critical weight/style
|
|
54
|
+
|
|
55
|
+
## Animation Performance
|
|
56
|
+
|
|
57
|
+
- Animate compositor-friendly properties only
|
|
58
|
+
- Use `will-change` narrowly and remove it when done
|
|
59
|
+
- Prefer CSS for simple transitions
|
|
60
|
+
- Use `requestAnimationFrame` or established animation libraries for JS motion
|
|
61
|
+
- Avoid scroll handler churn; use IntersectionObserver or well-behaved libraries
|
|
62
|
+
|
|
63
|
+
## Performance Checklist
|
|
64
|
+
|
|
65
|
+
- [ ] All images have explicit dimensions
|
|
66
|
+
- [ ] No accidental render-blocking resources
|
|
67
|
+
- [ ] No layout shifts from dynamic content
|
|
68
|
+
- [ ] Motion stays on compositor-friendly properties
|
|
69
|
+
- [ ] Third-party scripts load async/defer and only when needed
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/web/security.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
> This file extends [common/security.md](../common/security.md) with web-specific security content.
|
|
7
|
+
|
|
8
|
+
# Web Security Rules
|
|
9
|
+
|
|
10
|
+
## Content Security Policy
|
|
11
|
+
|
|
12
|
+
Always configure a production CSP.
|
|
13
|
+
|
|
14
|
+
### Nonce-Based CSP
|
|
15
|
+
|
|
16
|
+
Use a per-request nonce for scripts instead of `'unsafe-inline'`.
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
Content-Security-Policy:
|
|
20
|
+
default-src 'self';
|
|
21
|
+
script-src 'self' 'nonce-{RANDOM}' https://cdn.jsdelivr.net;
|
|
22
|
+
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
|
|
23
|
+
img-src 'self' data: https:;
|
|
24
|
+
font-src 'self' https://fonts.gstatic.com;
|
|
25
|
+
connect-src 'self' https://*.example.com;
|
|
26
|
+
frame-src 'none';
|
|
27
|
+
object-src 'none';
|
|
28
|
+
base-uri 'self';
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Adjust origins to the project. Do not cargo-cult this block unchanged.
|
|
32
|
+
|
|
33
|
+
## XSS Prevention
|
|
34
|
+
|
|
35
|
+
- Never inject unsanitized HTML
|
|
36
|
+
- Avoid `innerHTML` / `dangerouslySetInnerHTML` unless sanitized first
|
|
37
|
+
- Escape dynamic template values
|
|
38
|
+
- Sanitize user HTML with a vetted local sanitizer when absolutely necessary
|
|
39
|
+
|
|
40
|
+
## Third-Party Scripts
|
|
41
|
+
|
|
42
|
+
- Load asynchronously
|
|
43
|
+
- Use SRI when serving from a CDN
|
|
44
|
+
- Audit quarterly
|
|
45
|
+
- Prefer self-hosting for critical dependencies when practical
|
|
46
|
+
|
|
47
|
+
## HTTPS and Headers
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
|
|
51
|
+
X-Content-Type-Options: nosniff
|
|
52
|
+
X-Frame-Options: DENY
|
|
53
|
+
Referrer-Policy: strict-origin-when-cross-origin
|
|
54
|
+
Permissions-Policy: camera=(), microphone=(), geolocation=()
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Forms
|
|
58
|
+
|
|
59
|
+
- CSRF protection on state-changing forms
|
|
60
|
+
- Rate limiting on submission endpoints
|
|
61
|
+
- Validate client and server side
|
|
62
|
+
- Prefer honeypots or light anti-abuse controls over heavy-handed CAPTCHA defaults
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/web/testing.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
> This file extends [common/testing.md](../common/testing.md) with web-specific testing content.
|
|
7
|
+
|
|
8
|
+
# Web Testing Rules
|
|
9
|
+
|
|
10
|
+
## Priority Order
|
|
11
|
+
|
|
12
|
+
### 1. Visual Regression
|
|
13
|
+
|
|
14
|
+
- Screenshot key breakpoints: 320, 768, 1024, 1440
|
|
15
|
+
- Test hero sections, scrollytelling sections, and meaningful states
|
|
16
|
+
- Use Playwright screenshots for visual-heavy work
|
|
17
|
+
- If both themes exist, test both
|
|
18
|
+
|
|
19
|
+
### 2. Accessibility
|
|
20
|
+
|
|
21
|
+
- Run automated accessibility checks
|
|
22
|
+
- Test keyboard navigation
|
|
23
|
+
- Verify reduced-motion behavior
|
|
24
|
+
- Verify color contrast
|
|
25
|
+
|
|
26
|
+
### 3. Performance
|
|
27
|
+
|
|
28
|
+
- Run Lighthouse or equivalent against meaningful pages
|
|
29
|
+
- Keep CWV targets from [performance.md](performance.md)
|
|
30
|
+
|
|
31
|
+
### 4. Cross-Browser
|
|
32
|
+
|
|
33
|
+
- Minimum: Chrome, Firefox, Safari
|
|
34
|
+
- Test scrolling, motion, and fallback behavior
|
|
35
|
+
|
|
36
|
+
### 5. Responsive
|
|
37
|
+
|
|
38
|
+
- Test 320, 375, 768, 1024, 1440, 1920
|
|
39
|
+
- Verify no overflow
|
|
40
|
+
- Verify touch interactions
|
|
41
|
+
|
|
42
|
+
## E2E Shape
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import { test, expect } from '@playwright/test';
|
|
46
|
+
|
|
47
|
+
test('landing hero loads', async ({ page }) => {
|
|
48
|
+
await page.goto('/');
|
|
49
|
+
await expect(page.locator('h1')).toBeVisible();
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- Avoid flaky timeout-based assertions
|
|
54
|
+
- Prefer deterministic waits
|
|
55
|
+
|
|
56
|
+
## Unit Tests
|
|
57
|
+
|
|
58
|
+
- Test utilities, data transforms, and custom hooks
|
|
59
|
+
- For highly visual components, visual regression often carries more signal than brittle markup assertions
|
|
60
|
+
- Visual regression supplements coverage targets; it does not replace them
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/zh/README.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
# 规则
|
|
7
|
+
|
|
8
|
+
## 结构
|
|
9
|
+
|
|
10
|
+
规则按**通用**层和**语言特定**目录组织:
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
rules/
|
|
14
|
+
├── common/ # 语言无关的原则(始终安装)
|
|
15
|
+
│ ├── coding-style.md
|
|
16
|
+
│ ├── git-workflow.md
|
|
17
|
+
│ ├── testing.md
|
|
18
|
+
│ ├── performance.md
|
|
19
|
+
│ ├── patterns.md
|
|
20
|
+
│ ├── hooks.md
|
|
21
|
+
│ ├── agents.md
|
|
22
|
+
│ ├── security.md
|
|
23
|
+
│ ├── code-review.md
|
|
24
|
+
│ └── development-workflow.md
|
|
25
|
+
├── zh/ # 中文翻译版本
|
|
26
|
+
│ ├── coding-style.md
|
|
27
|
+
│ ├── git-workflow.md
|
|
28
|
+
│ ├── testing.md
|
|
29
|
+
│ ├── performance.md
|
|
30
|
+
│ ├── patterns.md
|
|
31
|
+
│ ├── hooks.md
|
|
32
|
+
│ ├── agents.md
|
|
33
|
+
│ ├── security.md
|
|
34
|
+
│ ├── code-review.md
|
|
35
|
+
│ └── development-workflow.md
|
|
36
|
+
├── typescript/ # TypeScript/JavaScript 特定
|
|
37
|
+
├── python/ # Python 特定
|
|
38
|
+
├── golang/ # Go 特定
|
|
39
|
+
├── swift/ # Swift 特定
|
|
40
|
+
└── php/ # PHP 特定
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- **common/** 包含通用原则 — 无语言特定的代码示例。
|
|
44
|
+
- **zh/** 包含 common 目录的中文翻译版本。
|
|
45
|
+
- **语言目录** 扩展通用规则,包含框架特定的模式、工具和代码示例。每个文件引用其对应的通用版本。
|
|
46
|
+
|
|
47
|
+
## 安装
|
|
48
|
+
|
|
49
|
+
### 选项 1:安装脚本(推荐)
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# 安装通用 + 一个或多个语言特定的规则集
|
|
53
|
+
./install.sh typescript
|
|
54
|
+
./install.sh python
|
|
55
|
+
./install.sh golang
|
|
56
|
+
./install.sh swift
|
|
57
|
+
./install.sh php
|
|
58
|
+
|
|
59
|
+
# 同时安装多种语言
|
|
60
|
+
./install.sh typescript python
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 选项 2:手动安装
|
|
64
|
+
|
|
65
|
+
> **重要提示:** 复制整个目录 — 不要使用 `/*` 展开。
|
|
66
|
+
> 通用和语言特定目录包含同名文件。
|
|
67
|
+
> 将它们展开到一个目录会导致语言特定文件覆盖通用规则,
|
|
68
|
+
> 并破坏语言特定文件使用的 `../common/` 相对引用。
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# 创建目标目录
|
|
72
|
+
mkdir -p ~/.claude/rules
|
|
73
|
+
|
|
74
|
+
# 安装通用规则(所有项目必需)
|
|
75
|
+
cp -r rules/common ~/.claude/rules/common
|
|
76
|
+
|
|
77
|
+
# 安装中文翻译版本(可选)
|
|
78
|
+
cp -r rules/zh ~/.claude/rules/zh
|
|
79
|
+
|
|
80
|
+
# 根据项目技术栈安装语言特定规则
|
|
81
|
+
cp -r rules/typescript ~/.claude/rules/typescript
|
|
82
|
+
cp -r rules/python ~/.claude/rules/python
|
|
83
|
+
cp -r rules/golang ~/.claude/rules/golang
|
|
84
|
+
cp -r rules/swift ~/.claude/rules/swift
|
|
85
|
+
cp -r rules/php ~/.claude/rules/php
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## 规则 vs 技能
|
|
89
|
+
|
|
90
|
+
- **规则** 定义广泛适用的标准、约定和检查清单(如"80% 测试覆盖率"、"禁止硬编码密钥")。
|
|
91
|
+
- **技能**(`skills/` 目录)为特定任务提供深入、可操作的参考材料(如 `python-patterns`、`golang-testing`)。
|
|
92
|
+
|
|
93
|
+
语言特定的规则文件在适当的地方引用相关技能。规则告诉你*做什么*;技能告诉你*怎么做*。
|
|
94
|
+
|
|
95
|
+
## 规则优先级
|
|
96
|
+
|
|
97
|
+
当语言特定规则与通用规则冲突时,**语言特定规则优先**(特定覆盖通用)。这遵循标准的分层配置模式(类似于 CSS 特异性或 `.gitignore` 优先级)。
|
|
98
|
+
|
|
99
|
+
- `rules/common/` 定义适用于所有项目的通用默认值。
|
|
100
|
+
- `rules/golang/`、`rules/python/`、`rules/swift/`、`rules/php/`、`rules/typescript/` 等在语言习惯不同时覆盖这些默认值。
|
|
101
|
+
- `rules/zh/` 是通用规则的中文翻译,与英文版本内容一致。
|
|
102
|
+
|
|
103
|
+
### 示例
|
|
104
|
+
|
|
105
|
+
`common/coding-style.md` 推荐不可变性作为默认原则。语言特定的 `golang/coding-style.md` 可以覆盖这一点:
|
|
106
|
+
|
|
107
|
+
> 惯用的 Go 使用指针接收器进行结构体变更 — 参见 [common/coding-style.md](../common/coding-style.md) 了解通用原则,但这里首选符合 Go 习惯的变更方式。
|
|
108
|
+
|
|
109
|
+
### 带覆盖说明的通用规则
|
|
110
|
+
|
|
111
|
+
`rules/common/` 中可能被语言特定文件覆盖的规则会被标记:
|
|
112
|
+
|
|
113
|
+
> **语言说明**:此规则可能会被语言特定规则覆盖;对于某些语言,该模式可能并不符合惯用写法。
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
rules/zh/agents.md — <one-line purpose>
|
|
3
|
+
|
|
4
|
+
<2–6 line summary.>
|
|
5
|
+
-->
|
|
6
|
+
# 代理编排
|
|
7
|
+
|
|
8
|
+
## 可用代理
|
|
9
|
+
|
|
10
|
+
位于 `~/.claude/agents/`:
|
|
11
|
+
|
|
12
|
+
| 代理 | 用途 | 何时使用 |
|
|
13
|
+
|-------|---------|------------|
|
|
14
|
+
| planner | 实现规划 | 复杂功能、重构 |
|
|
15
|
+
| architect | 系统设计 | 架构决策 |
|
|
16
|
+
| tdd-guide | 测试驱动开发 | 新功能、bug 修复 |
|
|
17
|
+
| code-reviewer | 代码审查 | 编写代码后 |
|
|
18
|
+
| security-reviewer | 安全分析 | 提交前 |
|
|
19
|
+
| build-error-resolver | 修复构建错误 | 构建失败时 |
|
|
20
|
+
| e2e-runner | E2E 测试 | 关键用户流程 |
|
|
21
|
+
| refactor-cleaner | 死代码清理 | 代码维护 |
|
|
22
|
+
| doc-updater | 文档 | 更新文档 |
|
|
23
|
+
| rust-reviewer | Rust 代码审查 | Rust 项目 |
|
|
24
|
+
|
|
25
|
+
## 立即使用代理
|
|
26
|
+
|
|
27
|
+
无需用户提示:
|
|
28
|
+
1. 复杂功能请求 - 使用 **planner** 代理
|
|
29
|
+
2. 刚编写/修改的代码 - 使用 **code-reviewer** 代理
|
|
30
|
+
3. Bug 修复或新功能 - 使用 **tdd-guide** 代理
|
|
31
|
+
4. 架构决策 - 使用 **architect** 代理
|
|
32
|
+
|
|
33
|
+
## 并行任务执行
|
|
34
|
+
|
|
35
|
+
对独立操作始终使用并行 Task 执行:
|
|
36
|
+
|
|
37
|
+
```markdown
|
|
38
|
+
# 好:并行执行
|
|
39
|
+
同时启动 3 个代理:
|
|
40
|
+
1. 代理 1:认证模块安全分析
|
|
41
|
+
2. 代理 2:缓存系统性能审查
|
|
42
|
+
3. 代理 3:工具类型检查
|
|
43
|
+
|
|
44
|
+
# 坏:不必要的顺序
|
|
45
|
+
先代理 1,然后代理 2,然后代理 3
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## 多视角分析
|
|
49
|
+
|
|
50
|
+
对于复杂问题,使用分角色子代理:
|
|
51
|
+
- 事实审查者
|
|
52
|
+
- 高级工程师
|
|
53
|
+
- 安全专家
|
|
54
|
+
- 一致性审查者
|
|
55
|
+
- 冗余检查者
|