@blxzer/cursor-trellis 0.4.1 → 0.4.3
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/CHANGELOG.md +49 -0
- package/README.md +25 -14
- package/README.zh-CN.md +14 -10
- package/bin/smart-search.js +10 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +36 -15
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +42 -153
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.d.ts +10 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +38 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/update.d.ts +5 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +144 -41
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/cursor.d.ts +2 -1
- package/dist/configurators/cursor.d.ts.map +1 -1
- package/dist/configurators/cursor.js +4 -2
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/index.js +4 -4
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/shared.d.ts +8 -0
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +27 -1
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +0 -9
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +12 -45
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +13 -0
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +17 -0
- package/dist/constants/paths.js.map +1 -1
- package/dist/migrations/manifests/0.3.0.json +1 -1
- package/dist/templates/common/bundled-skills/cstl-check/SKILL.md +1 -1
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/hooks-and-settings.md +2 -2
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/overview.md +1 -1
- package/dist/templates/common/bundled-skills/cstl-meta/references/platform-files/skills-and-commands.md +2 -4
- package/dist/templates/common/bundled-skills/cstl-skill-creator/SKILL.md +10 -7
- package/dist/templates/common/bundled-skills/cstl-skill-creator/references/authoring-rules.md +93 -19
- package/dist/templates/common/bundled-skills/cstl-skill-creator/references/general-authoring.md +189 -0
- package/dist/templates/common/bundled-skills/cstl-skill-creator/references/review-checklist.md +10 -5
- package/dist/templates/common/commands/continue.md +6 -5
- package/dist/templates/common/index.d.ts +20 -0
- package/dist/templates/common/index.d.ts.map +1 -1
- package/dist/templates/common/index.js +21 -2
- package/dist/templates/common/index.js.map +1 -1
- package/dist/templates/common/optional-skills/chrome-cdp/SKILL.md +179 -0
- package/dist/templates/common/optional-skills/chrome-cdp/examples/fetch-hook-api-capture.md +149 -0
- package/dist/templates/common/optional-skills/chrome-cdp/scripts/cdp.mjs +903 -0
- package/dist/templates/common/skills/brainstorm.md +2 -2
- package/dist/templates/cursor/agents/cstl-check.md +2 -2
- package/dist/templates/cursor/agents/cstl-implement.md +1 -1
- package/dist/templates/cursor/agents/cstl-research.md +2 -2
- package/dist/templates/cursor/fixtures/expected-rules.d.ts +1 -1
- package/dist/templates/cursor/fixtures/expected-rules.d.ts.map +1 -1
- package/dist/templates/cursor/fixtures/expected-rules.js +7 -24
- package/dist/templates/cursor/fixtures/expected-rules.js.map +1 -1
- package/dist/templates/cursor/hooks.json +4 -0
- package/dist/templates/cursor/index.d.ts +1 -1
- package/dist/templates/cursor/index.js +1 -1
- package/dist/templates/cursor/rules/cstl-bootstrap.mdc +17 -0
- package/dist/templates/markdown/agents.md +36 -3
- package/dist/templates/markdown/{spec/guides → framework}/cursor-native-modes-guide.md.txt +13 -10
- package/dist/templates/markdown/{spec/guides → framework}/cursor-subagent-policy.md.txt +63 -127
- package/dist/templates/markdown/framework/dogfood-only-surfaces.md.txt +29 -0
- package/dist/templates/markdown/{spec/guides → framework}/execution-strategy.md.txt +2 -0
- package/dist/templates/markdown/framework/index.md.txt +31 -0
- package/dist/templates/markdown/framework/internal-skills-cursor-reachability.md.txt +45 -0
- package/dist/templates/markdown/framework/middleware-protocol.md.txt +83 -0
- package/dist/templates/markdown/framework/parallel-first-execution.md.txt +78 -0
- package/dist/templates/markdown/framework/prd-grill-frontier.md.txt +83 -0
- package/dist/templates/markdown/framework/release-boundary.md.txt +30 -0
- package/dist/templates/markdown/{spec/guides → framework}/retrieval-daily-guide.md.txt +1 -1
- package/dist/templates/markdown/framework/upgrade.md.txt +15 -0
- package/dist/templates/markdown/{spec/guides → framework}/verification-strength-guide.md.txt +2 -2
- package/dist/templates/markdown/index.d.ts +26 -10
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +87 -11
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/prompts/run-semantic-slice-12.md.txt +1 -1
- package/dist/templates/markdown/spec/guides/index.md.txt +5 -19
- package/dist/templates/markdown/spec/guides/prototype-guide.md.txt +10 -10
- package/dist/templates/markdown/spec/guides/test-discipline-guide.md.txt +1 -1
- package/dist/templates/shared-hooks/event-bridge.py +60 -0
- package/dist/templates/shared-hooks/index.d.ts +1 -1
- package/dist/templates/shared-hooks/index.d.ts.map +1 -1
- package/dist/templates/shared-hooks/index.js +1 -0
- package/dist/templates/shared-hooks/index.js.map +1 -1
- package/dist/templates/shared-hooks/session-start.py +19 -2
- package/dist/templates/trellis/CONTEXT.md +63 -3
- package/dist/templates/trellis/config.yaml +1 -1
- package/dist/templates/trellis/gitignore.txt +39 -39
- package/dist/templates/trellis/index.d.ts +12 -0
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +73 -15
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/pool/README.md +12 -3
- package/dist/templates/trellis/pool/plan.md +24 -5
- package/dist/templates/trellis/scripts/common/adapter_middleware.py +158 -0
- package/dist/templates/trellis/scripts/common/artifact_locale.py +12 -3
- package/dist/templates/trellis/scripts/common/cursor_retrieval_env.py +5 -2
- package/dist/templates/trellis/scripts/common/full_quality.py +237 -0
- package/dist/templates/trellis/scripts/common/git.py +6 -0
- package/dist/templates/trellis/scripts/common/git_context.py +17 -5
- package/dist/templates/trellis/scripts/common/kernel_command.py +367 -0
- package/dist/templates/trellis/scripts/common/lite_context.py +280 -0
- package/dist/templates/trellis/scripts/common/ondemand_topology.py +225 -0
- package/dist/templates/trellis/scripts/common/parent_orchestration.py +1 -1
- package/dist/templates/trellis/scripts/common/pool_store.py +16 -4
- package/dist/templates/trellis/scripts/common/retrieval_agent_instructions.py +2 -2
- package/dist/templates/trellis/scripts/common/session_context.py +28 -2
- package/dist/templates/trellis/scripts/common/task_gates.py +73 -12
- package/dist/templates/trellis/scripts/common/task_map.py +42 -9
- package/dist/templates/trellis/scripts/common/task_store.py +293 -61
- package/dist/templates/trellis/scripts/common/test_adapter_middleware.py +56 -0
- package/dist/templates/trellis/scripts/common/test_depends_mode_block.py +9 -0
- package/dist/templates/trellis/scripts/common/test_full_quality.py +197 -0
- package/dist/templates/trellis/scripts/common/test_kernel_command.py +326 -0
- package/dist/templates/trellis/scripts/common/test_lite_path.py +190 -0
- package/dist/templates/trellis/scripts/common/test_observable_defaults.py +10 -4
- package/dist/templates/trellis/scripts/common/test_ondemand_topology.py +122 -0
- package/dist/templates/trellis/scripts/common/test_pool_store.py +17 -0
- package/dist/templates/trellis/scripts/common/test_task_store_kernel_patch.py +163 -0
- package/dist/templates/trellis/scripts/common/workflow_phase.py +3 -0
- package/dist/templates/trellis/scripts/cursor_retrieval_probe_prompt.md +4 -5
- package/dist/templates/trellis/scripts/get_context.py +1 -0
- package/dist/templates/trellis/scripts/pool.py +5 -0
- package/dist/templates/trellis/scripts/task.py +83 -7
- package/dist/templates/trellis/workflow.md +109 -23
- package/dist/utils/cursor-retrieval-env.d.ts +2 -1
- package/dist/utils/cursor-retrieval-env.d.ts.map +1 -1
- package/dist/utils/cursor-retrieval-env.js +3 -2
- package/dist/utils/cursor-retrieval-env.js.map +1 -1
- package/dist/utils/cursor2plus-residue-cleanup.d.ts +38 -0
- package/dist/utils/cursor2plus-residue-cleanup.d.ts.map +1 -0
- package/dist/utils/cursor2plus-residue-cleanup.js +145 -0
- package/dist/utils/cursor2plus-residue-cleanup.js.map +1 -0
- package/dist/utils/manifest-prune.d.ts.map +1 -1
- package/dist/utils/manifest-prune.js +7 -2
- package/dist/utils/manifest-prune.js.map +1 -1
- package/dist/utils/p36-upgrade.d.ts +62 -0
- package/dist/utils/p36-upgrade.d.ts.map +1 -0
- package/dist/utils/p36-upgrade.js +160 -0
- package/dist/utils/p36-upgrade.js.map +1 -0
- package/dist/utils/project-capabilities.d.ts +1 -12
- package/dist/utils/project-capabilities.d.ts.map +1 -1
- package/dist/utils/project-capabilities.js +3 -100
- package/dist/utils/project-capabilities.js.map +1 -1
- package/dist/utils/readiness.d.ts +10 -0
- package/dist/utils/readiness.d.ts.map +1 -1
- package/dist/utils/readiness.js +58 -26
- package/dist/utils/readiness.js.map +1 -1
- package/dist/utils/retrieval-agent-instructions.js +1 -1
- package/dist/utils/retrieval-agent-instructions.js.map +1 -1
- package/dist/utils/retrieval-execution-telemetry.js +1 -1
- package/dist/utils/retrieval-execution-telemetry.js.map +1 -1
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +11 -1
- package/dist/utils/template-hash.js.map +1 -1
- package/dist/utils/uninstall-scrubbers.d.ts.map +1 -1
- package/dist/utils/uninstall-scrubbers.js +52 -14
- package/dist/utils/uninstall-scrubbers.js.map +1 -1
- package/dist/utils/update-rollout-report.d.ts +14 -0
- package/dist/utils/update-rollout-report.d.ts.map +1 -1
- package/dist/utils/update-rollout-report.js +1 -0
- package/dist/utils/update-rollout-report.js.map +1 -1
- package/dist/utils/workflow-ownership.d.ts +1 -1
- package/dist/utils/workflow-ownership.js +4 -4
- package/dist/utils/workflow-ownership.js.map +1 -1
- package/package.json +5 -4
- package/scripts/postinstall.js +6 -7
- package/dist/commands/campaign/canvas-render.d.ts +0 -68
- package/dist/commands/campaign/canvas-render.d.ts.map +0 -1
- package/dist/commands/campaign/canvas-render.js +0 -414
- package/dist/commands/campaign/canvas-render.js.map +0 -1
- package/dist/commands/campaign/compose.d.ts +0 -15
- package/dist/commands/campaign/compose.d.ts.map +0 -1
- package/dist/commands/campaign/compose.js +0 -110
- package/dist/commands/campaign/compose.js.map +0 -1
- package/dist/commands/campaign/index.d.ts +0 -13
- package/dist/commands/campaign/index.d.ts.map +0 -1
- package/dist/commands/campaign/index.js +0 -134
- package/dist/commands/campaign/index.js.map +0 -1
- package/dist/commands/campaign/kind-map.d.ts +0 -6
- package/dist/commands/campaign/kind-map.d.ts.map +0 -1
- package/dist/commands/campaign/kind-map.js +0 -21
- package/dist/commands/campaign/kind-map.js.map +0 -1
- package/dist/commands/campaign/mcp-server.d.ts +0 -6
- package/dist/commands/campaign/mcp-server.d.ts.map +0 -1
- package/dist/commands/campaign/mcp-server.js +0 -167
- package/dist/commands/campaign/mcp-server.js.map +0 -1
- package/dist/commands/campaign/render.d.ts +0 -5
- package/dist/commands/campaign/render.d.ts.map +0 -1
- package/dist/commands/campaign/render.js +0 -103
- package/dist/commands/campaign/render.js.map +0 -1
- package/dist/commands/campaign/trellis-load.d.ts +0 -13
- package/dist/commands/campaign/trellis-load.d.ts.map +0 -1
- package/dist/commands/campaign/trellis-load.js +0 -122
- package/dist/commands/campaign/trellis-load.js.map +0 -1
- package/dist/commands/campaign/types.d.ts +0 -61
- package/dist/commands/campaign/types.d.ts.map +0 -1
- package/dist/commands/campaign/types.js +0 -3
- package/dist/commands/campaign/types.js.map +0 -1
- package/dist/commands/goal/index.d.ts +0 -3
- package/dist/commands/goal/index.d.ts.map +0 -1
- package/dist/commands/goal/index.js +0 -159
- package/dist/commands/goal/index.js.map +0 -1
- package/dist/commands/goal/review.d.ts +0 -6
- package/dist/commands/goal/review.d.ts.map +0 -1
- package/dist/commands/goal/review.js +0 -28
- package/dist/commands/goal/review.js.map +0 -1
- package/dist/commands/rpc/client.d.ts +0 -51
- package/dist/commands/rpc/client.d.ts.map +0 -1
- package/dist/commands/rpc/client.js +0 -147
- package/dist/commands/rpc/client.js.map +0 -1
- package/dist/commands/rpc/index.d.ts +0 -10
- package/dist/commands/rpc/index.d.ts.map +0 -1
- package/dist/commands/rpc/index.js +0 -157
- package/dist/commands/rpc/index.js.map +0 -1
- package/dist/commands/rpc/serve.d.ts +0 -23
- package/dist/commands/rpc/serve.d.ts.map +0 -1
- package/dist/commands/rpc/serve.js +0 -60
- package/dist/commands/rpc/serve.js.map +0 -1
- package/dist/commands/rpc/smoke.d.ts +0 -16
- package/dist/commands/rpc/smoke.d.ts.map +0 -1
- package/dist/commands/rpc/smoke.js +0 -92
- package/dist/commands/rpc/smoke.js.map +0 -1
- package/dist/commands/sdk/index.d.ts +0 -9
- package/dist/commands/sdk/index.d.ts.map +0 -1
- package/dist/commands/sdk/index.js +0 -58
- package/dist/commands/sdk/index.js.map +0 -1
- package/dist/commands/sdk/run.d.ts +0 -42
- package/dist/commands/sdk/run.d.ts.map +0 -1
- package/dist/commands/sdk/run.js +0 -220
- package/dist/commands/sdk/run.js.map +0 -1
- package/dist/commands/sdk/status.d.ts +0 -14
- package/dist/commands/sdk/status.d.ts.map +0 -1
- package/dist/commands/sdk/status.js +0 -69
- package/dist/commands/sdk/status.js.map +0 -1
- package/dist/configurators/cursor2plus-local.d.ts +0 -6
- package/dist/configurators/cursor2plus-local.d.ts.map +0 -1
- package/dist/configurators/cursor2plus-local.js +0 -21
- package/dist/configurators/cursor2plus-local.js.map +0 -1
- package/dist/goal/action-packet.d.ts +0 -89
- package/dist/goal/action-packet.d.ts.map +0 -1
- package/dist/goal/action-packet.js +0 -113
- package/dist/goal/action-packet.js.map +0 -1
- package/dist/goal/audit.d.ts +0 -14
- package/dist/goal/audit.d.ts.map +0 -1
- package/dist/goal/audit.js +0 -12
- package/dist/goal/audit.js.map +0 -1
- package/dist/goal/constants.d.ts +0 -26
- package/dist/goal/constants.d.ts.map +0 -1
- package/dist/goal/constants.js +0 -24
- package/dist/goal/constants.js.map +0 -1
- package/dist/goal/paths.d.ts +0 -8
- package/dist/goal/paths.d.ts.map +0 -1
- package/dist/goal/paths.js +0 -36
- package/dist/goal/paths.js.map +0 -1
- package/dist/goal/preflight.d.ts +0 -21
- package/dist/goal/preflight.d.ts.map +0 -1
- package/dist/goal/preflight.js +0 -97
- package/dist/goal/preflight.js.map +0 -1
- package/dist/goal/review-seam.d.ts +0 -44
- package/dist/goal/review-seam.d.ts.map +0 -1
- package/dist/goal/review-seam.js +0 -153
- package/dist/goal/review-seam.js.map +0 -1
- package/dist/goal/reviewer-rules.d.ts +0 -13
- package/dist/goal/reviewer-rules.d.ts.map +0 -1
- package/dist/goal/reviewer-rules.js +0 -153
- package/dist/goal/reviewer-rules.js.map +0 -1
- package/dist/goal/reviewer.d.ts +0 -9
- package/dist/goal/reviewer.d.ts.map +0 -1
- package/dist/goal/reviewer.js +0 -54
- package/dist/goal/reviewer.js.map +0 -1
- package/dist/goal/runtime.d.ts +0 -32
- package/dist/goal/runtime.d.ts.map +0 -1
- package/dist/goal/runtime.js +0 -242
- package/dist/goal/runtime.js.map +0 -1
- package/dist/goal/sdk-client.d.ts +0 -10
- package/dist/goal/sdk-client.d.ts.map +0 -1
- package/dist/goal/sdk-client.js +0 -34
- package/dist/goal/sdk-client.js.map +0 -1
- package/dist/goal/state.d.ts +0 -40
- package/dist/goal/state.d.ts.map +0 -1
- package/dist/goal/state.js +0 -37
- package/dist/goal/state.js.map +0 -1
- package/dist/goal/task-triggers.d.ts +0 -15
- package/dist/goal/task-triggers.d.ts.map +0 -1
- package/dist/goal/task-triggers.js +0 -23
- package/dist/goal/task-triggers.js.map +0 -1
- package/dist/goal/walls.d.ts +0 -12
- package/dist/goal/walls.d.ts.map +0 -1
- package/dist/goal/walls.js +0 -65
- package/dist/goal/walls.js.map +0 -1
- package/dist/goal/worker-prompt.d.ts +0 -13
- package/dist/goal/worker-prompt.d.ts.map +0 -1
- package/dist/goal/worker-prompt.js +0 -41
- package/dist/goal/worker-prompt.js.map +0 -1
- package/dist/goal/worker.d.ts +0 -42
- package/dist/goal/worker.d.ts.map +0 -1
- package/dist/goal/worker.js +0 -180
- package/dist/goal/worker.js.map +0 -1
- package/dist/templates/common/bundled-skills/cstl-cursor2plus-setup/SKILL.md +0 -63
- package/dist/templates/cursor/commands/cursor2plus-setup.md +0 -82
- package/dist/templates/cursor/rules/cstl-cursor-modes.mdc +0 -32
- package/dist/templates/cursor/rules/cstl-session-rename.mdc +0 -31
- package/dist/templates/cursor/rules/cstl-subagent-dispatch.mdc +0 -34
- package/dist/templates/cursor/rules/cstl-triage.mdc +0 -36
- package/dist/templates/cursor/rules/retrieval-routing.mdc +0 -78
- package/dist/templates/markdown/spec/guides/cursor-trellis-release-coexistence-guide.md.txt +0 -166
- package/dist/templates/markdown/spec/guides/goal-release-regression-runbook.md.txt +0 -132
- package/dist/templates/trellis/local/README.md +0 -85
- package/dist/templates/trellis/local/config.local.json.example +0 -6
- package/dist/templates/trellis/local/index.d.ts +0 -8
- package/dist/templates/trellis/local/index.d.ts.map +0 -1
- package/dist/templates/trellis/local/index.js +0 -15
- package/dist/templates/trellis/local/index.js.map +0 -1
- package/dist/templates/trellis/local/patch_wpelc8.py +0 -421
- package/dist/templates/trellis/local/smoke.py +0 -94
- package/dist/templates/trellis/local/subagent-models.json.example +0 -4
- package/dist/templates/trellis/local/trellis-task-models.json.example +0 -10
- package/dist/templates/trellis/local/trellis-task-models.json5.example +0 -45
- package/dist/templates/trellis/local/trellis_task_models_config.py +0 -200
- package/dist/utils/cursor-sdk-gate.d.ts +0 -10
- package/dist/utils/cursor-sdk-gate.d.ts.map +0 -1
- package/dist/utils/cursor-sdk-gate.js +0 -32
- package/dist/utils/cursor-sdk-gate.js.map +0 -1
- /package/dist/templates/markdown/{spec/guides → framework}/artifact-locale-guide.md.txt +0 -0
- /package/dist/templates/markdown/{spec/guides → framework}/cursor-context-injection-guide.md.txt +0 -0
- /package/dist/templates/markdown/{spec/guides → framework}/cursor-semantic-compliance.md.txt +0 -0
- /package/dist/templates/markdown/{spec/guides → framework}/injection-budget-guide.md.txt +0 -0
package/dist/templates/common/bundled-skills/cstl-skill-creator/references/general-authoring.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# General Skill Authoring
|
|
2
|
+
|
|
3
|
+
Method and patterns for writing reusable agent skills. Imperative rules live in `SKILL.md` Hard Constraints; this file explains how to apply them. For Trellis location choice, read `cstl-skill-locations.md`. For description wording and anti-patterns, read `authoring-rules.md`.
|
|
4
|
+
|
|
5
|
+
## Gather Requirements
|
|
6
|
+
|
|
7
|
+
Collect these six elements before writing files:
|
|
8
|
+
|
|
9
|
+
1. **Purpose and scope**: What specific workflow should this skill solve?
|
|
10
|
+
2. **Trigger scenarios**: When should the agent automatically use it?
|
|
11
|
+
3. **Target location**: Project skill, shared skill, bundled template, or personal skill?
|
|
12
|
+
4. **Domain constraints**: Required tools, APIs, reliability constraints.
|
|
13
|
+
5. **Output style**: Report template, checklist, strict schema, etc.
|
|
14
|
+
6. **Existing patterns**: Are there existing skills or conventions to follow?
|
|
15
|
+
|
|
16
|
+
### Inferring from Context
|
|
17
|
+
|
|
18
|
+
If previous conversation already surfaced workflows, patterns, or domain knowledge, infer the skill from that context.
|
|
19
|
+
|
|
20
|
+
Ask the user when requirements are ambiguous and discrete choices are needed.
|
|
21
|
+
|
|
22
|
+
## Directory Layout
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
skill-name/
|
|
26
|
+
├── SKILL.md # required
|
|
27
|
+
├── scripts/ # optional utility scripts
|
|
28
|
+
├── bin/ # optional compiled binaries
|
|
29
|
+
├── references/ # optional detailed docs (preferred over a single reference.md)
|
|
30
|
+
├── examples/ # optional samples
|
|
31
|
+
└── prompts/ # optional long prompts
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Keep the entry file short. Put long guidance one level deep under `references/` and link it from `SKILL.md`.
|
|
35
|
+
|
|
36
|
+
Generic storage scopes (`~/.agents/skills/` vs project `.agents/skills/`) are not enough for Trellis work. Use `cstl-skill-locations.md` to pick the target directory.
|
|
37
|
+
|
|
38
|
+
## Core Authoring Principles
|
|
39
|
+
|
|
40
|
+
### 1. Concise is Key
|
|
41
|
+
|
|
42
|
+
The context window is shared with conversation history, other skills, and requests. Every token competes for space.
|
|
43
|
+
|
|
44
|
+
Default assumption: the agent is already very smart. Only add context it does not already have.
|
|
45
|
+
|
|
46
|
+
Challenge each piece of information:
|
|
47
|
+
|
|
48
|
+
- Does the agent really need this explanation?
|
|
49
|
+
- Can I assume the agent knows this?
|
|
50
|
+
- Does this paragraph justify its token cost?
|
|
51
|
+
|
|
52
|
+
### 2. Progressive Disclosure
|
|
53
|
+
|
|
54
|
+
Put essential information in `SKILL.md`; detailed reference material in separate files that the agent reads only when needed.
|
|
55
|
+
|
|
56
|
+
Keep references one level deep — link directly from `SKILL.md`. Nested reference chains may result in partial reads.
|
|
57
|
+
|
|
58
|
+
### 3. One File, One Concern
|
|
59
|
+
|
|
60
|
+
Each skill should address a single workflow. If a skill tries to do too many things, split it.
|
|
61
|
+
|
|
62
|
+
### 4. Maximize Determinism
|
|
63
|
+
|
|
64
|
+
Skills run through multiple independent tool calls. Each call is stateless — no shared session or persistent variables between calls.
|
|
65
|
+
|
|
66
|
+
Eliminate ambiguity at every layer — description, workflow, script parameters, and output format.
|
|
67
|
+
|
|
68
|
+
- Internalize decisions: if a value can be decided inside a script (output path, temp filename, timestamp), do not expose it as a parameter.
|
|
69
|
+
- Use fixed literal paths in workflows. The agent copies commands verbatim. Never rely on shell variables staying consistent across separate tool calls.
|
|
70
|
+
- Minimize script parameters. Only require what the agent must provide.
|
|
71
|
+
- Scripts return structured JSON to stdout so the agent can parse the result deterministically.
|
|
72
|
+
- Specify an exact tool-call sequence, for example: "Exactly 3 steps: write file → run command → deliver output."
|
|
73
|
+
- Add stop conditions. Prevent open-ended tool loops for expensive operations.
|
|
74
|
+
|
|
75
|
+
### 5. Set Appropriate Degrees of Freedom
|
|
76
|
+
|
|
77
|
+
Match specificity to the task's fragility:
|
|
78
|
+
|
|
79
|
+
| Freedom Level | When to Use | Example |
|
|
80
|
+
|---------------|-------------|---------|
|
|
81
|
+
| **High** (text instructions) | Multiple valid approaches, context-dependent | Code review guidelines |
|
|
82
|
+
| **Medium** (pseudocode / templates) | Preferred pattern with acceptable variation | Report generation |
|
|
83
|
+
| **Low** (specific scripts) | Fragile operations, consistency critical | Database migrations |
|
|
84
|
+
|
|
85
|
+
## Recommended SKILL.md Sections
|
|
86
|
+
|
|
87
|
+
1. Goal
|
|
88
|
+
2. Hard Constraints (imperative one-liners; placed before Workflow)
|
|
89
|
+
3. Workflow
|
|
90
|
+
4. Output Template
|
|
91
|
+
5. When NOT to use this skill
|
|
92
|
+
|
|
93
|
+
## Common Patterns
|
|
94
|
+
|
|
95
|
+
### Workflow Pattern
|
|
96
|
+
|
|
97
|
+
Break operations into explicit steps with a clear tool-call sequence:
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
## Workflow
|
|
101
|
+
|
|
102
|
+
1. Gather input data
|
|
103
|
+
2. Process: `<exact command the agent should run>`
|
|
104
|
+
3. Parse output, proceed to the next step
|
|
105
|
+
4. Stop when the condition is met
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Template Pattern
|
|
109
|
+
|
|
110
|
+
Provide output format templates:
|
|
111
|
+
|
|
112
|
+
````markdown
|
|
113
|
+
## Output Template
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
# [Title]
|
|
117
|
+
|
|
118
|
+
## Summary
|
|
119
|
+
[One-paragraph overview]
|
|
120
|
+
|
|
121
|
+
## Findings
|
|
122
|
+
- Finding 1 with supporting data
|
|
123
|
+
- Finding 2 with supporting data
|
|
124
|
+
```
|
|
125
|
+
````
|
|
126
|
+
|
|
127
|
+
### Conditional Workflow Pattern
|
|
128
|
+
|
|
129
|
+
Guide through decision points:
|
|
130
|
+
|
|
131
|
+
```markdown
|
|
132
|
+
## Workflow
|
|
133
|
+
|
|
134
|
+
1. Determine the type:
|
|
135
|
+
**Creating new?** → Follow "Creation workflow" below
|
|
136
|
+
**Editing existing?** → Follow "Editing workflow" below
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Feedback Loop Pattern
|
|
140
|
+
|
|
141
|
+
For quality-critical tasks, implement validation:
|
|
142
|
+
|
|
143
|
+
```markdown
|
|
144
|
+
1. Make edits
|
|
145
|
+
2. Validate: `python scripts/validate.py output/`
|
|
146
|
+
3. If validation fails → fix and re-validate
|
|
147
|
+
4. Only proceed when validation passes
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Utility Scripts
|
|
151
|
+
|
|
152
|
+
Pre-made scripts are more reliable than generated code, save tokens, and keep behavior consistent.
|
|
153
|
+
|
|
154
|
+
Script design:
|
|
155
|
+
|
|
156
|
+
- Only expose parameters the agent must supply (input data, mode selection).
|
|
157
|
+
- Let the script handle internal decisions (output path, temp files, format defaults).
|
|
158
|
+
- Return results as structured JSON to stdout.
|
|
159
|
+
- State whether the agent should **execute** the script or **read** it as reference.
|
|
160
|
+
|
|
161
|
+
## Minimal Template
|
|
162
|
+
|
|
163
|
+
```markdown
|
|
164
|
+
---
|
|
165
|
+
name: skill-name
|
|
166
|
+
description: Specific capability and trigger scenarios.
|
|
167
|
+
---
|
|
168
|
+
|
|
169
|
+
# Skill Name
|
|
170
|
+
|
|
171
|
+
## Goal
|
|
172
|
+
One clear objective.
|
|
173
|
+
|
|
174
|
+
## Hard Constraints
|
|
175
|
+
- Always X. Never Y.
|
|
176
|
+
- Always validate the input before step 2.
|
|
177
|
+
- Never call the API more than 5 times per run.
|
|
178
|
+
|
|
179
|
+
## Workflow
|
|
180
|
+
1. Step one
|
|
181
|
+
2. Step two
|
|
182
|
+
3. Stop when condition met
|
|
183
|
+
|
|
184
|
+
## Output Template
|
|
185
|
+
Required output structure.
|
|
186
|
+
|
|
187
|
+
## When NOT to use this skill
|
|
188
|
+
- Boundary cases.
|
|
189
|
+
```
|
package/dist/templates/common/bundled-skills/cstl-skill-creator/references/review-checklist.md
CHANGED
|
@@ -5,9 +5,10 @@ Use this checklist before handing off a new or modified skill.
|
|
|
5
5
|
## Frontmatter
|
|
6
6
|
|
|
7
7
|
- [ ] `name` uses lowercase letters, numbers, and hyphens only.
|
|
8
|
-
- [ ] `description` is third-person and trigger
|
|
9
|
-
- [ ] `description` includes both what the skill does and when to use it.
|
|
8
|
+
- [ ] `description` is third-person, specific, and includes trigger terms.
|
|
9
|
+
- [ ] `description` includes both what the skill does (WHAT) and when to use it (WHEN).
|
|
10
10
|
- [ ] The skill name does not collide with a platform built-in helper unless that is intentional.
|
|
11
|
+
- [ ] The skill name is specific (`processing-pdfs`), not vague (`helper`, `utils`, `tools`).
|
|
11
12
|
|
|
12
13
|
## Scope And Boundaries
|
|
13
14
|
|
|
@@ -15,14 +16,18 @@ Use this checklist before handing off a new or modified skill.
|
|
|
15
16
|
- [ ] `When NOT To Use` or equivalent boundary guidance is present when triggers may overlap.
|
|
16
17
|
- [ ] Project-private rules are in `.cstl/spec/` or a project-local skill, not in a public bundled skill.
|
|
17
18
|
- [ ] The skill distinguishes local project customization from upstream Trellis source changes.
|
|
19
|
+
- [ ] Terminology is consistent throughout.
|
|
18
20
|
|
|
19
21
|
## Entry File
|
|
20
22
|
|
|
21
23
|
- [ ] `SKILL.md` is concise and under 500 lines.
|
|
24
|
+
- [ ] `SKILL.md` is written in English unless the target platform or user explicitly requires another language.
|
|
22
25
|
- [ ] `SKILL.md` contains the minimum routing and workflow needed to start.
|
|
23
26
|
- [ ] `## Hard Constraints` appears before `## Workflow` when constraints exist.
|
|
24
|
-
- [ ] Hard constraints are imperative one-liners.
|
|
25
|
-
- [ ] The same rule is not repeated in multiple sections.
|
|
27
|
+
- [ ] Hard constraints are imperative one-liners (`Always X. Never Y.`).
|
|
28
|
+
- [ ] The same rule is not repeated in multiple sections; Hard Constraints is the only rule list.
|
|
29
|
+
- [ ] Workflow has an explicit tool-call sequence and stop conditions.
|
|
30
|
+
- [ ] Tool usage limits are stated when applicable.
|
|
26
31
|
|
|
27
32
|
## References And Assets
|
|
28
33
|
|
|
@@ -36,7 +41,7 @@ Use this checklist before handing off a new or modified skill.
|
|
|
36
41
|
- [ ] Scripts are necessary for determinism, not decorative.
|
|
37
42
|
- [ ] Scripts expose only necessary parameters.
|
|
38
43
|
- [ ] Scripts do not rely on shell variables or state from a previous tool call.
|
|
39
|
-
- [ ] Scripts return structured JSON when they mutate files or provide machine-readable status.
|
|
44
|
+
- [ ] Scripts return structured JSON to stdout when they mutate files or provide machine-readable status.
|
|
40
45
|
- [ ] Syntax checks were run for modified scripts when applicable.
|
|
41
46
|
|
|
42
47
|
## Trellis Template Integration
|
|
@@ -41,21 +41,22 @@ Shows the Phase Index (Plan / Execute / Finish) with routing + skill mapping.
|
|
|
41
41
|
|
|
42
42
|
## Step 4: Decide Where You Are
|
|
43
43
|
|
|
44
|
-
When a task is selected, `get_context.py` shows the selected task
|
|
44
|
+
When a task is selected, `get_context.py` shows the selected task. Route by Kernel / persisted `required_controls.rigor` and `topology.kind`, not by whether `design.md` or `implement.md` exist. `status` is a projection, not the sole truth. This command replaces the user needing to remember the Trellis flow; it does not itself approve implementation.
|
|
45
45
|
|
|
46
|
-
- `status=planning` + no `prd.md` → **1.1** (
|
|
47
|
-
- `status=planning` + `prd.md`
|
|
48
|
-
- `status=planning` +
|
|
46
|
+
- `status=planning` + no `prd.md` → **1.1** (Read `.cstl/framework/prd-grill-frontier.md` for PRD Grill discipline)
|
|
47
|
+
- `status=planning` + `prd.md` + rigor is lite (or missing contract = explicit Lite) → **1.4** review / execution gate
|
|
48
|
+
- `status=planning` + rigor is full + required planning artifacts not complete → stay in planning (`design.md` / `implement.md` only when `required_controls` says so)
|
|
49
49
|
- `status=planning` + required artifacts complete + required jsonl curated or inline mode → execution gate (run `task.py start-execution <task> --check`, report PASS, ask for explicit execution approval, then run `task.py start-execution <task> --approved`)
|
|
50
50
|
- `status=in_progress` + implementation not started → **2.1**
|
|
51
51
|
- `status=in_progress` + implementation done, not yet checked → **2.2**
|
|
52
52
|
- `status=in_progress` + check passed → **3.1**
|
|
53
53
|
- `status=completed` (rare; usually archived immediately) → archive flow
|
|
54
|
+
- `topology.kind=parent-child` → Parent integration path, not ordinary Child closeout. `parent_id` alone does **not** make a Child a Parent.
|
|
54
55
|
|
|
55
56
|
Phase rules (full detail in `.cstl/workflow.md`):
|
|
56
57
|
|
|
57
58
|
1. Run steps **in order** within a phase — `[required]` steps must not be skipped
|
|
58
|
-
2. `[once]` steps are already done if the required output exists. `prd.md` alone can be enough
|
|
59
|
+
2. `[once]` steps are already done if the required output exists. `prd.md` alone can be enough when rigor is Lite; Full follows `required_controls`, not file presence.
|
|
59
60
|
3. You may go back to an earlier phase if discoveries require it
|
|
60
61
|
|
|
61
62
|
## Step 5: Load the Specific Step
|
|
@@ -28,6 +28,17 @@ export interface CommonBundledSkill {
|
|
|
28
28
|
/** Files that must be written under the skill directory */
|
|
29
29
|
files: CommonBundledSkillFile[];
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Optional/experimental skill — same shape as bundled skills, but lives under
|
|
33
|
+
* `optional-skills/` which `getBundledSkillTemplates()` does NOT scan.
|
|
34
|
+
* Installed only via `cstl init --with-optional <name>` (default off).
|
|
35
|
+
*/
|
|
36
|
+
export interface CommonOptionalSkill {
|
|
37
|
+
/** Skill directory name, e.g. "chrome-cdp" */
|
|
38
|
+
name: string;
|
|
39
|
+
/** Files that must be written under the skill directory */
|
|
40
|
+
files: CommonBundledSkillFile[];
|
|
41
|
+
}
|
|
31
42
|
/**
|
|
32
43
|
* Get all command templates (stay as slash commands on all platforms).
|
|
33
44
|
* Results are cached after first call.
|
|
@@ -45,4 +56,13 @@ export declare function getSkillTemplates(): CommonTemplate[];
|
|
|
45
56
|
* lazy-loadable instead of being flattened into one oversized SKILL.md.
|
|
46
57
|
*/
|
|
47
58
|
export declare function getBundledSkillTemplates(): CommonBundledSkill[];
|
|
59
|
+
/**
|
|
60
|
+
* Get all optional/experimental skills (e.g. `optional-skills/chrome-cdp/`).
|
|
61
|
+
*
|
|
62
|
+
* Deliberately separate from {@link getBundledSkillTemplates}: `optional-skills/`
|
|
63
|
+
* is NOT scanned by the bundled pipeline, so default `cstl init` never installs
|
|
64
|
+
* these. They are installed only through `cstl init --with-optional <name>`.
|
|
65
|
+
* Results are cached after first call.
|
|
66
|
+
*/
|
|
67
|
+
export declare function getOptionalSkillTemplates(): CommonOptionalSkill[];
|
|
48
68
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAuBH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,KAAK,EAAE,sBAAsB,EAAE,CAAC;CACjC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAuBH,MAAM,WAAW,cAAc;IAC7B,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,sBAAsB;IACrC,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,0EAA0E;IAC1E,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,KAAK,EAAE,sBAAsB,EAAE,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,2DAA2D;IAC3D,KAAK,EAAE,sBAAsB,EAAE,CAAC;CACjC;AAQD;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,EAAE,CAMtD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,cAAc,EAAE,CAMpD;AA2CD;;;;;GAKG;AACH,wBAAgB,wBAAwB,IAAI,kBAAkB,EAAE,CAM/D;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,IAAI,mBAAmB,EAAE,CAMjE"}
|
|
@@ -32,6 +32,7 @@ function listMarkdownFiles(dir) {
|
|
|
32
32
|
let cachedCommands;
|
|
33
33
|
let cachedSkills;
|
|
34
34
|
let cachedBundledSkills;
|
|
35
|
+
let cachedOptionalSkills;
|
|
35
36
|
/**
|
|
36
37
|
* Get all command templates (stay as slash commands on all platforms).
|
|
37
38
|
* Results are cached after first call.
|
|
@@ -67,8 +68,8 @@ function listDirectories(dir) {
|
|
|
67
68
|
function toPosixRelativePath(root, filePath) {
|
|
68
69
|
return relative(root, filePath).split(sep).join("/");
|
|
69
70
|
}
|
|
70
|
-
function
|
|
71
|
-
const root = join(__dirname,
|
|
71
|
+
function listSkillFiles(rootDir, skillDir) {
|
|
72
|
+
const root = join(__dirname, rootDir, skillDir);
|
|
72
73
|
const files = [];
|
|
73
74
|
function walk(dir) {
|
|
74
75
|
for (const entry of readdirSync(dir)) {
|
|
@@ -88,6 +89,9 @@ function listBundledSkillFiles(skillDir) {
|
|
|
88
89
|
walk(root);
|
|
89
90
|
return files.sort((a, b) => a.relativePath.localeCompare(b.relativePath));
|
|
90
91
|
}
|
|
92
|
+
function listBundledSkillFiles(skillDir) {
|
|
93
|
+
return listSkillFiles("bundled-skills", skillDir);
|
|
94
|
+
}
|
|
91
95
|
/**
|
|
92
96
|
* Get all multi-file built-in skills.
|
|
93
97
|
*
|
|
@@ -101,4 +105,19 @@ export function getBundledSkillTemplates() {
|
|
|
101
105
|
}));
|
|
102
106
|
return cachedBundledSkills;
|
|
103
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Get all optional/experimental skills (e.g. `optional-skills/chrome-cdp/`).
|
|
110
|
+
*
|
|
111
|
+
* Deliberately separate from {@link getBundledSkillTemplates}: `optional-skills/`
|
|
112
|
+
* is NOT scanned by the bundled pipeline, so default `cstl init` never installs
|
|
113
|
+
* these. They are installed only through `cstl init --with-optional <name>`.
|
|
114
|
+
* Results are cached after first call.
|
|
115
|
+
*/
|
|
116
|
+
export function getOptionalSkillTemplates() {
|
|
117
|
+
cachedOptionalSkills ??= listDirectories("optional-skills").map((name) => ({
|
|
118
|
+
name,
|
|
119
|
+
files: listSkillFiles("optional-skills", name),
|
|
120
|
+
}));
|
|
121
|
+
return cachedOptionalSkills;
|
|
122
|
+
}
|
|
104
123
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/common/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,SAAS,YAAY,CAAC,YA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E,CAAC,CAAC;QACvE,IAAI;QACJ,KAAK,EAAE,qBAAqB,CAAC,IAAI,CAAC;KACnC,CAAC,CAAC,CAAC;IACJ,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB;IACvC,oBAAoB,KAAK,eAAe,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACzE,IAAI;QACJ,KAAK,EAAE,cAAc,CAAC,iBAAiB,EAAE,IAAI,CAAC;KAC/C,CAAC,CAAC,CAAC;IACJ,OAAO,oBAAoB,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: chrome-cdp
|
|
3
|
+
description: Interact with local Chrome browser session (only on explicit user approval after being asked to inspect, debug, or interact with a page open in Chrome)
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
> **experimental** — optional skill, installed on explicit request only (`cstl init --with-optional chrome-cdp`). Not a default Trellis capability.
|
|
7
|
+
>
|
|
8
|
+
> vendored from `blaze-skills/chrome-cdp@4ed61ff`(源 commit);同步机制:改源 → 拷副本 → 更新本标记。不要直接在本副本上分叉内容。
|
|
9
|
+
|
|
10
|
+
# Chrome CDP
|
|
11
|
+
|
|
12
|
+
Lightweight Chrome DevTools Protocol CLI. Connects directly via WebSocket — no Puppeteer, works with 100+ tabs, instant connection.
|
|
13
|
+
|
|
14
|
+
## Required Safety Wording
|
|
15
|
+
|
|
16
|
+
> Use Chrome CDP only after the user explicitly approves interacting with their existing local Chrome browser session for this task. This skill can reveal open tabs, page content, authenticated data, screenshots, profile state, and extension-influenced behavior, and it can mutate real browser state through navigation, clicks, typing, new tabs, or arbitrary CDP commands. Prefer Playwright MCP for reproducible browser automation and UI verification. Ask before `list`; ask again before inspecting content, taking screenshots, evaluating JavaScript, navigating, clicking, typing, opening tabs, or using raw CDP commands. Never use this skill for routine browser tests or when a controlled Playwright/sessionless check is sufficient.
|
|
17
|
+
|
|
18
|
+
## Channel Selection (three-way)
|
|
19
|
+
|
|
20
|
+
| Channel | Status | Use for |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| Playwright MCP | **default** | Reproducible browser automation, rendered UI evidence, screenshots, UI smoke verification |
|
|
23
|
+
| `cursor-ide-browser` (IDE preview) | IDE 预览 | Page inspection/preview inside the IDE without touching the user's real Chrome profile |
|
|
24
|
+
| `chrome-cdp` (this skill) | real Chrome, attach-only on approval | Inspect/debug/interact with the user's **already-open local Chrome session** (login state, cookies, tabs) — only after explicit user approval |
|
|
25
|
+
|
|
26
|
+
- If a `mcp__chrome-devtools__*` server is present in the environment, ask the user which channel they want: the chrome-devtools MCP server and this CDP CLI are **mutually exclusive** for a given interaction — never run both against the same tab.
|
|
27
|
+
- Never switch to MCP when the user explicitly requires CDP. CDP may have login state that MCP does not.
|
|
28
|
+
|
|
29
|
+
## Prerequisites
|
|
30
|
+
|
|
31
|
+
- Chrome (or Chromium, Brave, Edge, Vivaldi) with remote debugging enabled: open `chrome://inspect/#remote-debugging` and toggle the switch
|
|
32
|
+
- Node.js 22+ (uses built-in WebSocket)
|
|
33
|
+
- If your browser's `DevToolsActivePort` is in a non-standard location, set `CDP_PORT_FILE` to its full path
|
|
34
|
+
|
|
35
|
+
## Hard Constraints
|
|
36
|
+
|
|
37
|
+
- Never use `shot` to read page content. Use it only for visual debugging as a last resort.
|
|
38
|
+
- Always prefer `eval` plus `getBoundingClientRect()` over `shot` to find element coordinates.
|
|
39
|
+
- Always prefer `clickxy` over `click <selector>` unless you have a specific reason to use DOM click.
|
|
40
|
+
- Always check `window.location.href` and `list` after clicking.
|
|
41
|
+
- Always collect volatile page data in one `eval` call when possible.
|
|
42
|
+
- Never switch to MCP when the user explicitly requires CDP. CDP may have login state that MCP does not.
|
|
43
|
+
|
|
44
|
+
## Commands
|
|
45
|
+
|
|
46
|
+
All commands use `scripts/cdp.mjs`. The `<target>` is a **unique** targetId prefix from `list`.
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
scripts/cdp.mjs list # list all open tabs (* marks current active tab)
|
|
50
|
+
scripts/cdp.mjs eval <target> <expr> # run JS in page context
|
|
51
|
+
scripts/cdp.mjs clickxy <target> <x> <y> # real mouse click at CSS px coords (preferred)
|
|
52
|
+
scripts/cdp.mjs click <target> <selector> # DOM click by CSS selector (SPA-unreliable)
|
|
53
|
+
scripts/cdp.mjs nav <target> <url> # navigate and wait for load
|
|
54
|
+
scripts/cdp.mjs snap <target> # accessibility tree (token-light alternative to shot)
|
|
55
|
+
scripts/cdp.mjs type <target> <text> # insert text at current focus
|
|
56
|
+
scripts/cdp.mjs html <target> [selector] # full page or element HTML
|
|
57
|
+
scripts/cdp.mjs shot <target> [file] # screenshot (last resort, very token-heavy)
|
|
58
|
+
scripts/cdp.mjs net <target> # network performance entries (resource timing)
|
|
59
|
+
scripts/cdp.mjs loadall <target> <selector> [ms] # [exceptional] repeatedly click a "load more" button until it disappears
|
|
60
|
+
scripts/cdp.mjs evalraw <target> <method> [json] # [exceptional] send a raw CDP command; returns JSON result
|
|
61
|
+
scripts/cdp.mjs open [url] # open new tab
|
|
62
|
+
scripts/cdp.mjs stop [target] # stop daemon(s)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- `net` is safe, read-only (resource timing entries).
|
|
66
|
+
- `loadall` is **exceptional**: it mutates the real page repeatedly; ask for explicit approval before using it.
|
|
67
|
+
- `evalraw` is **exceptional**: it exposes arbitrary CDP methods beyond the curated command list; require exceptional approval before using it.
|
|
68
|
+
|
|
69
|
+
## Active Tab Detection (macOS)
|
|
70
|
+
|
|
71
|
+
`list` automatically marks the currently focused Chrome tab with `*` using AppleScript:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
(* = current active tab in Chrome)
|
|
75
|
+
* B5404DDD MiMo-V2-Pro & Omni & TTS ... https://www.reddit.com/...
|
|
76
|
+
5BE8FE3C Google 新聞 https://news.google.com/...
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
- On first run, macOS may show an automation permission dialog — click Allow once.
|
|
80
|
+
- Only works on macOS; silently skipped on other platforms.
|
|
81
|
+
- Reflects the real Chrome foreground tab, updates on every `list` call.
|
|
82
|
+
- **Use this to quickly identify the target without manually matching URLs.**
|
|
83
|
+
|
|
84
|
+
## Windows
|
|
85
|
+
|
|
86
|
+
- Windows uses a **named pipe** per tab (`\\.\pipe\cdp-<targetId>`) instead of a Unix socket; runtime files live under `%LOCALAPPDATA%\cdp\`.
|
|
87
|
+
- Chrome may show an **"Allow debugging?"** popup once per tab daemon — click Allow once. If the daemon fails to start, the error message explicitly asks whether you clicked Allow in Chrome.
|
|
88
|
+
- Remote debugging must be enabled at `chrome://inspect/#remote-debugging` (Windows supported; `DevToolsActivePort` is discovered under `%LOCALAPPDATA%\<browser>\User Data\`).
|
|
89
|
+
|
|
90
|
+
## Coordinates
|
|
91
|
+
|
|
92
|
+
`shot` saves at native resolution: image pixels = CSS pixels × DPR. `clickxy` takes **CSS pixels**.
|
|
93
|
+
Use this conversion only if you already have a screenshot for visual debugging. Do not take a screenshot just to compute click coordinates.
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
CSS px = screenshot px / DPR
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Workflow
|
|
100
|
+
|
|
101
|
+
### Identify the right target quickly
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Run list — the * tab is what the user currently has open in Chrome
|
|
105
|
+
scripts/cdp.mjs list
|
|
106
|
+
# → use the * prefix directly as <target>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Click a JS-driven link (SPA / Google News / React apps)
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# 1. Get element center in CSS px via JS (no screenshot needed)
|
|
113
|
+
eval <target> "var el=document.querySelector('a[href*=\"keyword\"]'); var r=el.getBoundingClientRect(); ((r.left+r.right)/2)+','+((r.top+r.bottom)/2)"
|
|
114
|
+
# → "908,555"
|
|
115
|
+
|
|
116
|
+
# 2. Click using real mouse input
|
|
117
|
+
clickxy <target> 908 555
|
|
118
|
+
|
|
119
|
+
# 3a. Check if current tab navigated
|
|
120
|
+
eval <target> "window.location.href"
|
|
121
|
+
|
|
122
|
+
# 3b. Check if a new tab opened (compare before/after)
|
|
123
|
+
list
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Detect new tab after click
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Before click — note existing targetIds
|
|
130
|
+
list
|
|
131
|
+
# Click ...
|
|
132
|
+
# After click — new entry = new tab
|
|
133
|
+
list
|
|
134
|
+
# Inspect the new tab
|
|
135
|
+
eval <new-target-prefix> "window.location.href"
|
|
136
|
+
eval <new-target-prefix> "document.title"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Inspect page content efficiently
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
# Preferred: JS query (near-zero tokens)
|
|
143
|
+
eval <target> "document.title"
|
|
144
|
+
eval <target> "Array.from(document.querySelectorAll('a[href*=\"/news/\"]')).map(a=>a.innerText+' | '+a.href).join('\n')"
|
|
145
|
+
|
|
146
|
+
# Alternative: accessibility tree (compact, structured)
|
|
147
|
+
snap <target>
|
|
148
|
+
|
|
149
|
+
# Avoid: screenshot (only when visual layout truly needed)
|
|
150
|
+
shot <target>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Token Cost Guide
|
|
154
|
+
|
|
155
|
+
| Command | Relative cost | Use when |
|
|
156
|
+
|---------|--------------|----------|
|
|
157
|
+
| `eval` | Very low | Reading text, coords, URLs, DOM state |
|
|
158
|
+
| `snap` | Low–Medium | Need page structure overview |
|
|
159
|
+
| `html` | Medium | Need raw HTML of a section |
|
|
160
|
+
| `shot` | Very high | Visual debugging only (last resort) |
|
|
161
|
+
|
|
162
|
+
## Examples
|
|
163
|
+
|
|
164
|
+
| Example | Description |
|
|
165
|
+
|---------|-------------|
|
|
166
|
+
| [`examples/fetch-hook-api-capture.md`](examples/fetch-hook-api-capture.md) | Intercept SPA API responses by injecting a fetch/XHR hook via `eval` — covers inject → trigger → read → paginate workflow |
|
|
167
|
+
|
|
168
|
+
## Runtime Artifacts & Cleanup
|
|
169
|
+
|
|
170
|
+
- Each tab runs a per-tab daemon (holds the CDP session; auto-exits after 20 min idle or when the tab closes).
|
|
171
|
+
- `pages.json` cache + screenshots live in the runtime dir: `%LOCALAPPDATA%\cdp\` (Windows), `$XDG_RUNTIME_DIR/cdp` or `~/.cache/cdp` (Linux), `~/Library/Caches`-adjacent `~/.cache/cdp` (macOS).
|
|
172
|
+
- Stop daemons explicitly when done: `scripts/cdp.mjs stop` (all) or `scripts/cdp.mjs stop <target>` (one).
|
|
173
|
+
- Screenshots saved without an explicit path land in the runtime dir (`screenshot-<target>.png`) — delete them after use; they are local residual artifacts, not evidence for task verification.
|
|
174
|
+
|
|
175
|
+
## When NOT to use this skill
|
|
176
|
+
|
|
177
|
+
- Page content can be fetched statically (use `WebFetch` instead).
|
|
178
|
+
- User has not explicitly asked to interact with Chrome.
|
|
179
|
+
- A controlled Playwright/sessionless check is sufficient.
|