ultimate-pi 0.18.0 → 0.19.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/.agents/skills/harness-debate-plan/SKILL.md +1 -1
- package/.agents/skills/harness-decisions/SKILL.md +2 -3
- package/.agents/skills/harness-governor/SKILL.md +6 -5
- package/.agents/skills/harness-orchestration/SKILL.md +4 -4
- package/.agents/skills/harness-review/SKILL.md +7 -7
- package/.agents/skills/harness-sentrux-setup/SKILL.md +4 -3
- package/.agents/skills/harness-steer/SKILL.md +1 -1
- package/.agents/skills/sentrux/SKILL.md +9 -9
- package/.pi/PACKAGING.md +4 -4
- package/.pi/SYSTEM.md +54 -120
- package/.pi/agents/harness/incident-recorder.md +0 -1
- package/.pi/agents/harness/planning/decompose.md +1 -3
- package/.pi/agents/harness/planning/execution-plan-author.md +0 -2
- package/.pi/agents/harness/planning/hypothesis-validator.md +0 -2
- package/.pi/agents/harness/planning/hypothesis.md +0 -2
- package/.pi/agents/harness/planning/implementation-researcher.md +0 -2
- package/.pi/agents/harness/planning/plan-adversary.md +0 -2
- package/.pi/agents/harness/planning/plan-evaluator.md +1 -3
- package/.pi/agents/harness/planning/planning-context.md +0 -2
- package/.pi/agents/harness/planning/review-integrator.md +0 -2
- package/.pi/agents/harness/planning/sprint-contract-auditor.md +0 -2
- package/.pi/agents/harness/planning/stack-researcher.md +0 -2
- package/.pi/agents/harness/{adversary.md → reviewing/adversary.md} +0 -2
- package/.pi/agents/harness/{evaluator.md → reviewing/evaluator.md} +0 -2
- package/.pi/agents/harness/{tie-breaker.md → reviewing/tie-breaker.md} +0 -2
- package/.pi/agents/harness/{executor.md → running/executor.md} +0 -2
- package/.pi/agents/harness/sentrux-bootstrap.md +0 -1
- package/.pi/agents/harness/sentrux-steward.md +0 -2
- package/.pi/agents/harness/trace-librarian.md +0 -1
- package/.pi/extensions/00-harness-project-control.ts +133 -0
- package/.pi/extensions/00-posthog-network-bootstrap.ts +1 -1
- package/.pi/extensions/agt-kill-switch.ts +57 -0
- package/.pi/extensions/agt-prompt-guard.ts +32 -0
- package/.pi/extensions/budget-guard.ts +2 -0
- package/.pi/extensions/custom-footer.ts +46 -145
- package/.pi/extensions/custom-header.ts +1 -1
- package/.pi/extensions/custom-system-prompt.ts +1 -1
- package/.pi/extensions/debate-orchestrator.ts +7 -5
- package/.pi/extensions/harness-ask-user.ts +8 -8
- package/.pi/extensions/harness-debate-tools.ts +27 -43
- package/.pi/extensions/harness-lens.ts +94 -0
- package/.pi/extensions/harness-live-widget.ts +33 -2
- package/.pi/extensions/harness-plan-approval.ts +12 -12
- package/.pi/extensions/harness-run-context.ts +1214 -852
- package/.pi/extensions/harness-subagent-governance.ts +8 -0
- package/.pi/extensions/harness-subagent-submit.ts +36 -164
- package/.pi/extensions/harness-subagents.ts +4 -4
- package/.pi/extensions/harness-telemetry.ts +3 -1
- package/.pi/extensions/harness-web-tools.ts +3 -3
- package/.pi/extensions/observation-bus.ts +2 -0
- package/.pi/extensions/policy-gate.ts +27 -5
- package/.pi/extensions/review-integrity.ts +91 -10
- package/.pi/extensions/sentrux-rules-sync.ts +3 -1
- package/.pi/extensions/subagent-governance.ts +92 -0
- package/.pi/extensions/test-diff-integrity.ts +1 -0
- package/.pi/extensions/trace-recorder.ts +3 -1
- package/.pi/extensions/{ultimate-pi-vcc.ts → vcc-compaction.ts} +1 -1
- package/.pi/harness/README.md +6 -2
- package/.pi/harness/agents.manifest.json +38 -49
- package/.pi/harness/agents.policy.yaml +275 -0
- package/.pi/harness/corpus/graphify-kb-updater.config.json +55 -0
- package/.pi/harness/docs/adrs/0006-sentrux-dual-layer.md +2 -1
- package/.pi/harness/docs/adrs/0030-inhouse-vcc-compaction.md +1 -1
- package/.pi/harness/docs/adrs/0035-plan-phase-review-gate.md +1 -1
- package/.pi/harness/docs/adrs/0044-harness-steer-loop.md +3 -2
- package/.pi/harness/docs/adrs/0045-harness-lens-minimal-contract.md +49 -0
- package/.pi/harness/docs/adrs/0045-phase-scoped-agent-directories.md +33 -0
- package/.pi/harness/docs/adrs/0046-agt-policy-engine.md +51 -0
- package/.pi/harness/docs/adrs/0047-agt-layered-security.md +39 -0
- package/.pi/harness/docs/adrs/0048-tool-call-hook-order.md +25 -0
- package/.pi/harness/docs/adrs/0049-agents-policy-manifest.md +36 -0
- package/.pi/harness/docs/adrs/README.md +6 -0
- package/.pi/harness/docs/graphify-kb-updater-runbook.md +11 -5
- package/.pi/harness/docs/practice-map.md +2 -2
- package/.pi/harness/evolution/README.md +1 -2
- package/.pi/harness/examples/agents.policy.project.yaml +19 -0
- package/.pi/harness/examples/policies/custom-deny-bash.yaml +9 -0
- package/.pi/harness/policies/bash-denylists.yaml +5 -0
- package/.pi/harness/policies/defaults.yaml +51 -0
- package/.pi/harness/policies/orchestrator.yaml +18 -0
- package/.pi/harness/policies/phases.yaml +10 -0
- package/.pi/harness/policies/roles.yaml +5 -0
- package/.pi/harness/policies/web-guard.yaml +5 -0
- package/.pi/harness/policies/workflow-sequences.yaml +9 -0
- package/.pi/harness/sentrux/architecture.manifest.json +26 -4
- package/.pi/harness/specs/harness-spawn-context.schema.json +1 -1
- package/.pi/harness/specs/observation.schema.json +2 -1
- package/.pi/lib/agents-policy.d.mts +70 -0
- package/.pi/lib/agents-policy.mjs +325 -0
- package/.pi/lib/agents-policy.ts +19 -0
- package/.pi/lib/agt/audit-run-sink.ts +52 -0
- package/.pi/lib/agt/build-evaluation-context.ts +285 -0
- package/.pi/lib/agt/config.ts +28 -0
- package/.pi/lib/agt/delegation.ts +69 -0
- package/.pi/lib/agt/evaluate-policy.ts +56 -0
- package/.pi/lib/agt/identity-registry.ts +41 -0
- package/.pi/lib/agt/index.ts +55 -0
- package/.pi/lib/agt/kill-switch-state.ts +11 -0
- package/.pi/lib/agt/legacy-evaluate.ts +101 -0
- package/.pi/lib/agt/policy-engine.ts +154 -0
- package/.pi/lib/agt/rings.ts +21 -0
- package/.pi/lib/agt/sre-hooks.ts +45 -0
- package/.pi/lib/agt/trust-run-store.ts +26 -0
- package/.pi/lib/agt/workflow-history.ts +29 -0
- package/.pi/lib/agt-governance-active.ts +14 -0
- package/.pi/lib/agt-tool-guard.ts +78 -0
- package/.pi/lib/ask-user/dialog.ts +314 -0
- package/.pi/{extensions/lib → lib}/debate-bus-core.ts +10 -10
- package/.pi/{extensions/lib → lib}/debate-bus-state.ts +1 -1
- package/.pi/{extensions/lib → lib}/extension-load-guard.ts +21 -0
- package/.pi/lib/harness-agt-tool-guard.ts +5 -0
- package/.pi/{extensions/lib → lib}/harness-artifact-gate.ts +6 -16
- package/.pi/lib/harness-debate-core-deps.ts +14 -0
- package/.pi/lib/harness-debate-workflow-deps.ts +43 -0
- package/.pi/lib/harness-lens/.gitattributes +1 -0
- package/.pi/lib/harness-lens/clients/edit-autopatch.ts +88 -0
- package/.pi/lib/harness-lens/clients/file-kinds.ts +380 -0
- package/.pi/lib/harness-lens/clients/file-time.ts +215 -0
- package/.pi/lib/harness-lens/clients/file-utils.ts +484 -0
- package/.pi/lib/harness-lens/clients/format-service.ts +276 -0
- package/.pi/lib/harness-lens/clients/formatters.ts +1000 -0
- package/.pi/lib/harness-lens/clients/git-guard.ts +31 -0
- package/.pi/lib/harness-lens/clients/indent-retarget.ts +90 -0
- package/.pi/lib/harness-lens/clients/installer/index.ts +2368 -0
- package/.pi/lib/harness-lens/clients/latency-logger.ts +80 -0
- package/.pi/lib/harness-lens/clients/lens-config.ts +43 -0
- package/.pi/lib/harness-lens/clients/lens-events.ts +164 -0
- package/.pi/lib/harness-lens/clients/lsp/aggregation.ts +91 -0
- package/.pi/lib/harness-lens/clients/lsp/client.ts +1466 -0
- package/.pi/lib/harness-lens/clients/lsp/config.ts +216 -0
- package/.pi/lib/harness-lens/clients/lsp/edits.ts +297 -0
- package/.pi/lib/harness-lens/clients/lsp/index.ts +1355 -0
- package/.pi/lib/harness-lens/clients/lsp/interactive-install.ts +424 -0
- package/.pi/lib/harness-lens/clients/lsp/language.ts +223 -0
- package/.pi/lib/harness-lens/clients/lsp/launch.ts +939 -0
- package/.pi/lib/harness-lens/clients/lsp/lsp-index.ts +11 -0
- package/.pi/lib/harness-lens/clients/lsp/path-utils.ts +12 -0
- package/.pi/lib/harness-lens/clients/lsp/server-strategies.ts +81 -0
- package/.pi/lib/harness-lens/clients/lsp/server.ts +1971 -0
- package/.pi/lib/harness-lens/clients/path-utils.ts +182 -0
- package/.pi/lib/harness-lens/clients/pipeline.ts +360 -0
- package/.pi/lib/harness-lens/clients/project-profile.ts +117 -0
- package/.pi/lib/harness-lens/clients/runtime-agent-end.ts +112 -0
- package/.pi/lib/harness-lens/clients/runtime-config.ts +33 -0
- package/.pi/lib/harness-lens/clients/runtime-coordinator.ts +186 -0
- package/.pi/lib/harness-lens/clients/runtime-tool-result.ts +171 -0
- package/.pi/lib/harness-lens/clients/safe-spawn.ts +339 -0
- package/.pi/lib/harness-lens/clients/secrets-scanner.ts +214 -0
- package/.pi/lib/harness-lens/clients/tool-policy.ts +2072 -0
- package/.pi/lib/harness-lens/clients/types.ts +59 -0
- package/.pi/lib/harness-lens/clients/widget-state.ts +283 -0
- package/.pi/lib/harness-lens/index.ts +532 -0
- package/.pi/lib/harness-lens/tools/lsp-diagnostics.ts +706 -0
- package/.pi/lib/harness-lens/tools/lsp-navigation.ts +1246 -0
- package/.pi/{extensions/lib → lib}/harness-posthog.ts +3 -0
- package/.pi/lib/harness-project-config.ts +91 -0
- package/.pi/lib/harness-run-context-responses.ts +9 -0
- package/.pi/lib/harness-run-context.ts +1 -3
- package/.pi/{extensions/lib/spawn-policy.ts → lib/harness-spawn-policy.ts} +4 -3
- package/.pi/{extensions/lib → lib}/harness-spawn-topology.ts +5 -28
- package/.pi/lib/harness-subagent-auth.ts +51 -0
- package/.pi/{extensions/lib → lib}/harness-subagent-precheck.ts +13 -10
- package/.pi/{extensions/lib → lib}/harness-subagent-submit-pipeline.ts +3 -3
- package/.pi/lib/harness-subagent-submit-register.ts +163 -0
- package/.pi/{extensions/lib → lib}/harness-subagent-submit-registry.ts +1 -55
- package/.pi/{extensions/lib → lib}/harness-subagents-bridge.ts +53 -14
- package/.pi/{extensions/lib → lib}/harness-subprocess-bootstrap.ts +1 -1
- package/.pi/lib/harness-ui-state.ts +27 -12
- package/.pi/{extensions/lib → lib}/plan-approval/create-plan.ts +2 -2
- package/.pi/{extensions/lib → lib}/plan-approval/format-plan.ts +2 -2
- package/.pi/{extensions/lib → lib}/plan-approval/plan-review.ts +162 -201
- package/.pi/{extensions/lib → lib}/plan-approval/render.ts +1 -1
- package/.pi/{extensions/lib → lib}/plan-approval/resolve-disk.ts +2 -2
- package/.pi/{extensions/lib → lib}/plan-approval/types.ts +1 -1
- package/.pi/{extensions/lib → lib}/plan-approval/validate.ts +3 -3
- package/.pi/{extensions/lib → lib}/plan-approval-readiness.ts +3 -52
- package/.pi/{extensions/lib → lib}/plan-debate-envelope.ts +1 -1
- package/.pi/{extensions/lib → lib}/plan-debate-gate.ts +1 -1
- package/.pi/{extensions/lib → lib}/plan-debate-lane.ts +1 -4
- package/.pi/{extensions/lib → lib}/plan-messenger.ts +1 -1
- package/.pi/prompts/harness-auto.md +2 -2
- package/.pi/prompts/harness-plan.md +4 -6
- package/.pi/prompts/harness-review.md +9 -9
- package/.pi/prompts/harness-run.md +7 -7
- package/.pi/prompts/harness-setup.md +42 -68
- package/.pi/prompts/harness-steer.md +2 -2
- package/.pi/scripts/README.md +3 -5
- package/.pi/scripts/generate-agents-policy-yaml.mjs +148 -0
- package/.pi/scripts/graphify-kb-updater.mjs +48 -8
- package/.pi/scripts/harness-agents-manifest.mjs +61 -4
- package/.pi/scripts/harness-agt-doctor.ts +36 -0
- package/.pi/scripts/harness-cli-verify.sh +9 -2
- package/.pi/scripts/harness-project-toggle.mjs +129 -0
- package/.pi/scripts/harness-sentrux-cli.mjs +142 -0
- package/.pi/scripts/harness-verify.mjs +113 -39
- package/.pi/scripts/harness-web-policy-guard.mjs +2 -2
- package/.pi/scripts/validate-plan-dag.mjs +65 -74
- package/.pi/scripts/vendor-pi-vcc-settings.stub.ts +2 -2
- package/.pi/scripts/vendor-sync-pi-vcc.sh +1 -1
- package/.pi/skills/architecture/broker-domain/SKILL.md +65 -0
- package/.pi/skills/architecture/cqrs/SKILL.md +63 -0
- package/.pi/skills/architecture/event-driven/SKILL.md +60 -0
- package/.pi/skills/architecture/hexagonal-ports-adapters/SKILL.md +66 -0
- package/.pi/skills/architecture/layered/SKILL.md +68 -0
- package/.pi/skills/architecture/microkernel/SKILL.md +62 -0
- package/.pi/skills/architecture/microservices/SKILL.md +64 -0
- package/.pi/skills/architecture/modular-monolith/SKILL.md +65 -0
- package/.pi/skills/architecture/orchestration-driven-soa/SKILL.md +61 -0
- package/.pi/skills/architecture/pipeline/SKILL.md +63 -0
- package/.pi/skills/architecture/service-based/SKILL.md +64 -0
- package/.pi/skills/architecture/service-mesh/SKILL.md +60 -0
- package/.pi/skills/architecture/space-based/SKILL.md +60 -0
- package/.pi/skills/ast-grep/SKILL.md +40 -321
- package/.pi/skills/delivery/debugging-discipline/SKILL.md +36 -0
- package/.pi/skills/delivery/documentation-update/SKILL.md +33 -0
- package/.pi/skills/delivery/requirements-to-implementation/SKILL.md +34 -0
- package/.pi/skills/delivery/risk-based-verification/SKILL.md +43 -0
- package/.pi/skills/delivery/tradeoff-analysis/SKILL.md +34 -0
- package/.pi/skills/engineering/api-contract-design/SKILL.md +38 -0
- package/.pi/skills/engineering/cohesion-coupling/SKILL.md +43 -0
- package/.pi/skills/engineering/complexity-control/SKILL.md +31 -0
- package/.pi/skills/engineering/defensive-programming/SKILL.md +38 -0
- package/.pi/skills/engineering/dependency-management/SKILL.md +29 -0
- package/.pi/skills/engineering/domain-modeling/SKILL.md +32 -0
- package/.pi/skills/engineering/error-handling/SKILL.md +37 -0
- package/.pi/skills/engineering/legacy-code-seams/SKILL.md +35 -0
- package/.pi/skills/engineering/naming-and-intent/SKILL.md +29 -0
- package/.pi/skills/engineering/refactoring-safe-evolution/SKILL.md +35 -0
- package/.pi/skills/engineering/routine-function-design/SKILL.md +34 -0
- package/.pi/skills/engineering/small-change-discipline/SKILL.md +35 -0
- package/.pi/skills/lsp-navigation/SKILL.md +89 -0
- package/.pi/skills/quality/code-review-self-check/SKILL.md +35 -0
- package/.pi/skills/quality/privacy-data-handling/SKILL.md +26 -0
- package/.pi/skills/quality/security-review/SKILL.md +34 -0
- package/.pi/skills/quality/test-strategy/SKILL.md +33 -0
- package/.pi/skills/quality/testability-design/SKILL.md +33 -0
- package/.pi/skills/systems/concurrency-safety/SKILL.md +32 -0
- package/.pi/skills/systems/data-modeling-migrations/SKILL.md +31 -0
- package/.pi/skills/systems/observability-instrumentation/SKILL.md +32 -0
- package/.pi/skills/systems/performance-measurement/SKILL.md +35 -0
- package/.pi/skills/systems/reliability-design/SKILL.md +32 -0
- package/.sentrux/rules.toml +20 -4
- package/AGENTS.md +5 -0
- package/CHANGELOG.md +26 -0
- package/README.md +85 -58
- package/THIRD_PARTY_NOTICES.md +12 -21
- package/package.json +15 -7
- package/vendor/pi-subagents/src/agents.ts +45 -1
- package/vendor/pi-subagents/src/subagents.ts +866 -811
- package/vendor/pi-vcc/src/core/brief.ts +68 -99
- package/vendor/pi-vcc/src/core/settings.ts +2 -2
- package/.agents/skills/caveman/SKILL.md +0 -67
- package/.pi/agents/harness/meta-optimizer.md +0 -36
- package/.pi/agents/harness/planning/scout-graphify.md +0 -39
- package/.pi/agents/harness/planning/scout-semantic.md +0 -41
- package/.pi/agents/harness/planning/scout-structure.md +0 -37
- package/.pi/extensions/lib/ask-user/dialog.ts +0 -260
- package/.pi/extensions/lib/harness-subagent-auth.ts +0 -209
- package/.pi/extensions/lib/harness-subagent-policy.ts +0 -236
- package/.pi/extensions/pi-model-router-harness.ts +0 -42
- package/.pi/harness/evolution/meta-optimizer.mjs +0 -99
- package/.pi/harness/specs/router-tuning-proposal.schema.json +0 -114
- package/.pi/model-router.example.json +0 -36
- package/.pi/prompts/harness-critic.md +0 -10
- package/.pi/prompts/harness-eval.md +0 -10
- package/.pi/prompts/harness-router-tune.md +0 -52
- package/.pi/scripts/harness-generate-model-router.mjs +0 -327
- package/.pi/scripts/harness-model-router-routing.test.mjs +0 -97
- package/.pi/scripts/harness-sync-model-router.mjs +0 -97
- package/.pi/scripts/vendor-sync-pi-model-router.sh +0 -47
- package/vendor/pi-model-router/.prettierignore +0 -4
- package/vendor/pi-model-router/.prettierrc +0 -5
- package/vendor/pi-model-router/AGENTS.md +0 -39
- package/vendor/pi-model-router/LICENSE +0 -21
- package/vendor/pi-model-router/README.md +0 -99
- package/vendor/pi-model-router/UPSTREAM_PIN.md +0 -10
- package/vendor/pi-model-router/docs/ARCHITECTURE.md +0 -54
- package/vendor/pi-model-router/extensions/commands.ts +0 -720
- package/vendor/pi-model-router/extensions/config.ts +0 -348
- package/vendor/pi-model-router/extensions/constants.ts +0 -1
- package/vendor/pi-model-router/extensions/index.ts +0 -478
- package/vendor/pi-model-router/extensions/provider.ts +0 -580
- package/vendor/pi-model-router/extensions/routing.ts +0 -564
- package/vendor/pi-model-router/extensions/state.ts +0 -52
- package/vendor/pi-model-router/extensions/types.ts +0 -95
- package/vendor/pi-model-router/extensions/ui.ts +0 -144
- package/vendor/pi-model-router/model-router.example.json +0 -48
- package/vendor/pi-model-router/package.json +0 -48
- package/vendor/pi-model-router/tsconfig.json +0 -16
- /package/.pi/{prompts → harness/docs}/planning-rubrics.md +0 -0
- /package/.pi/{extensions/lib → lib}/ask-user/fallback.ts +0 -0
- /package/.pi/{extensions/lib → lib}/ask-user/render.ts +0 -0
- /package/.pi/{extensions/lib → lib}/ask-user/schema.ts +0 -0
- /package/.pi/{extensions/lib → lib}/ask-user/types.ts +0 -0
- /package/.pi/{extensions/lib → lib}/ask-user/validate-core.mjs +0 -0
- /package/.pi/{extensions/lib → lib}/ask-user/validate.ts +0 -0
- /package/.pi/{extensions/lib → lib}/harness-cocoindex-refresh.ts +0 -0
- /package/.pi/{extensions/lib → lib}/harness-paths.ts +0 -0
- /package/.pi/{extensions/lib → lib}/harness-spawn-budget.ts +0 -0
- /package/.pi/{extensions/lib → lib}/harness-vcc-settings.ts +0 -0
- /package/.pi/{extensions/lib → lib}/harness-web/run-cli.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-approval/dialog.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-approval/schema.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-debate-eligibility.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-debate-focus.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-debate-id.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-debate-lanes.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-debate-round-status.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-debate-write-guard.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-review-gate.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-review-integrator-rules.ts +0 -0
- /package/.pi/{extensions/lib → lib}/plan-scope-guard.ts +0 -0
- /package/.pi/{extensions/lib → lib}/posthog-client.ts +0 -0
- /package/.pi/{extensions/lib → lib}/posthog-node.d.ts +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tradeoff-analysis
|
|
3
|
+
description: Make engineering tradeoffs explicit before choosing an implementation. Use when multiple viable approaches exist or when simplicity, maintainability, performance, reliability, compatibility, security, and delivery speed conflict. Chooses the least-worst option with rationale.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Tradeoff Analysis
|
|
7
|
+
|
|
8
|
+
Use this skill when there is no single obviously best approach.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. State the decision to make.
|
|
13
|
+
2. List forces: correctness, simplicity, maintainability, performance, reliability, scalability, security, compatibility, cost, delivery speed, and operability.
|
|
14
|
+
3. Identify two or three realistic options.
|
|
15
|
+
4. Compare each option against the forces and project constraints.
|
|
16
|
+
5. Choose the least-worst option for the current context.
|
|
17
|
+
6. Record why rejected options were not chosen when the decision matters.
|
|
18
|
+
7. Keep the implementation aligned with the chosen tradeoff.
|
|
19
|
+
|
|
20
|
+
## Output shape
|
|
21
|
+
|
|
22
|
+
- Decision:
|
|
23
|
+
- Constraints:
|
|
24
|
+
- Options:
|
|
25
|
+
- Chosen approach:
|
|
26
|
+
- Why:
|
|
27
|
+
- Risks:
|
|
28
|
+
- Verification:
|
|
29
|
+
|
|
30
|
+
## Avoid
|
|
31
|
+
|
|
32
|
+
- Generic best-practice claims without project context.
|
|
33
|
+
- Optimizing for future scale without evidence.
|
|
34
|
+
- Choosing complexity because it feels more professional.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: api-contract-design
|
|
3
|
+
description: Design stable contracts for modules, services, commands, events, plugins, CLIs, and public interfaces. Use when adding or changing any boundary that other code or people depend on. Focuses on minimal contracts, compatibility, versioning, errors, idempotency, and documentation.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# API and Contract Design
|
|
7
|
+
|
|
8
|
+
Use this skill for any boundary with callers or consumers.
|
|
9
|
+
|
|
10
|
+
## Contract elements
|
|
11
|
+
|
|
12
|
+
Define:
|
|
13
|
+
|
|
14
|
+
- purpose and owner
|
|
15
|
+
- inputs and validation rules
|
|
16
|
+
- outputs and guarantees
|
|
17
|
+
- error cases
|
|
18
|
+
- idempotency and ordering expectations
|
|
19
|
+
- compatibility/versioning expectations
|
|
20
|
+
- security and privacy constraints
|
|
21
|
+
- observability expectations
|
|
22
|
+
|
|
23
|
+
## Workflow
|
|
24
|
+
|
|
25
|
+
1. Identify consumers and their real needs.
|
|
26
|
+
2. Keep the contract smaller than the implementation model.
|
|
27
|
+
3. Separate public contract from internal representation.
|
|
28
|
+
4. Make defaults and optional fields explicit.
|
|
29
|
+
5. Preserve backward compatibility unless a breaking change is approved.
|
|
30
|
+
6. Add contract tests or examples for important cases.
|
|
31
|
+
7. Document semantics near the contract surface.
|
|
32
|
+
|
|
33
|
+
## Review questions
|
|
34
|
+
|
|
35
|
+
- Can the implementation change without breaking consumers?
|
|
36
|
+
- Are failure modes part of the contract?
|
|
37
|
+
- Is the contract stable enough to test?
|
|
38
|
+
- Are names domain-specific and unambiguous?
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cohesion-coupling
|
|
3
|
+
description: Improve code-level modularity by increasing cohesion and reducing accidental coupling. Use when splitting files/components, moving logic, introducing boundaries, or reviewing dependency direction. Focuses on reason-to-change, dependency minimization, and cognitive load.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Cohesion and Coupling
|
|
7
|
+
|
|
8
|
+
Use this skill to make code easier to understand and change.
|
|
9
|
+
|
|
10
|
+
## Cohesion checks
|
|
11
|
+
|
|
12
|
+
Keep together code that:
|
|
13
|
+
|
|
14
|
+
- changes for the same reason
|
|
15
|
+
- enforces the same invariant
|
|
16
|
+
- uses the same domain language
|
|
17
|
+
- participates in the same workflow step
|
|
18
|
+
- shares a stable lifecycle
|
|
19
|
+
|
|
20
|
+
## Coupling checks
|
|
21
|
+
|
|
22
|
+
Reduce dependencies that are:
|
|
23
|
+
|
|
24
|
+
- unnecessary for the caller's purpose
|
|
25
|
+
- pointed from stable code to volatile code
|
|
26
|
+
- created only for convenience
|
|
27
|
+
- transitive through broad utility modules
|
|
28
|
+
- hidden through globals or ambient context
|
|
29
|
+
|
|
30
|
+
## Workflow
|
|
31
|
+
|
|
32
|
+
1. Identify the responsibility being changed.
|
|
33
|
+
2. List current dependencies and call direction.
|
|
34
|
+
3. Move behavior toward the concept that owns the rule.
|
|
35
|
+
4. Expose a narrow facade instead of leaking internals.
|
|
36
|
+
5. Remove dependency cycles or document why they cannot be removed now.
|
|
37
|
+
6. Verify call sites still read clearly.
|
|
38
|
+
|
|
39
|
+
## Avoid
|
|
40
|
+
|
|
41
|
+
- Splitting code by technical layer when the change is domain-local.
|
|
42
|
+
- Central helper modules that collect unrelated behavior.
|
|
43
|
+
- Abstractions that reduce lines but increase conceptual coupling.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: complexity-control
|
|
3
|
+
description: Reduce accidental complexity while preserving essential behavior. Use when code becomes hard to reason about, branches multiply, abstractions feel premature, or a simple feature is spreading across many files. Focuses on explicitness, concept deduplication, and avoiding clever generic designs.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Complexity Control
|
|
7
|
+
|
|
8
|
+
Use this skill to make the simplest correct change.
|
|
9
|
+
|
|
10
|
+
## Distinguish complexity types
|
|
11
|
+
|
|
12
|
+
- Essential complexity: required by the domain, correctness, scale, security, or compatibility.
|
|
13
|
+
- Accidental complexity: introduced by unclear structure, duplication, premature abstraction, hidden state, or over-generalization.
|
|
14
|
+
|
|
15
|
+
## Workflow
|
|
16
|
+
|
|
17
|
+
1. State the problem in one sentence.
|
|
18
|
+
2. Identify the minimum concepts needed to solve it.
|
|
19
|
+
3. Remove duplicate representations of the same concept.
|
|
20
|
+
4. Prefer straightforward control flow over clever indirection.
|
|
21
|
+
5. Add abstraction only after it clarifies repeated behavior or protects a real boundary.
|
|
22
|
+
6. Document unavoidable complexity near the code that needs it.
|
|
23
|
+
7. Verify that the final code has fewer paths a maintainer must simulate mentally.
|
|
24
|
+
|
|
25
|
+
## Warning signs
|
|
26
|
+
|
|
27
|
+
- Generic names with no domain meaning.
|
|
28
|
+
- Configuration that controls unrelated behaviors.
|
|
29
|
+
- Multiple sources of truth.
|
|
30
|
+
- Deep nesting or long chains of callbacks/handlers/coordinators.
|
|
31
|
+
- Abstraction introduced for a single use without a clear boundary.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: defensive-programming
|
|
3
|
+
description: Add robustness at trust boundaries and failure-prone code paths. Use when handling external input, persistence, IO, configuration, user data, inter-process calls, events, commands, or invariants. Guides validation, explicit failures, diagnostics, and invalid-state prevention.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Defensive Programming
|
|
7
|
+
|
|
8
|
+
Use this skill when code must survive bad inputs, partial failures, or violated assumptions.
|
|
9
|
+
|
|
10
|
+
## Boundary checks
|
|
11
|
+
|
|
12
|
+
Validate at trust boundaries:
|
|
13
|
+
|
|
14
|
+
- user or caller input
|
|
15
|
+
- configuration and environment
|
|
16
|
+
- serialized data
|
|
17
|
+
- storage reads
|
|
18
|
+
- network/process responses
|
|
19
|
+
- event/message payloads
|
|
20
|
+
- plugin or extension inputs
|
|
21
|
+
|
|
22
|
+
## Workflow
|
|
23
|
+
|
|
24
|
+
1. Identify trusted and untrusted data.
|
|
25
|
+
2. State required invariants and preconditions.
|
|
26
|
+
3. Normalize or reject invalid input at the boundary.
|
|
27
|
+
4. Fail explicitly with useful diagnostics.
|
|
28
|
+
5. Preserve causal context while avoiding secret leakage.
|
|
29
|
+
6. Make invalid states unrepresentable where practical.
|
|
30
|
+
7. Add tests for malformed, missing, boundary, and contradictory inputs.
|
|
31
|
+
|
|
32
|
+
## Guidelines
|
|
33
|
+
|
|
34
|
+
- Do not silently coerce ambiguous data.
|
|
35
|
+
- Do not swallow errors without observability.
|
|
36
|
+
- Distinguish programmer errors from recoverable runtime errors.
|
|
37
|
+
- Prefer clear guard clauses over deeply nested defensive logic.
|
|
38
|
+
- Keep validation close to where trust changes.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dependency-management
|
|
3
|
+
description: Prevent dependency sprawl and risky coupling to third-party or shared code. Use when adding, upgrading, replacing, or wrapping dependencies, libraries, tools, plugins, shared utilities, or platform services. Encourages reuse, isolation, compatibility checks, and lockfile discipline.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Dependency Management
|
|
7
|
+
|
|
8
|
+
Use this skill before introducing or changing a dependency.
|
|
9
|
+
|
|
10
|
+
## Decision workflow
|
|
11
|
+
|
|
12
|
+
1. Check whether the project already has an equivalent dependency or local utility.
|
|
13
|
+
2. Decide whether the task needs a dependency or simple local code is safer.
|
|
14
|
+
3. Evaluate maintenance, license, security, size, compatibility, and operational risk.
|
|
15
|
+
4. Isolate third-party APIs behind a local boundary when they affect core code.
|
|
16
|
+
5. Keep dependency updates scoped and explain lockfile changes.
|
|
17
|
+
6. Add tests around behavior that depends on external packages or services.
|
|
18
|
+
|
|
19
|
+
## Guidelines
|
|
20
|
+
|
|
21
|
+
- Do not add dependencies for trivial transformations.
|
|
22
|
+
- Avoid leaking vendor-specific types across domain or public boundaries.
|
|
23
|
+
- Prefer stable, actively maintained dependencies already accepted by the project.
|
|
24
|
+
- Treat major upgrades as behavior-risk changes.
|
|
25
|
+
- Document why the dependency is needed when the choice is non-obvious.
|
|
26
|
+
|
|
27
|
+
## Verification
|
|
28
|
+
|
|
29
|
+
Run dependency-aware checks available in the project: install/lockfile validation, tests, build, security audit, or compatibility checks as appropriate to risk.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: domain-modeling
|
|
3
|
+
description: Model business rules and domain concepts clearly. Use when adding features with domain behavior, invariants, workflows, policies, state transitions, commands, queries, or user/business terminology. Helps agents place rules correctly and avoid data-bag implementations.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Domain Modeling
|
|
7
|
+
|
|
8
|
+
Use this skill when correctness depends on business meaning, not just data movement.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. Extract domain language from requirements, existing code, tests, and docs.
|
|
13
|
+
2. Identify core concepts, actors, actions, policies, and invariants.
|
|
14
|
+
3. Distinguish commands that change state from queries that observe state.
|
|
15
|
+
4. Place invariants in the domain/core path, not only in UI or transport boundaries.
|
|
16
|
+
5. Represent meaningful values explicitly rather than passing ambiguous primitives everywhere.
|
|
17
|
+
6. Keep persistence and transport concerns separate from domain decisions.
|
|
18
|
+
7. Test domain rules directly where possible.
|
|
19
|
+
|
|
20
|
+
## Modeling prompts
|
|
21
|
+
|
|
22
|
+
- What must always be true?
|
|
23
|
+
- What state transitions are allowed or forbidden?
|
|
24
|
+
- Who is allowed to perform this action?
|
|
25
|
+
- What terms does the business use for this concept?
|
|
26
|
+
- Is this a rule, a calculation, a workflow, or mere data storage?
|
|
27
|
+
|
|
28
|
+
## Avoid
|
|
29
|
+
|
|
30
|
+
- Anemic data containers when behavior has rules.
|
|
31
|
+
- Duplicating the same rule in multiple adapters.
|
|
32
|
+
- Naming domain concepts after technical implementation details.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: error-handling
|
|
3
|
+
description: Design predictable, debuggable error behavior. Use when adding or changing failure paths, retries, validation, IO, service calls, event handling, command handling, or user-facing errors. Classifies errors, preserves causes, avoids secret leaks, and separates internal diagnostics from external messages.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Error Handling
|
|
7
|
+
|
|
8
|
+
Use this skill when a change can fail or when existing failure behavior is unclear.
|
|
9
|
+
|
|
10
|
+
## Error classes
|
|
11
|
+
|
|
12
|
+
Classify failures before coding:
|
|
13
|
+
|
|
14
|
+
- validation: caller supplied invalid data
|
|
15
|
+
- domain: business invariant rejected the action
|
|
16
|
+
- authorization: actor lacks permission
|
|
17
|
+
- not found/conflict: state does not match expectation
|
|
18
|
+
- infrastructure: storage, network, filesystem, process, or dependency failed
|
|
19
|
+
- transient: retry may succeed
|
|
20
|
+
- programmer: bug or violated internal invariant
|
|
21
|
+
- unknown: unexpected and should be surfaced with diagnostics
|
|
22
|
+
|
|
23
|
+
## Workflow
|
|
24
|
+
|
|
25
|
+
1. Identify who needs to act on the error: caller, user, operator, or developer.
|
|
26
|
+
2. Choose error shape consistent with the codebase.
|
|
27
|
+
3. Preserve cause/context for diagnostics.
|
|
28
|
+
4. Expose only safe, actionable messages externally.
|
|
29
|
+
5. Retry only if the operation is safe or idempotent.
|
|
30
|
+
6. Add tests for expected failure paths.
|
|
31
|
+
|
|
32
|
+
## Avoid
|
|
33
|
+
|
|
34
|
+
- Catch-all handlers that hide defects.
|
|
35
|
+
- Retrying non-idempotent operations without safeguards.
|
|
36
|
+
- Logging secrets or private data.
|
|
37
|
+
- Returning success with partial hidden failure.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: legacy-code-seams
|
|
3
|
+
description: Safely change hard-to-test legacy code. Use when code has hidden side effects, weak tests, global state, large routines, unclear ownership, or risky dependencies. Focuses on seams, characterization tests, dependency isolation, and avoiding clean rewrites.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Legacy Code Seams
|
|
7
|
+
|
|
8
|
+
Use this skill to modify legacy code without destabilizing unknown behavior.
|
|
9
|
+
|
|
10
|
+
## Principles
|
|
11
|
+
|
|
12
|
+
- Preserve current behavior until a deliberate behavior change is requested.
|
|
13
|
+
- Add tests around observed behavior before restructuring.
|
|
14
|
+
- Introduce seams at dependency boundaries rather than rewriting internals first.
|
|
15
|
+
- Prefer wrapping, extracting, and adapting over large replacement.
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
1. Identify the change point and affected behavior.
|
|
20
|
+
2. Find seams: parameters, interfaces, facades, adapters, configuration, entrypoints, or file/module boundaries.
|
|
21
|
+
3. Add characterization tests for the behavior you will touch.
|
|
22
|
+
4. Isolate hard dependencies such as time, randomness, storage, network, process state, or environment.
|
|
23
|
+
5. Make the requested change through the seam.
|
|
24
|
+
6. Keep legacy compatibility until callers and tests prove it can be removed.
|
|
25
|
+
|
|
26
|
+
## Avoid
|
|
27
|
+
|
|
28
|
+
- Large rewrites justified only by code quality.
|
|
29
|
+
- Changing multiple responsibilities while fixing one bug.
|
|
30
|
+
- Deleting strange behavior without proving it is unused.
|
|
31
|
+
- Assuming undocumented behavior is accidental.
|
|
32
|
+
|
|
33
|
+
## Verification
|
|
34
|
+
|
|
35
|
+
Use regression tests, golden examples, focused integration checks, and diff review to prove intended behavior changed and adjacent behavior stayed stable.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: naming-and-intent
|
|
3
|
+
description: Improve readability through precise names and explicit intent. Use when adding functions, modules, variables, commands, events, errors, tests, or docs. Encourages domain vocabulary, side-effect clarity, consistency, and avoiding vague helper/manager/data names.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Naming and Intent
|
|
7
|
+
|
|
8
|
+
Use this skill when names carry meaning for future maintainers.
|
|
9
|
+
|
|
10
|
+
## Naming rules
|
|
11
|
+
|
|
12
|
+
- Prefer domain vocabulary already used by the project.
|
|
13
|
+
- Name by purpose and behavior, not implementation accident.
|
|
14
|
+
- Make side effects visible in command/action names.
|
|
15
|
+
- Use consistent terms for the same concept.
|
|
16
|
+
- Avoid vague names such as manager, helper, util, data, info, item, or handler unless the surrounding code gives them precise meaning.
|
|
17
|
+
- Do not rename broadly unless the task is a rename/refactor and verification is available.
|
|
18
|
+
|
|
19
|
+
## Workflow
|
|
20
|
+
|
|
21
|
+
1. Identify the concept's role in the domain or system.
|
|
22
|
+
2. Search nearby code/docs for existing vocabulary.
|
|
23
|
+
3. Pick names that distinguish similar concepts.
|
|
24
|
+
4. Ensure tests describe behavior, not implementation detail.
|
|
25
|
+
5. Re-read changed code as a sentence: intent should be clear without comments.
|
|
26
|
+
|
|
27
|
+
## Comments
|
|
28
|
+
|
|
29
|
+
Use comments to explain non-obvious why, invariants, tradeoffs, and constraints. Do not comment what the code already states clearly.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: refactoring-safe-evolution
|
|
3
|
+
description: Refactor code without changing observable behavior. Use when improving structure, extracting abstractions, simplifying code, or modernizing internals while preserving existing contracts. Guides characterization, small mechanical steps, reversible edits, and verification after each phase.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Refactoring for Safe Evolution
|
|
7
|
+
|
|
8
|
+
Use this skill when the goal is better structure, not new behavior.
|
|
9
|
+
|
|
10
|
+
## Preconditions
|
|
11
|
+
|
|
12
|
+
- Identify the observable behavior that must remain unchanged.
|
|
13
|
+
- Identify public contracts, persistence formats, events, commands, and integration points.
|
|
14
|
+
- If behavior is unclear, add characterization tests before changing structure.
|
|
15
|
+
|
|
16
|
+
## Workflow
|
|
17
|
+
|
|
18
|
+
1. State the refactoring goal and explicit non-behavioral scope.
|
|
19
|
+
2. Capture current behavior with existing tests, characterization tests, or executable examples.
|
|
20
|
+
3. Make one mechanical transformation at a time: extract, rename, move, inline, split, or isolate.
|
|
21
|
+
4. Keep old and new paths equivalent during transitions when possible.
|
|
22
|
+
5. Run targeted checks after each meaningful step.
|
|
23
|
+
6. Remove temporary compatibility code only after callers are migrated and verified.
|
|
24
|
+
|
|
25
|
+
## Safe transformations
|
|
26
|
+
|
|
27
|
+
- Extract pure logic from side-effecting code.
|
|
28
|
+
- Move code behind an existing interface/facade.
|
|
29
|
+
- Rename with all call sites updated atomically.
|
|
30
|
+
- Split large routines by responsibility.
|
|
31
|
+
- Replace duplicated logic with a single well-named concept.
|
|
32
|
+
|
|
33
|
+
## Stop conditions
|
|
34
|
+
|
|
35
|
+
Stop and ask or report risk if the refactor requires contract changes, data migration, broad formatting, new dependencies, or behavior you cannot characterize.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: routine-function-design
|
|
3
|
+
description: Design clear routines, functions, methods, or procedures. Use when adding or restructuring executable units. Guides single purpose, parameter discipline, pre/postconditions, command-query separation, nesting control, and side-effect clarity in a language-agnostic way.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Routine / Function Design
|
|
7
|
+
|
|
8
|
+
Use this skill when creating or changing a callable unit.
|
|
9
|
+
|
|
10
|
+
## Design checklist
|
|
11
|
+
|
|
12
|
+
- One clear purpose.
|
|
13
|
+
- Name communicates the result or action.
|
|
14
|
+
- Parameters are minimal and cohesive.
|
|
15
|
+
- Preconditions and postconditions are explicit or obvious.
|
|
16
|
+
- Side effects are intentional and visible.
|
|
17
|
+
- Return shape is predictable.
|
|
18
|
+
- Error behavior matches caller expectations.
|
|
19
|
+
- Nesting and branching stay readable.
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
1. Decide whether the routine is a command, query, calculation, policy, coordinator, or adapter call.
|
|
24
|
+
2. Keep pure calculations separate from IO and mutation where practical.
|
|
25
|
+
3. Pass cohesive concepts instead of long unrelated parameter lists.
|
|
26
|
+
4. Extract nested decision logic only when the extracted name adds meaning.
|
|
27
|
+
5. Test edge cases around boundaries and invariants.
|
|
28
|
+
|
|
29
|
+
## Avoid
|
|
30
|
+
|
|
31
|
+
- Boolean flags that create multiple hidden behaviors.
|
|
32
|
+
- Hidden reliance on global or ambient state.
|
|
33
|
+
- Routines that both decide policy and perform unrelated IO.
|
|
34
|
+
- Clever compression that obscures intent.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: small-change-discipline
|
|
3
|
+
description: Keep coding-agent edits surgical and reversible. Use when implementing any code change, bug fix, refactor, or cleanup where scope control matters. Enforces inspect-before-edit, minimal diffs, existing style preservation, unrelated-issue isolation, and targeted verification.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Small Change Discipline
|
|
7
|
+
|
|
8
|
+
Use this skill to keep implementation work narrow, understandable, and safe.
|
|
9
|
+
|
|
10
|
+
## Operating rules
|
|
11
|
+
|
|
12
|
+
1. Restate the requested behavior and the exact files/areas likely affected.
|
|
13
|
+
2. Inspect existing code before editing. Do not infer conventions from memory.
|
|
14
|
+
3. Change the fewest files and smallest code regions that satisfy the request.
|
|
15
|
+
4. Preserve existing naming, formatting, layering, and error-handling style unless the task requires changing them.
|
|
16
|
+
5. Do not mix feature work, refactoring, formatting, dependency updates, and cleanup in one change unless explicitly requested.
|
|
17
|
+
6. If you discover unrelated defects, report them separately instead of fixing them opportunistically.
|
|
18
|
+
7. Prefer targeted verification over broad slow checks unless risk requires broader coverage.
|
|
19
|
+
|
|
20
|
+
## Workflow
|
|
21
|
+
|
|
22
|
+
1. Identify the requested outcome and non-goals.
|
|
23
|
+
2. Locate the smallest existing extension point.
|
|
24
|
+
3. Make the minimal implementation change.
|
|
25
|
+
4. Add or update only tests/docs directly tied to the behavior.
|
|
26
|
+
5. Review the diff for accidental broadening.
|
|
27
|
+
6. Run the narrowest useful checks.
|
|
28
|
+
|
|
29
|
+
## Self-check
|
|
30
|
+
|
|
31
|
+
- Did I edit only files needed for the request?
|
|
32
|
+
- Did I preserve existing public contracts unless asked to change them?
|
|
33
|
+
- Did I avoid drive-by cleanup?
|
|
34
|
+
- Can each changed line be explained by the user request?
|
|
35
|
+
- Did verification match the risk of the change?
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lsp-navigation
|
|
3
|
+
description: Navigate code with IDE features and run proactive LSP diagnostics on files/folders/batches. Use as PRIMARY for code intelligence and type/error checks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# LSP Navigation and Diagnostics
|
|
7
|
+
|
|
8
|
+
Use `lsp_navigation` as **PRIMARY** for code intelligence. Use `lsp_diagnostics` as **PRIMARY** for proactive type/error checks on files, folders, or explicit batches. Do NOT use grep/glob/ast-grep first for code intelligence or diagnostics.
|
|
9
|
+
|
|
10
|
+
**Requires:** `--lens-lsp` flag
|
|
11
|
+
|
|
12
|
+
## When to Use Diagnostics
|
|
13
|
+
|
|
14
|
+
Use `lsp_diagnostics` before builds/tests or after touching several files:
|
|
15
|
+
|
|
16
|
+
| Need | Tool call |
|
|
17
|
+
| --------------------------- | -------------------------------------------------------------------------- |
|
|
18
|
+
| Check one file | `lsp_diagnostics({ filePath: "src/file.ts" })` |
|
|
19
|
+
| Check a folder | `lsp_diagnostics({ filePath: "src/", severity: "error" })` |
|
|
20
|
+
| Check exact touched files | `lsp_diagnostics({ filePaths: ["src/a.ts", "src/b.ts"], concurrency: 8 })` |
|
|
21
|
+
| Give slow servers more time | `lsp_diagnostics({ filePaths: files, waitMs: 2000 })` |
|
|
22
|
+
| Show warnings too | `lsp_diagnostics({ filePaths: files, severity: "all" })` |
|
|
23
|
+
|
|
24
|
+
Prefer explicit `filePaths` batches after multi-file edits: they are bounded-concurrency and avoid unrelated directory noise.
|
|
25
|
+
|
|
26
|
+
## When to Use Navigation (Code Intelligence)
|
|
27
|
+
|
|
28
|
+
| Question | Operation | Parameters |
|
|
29
|
+
| --------------------------------------- | ---------------------------------------- | ----------------------------------------------------------------------------- |
|
|
30
|
+
| "Where is this defined?" | `definition` | filePath, line, character |
|
|
31
|
+
| "Find all usages" | `references` | filePath, line, character |
|
|
32
|
+
| "What type is this?" | `hover` | filePath, line, character |
|
|
33
|
+
| "Show call signature here" | `signatureHelp` | filePath, line, character (at call-site args) |
|
|
34
|
+
| "What symbols in this file?" | `documentSymbol` | filePath |
|
|
35
|
+
| "Find symbol across project" | `workspaceSymbol` | query + **filePath strongly recommended** |
|
|
36
|
+
| "What quick fixes are available?" | `codeAction` | filePath, line, character, endLine, endCharacter |
|
|
37
|
+
| "Rename symbol safely" | `rename` | filePath, line, character, newName |
|
|
38
|
+
| "Who implements this interface?" | `implementation` | filePath, line, character |
|
|
39
|
+
| "Who calls this function?" | `prepareCallHierarchy` → `incomingCalls` | filePath, line, character |
|
|
40
|
+
| "What does this function call?" | `prepareCallHierarchy` → `outgoingCalls` | filePath, line, character |
|
|
41
|
+
| "Show tracked LSP diagnostics snapshot" | `workspaceDiagnostics` | optional filePath (snapshot only; prefer `lsp_diagnostics` for active checks) |
|
|
42
|
+
|
|
43
|
+
## Operational Guidance (From Field Tests)
|
|
44
|
+
|
|
45
|
+
- Always pass `filePath` for `workspaceSymbol` when possible. Unscoped queries are best-effort and often empty.
|
|
46
|
+
- For `references`, prefer querying from the definition site for broader cross-file coverage; usage-site queries can be partial.
|
|
47
|
+
- Use `signatureHelp` only at call-site argument positions; declaration positions often return empty.
|
|
48
|
+
- Treat `workspaceDiagnostics` as tracked push snapshot (`publishDiagnostics`), not protocol pull `workspace/diagnostic` coverage. Prefer `lsp_diagnostics` when you need an active file/folder/batch check.
|
|
49
|
+
- For `codeAction`, separate `quickfix` from generic refactors (for example "Move to new file"). Do not treat generic refactors as error fixes.
|
|
50
|
+
- `prepareCallHierarchy` is server-capability dependent; if unsupported, skip incoming/outgoing calls.
|
|
51
|
+
- If TypeScript returns `No Project` on `workspaceSymbol`, retry after opening the scoped file context.
|
|
52
|
+
|
|
53
|
+
## Call Hierarchy Pattern
|
|
54
|
+
|
|
55
|
+
```typescript
|
|
56
|
+
// Step 1: Prepare (get the callable item)
|
|
57
|
+
const items = await lsp_navigation({
|
|
58
|
+
operation: "prepareCallHierarchy",
|
|
59
|
+
filePath: "src/api.ts",
|
|
60
|
+
line: 42,
|
|
61
|
+
character: 10,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
// Step 2: Get callers (who calls this function)
|
|
65
|
+
const callers = await lsp_navigation({
|
|
66
|
+
operation: "incomingCalls",
|
|
67
|
+
callHierarchyItem: items[0],
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
// Step 2: Get callees (what this function calls)
|
|
71
|
+
const callees = await lsp_navigation({
|
|
72
|
+
operation: "outgoingCalls",
|
|
73
|
+
callHierarchyItem: items[0],
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## When NOT to Use LSP
|
|
78
|
+
|
|
79
|
+
| Task | Use Instead | Why |
|
|
80
|
+
| --------------------------- | ----------------- | --------------------------- |
|
|
81
|
+
| Active type/error checks | `lsp_diagnostics` | Diagnostics, not navigation |
|
|
82
|
+
| Find patterns (console.log) | `ast_grep_search` | Pattern matching |
|
|
83
|
+
| Find text/TODOs | `grep` | Text search |
|
|
84
|
+
| Find files by name | `glob` | File discovery |
|
|
85
|
+
| Read file content | `read` | Direct access |
|
|
86
|
+
|
|
87
|
+
## Golden Rule
|
|
88
|
+
|
|
89
|
+
**Code intelligence → `lsp_navigation` first. Type/error validation → `lsp_diagnostics` first. Text/pattern search → grep/ast-grep.**
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review-self-check
|
|
3
|
+
description: Perform a final agent self-review before reporting completion. Use after any code edit, refactor, test change, config change, or docs update. Checks diff scope, behavior alignment, edge cases, tests, security/privacy, naming, and unverified risks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review Self-Check
|
|
7
|
+
|
|
8
|
+
Use this skill before final response on code-writing tasks.
|
|
9
|
+
|
|
10
|
+
## Review workflow
|
|
11
|
+
|
|
12
|
+
1. Inspect the diff, not just memory of edits.
|
|
13
|
+
2. Re-read the original request and compare it to changed behavior.
|
|
14
|
+
3. Check that no unrelated files or formatting churn were introduced.
|
|
15
|
+
4. Check public contracts, data formats, and error behavior.
|
|
16
|
+
5. Check edge cases and failure paths.
|
|
17
|
+
6. Check names and structure against nearby conventions.
|
|
18
|
+
7. Check tests: they should assert behavior that matters and fail for the old bug/change when applicable.
|
|
19
|
+
8. Check logs/errors for secret or private data exposure.
|
|
20
|
+
9. Run or explain the most relevant verification.
|
|
21
|
+
10. Report residual risk honestly.
|
|
22
|
+
|
|
23
|
+
## Final response fields
|
|
24
|
+
|
|
25
|
+
- changed files
|
|
26
|
+
- why changed
|
|
27
|
+
- verification run
|
|
28
|
+
- known risks or follow-ups
|
|
29
|
+
|
|
30
|
+
## Red flags
|
|
31
|
+
|
|
32
|
+
- The implementation is larger than the request.
|
|
33
|
+
- Tests only assert mocks or snapshots without behavior.
|
|
34
|
+
- The code handles success but not failure.
|
|
35
|
+
- A new dependency or contract change is unexplained.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: privacy-data-handling
|
|
3
|
+
description: Handle personal, sensitive, or customer data safely. Use when adding storage, logs, analytics, exports, imports, integrations, telemetry, search indexes, AI context, or user-facing data flows. Focuses on minimization, retention, access, deletion, and safe observability.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Privacy and Data Handling
|
|
7
|
+
|
|
8
|
+
Use this skill when code touches data that may identify, describe, or affect people, customers, tenants, organizations, or secrets.
|
|
9
|
+
|
|
10
|
+
## Workflow
|
|
11
|
+
|
|
12
|
+
1. Classify data: public, internal, sensitive, personal, secret, regulated, or tenant-scoped.
|
|
13
|
+
2. Minimize collection, storage, logging, and propagation.
|
|
14
|
+
3. Keep access checks close to reads and writes.
|
|
15
|
+
4. Avoid placing sensitive data in logs, errors, metrics labels, analytics, caches, prompts, or filenames.
|
|
16
|
+
5. Define retention, deletion, and export implications when adding storage.
|
|
17
|
+
6. Redact or aggregate data used for observability.
|
|
18
|
+
7. Add tests for tenant isolation, access denial, and redaction where relevant.
|
|
19
|
+
|
|
20
|
+
## Review questions
|
|
21
|
+
|
|
22
|
+
- Who can read this data now?
|
|
23
|
+
- Where else does this data flow?
|
|
24
|
+
- Can it be deleted or corrected if needed?
|
|
25
|
+
- Is sensitive data copied into long-lived artifacts?
|
|
26
|
+
- Does the final response expose private values?
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-review
|
|
3
|
+
description: Run a lightweight security pass on code changes. Use when touching authentication, authorization, input handling, files, paths, commands, network calls, serialization, storage, secrets, dependencies, or user-controlled data. Focuses on trust boundaries and common vulnerability classes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Security Review
|
|
7
|
+
|
|
8
|
+
Use this skill whenever a change crosses a trust boundary.
|
|
9
|
+
|
|
10
|
+
## Checklist
|
|
11
|
+
|
|
12
|
+
- Authentication: is the actor known when required?
|
|
13
|
+
- Authorization: is the actor allowed to perform this action on this resource?
|
|
14
|
+
- Input validation: is untrusted input constrained before use?
|
|
15
|
+
- Injection: are queries, commands, paths, templates, and expressions safely constructed?
|
|
16
|
+
- Secrets: are credentials never logged, committed, exposed, or returned?
|
|
17
|
+
- Sensitive data: is private data minimized and protected?
|
|
18
|
+
- Deserialization/parsing: are formats constrained and failures explicit?
|
|
19
|
+
- Filesystem/process/network: are paths, arguments, redirects, and destinations controlled?
|
|
20
|
+
- Dependencies: does the change introduce known vulnerable or unnecessary packages?
|
|
21
|
+
|
|
22
|
+
## Workflow
|
|
23
|
+
|
|
24
|
+
1. Identify trust boundaries and attacker-controlled values.
|
|
25
|
+
2. Trace those values to sensitive sinks.
|
|
26
|
+
3. Add validation, authorization, escaping, or isolation at the right layer.
|
|
27
|
+
4. Add abuse-case tests for important risks.
|
|
28
|
+
5. Report any security assumption that remains unverified.
|
|
29
|
+
|
|
30
|
+
## Avoid
|
|
31
|
+
|
|
32
|
+
- Relying only on client-side checks.
|
|
33
|
+
- Logging full request bodies or tokens.
|
|
34
|
+
- Treating internal callers as inherently safe when data originated outside.
|