@prismer/runtime 2.0.7 → 2.2.55
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 +3631 -0
- package/README.md +34 -12
- package/apc/skills/FIELD-DICTIONARY.md +111 -0
- package/apc/skills/bug-reproduce/SKILL.md +150 -0
- package/apc/skills/bug-reproduce/skill.json +96 -0
- package/apc/skills/code-review/SKILL.md +198 -0
- package/apc/skills/code-review/skill.json +124 -0
- package/apc/skills/design-review/SKILL.md +122 -0
- package/apc/skills/design-review/skill.json +88 -0
- package/apc/skills/doc-sync/SKILL.md +168 -0
- package/apc/skills/doc-sync/skill.json +81 -0
- package/apc/skills/env-doctor/SKILL.md +194 -0
- package/apc/skills/env-doctor/skill.json +209 -0
- package/apc/skills/git-ops/SKILL.md +189 -0
- package/apc/skills/git-ops/skill.json +94 -0
- package/apc/skills/impact-trace/SKILL.md +168 -0
- package/apc/skills/impact-trace/skill.json +104 -0
- package/apc/skills/observability/SKILL.md +195 -0
- package/apc/skills/observability/skill.json +116 -0
- package/apc/skills/release-db-config-sync/SKILL.md +186 -0
- package/apc/skills/release-db-config-sync/skill.json +109 -0
- package/apc/skills/release-ota-promote/SKILL.md +195 -0
- package/apc/skills/release-ota-promote/skill.json +176 -0
- package/apc/skills/release-preflight/SKILL.md +174 -0
- package/apc/skills/release-preflight/skill.json +175 -0
- package/apc/skills/release-rollback/SKILL.md +214 -0
- package/apc/skills/release-rollback/skill.json +230 -0
- package/apc/skills/release-tag/SKILL.md +194 -0
- package/apc/skills/release-tag/skill.json +94 -0
- package/apc/skills/releasing-prod/SKILL.md +49 -0
- package/apc/skills/releasing-test/SKILL.md +135 -0
- package/apc/skills/sdk-release/SKILL.md +200 -0
- package/apc/skills/spec-intake/SKILL.md +169 -0
- package/apc/skills/spec-intake/skill.json +93 -0
- package/apc/skills/test-result-feedback/SKILL.md +239 -0
- package/apc/skills/test-result-feedback/skill.json +193 -0
- package/apc/skills/test-runner/SKILL.md +169 -0
- package/apc/skills/test-runner/skill.json +103 -0
- package/apc/skills/ui-align/SKILL.md +209 -0
- package/apc/skills/ui-align/skill.json +114 -0
- package/apc/skills/ui-canvas/SKILL.md +148 -0
- package/apc/skills/ui-canvas/skill.json +127 -0
- package/built-in-skills/agent-coordination/SKILL.md +257 -0
- package/built-in-skills/agent-meta/SKILL.md +53 -0
- package/built-in-skills/assets/SKILL.md +133 -0
- package/built-in-skills/browser-use/SKILL.md +93 -0
- package/built-in-skills/canvas-design/LICENSE.txt +202 -0
- package/built-in-skills/canvas-design/SKILL.md +157 -0
- package/built-in-skills/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/ArsenalSC-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/BigShoulders-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/BigShoulders-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Boldonse-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/BricolageGrotesque-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/BricolageGrotesque-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/CrimsonPro-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/CrimsonPro-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/CrimsonPro-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/DMMono-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
- package/built-in-skills/canvas-design/canvas-fonts/EricaOne-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/GeistMono-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/GeistMono-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Gloock-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexMono-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexMono-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexSerif-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexSerif-BoldItalic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexSerif-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/IBMPlexSerif-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSans-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSans-BoldItalic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSans-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSans-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSerif-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/InstrumentSerif-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Italiana-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/JetBrainsMono-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/JetBrainsMono-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Jura-Light.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Jura-Medium.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/LibreBaskerville-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Lora-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Lora-BoldItalic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Lora-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Lora-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/NationalPark-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/NationalPark-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/NothingYouCouldDo-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Outfit-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Outfit-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/PixelifySans-Medium.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/PoiretOne-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/RedHatMono-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/RedHatMono-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Silkscreen-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/SmoochSans-Medium.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Tektur-Medium.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/Tektur-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/WorkSans-Bold.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/WorkSans-BoldItalic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/WorkSans-Italic.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/WorkSans-Regular.ttf +0 -0
- package/built-in-skills/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
- package/built-in-skills/canvas-design/canvas-fonts/YoungSerif-Regular.ttf +0 -0
- package/built-in-skills/claim-agent-ownership/SKILL.md +255 -0
- package/built-in-skills/claude-api/LICENSE.txt +202 -0
- package/built-in-skills/claude-api/SKILL.md +325 -0
- package/built-in-skills/claude-api/csharp/claude-api.md +402 -0
- package/built-in-skills/claude-api/curl/examples.md +216 -0
- package/built-in-skills/claude-api/curl/managed-agents.md +336 -0
- package/built-in-skills/claude-api/go/claude-api.md +421 -0
- package/built-in-skills/claude-api/go/managed-agents/README.md +561 -0
- package/built-in-skills/claude-api/java/claude-api.md +432 -0
- package/built-in-skills/claude-api/java/managed-agents/README.md +442 -0
- package/built-in-skills/claude-api/php/claude-api.md +375 -0
- package/built-in-skills/claude-api/php/managed-agents/README.md +435 -0
- package/built-in-skills/claude-api/python/claude-api/README.md +420 -0
- package/built-in-skills/claude-api/python/claude-api/batches.md +185 -0
- package/built-in-skills/claude-api/python/claude-api/files-api.md +165 -0
- package/built-in-skills/claude-api/python/claude-api/streaming.md +162 -0
- package/built-in-skills/claude-api/python/claude-api/tool-use.md +590 -0
- package/built-in-skills/claude-api/python/managed-agents/README.md +332 -0
- package/built-in-skills/claude-api/ruby/claude-api.md +113 -0
- package/built-in-skills/claude-api/ruby/managed-agents/README.md +389 -0
- package/built-in-skills/claude-api/shared/agent-design.md +101 -0
- package/built-in-skills/claude-api/shared/error-codes.md +213 -0
- package/built-in-skills/claude-api/shared/live-sources.md +135 -0
- package/built-in-skills/claude-api/shared/managed-agents-api-reference.md +378 -0
- package/built-in-skills/claude-api/shared/managed-agents-client-patterns.md +209 -0
- package/built-in-skills/claude-api/shared/managed-agents-core.md +238 -0
- package/built-in-skills/claude-api/shared/managed-agents-environments.md +215 -0
- package/built-in-skills/claude-api/shared/managed-agents-events.md +195 -0
- package/built-in-skills/claude-api/shared/managed-agents-memory.md +197 -0
- package/built-in-skills/claude-api/shared/managed-agents-multiagent.md +99 -0
- package/built-in-skills/claude-api/shared/managed-agents-onboarding.md +114 -0
- package/built-in-skills/claude-api/shared/managed-agents-outcomes.md +106 -0
- package/built-in-skills/claude-api/shared/managed-agents-overview.md +68 -0
- package/built-in-skills/claude-api/shared/managed-agents-self-hosted-sandboxes.md +173 -0
- package/built-in-skills/claude-api/shared/managed-agents-tools.md +321 -0
- package/built-in-skills/claude-api/shared/managed-agents-webhooks.md +110 -0
- package/built-in-skills/claude-api/shared/model-migration.md +779 -0
- package/built-in-skills/claude-api/shared/models.md +121 -0
- package/built-in-skills/claude-api/shared/prompt-caching.md +171 -0
- package/built-in-skills/claude-api/shared/tool-use-concepts.md +327 -0
- package/built-in-skills/claude-api/typescript/claude-api/README.md +333 -0
- package/built-in-skills/claude-api/typescript/claude-api/batches.md +106 -0
- package/built-in-skills/claude-api/typescript/claude-api/files-api.md +98 -0
- package/built-in-skills/claude-api/typescript/claude-api/streaming.md +178 -0
- package/built-in-skills/claude-api/typescript/claude-api/tool-use.md +527 -0
- package/built-in-skills/claude-api/typescript/managed-agents/README.md +359 -0
- package/built-in-skills/codebase-design/DEEPENING.md +37 -0
- package/built-in-skills/codebase-design/DESIGN-IT-TWICE.md +44 -0
- package/built-in-skills/codebase-design/LICENSE +21 -0
- package/built-in-skills/codebase-design/SKILL.md +116 -0
- package/built-in-skills/conversation-compaction/SKILL.md +114 -0
- package/built-in-skills/council-creator/SKILL.md +426 -0
- package/built-in-skills/diagnosing-bugs/LICENSE +21 -0
- package/built-in-skills/diagnosing-bugs/SKILL.md +136 -0
- package/built-in-skills/diagnosing-bugs/scripts/hitl-loop.template.sh +41 -0
- package/built-in-skills/doc-coauthoring/SKILL.md +376 -0
- package/built-in-skills/document-generation/SKILL.md +105 -0
- package/built-in-skills/domain-modeling/ADR-FORMAT.md +47 -0
- package/built-in-skills/domain-modeling/CONTEXT-FORMAT.md +60 -0
- package/built-in-skills/domain-modeling/LICENSE +21 -0
- package/built-in-skills/domain-modeling/SKILL.md +76 -0
- package/built-in-skills/frontend-design/LICENSE.txt +177 -0
- package/built-in-skills/frontend-design/SKILL.md +43 -0
- package/built-in-skills/human-approval/SKILL.md +129 -0
- package/built-in-skills/image-generate/SKILL.md +128 -0
- package/built-in-skills/image-generate/scripts/generate-and-deliver.mjs +289 -0
- package/built-in-skills/ingest/SKILL.md +73 -0
- package/built-in-skills/internal-comms/LICENSE.txt +202 -0
- package/built-in-skills/internal-comms/SKILL.md +33 -0
- package/built-in-skills/internal-comms/examples/3p-updates.md +47 -0
- package/built-in-skills/internal-comms/examples/company-newsletter.md +65 -0
- package/built-in-skills/internal-comms/examples/faq-answers.md +30 -0
- package/built-in-skills/internal-comms/examples/general-comms.md +16 -0
- package/built-in-skills/liteparse/SKILL.md +176 -0
- package/built-in-skills/mcp-builder/LICENSE.txt +202 -0
- package/built-in-skills/mcp-builder/SKILL.md +237 -0
- package/built-in-skills/mcp-builder/reference/evaluation.md +602 -0
- package/built-in-skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/built-in-skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/built-in-skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/built-in-skills/mcp-builder/scripts/connections.py +151 -0
- package/built-in-skills/mcp-builder/scripts/evaluation.py +373 -0
- package/built-in-skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/built-in-skills/mcp-builder/scripts/requirements.txt +2 -0
- package/built-in-skills/memory/SKILL.md +471 -0
- package/built-in-skills/memory-dream/SKILL.md +339 -0
- package/built-in-skills/office-artifacts/SKILL.md +211 -0
- package/built-in-skills/okr/SKILL.md +154 -0
- package/built-in-skills/persona/SKILL.md +81 -0
- package/built-in-skills/persona-generator/SKILL.md +296 -0
- package/built-in-skills/pkf-svg/SKILL.md +253 -0
- package/built-in-skills/pkf-writing/SKILL.md +236 -0
- package/built-in-skills/prismer-im-collab/SKILL.md +168 -0
- package/built-in-skills/proactivity/SKILL.md +84 -0
- package/built-in-skills/remotion/SKILL.md +431 -0
- package/built-in-skills/role-builder/SKILL.md +203 -0
- package/built-in-skills/role-builder/scripts/author-role.mjs +334 -0
- package/built-in-skills/role-builder/scripts/ingest-role.mjs +223 -0
- package/built-in-skills/role-builder/scripts/instantiate-and-run.mjs +290 -0
- package/built-in-skills/role-builder/scripts/operation-harness.mjs +267 -0
- package/built-in-skills/skill-authoring/SKILL.md +134 -0
- package/built-in-skills/skill-authoring/skill.json +74 -0
- package/built-in-skills/skill-builder/SKILL.md +171 -0
- package/built-in-skills/skill-builder/scripts/ingest.mjs +265 -0
- package/built-in-skills/skill-creator/LICENSE.txt +202 -0
- package/built-in-skills/skill-creator/SKILL.md +227 -0
- package/built-in-skills/skill-creator/agents/analyzer.md +274 -0
- package/built-in-skills/skill-creator/agents/comparator.md +202 -0
- package/built-in-skills/skill-creator/agents/grader.md +223 -0
- package/built-in-skills/skill-creator/assets/eval_review.html +146 -0
- package/built-in-skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/built-in-skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/built-in-skills/skill-creator/references/external-library-import.md +110 -0
- package/built-in-skills/skill-creator/references/schemas.md +430 -0
- package/built-in-skills/skill-creator/scripts/__init__.py +0 -0
- package/built-in-skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/built-in-skills/skill-creator/scripts/generate_report.py +326 -0
- package/built-in-skills/skill-creator/scripts/import-library.mjs +475 -0
- package/built-in-skills/skill-creator/scripts/improve_description.py +247 -0
- package/built-in-skills/skill-creator/scripts/package_skill.py +136 -0
- package/built-in-skills/skill-creator/scripts/quick_validate.py +103 -0
- package/built-in-skills/skill-creator/scripts/run_eval.py +310 -0
- package/built-in-skills/skill-creator/scripts/run_loop.py +328 -0
- package/built-in-skills/skill-creator/scripts/utils.py +47 -0
- package/built-in-skills/slack-gif-creator/LICENSE.txt +202 -0
- package/built-in-skills/slack-gif-creator/SKILL.md +291 -0
- package/built-in-skills/slack-gif-creator/core/easing.py +234 -0
- package/built-in-skills/slack-gif-creator/core/frame_composer.py +176 -0
- package/built-in-skills/slack-gif-creator/core/gif_builder.py +269 -0
- package/built-in-skills/slack-gif-creator/core/validators.py +136 -0
- package/built-in-skills/slack-gif-creator/requirements.txt +4 -0
- package/built-in-skills/tasks/SKILL.md +413 -0
- package/built-in-skills/tdd/LICENSE +21 -0
- package/built-in-skills/tdd/SKILL.md +110 -0
- package/built-in-skills/tdd/mocking.md +59 -0
- package/built-in-skills/tdd/refactoring.md +10 -0
- package/built-in-skills/tdd/tests.md +61 -0
- package/built-in-skills/team/SKILL.md +77 -0
- package/built-in-skills/web-artifacts-builder/LICENSE.txt +202 -0
- package/built-in-skills/web-artifacts-builder/SKILL.md +105 -0
- package/built-in-skills/web-artifacts-builder/scripts/bundle-artifact.sh +54 -0
- package/built-in-skills/web-artifacts-builder/scripts/init-artifact.sh +334 -0
- package/built-in-skills/web-artifacts-builder/scripts/shadcn-components.tar.gz +0 -0
- package/built-in-skills/webapp-testing/LICENSE.txt +202 -0
- package/built-in-skills/webapp-testing/SKILL.md +97 -0
- package/built-in-skills/webapp-testing/examples/console_logging.py +35 -0
- package/built-in-skills/webapp-testing/examples/element_discovery.py +40 -0
- package/built-in-skills/webapp-testing/examples/static_html_automation.py +33 -0
- package/built-in-skills/webapp-testing/scripts/with_server.py +106 -0
- package/built-in-skills/wechat-pay/SKILL.md +59 -0
- package/dist/cli.cjs +72577 -16101
- package/dist/cli.js +72752 -16232
- package/dist/index.cjs +72632 -16024
- package/dist/index.d.cts +4956 -640
- package/dist/index.d.ts +4956 -640
- package/dist/index.js +72564 -15963
- package/package.json +39 -6
- package/plugins/memory/prismer/__init__.py +1211 -0
- package/plugins/memory/prismer/plugin.yaml +8 -0
- package/plugins/memory/prismer/tool-schemas.generated.json +249 -0
- package/plugins/tools/prismer-recall/__init__.py +282 -0
- package/plugins/tools/prismer-recall/plugin.yaml +15 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: diagnosing-bugs
|
|
3
|
+
scope: coding
|
|
4
|
+
source: https://github.com/mattpocock/skills (MIT, © 2026 Matt Pocock)
|
|
5
|
+
description: Diagnosis loop for hard bugs and performance regressions. Use when the user says "diagnose"/"debug this", or reports something broken/throwing/failing/slow.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Diagnosing Bugs
|
|
9
|
+
|
|
10
|
+
A discipline for hard bugs. Skip phases only when explicitly justified.
|
|
11
|
+
|
|
12
|
+
When exploring the codebase, read `CONTEXT.md` (if it exists) to get a clear mental model of the relevant modules, and check ADRs in the area you're touching.
|
|
13
|
+
|
|
14
|
+
## Phase 1 — Build a feedback loop
|
|
15
|
+
|
|
16
|
+
**This is the skill.** Everything else is mechanical. If you have a **tight** pass/fail signal for the bug — one that goes red on _this_ bug — you will find the cause; bisection, hypothesis-testing, and instrumentation all just consume it. If you don't have one, no amount of staring at code will save you.
|
|
17
|
+
|
|
18
|
+
Spend disproportionate effort here. **Be aggressive. Be creative. Refuse to give up.**
|
|
19
|
+
|
|
20
|
+
### Ways to construct one — try them in roughly this order
|
|
21
|
+
|
|
22
|
+
1. **Failing test** at whatever seam reaches the bug — unit, integration, e2e.
|
|
23
|
+
2. **Curl / HTTP script** against a running dev server.
|
|
24
|
+
3. **CLI invocation** with a fixture input, diffing stdout against a known-good snapshot.
|
|
25
|
+
4. **Headless browser script** (Playwright / Puppeteer) — drives the UI, asserts on DOM/console/network.
|
|
26
|
+
5. **Replay a captured trace.** Save a real network request / payload / event log to disk; replay it through the code path in isolation.
|
|
27
|
+
6. **Throwaway harness.** Spin up a minimal subset of the system (one service, mocked deps) that exercises the bug code path with a single function call.
|
|
28
|
+
7. **Property / fuzz loop.** If the bug is "sometimes wrong output", run 1000 random inputs and look for the failure mode.
|
|
29
|
+
8. **Bisection harness.** If the bug appeared between two known states (commit, dataset, version), automate "boot at state X, check, repeat" so you can `git bisect run` it.
|
|
30
|
+
9. **Differential loop.** Run the same input through old-version vs new-version (or two configs) and diff outputs.
|
|
31
|
+
10. **HITL bash script.** Last resort. If a human must click, drive _them_ with `scripts/hitl-loop.template.sh` so the loop is still structured. Captured output feeds back to you.
|
|
32
|
+
|
|
33
|
+
Build the right feedback loop, and the bug is 90% fixed.
|
|
34
|
+
|
|
35
|
+
### Tighten the loop
|
|
36
|
+
|
|
37
|
+
Treat the loop as a product. Once you have _a_ loop, **tighten** it:
|
|
38
|
+
|
|
39
|
+
- Can I make it faster? (Cache setup, skip unrelated init, narrow the test scope.)
|
|
40
|
+
- Can I make the signal sharper? (Assert on the specific symptom, not "didn't crash".)
|
|
41
|
+
- Can I make it more deterministic? (Pin time, seed RNG, isolate filesystem, freeze network.)
|
|
42
|
+
|
|
43
|
+
A 30-second flaky loop is barely better than no loop; a 2-second deterministic one is tight — a debugging superpower.
|
|
44
|
+
|
|
45
|
+
### Non-deterministic bugs
|
|
46
|
+
|
|
47
|
+
The goal is not a clean repro but a **higher reproduction rate**. Loop the trigger 100×, parallelise, add stress, narrow timing windows, inject sleeps. A 50%-flake bug is debuggable; 1% is not — keep raising the rate until it's debuggable.
|
|
48
|
+
|
|
49
|
+
### When you genuinely cannot build a loop
|
|
50
|
+
|
|
51
|
+
Stop and say so explicitly. List what you tried. Ask the user for: (a) access to whatever environment reproduces it, (b) a captured artifact (HAR file, log dump, core dump, screen recording with timestamps), or (c) permission to add temporary production instrumentation. Do **not** proceed to hypothesise without a loop.
|
|
52
|
+
|
|
53
|
+
### Completion criterion — a tight loop that goes red
|
|
54
|
+
|
|
55
|
+
Phase 1 is done when the loop is **tight** and **red-capable**: you can name **one command** — a script path, a test invocation, a curl — that you have **already run at least once** (paste the invocation and its output), and that is:
|
|
56
|
+
|
|
57
|
+
- [ ] **Red-capable** — it drives the actual bug code path and asserts the **user's exact symptom**, so it can go red on this bug and green once fixed. Not "runs without erroring" — it must be able to _catch this specific bug_.
|
|
58
|
+
- [ ] **Deterministic** — same verdict every run (flaky bugs: a pinned, high reproduction rate, per above).
|
|
59
|
+
- [ ] **Fast** — seconds, not minutes.
|
|
60
|
+
- [ ] **Agent-runnable** — you can run it unattended; a human in the loop only via `scripts/hitl-loop.template.sh`.
|
|
61
|
+
|
|
62
|
+
If you catch yourself reading code to build a theory before this command exists, **stop — jumping straight to a hypothesis is the exact failure this skill prevents.** No red-capable command, no Phase 2.
|
|
63
|
+
|
|
64
|
+
## Phase 2 — Reproduce + minimise
|
|
65
|
+
|
|
66
|
+
Run the loop. Watch it go red — the bug appears.
|
|
67
|
+
|
|
68
|
+
Confirm:
|
|
69
|
+
|
|
70
|
+
- [ ] The loop produces the failure mode the **user** described — not a different failure that happens to be nearby. Wrong bug = wrong fix.
|
|
71
|
+
- [ ] The failure is reproducible across multiple runs (or, for non-deterministic bugs, reproducible at a high enough rate to debug against).
|
|
72
|
+
- [ ] You have captured the exact symptom (error message, wrong output, slow timing) so later phases can verify the fix actually addresses it.
|
|
73
|
+
|
|
74
|
+
### Minimise
|
|
75
|
+
|
|
76
|
+
Once it's red, shrink the repro to the **smallest scenario that still goes red**. Cut inputs, callers, config, data, and steps **one at a time**, re-running the loop after each cut — keep only what's load-bearing for the failure.
|
|
77
|
+
|
|
78
|
+
Why bother: a minimal repro shrinks the hypothesis space in Phase 3 (fewer moving parts left to suspect) and becomes the clean regression test in Phase 5.
|
|
79
|
+
|
|
80
|
+
Done when **every remaining element is load-bearing** — removing any one of them makes the loop go green.
|
|
81
|
+
|
|
82
|
+
Do not proceed until you have reproduced **and** minimised.
|
|
83
|
+
|
|
84
|
+
## Phase 3 — Hypothesise
|
|
85
|
+
|
|
86
|
+
Generate **3–5 ranked hypotheses** before testing any of them. Single-hypothesis generation anchors on the first plausible idea.
|
|
87
|
+
|
|
88
|
+
Each hypothesis must be **falsifiable**: state the prediction it makes.
|
|
89
|
+
|
|
90
|
+
> Format: "If <X> is the cause, then <changing Y> will make the bug disappear / <changing Z> will make it worse."
|
|
91
|
+
|
|
92
|
+
If you cannot state the prediction, the hypothesis is a vibe — discard or sharpen it.
|
|
93
|
+
|
|
94
|
+
**Show the ranked list to the user before testing.** They often have domain knowledge that re-ranks instantly ("we just deployed a change to #3"), or know hypotheses they've already ruled out. Cheap checkpoint, big time saver. Don't block on it — proceed with your ranking if the user is AFK.
|
|
95
|
+
|
|
96
|
+
## Phase 4 — Instrument
|
|
97
|
+
|
|
98
|
+
Each probe must map to a specific prediction from Phase 3. **Change one variable at a time.**
|
|
99
|
+
|
|
100
|
+
Tool preference:
|
|
101
|
+
|
|
102
|
+
1. **Debugger / REPL inspection** if the env supports it. One breakpoint beats ten logs.
|
|
103
|
+
2. **Targeted logs** at the boundaries that distinguish hypotheses.
|
|
104
|
+
3. Never "log everything and grep".
|
|
105
|
+
|
|
106
|
+
**Tag every debug log** with a unique prefix, e.g. `[DEBUG-a4f2]`. Cleanup at the end becomes a single grep. Untagged logs survive; tagged logs die.
|
|
107
|
+
|
|
108
|
+
**Perf branch.** For performance regressions, logs are usually wrong. Instead: establish a baseline measurement (timing harness, `performance.now()`, profiler, query plan), then bisect. Measure first, fix second.
|
|
109
|
+
|
|
110
|
+
## Phase 5 — Fix + regression test
|
|
111
|
+
|
|
112
|
+
Write the regression test **before the fix** — but only if there is a **correct seam** for it.
|
|
113
|
+
|
|
114
|
+
A correct seam is one where the test exercises the **real bug pattern** as it occurs at the call site. If the only available seam is too shallow (single-caller test when the bug needs multiple callers, unit test that can't replicate the chain that triggered the bug), a regression test there gives false confidence.
|
|
115
|
+
|
|
116
|
+
**If no correct seam exists, that itself is the finding.** Note it. The codebase architecture is preventing the bug from being locked down. Flag this for the next phase.
|
|
117
|
+
|
|
118
|
+
If a correct seam exists:
|
|
119
|
+
|
|
120
|
+
1. Turn the minimised repro into a failing test at that seam.
|
|
121
|
+
2. Watch it fail.
|
|
122
|
+
3. Apply the fix.
|
|
123
|
+
4. Watch it pass.
|
|
124
|
+
5. Re-run the Phase 1 feedback loop against the original (un-minimised) scenario.
|
|
125
|
+
|
|
126
|
+
## Phase 6 — Cleanup + post-mortem
|
|
127
|
+
|
|
128
|
+
Required before declaring done:
|
|
129
|
+
|
|
130
|
+
- [ ] Original repro no longer reproduces (re-run the Phase 1 loop)
|
|
131
|
+
- [ ] Regression test passes (or absence of seam is documented)
|
|
132
|
+
- [ ] All `[DEBUG-...]` instrumentation removed (`grep` the prefix)
|
|
133
|
+
- [ ] Throwaway prototypes deleted (or moved to a clearly-marked debug location)
|
|
134
|
+
- [ ] The hypothesis that turned out correct is stated in the commit / PR message — so the next debugger learns
|
|
135
|
+
|
|
136
|
+
**Then ask: what would have prevented this bug?** If the answer involves architectural change (no good test seam, tangled callers, hidden coupling) hand off to the `/improve-codebase-architecture` skill with the specifics. Make the recommendation **after** the fix is in, not before — you have more information now than when you started.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Human-in-the-loop reproduction loop.
|
|
3
|
+
# Copy this file, edit the steps below, and run it.
|
|
4
|
+
# The agent runs the script; the user follows prompts in their terminal.
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# bash hitl-loop.template.sh
|
|
8
|
+
#
|
|
9
|
+
# Two helpers:
|
|
10
|
+
# step "<instruction>" → show instruction, wait for Enter
|
|
11
|
+
# capture VAR "<question>" → show question, read response into VAR
|
|
12
|
+
#
|
|
13
|
+
# At the end, captured values are printed as KEY=VALUE for the agent to parse.
|
|
14
|
+
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
|
|
17
|
+
step() {
|
|
18
|
+
printf '\n>>> %s\n' "$1"
|
|
19
|
+
read -r -p " [Enter when done] " _
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
capture() {
|
|
23
|
+
local var="$1" question="$2" answer
|
|
24
|
+
printf '\n>>> %s\n' "$question"
|
|
25
|
+
read -r -p " > " answer
|
|
26
|
+
printf -v "$var" '%s' "$answer"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
# --- edit below ---------------------------------------------------------
|
|
30
|
+
|
|
31
|
+
step "Open the app at http://localhost:3000 and sign in."
|
|
32
|
+
|
|
33
|
+
capture ERRORED "Click the 'Export' button. Did it throw an error? (y/n)"
|
|
34
|
+
|
|
35
|
+
capture ERROR_MSG "Paste the error message (or 'none'):"
|
|
36
|
+
|
|
37
|
+
# --- edit above ---------------------------------------------------------
|
|
38
|
+
|
|
39
|
+
printf '\n--- Captured ---\n'
|
|
40
|
+
printf 'ERRORED=%s\n' "$ERRORED"
|
|
41
|
+
printf 'ERROR_MSG=%s\n' "$ERROR_MSG"
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: doc-coauthoring
|
|
3
|
+
scope: persistence
|
|
4
|
+
description: Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Doc Co-Authoring Workflow
|
|
8
|
+
|
|
9
|
+
This skill provides a structured workflow for guiding users through collaborative document creation. Act as an active guide, walking users through three stages: Context Gathering, Refinement & Structure, and Reader Testing.
|
|
10
|
+
|
|
11
|
+
## When to Offer This Workflow
|
|
12
|
+
|
|
13
|
+
**Trigger conditions:**
|
|
14
|
+
- User mentions writing documentation: "write a doc", "draft a proposal", "create a spec", "write up"
|
|
15
|
+
- User mentions specific doc types: "PRD", "design doc", "decision doc", "RFC"
|
|
16
|
+
- User seems to be starting a substantial writing task
|
|
17
|
+
|
|
18
|
+
**Initial offer:**
|
|
19
|
+
Offer the user a structured workflow for co-authoring the document. Explain the three stages:
|
|
20
|
+
|
|
21
|
+
1. **Context Gathering**: User provides all relevant context while Claude asks clarifying questions
|
|
22
|
+
2. **Refinement & Structure**: Iteratively build each section through brainstorming and editing
|
|
23
|
+
3. **Reader Testing**: Test the doc with a fresh Claude (no context) to catch blind spots before others read it
|
|
24
|
+
|
|
25
|
+
Explain that this approach helps ensure the doc works well when others read it (including when they paste it into Claude). Ask if they want to try this workflow or prefer to work freeform.
|
|
26
|
+
|
|
27
|
+
If user declines, work freeform. If user accepts, proceed to Stage 1.
|
|
28
|
+
|
|
29
|
+
## Stage 1: Context Gathering
|
|
30
|
+
|
|
31
|
+
**Goal:** Close the gap between what the user knows and what Claude knows, enabling smart guidance later.
|
|
32
|
+
|
|
33
|
+
### Initial Questions
|
|
34
|
+
|
|
35
|
+
Start by asking the user for meta-context about the document:
|
|
36
|
+
|
|
37
|
+
1. What type of document is this? (e.g., technical spec, decision doc, proposal)
|
|
38
|
+
2. Who's the primary audience?
|
|
39
|
+
3. What's the desired impact when someone reads this?
|
|
40
|
+
4. Is there a template or specific format to follow?
|
|
41
|
+
5. Any other constraints or context to know?
|
|
42
|
+
|
|
43
|
+
Inform them they can answer in shorthand or dump information however works best for them.
|
|
44
|
+
|
|
45
|
+
**If user provides a template or mentions a doc type:**
|
|
46
|
+
- Ask if they have a template document to share
|
|
47
|
+
- If they provide a link to a shared document, use the appropriate integration to fetch it
|
|
48
|
+
- If they provide a file, read it
|
|
49
|
+
|
|
50
|
+
**If user mentions editing an existing shared document:**
|
|
51
|
+
- Use the appropriate integration to read the current state
|
|
52
|
+
- Check for images without alt-text
|
|
53
|
+
- If images exist without alt-text, explain that when others use Claude to understand the doc, Claude won't be able to see them. Ask if they want alt-text generated. If so, request they paste each image into chat for descriptive alt-text generation.
|
|
54
|
+
|
|
55
|
+
### Info Dumping
|
|
56
|
+
|
|
57
|
+
Once initial questions are answered, encourage the user to dump all the context they have. Request information such as:
|
|
58
|
+
- Background on the project/problem
|
|
59
|
+
- Related team discussions or shared documents
|
|
60
|
+
- Why alternative solutions aren't being used
|
|
61
|
+
- Organizational context (team dynamics, past incidents, politics)
|
|
62
|
+
- Timeline pressures or constraints
|
|
63
|
+
- Technical architecture or dependencies
|
|
64
|
+
- Stakeholder concerns
|
|
65
|
+
|
|
66
|
+
Advise them not to worry about organizing it - just get it all out. Offer multiple ways to provide context:
|
|
67
|
+
- Info dump stream-of-consciousness
|
|
68
|
+
- Point to team channels or threads to read
|
|
69
|
+
- Link to shared documents
|
|
70
|
+
|
|
71
|
+
**If integrations are available** (e.g., Slack, Teams, Google Drive, SharePoint, or other MCP servers), mention that these can be used to pull in context directly.
|
|
72
|
+
|
|
73
|
+
**If no integrations are detected and in Claude.ai or Claude app:** Suggest they can enable connectors in their Claude settings to allow pulling context from messaging apps and document storage directly.
|
|
74
|
+
|
|
75
|
+
Inform them clarifying questions will be asked once they've done their initial dump.
|
|
76
|
+
|
|
77
|
+
**During context gathering:**
|
|
78
|
+
|
|
79
|
+
- If user mentions team channels or shared documents:
|
|
80
|
+
- If integrations available: Inform them the content will be read now, then use the appropriate integration
|
|
81
|
+
- If integrations not available: Explain lack of access. Suggest they enable connectors in Claude settings, or paste the relevant content directly.
|
|
82
|
+
|
|
83
|
+
- If user mentions entities/projects that are unknown:
|
|
84
|
+
- Ask if connected tools should be searched to learn more
|
|
85
|
+
- Wait for user confirmation before searching
|
|
86
|
+
|
|
87
|
+
- As user provides context, track what's being learned and what's still unclear
|
|
88
|
+
|
|
89
|
+
**Asking clarifying questions:**
|
|
90
|
+
|
|
91
|
+
When user signals they've done their initial dump (or after substantial context provided), ask clarifying questions to ensure understanding:
|
|
92
|
+
|
|
93
|
+
Generate 5-10 numbered questions based on gaps in the context.
|
|
94
|
+
|
|
95
|
+
Inform them they can use shorthand to answer (e.g., "1: yes, 2: see #channel, 3: no because backwards compat"), link to more docs, point to channels to read, or just keep info-dumping. Whatever's most efficient for them.
|
|
96
|
+
|
|
97
|
+
**Exit condition:**
|
|
98
|
+
Sufficient context has been gathered when questions show understanding - when edge cases and trade-offs can be asked about without needing basics explained.
|
|
99
|
+
|
|
100
|
+
**Transition:**
|
|
101
|
+
Ask if there's any more context they want to provide at this stage, or if it's time to move on to drafting the document.
|
|
102
|
+
|
|
103
|
+
If user wants to add more, let them. When ready, proceed to Stage 2.
|
|
104
|
+
|
|
105
|
+
## Stage 2: Refinement & Structure
|
|
106
|
+
|
|
107
|
+
**Goal:** Build the document section by section through brainstorming, curation, and iterative refinement.
|
|
108
|
+
|
|
109
|
+
**Instructions to user:**
|
|
110
|
+
Explain that the document will be built section by section. For each section:
|
|
111
|
+
1. Clarifying questions will be asked about what to include
|
|
112
|
+
2. 5-20 options will be brainstormed
|
|
113
|
+
3. User will indicate what to keep/remove/combine
|
|
114
|
+
4. The section will be drafted
|
|
115
|
+
5. It will be refined through surgical edits
|
|
116
|
+
|
|
117
|
+
Start with whichever section has the most unknowns (usually the core decision/proposal), then work through the rest.
|
|
118
|
+
|
|
119
|
+
**Section ordering:**
|
|
120
|
+
|
|
121
|
+
If the document structure is clear:
|
|
122
|
+
Ask which section they'd like to start with.
|
|
123
|
+
|
|
124
|
+
Suggest starting with whichever section has the most unknowns. For decision docs, that's usually the core proposal. For specs, it's typically the technical approach. Summary sections are best left for last.
|
|
125
|
+
|
|
126
|
+
If user doesn't know what sections they need:
|
|
127
|
+
Based on the type of document and template, suggest 3-5 sections appropriate for the doc type.
|
|
128
|
+
|
|
129
|
+
Ask if this structure works, or if they want to adjust it.
|
|
130
|
+
|
|
131
|
+
**Once structure is agreed:**
|
|
132
|
+
|
|
133
|
+
Create the initial document structure with placeholder text for all sections.
|
|
134
|
+
|
|
135
|
+
**If access to artifacts is available:**
|
|
136
|
+
Use `create_file` to create an artifact. This gives both Claude and the user a scaffold to work from.
|
|
137
|
+
|
|
138
|
+
Inform them that the initial structure with placeholders for all sections will be created.
|
|
139
|
+
|
|
140
|
+
Create artifact with all section headers and brief placeholder text like "[To be written]" or "[Content here]".
|
|
141
|
+
|
|
142
|
+
Provide the scaffold link and indicate it's time to fill in each section.
|
|
143
|
+
|
|
144
|
+
**If no access to artifacts:**
|
|
145
|
+
Create a markdown file in the working directory. Name it appropriately (e.g., `decision-doc.md`, `technical-spec.md`).
|
|
146
|
+
|
|
147
|
+
Inform them that the initial structure with placeholders for all sections will be created.
|
|
148
|
+
|
|
149
|
+
Create file with all section headers and placeholder text.
|
|
150
|
+
|
|
151
|
+
Confirm the filename has been created and indicate it's time to fill in each section.
|
|
152
|
+
|
|
153
|
+
**For each section:**
|
|
154
|
+
|
|
155
|
+
### Step 1: Clarifying Questions
|
|
156
|
+
|
|
157
|
+
Announce work will begin on the [SECTION NAME] section. Ask 5-10 clarifying questions about what should be included:
|
|
158
|
+
|
|
159
|
+
Generate 5-10 specific questions based on context and section purpose.
|
|
160
|
+
|
|
161
|
+
Inform them they can answer in shorthand or just indicate what's important to cover.
|
|
162
|
+
|
|
163
|
+
### Step 2: Brainstorming
|
|
164
|
+
|
|
165
|
+
For the [SECTION NAME] section, brainstorm [5-20] things that might be included, depending on the section's complexity. Look for:
|
|
166
|
+
- Context shared that might have been forgotten
|
|
167
|
+
- Angles or considerations not yet mentioned
|
|
168
|
+
|
|
169
|
+
Generate 5-20 numbered options based on section complexity. At the end, offer to brainstorm more if they want additional options.
|
|
170
|
+
|
|
171
|
+
### Step 3: Curation
|
|
172
|
+
|
|
173
|
+
Ask which points should be kept, removed, or combined. Request brief justifications to help learn priorities for the next sections.
|
|
174
|
+
|
|
175
|
+
Provide examples:
|
|
176
|
+
- "Keep 1,4,7,9"
|
|
177
|
+
- "Remove 3 (duplicates 1)"
|
|
178
|
+
- "Remove 6 (audience already knows this)"
|
|
179
|
+
- "Combine 11 and 12"
|
|
180
|
+
|
|
181
|
+
**If user gives freeform feedback** (e.g., "looks good" or "I like most of it but...") instead of numbered selections, extract their preferences and proceed. Parse what they want kept/removed/changed and apply it.
|
|
182
|
+
|
|
183
|
+
### Step 4: Gap Check
|
|
184
|
+
|
|
185
|
+
Based on what they've selected, ask if there's anything important missing for the [SECTION NAME] section.
|
|
186
|
+
|
|
187
|
+
### Step 5: Drafting
|
|
188
|
+
|
|
189
|
+
Use `str_replace` to replace the placeholder text for this section with the actual drafted content.
|
|
190
|
+
|
|
191
|
+
Announce the [SECTION NAME] section will be drafted now based on what they've selected.
|
|
192
|
+
|
|
193
|
+
**If using artifacts:**
|
|
194
|
+
After drafting, provide a link to the artifact.
|
|
195
|
+
|
|
196
|
+
Ask them to read through it and indicate what to change. Note that being specific helps learning for the next sections.
|
|
197
|
+
|
|
198
|
+
**If using a file (no artifacts):**
|
|
199
|
+
After drafting, confirm completion.
|
|
200
|
+
|
|
201
|
+
Inform them the [SECTION NAME] section has been drafted in [filename]. Ask them to read through it and indicate what to change. Note that being specific helps learning for the next sections.
|
|
202
|
+
|
|
203
|
+
**Key instruction for user (include when drafting the first section):**
|
|
204
|
+
Provide a note: Instead of editing the doc directly, ask them to indicate what to change. This helps learning of their style for future sections. For example: "Remove the X bullet - already covered by Y" or "Make the third paragraph more concise".
|
|
205
|
+
|
|
206
|
+
### Step 6: Iterative Refinement
|
|
207
|
+
|
|
208
|
+
As user provides feedback:
|
|
209
|
+
- Use `str_replace` to make edits (never reprint the whole doc)
|
|
210
|
+
- **If using artifacts:** Provide link to artifact after each edit
|
|
211
|
+
- **If using files:** Just confirm edits are complete
|
|
212
|
+
- If user edits doc directly and asks to read it: mentally note the changes they made and keep them in mind for future sections (this shows their preferences)
|
|
213
|
+
|
|
214
|
+
**Continue iterating** until user is satisfied with the section.
|
|
215
|
+
|
|
216
|
+
### Quality Checking
|
|
217
|
+
|
|
218
|
+
After 3 consecutive iterations with no substantial changes, ask if anything can be removed without losing important information.
|
|
219
|
+
|
|
220
|
+
When section is done, confirm [SECTION NAME] is complete. Ask if ready to move to the next section.
|
|
221
|
+
|
|
222
|
+
**Repeat for all sections.**
|
|
223
|
+
|
|
224
|
+
### Near Completion
|
|
225
|
+
|
|
226
|
+
As approaching completion (80%+ of sections done), announce intention to re-read the entire document and check for:
|
|
227
|
+
- Flow and consistency across sections
|
|
228
|
+
- Redundancy or contradictions
|
|
229
|
+
- Anything that feels like "slop" or generic filler
|
|
230
|
+
- Whether every sentence carries weight
|
|
231
|
+
|
|
232
|
+
Read entire document and provide feedback.
|
|
233
|
+
|
|
234
|
+
**When all sections are drafted and refined:**
|
|
235
|
+
Announce all sections are drafted. Indicate intention to review the complete document one more time.
|
|
236
|
+
|
|
237
|
+
Review for overall coherence, flow, completeness.
|
|
238
|
+
|
|
239
|
+
Provide any final suggestions.
|
|
240
|
+
|
|
241
|
+
Ask if ready to move to Reader Testing, or if they want to refine anything else.
|
|
242
|
+
|
|
243
|
+
## Stage 3: Reader Testing
|
|
244
|
+
|
|
245
|
+
**Goal:** Test the document with a fresh Claude (no context bleed) to verify it works for readers.
|
|
246
|
+
|
|
247
|
+
**Instructions to user:**
|
|
248
|
+
Explain that testing will now occur to see if the document actually works for readers. This catches blind spots - things that make sense to the authors but might confuse others.
|
|
249
|
+
|
|
250
|
+
### Testing Approach
|
|
251
|
+
|
|
252
|
+
**If access to sub-agents is available (e.g., in Claude Code):**
|
|
253
|
+
|
|
254
|
+
Perform the testing directly without user involvement.
|
|
255
|
+
|
|
256
|
+
### Step 1: Predict Reader Questions
|
|
257
|
+
|
|
258
|
+
Announce intention to predict what questions readers might ask when trying to discover this document.
|
|
259
|
+
|
|
260
|
+
Generate 5-10 questions that readers would realistically ask.
|
|
261
|
+
|
|
262
|
+
### Step 2: Test with Sub-Agent
|
|
263
|
+
|
|
264
|
+
Announce that these questions will be tested with a fresh Claude instance (no context from this conversation).
|
|
265
|
+
|
|
266
|
+
For each question, invoke a sub-agent with just the document content and the question.
|
|
267
|
+
|
|
268
|
+
Summarize what Reader Claude got right/wrong for each question.
|
|
269
|
+
|
|
270
|
+
### Step 3: Run Additional Checks
|
|
271
|
+
|
|
272
|
+
Announce additional checks will be performed.
|
|
273
|
+
|
|
274
|
+
Invoke sub-agent to check for ambiguity, false assumptions, contradictions.
|
|
275
|
+
|
|
276
|
+
Summarize any issues found.
|
|
277
|
+
|
|
278
|
+
### Step 4: Report and Fix
|
|
279
|
+
|
|
280
|
+
If issues found:
|
|
281
|
+
Report that Reader Claude struggled with specific issues.
|
|
282
|
+
|
|
283
|
+
List the specific issues.
|
|
284
|
+
|
|
285
|
+
Indicate intention to fix these gaps.
|
|
286
|
+
|
|
287
|
+
Loop back to refinement for problematic sections.
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
**If no access to sub-agents (e.g., claude.ai web interface):**
|
|
292
|
+
|
|
293
|
+
The user will need to do the testing manually.
|
|
294
|
+
|
|
295
|
+
### Step 1: Predict Reader Questions
|
|
296
|
+
|
|
297
|
+
Ask what questions people might ask when trying to discover this document. What would they type into Claude.ai?
|
|
298
|
+
|
|
299
|
+
Generate 5-10 questions that readers would realistically ask.
|
|
300
|
+
|
|
301
|
+
### Step 2: Setup Testing
|
|
302
|
+
|
|
303
|
+
Provide testing instructions:
|
|
304
|
+
1. Open a fresh Claude conversation: https://claude.ai
|
|
305
|
+
2. Paste or share the document content (if using a shared doc platform with connectors enabled, provide the link)
|
|
306
|
+
3. Ask Reader Claude the generated questions
|
|
307
|
+
|
|
308
|
+
For each question, instruct Reader Claude to provide:
|
|
309
|
+
- The answer
|
|
310
|
+
- Whether anything was ambiguous or unclear
|
|
311
|
+
- What knowledge/context the doc assumes is already known
|
|
312
|
+
|
|
313
|
+
Check if Reader Claude gives correct answers or misinterprets anything.
|
|
314
|
+
|
|
315
|
+
### Step 3: Additional Checks
|
|
316
|
+
|
|
317
|
+
Also ask Reader Claude:
|
|
318
|
+
- "What in this doc might be ambiguous or unclear to readers?"
|
|
319
|
+
- "What knowledge or context does this doc assume readers already have?"
|
|
320
|
+
- "Are there any internal contradictions or inconsistencies?"
|
|
321
|
+
|
|
322
|
+
### Step 4: Iterate Based on Results
|
|
323
|
+
|
|
324
|
+
Ask what Reader Claude got wrong or struggled with. Indicate intention to fix those gaps.
|
|
325
|
+
|
|
326
|
+
Loop back to refinement for any problematic sections.
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
### Exit Condition (Both Approaches)
|
|
331
|
+
|
|
332
|
+
When Reader Claude consistently answers questions correctly and doesn't surface new gaps or ambiguities, the doc is ready.
|
|
333
|
+
|
|
334
|
+
## Final Review
|
|
335
|
+
|
|
336
|
+
When Reader Testing passes:
|
|
337
|
+
Announce the doc has passed Reader Claude testing. Before completion:
|
|
338
|
+
|
|
339
|
+
1. Recommend they do a final read-through themselves - they own this document and are responsible for its quality
|
|
340
|
+
2. Suggest double-checking any facts, links, or technical details
|
|
341
|
+
3. Ask them to verify it achieves the impact they wanted
|
|
342
|
+
|
|
343
|
+
Ask if they want one more review, or if the work is done.
|
|
344
|
+
|
|
345
|
+
**If user wants final review, provide it. Otherwise:**
|
|
346
|
+
Announce document completion. Provide a few final tips:
|
|
347
|
+
- Consider linking this conversation in an appendix so readers can see how the doc was developed
|
|
348
|
+
- Use appendices to provide depth without bloating the main doc
|
|
349
|
+
- Update the doc as feedback is received from real readers
|
|
350
|
+
|
|
351
|
+
## Tips for Effective Guidance
|
|
352
|
+
|
|
353
|
+
**Tone:**
|
|
354
|
+
- Be direct and procedural
|
|
355
|
+
- Explain rationale briefly when it affects user behavior
|
|
356
|
+
- Don't try to "sell" the approach - just execute it
|
|
357
|
+
|
|
358
|
+
**Handling Deviations:**
|
|
359
|
+
- If user wants to skip a stage: Ask if they want to skip this and write freeform
|
|
360
|
+
- If user seems frustrated: Acknowledge this is taking longer than expected. Suggest ways to move faster
|
|
361
|
+
- Always give user agency to adjust the process
|
|
362
|
+
|
|
363
|
+
**Context Management:**
|
|
364
|
+
- Throughout, if context is missing on something mentioned, proactively ask
|
|
365
|
+
- Don't let gaps accumulate - address them as they come up
|
|
366
|
+
|
|
367
|
+
**Artifact Management:**
|
|
368
|
+
- Use `create_file` for drafting full sections
|
|
369
|
+
- Use `str_replace` for all edits
|
|
370
|
+
- Provide artifact link after every change
|
|
371
|
+
- Never use artifacts for brainstorming lists - that's just conversation
|
|
372
|
+
|
|
373
|
+
**Quality over Speed:**
|
|
374
|
+
- Don't rush through stages
|
|
375
|
+
- Each iteration should make meaningful improvements
|
|
376
|
+
- The goal is a document that actually works for readers
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: document-generation
|
|
3
|
+
scope: common
|
|
4
|
+
description: Generate Word/PDF documents with correct CJK fonts (no tofu boxes). Industry-standard font semantics — 宋体/黑体/SimSun/Times New Roman resolve to the Noto CJK faces installed in the image via fontconfig aliases. Use whenever the task produces a .docx, .pdf, or rendered document containing Chinese/Japanese/Korean text.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Document Generation (Word / PDF, CJK-safe)
|
|
8
|
+
|
|
9
|
+
The image ships `python-docx` + `reportlab` and the full Noto CJK family
|
|
10
|
+
(Sans + Serif, .ttc). Font semantics are handled by
|
|
11
|
+
`/etc/fonts/conf.d/99-cjk-semantics.conf` — renderers resolve conventional
|
|
12
|
+
Chinese font names to the right Noto face automatically. Do NOT install extra
|
|
13
|
+
font packages; use the mapping below.
|
|
14
|
+
|
|
15
|
+
## Font semantics (industry-standard mapping)
|
|
16
|
+
|
|
17
|
+
| Scenario | Conventional name | Resolves to (image) |
|
|
18
|
+
| --- | --- | --- |
|
|
19
|
+
| 官文/学术正文(宋体等效) | 宋体 / SimSun / Times New Roman | **Noto Serif CJK SC** |
|
|
20
|
+
| 标题/正文(黑体等效) | 黑体 / SimHei | **Noto Sans CJK SC** |
|
|
21
|
+
| 楷体(无开源 Noto 楷体,Serif 兜底) | 楷体 / KaiTi / 仿宋 | Noto Serif CJK SC |
|
|
22
|
+
| 代码/等宽 | Courier New / Monospace | DejaVu Sans Mono + Noto fallback |
|
|
23
|
+
|
|
24
|
+
Rule of thumb: **serif (Noto Serif CJK SC) for official/academic documents,
|
|
25
|
+
sans (Noto Sans CJK SC) for UI/headings** — same convention as Times New Roman
|
|
26
|
+
vs Arial in Western docs.
|
|
27
|
+
|
|
28
|
+
## Word (.docx) — python-docx
|
|
29
|
+
|
|
30
|
+
Word stores font *names*, not glyphs — the rendering machine resolves them.
|
|
31
|
+
Two cases:
|
|
32
|
+
|
|
33
|
+
**A. User opens the docx on their desktop (Word/WPS has 宋体/SimSun)** — write
|
|
34
|
+
conventional names so it renders correctly on THEIR machine:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from docx import Document
|
|
38
|
+
from docx.shared import Pt
|
|
39
|
+
from docx.enum.text import WD_ALIGN_PARAGRAPH
|
|
40
|
+
|
|
41
|
+
doc = Document()
|
|
42
|
+
# set east-asian font properly (both ascii + eastAsia, or Word ignores it):
|
|
43
|
+
style = doc.styles['Normal']
|
|
44
|
+
style.font.name = 'Times New Roman' # ascii
|
|
45
|
+
style.font.size = Pt(12)
|
|
46
|
+
style.element.rPr.rFonts.set('{http://schemas.openxmlformats.org/wordprocessingml/2006/main}eastAsia', '宋体')
|
|
47
|
+
p = doc.add_paragraph('中文正文——宋体五号')
|
|
48
|
+
doc.save('/workspace/output.docx')
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**B. The sandbox itself must render/convert the docx to PDF** — use Noto names
|
|
52
|
+
so fontconfig resolves locally (LibreOffice may not be installed; prefer
|
|
53
|
+
generating PDF directly with reportlab instead of converting).
|
|
54
|
+
|
|
55
|
+
## PDF — weasyprint (HTML→PDF, PREFERRED — industry standard for CJK)
|
|
56
|
+
|
|
57
|
+
**reportlab cannot render Noto CJK** (CFF/PostScript outlines — a reportlab
|
|
58
|
+
limitation, verified 2026-08-07). The industry-standard CJK PDF path is
|
|
59
|
+
**HTML/CSS → weasyprint**: CSS font-family resolves via fontconfig, the
|
|
60
|
+
aliases make conventional names work directly, and it ships in the image.
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from weasyprint import HTML
|
|
64
|
+
|
|
65
|
+
html = '''<html><head><style>
|
|
66
|
+
body { font-family: '宋体', 'Noto Serif CJK SC', serif; font-size: 12pt; }
|
|
67
|
+
h1 { font-family: '黑体', 'Noto Sans CJK SC', sans-serif; }
|
|
68
|
+
code { font-family: 'Courier New', monospace; }
|
|
69
|
+
</style></head><body>
|
|
70
|
+
<h1>中文标题——黑体</h1>
|
|
71
|
+
<p>中文正文——宋体等效。混合 ASCII text works too.</p>
|
|
72
|
+
</body></html>'''
|
|
73
|
+
HTML(string=html).write_pdf('/workspace/output.pdf')
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
pandoc is also present — `pandoc input.md -o output.pdf
|
|
77
|
+
--pdf-engine=weasyprint` is a valid markdown→PDF pipeline.
|
|
78
|
+
|
|
79
|
+
## PDF — reportlab (programmatic; ASCII/Latin only for CJK)
|
|
80
|
+
|
|
81
|
+
reportlab 5.0 rejects Noto CJK .ttc files (`postscript outlines are not
|
|
82
|
+
supported` — CFF outlines). Use reportlab only for Latin/ASCII documents, or
|
|
83
|
+
for PDFs whose text never contains CJK. For CJK content use weasyprint above.
|
|
84
|
+
|
|
85
|
+
```html
|
|
86
|
+
<style>
|
|
87
|
+
body { font-family: '宋体', 'Noto Serif CJK SC', serif; font-size: 12pt; }
|
|
88
|
+
h1 { font-family: '黑体', 'Noto Sans CJK SC', sans-serif; }
|
|
89
|
+
</style>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Verification
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
fc-match '宋体' # → Noto Serif CJK SC (alias working)
|
|
96
|
+
fc-match '黑体' # → Noto Sans CJK SC
|
|
97
|
+
fc-list | grep -c 'Noto.*CJK' # faces present
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Output contract
|
|
101
|
+
|
|
102
|
+
- Deliver the file as a task asset (`cloud file send` / attach) — never paste
|
|
103
|
+
document content as chat text.
|
|
104
|
+
- Verify the PDF opens (pdfplumber is installed) and contains the expected
|
|
105
|
+
Chinese text — tofu boxes are a FAIL, not a delivery.
|