cowork-flow 0.0.1

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.
Files changed (101) hide show
  1. package/README.md +193 -0
  2. package/bin/cowork-flow.js +9 -0
  3. package/package.json +28 -0
  4. package/src/cli.js +61 -0
  5. package/src/commands/init.js +88 -0
  6. package/src/commands/sync.js +33 -0
  7. package/src/commands/update.js +60 -0
  8. package/src/lib/copy-template.js +189 -0
  9. package/src/lib/package-info.js +49 -0
  10. package/src/lib/paths.js +6 -0
  11. package/template/.agent/skills/break-loop/SKILL.md +131 -0
  12. package/template/.agent/skills/check-cross-layer/SKILL.md +158 -0
  13. package/template/.agent/skills/finish-work/SKILL.md +163 -0
  14. package/template/.agent/skills/record-session/SKILL.md +78 -0
  15. package/template/.agent/skills/start/SKILL.md +390 -0
  16. package/template/.agent/skills/update-spec/SKILL.md +335 -0
  17. package/template/.cowork-flow/.version +1 -0
  18. package/template/.cowork-flow/changes/archive/.gitkeep +1 -0
  19. package/template/.cowork-flow/config.yaml +49 -0
  20. package/template/.cowork-flow/plans/.gitkeep +1 -0
  21. package/template/.cowork-flow/scripts/add_session.py +441 -0
  22. package/template/.cowork-flow/scripts/change.py +314 -0
  23. package/template/.cowork-flow/scripts/common/__init__.py +84 -0
  24. package/template/.cowork-flow/scripts/common/config.py +128 -0
  25. package/template/.cowork-flow/scripts/common/developer.py +205 -0
  26. package/template/.cowork-flow/scripts/common/files.py +24 -0
  27. package/template/.cowork-flow/scripts/common/git_context.py +628 -0
  28. package/template/.cowork-flow/scripts/common/paths.py +350 -0
  29. package/template/.cowork-flow/scripts/common/task_utils.py +200 -0
  30. package/template/.cowork-flow/scripts/get_context.py +16 -0
  31. package/template/.cowork-flow/scripts/get_developer.py +26 -0
  32. package/template/.cowork-flow/scripts/init_developer.py +51 -0
  33. package/template/.cowork-flow/scripts/task.py +1378 -0
  34. package/template/.cowork-flow/spec/backend/database-guidelines.md +26 -0
  35. package/template/.cowork-flow/spec/backend/directory-structure.md +27 -0
  36. package/template/.cowork-flow/spec/backend/error-handling.md +20 -0
  37. package/template/.cowork-flow/spec/backend/index.md +36 -0
  38. package/template/.cowork-flow/spec/backend/logging-guidelines.md +20 -0
  39. package/template/.cowork-flow/spec/backend/quality-guidelines.md +24 -0
  40. package/template/.cowork-flow/spec/frontend/component-guidelines.md +19 -0
  41. package/template/.cowork-flow/spec/frontend/directory-structure.md +18 -0
  42. package/template/.cowork-flow/spec/frontend/hook-guidelines.md +17 -0
  43. package/template/.cowork-flow/spec/frontend/index.md +28 -0
  44. package/template/.cowork-flow/spec/frontend/quality-guidelines.md +23 -0
  45. package/template/.cowork-flow/spec/frontend/state-management.md +18 -0
  46. package/template/.cowork-flow/spec/frontend/type-safety.md +18 -0
  47. package/template/.cowork-flow/spec/guides/code-reuse-thinking-guide.md +26 -0
  48. package/template/.cowork-flow/spec/guides/cross-layer-thinking-guide.md +21 -0
  49. package/template/.cowork-flow/spec/guides/index.md +31 -0
  50. package/template/.cowork-flow/spec/guides/pre-implementation-checklist.md +15 -0
  51. package/template/.cowork-flow/tasks/.gitkeep +1 -0
  52. package/template/.cowork-flow/tasks/archive/.gitkeep +1 -0
  53. package/template/.cowork-flow/workflow.md +411 -0
  54. package/template/.cowork-flow/workspace/index.md +95 -0
  55. package/template/.superpowers/brainstorming/SKILL.md +164 -0
  56. package/template/.superpowers/brainstorming/scripts/frame-template.html +214 -0
  57. package/template/.superpowers/brainstorming/scripts/helper.js +88 -0
  58. package/template/.superpowers/brainstorming/scripts/server.cjs +354 -0
  59. package/template/.superpowers/brainstorming/scripts/start-server.sh +148 -0
  60. package/template/.superpowers/brainstorming/scripts/stop-server.sh +56 -0
  61. package/template/.superpowers/brainstorming/spec-document-reviewer-prompt.md +49 -0
  62. package/template/.superpowers/brainstorming/visual-companion.md +287 -0
  63. package/template/.superpowers/dispatching-parallel-agents/SKILL.md +182 -0
  64. package/template/.superpowers/executing-plans/SKILL.md +70 -0
  65. package/template/.superpowers/finishing-a-development-branch/SKILL.md +251 -0
  66. package/template/.superpowers/receiving-code-review/SKILL.md +213 -0
  67. package/template/.superpowers/requesting-code-review/SKILL.md +103 -0
  68. package/template/.superpowers/requesting-code-review/code-reviewer.md +168 -0
  69. package/template/.superpowers/subagent-driven-development/SKILL.md +279 -0
  70. package/template/.superpowers/subagent-driven-development/code-quality-reviewer-prompt.md +25 -0
  71. package/template/.superpowers/subagent-driven-development/implementer-prompt.md +113 -0
  72. package/template/.superpowers/subagent-driven-development/spec-reviewer-prompt.md +61 -0
  73. package/template/.superpowers/systematic-debugging/CREATION-LOG.md +119 -0
  74. package/template/.superpowers/systematic-debugging/SKILL.md +296 -0
  75. package/template/.superpowers/systematic-debugging/condition-based-waiting-example.ts +158 -0
  76. package/template/.superpowers/systematic-debugging/condition-based-waiting.md +115 -0
  77. package/template/.superpowers/systematic-debugging/defense-in-depth.md +122 -0
  78. package/template/.superpowers/systematic-debugging/find-polluter.sh +63 -0
  79. package/template/.superpowers/systematic-debugging/root-cause-tracing.md +169 -0
  80. package/template/.superpowers/systematic-debugging/test-academic.md +14 -0
  81. package/template/.superpowers/systematic-debugging/test-pressure-1.md +58 -0
  82. package/template/.superpowers/systematic-debugging/test-pressure-2.md +68 -0
  83. package/template/.superpowers/systematic-debugging/test-pressure-3.md +69 -0
  84. package/template/.superpowers/test-driven-development/SKILL.md +371 -0
  85. package/template/.superpowers/test-driven-development/testing-anti-patterns.md +299 -0
  86. package/template/.superpowers/using-git-worktrees/SKILL.md +215 -0
  87. package/template/.superpowers/using-superpowers/SKILL.md +117 -0
  88. package/template/.superpowers/using-superpowers/references/codex-tools.md +59 -0
  89. package/template/.superpowers/using-superpowers/references/copilot-tools.md +42 -0
  90. package/template/.superpowers/using-superpowers/references/gemini-tools.md +51 -0
  91. package/template/.superpowers/verification-before-completion/SKILL.md +139 -0
  92. package/template/.superpowers/writing-plans/SKILL.md +152 -0
  93. package/template/.superpowers/writing-plans/plan-document-reviewer-prompt.md +49 -0
  94. package/template/.superpowers/writing-skills/SKILL.md +655 -0
  95. package/template/.superpowers/writing-skills/anthropic-best-practices.md +1150 -0
  96. package/template/.superpowers/writing-skills/examples/CLAUDE_MD_TESTING.md +189 -0
  97. package/template/.superpowers/writing-skills/graphviz-conventions.dot +172 -0
  98. package/template/.superpowers/writing-skills/persuasion-principles.md +187 -0
  99. package/template/.superpowers/writing-skills/render-graphs.js +168 -0
  100. package/template/.superpowers/writing-skills/testing-skills-with-subagents.md +384 -0
  101. package/template/AGENTS.md +116 -0
@@ -0,0 +1,49 @@
1
+ import { execFile, spawn } from 'node:child_process';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { join } from 'node:path';
4
+ import { promisify } from 'node:util';
5
+
6
+ import { packageRoot } from './paths.js';
7
+
8
+ const execFileAsync = promisify(execFile);
9
+
10
+ export async function readPackageInfo() {
11
+ const raw = await readFile(join(packageRoot, 'package.json'), 'utf8');
12
+ return JSON.parse(raw);
13
+ }
14
+
15
+ export function compareVersions(left, right) {
16
+ const leftParts = left.split('.').map((part) => Number.parseInt(part, 10));
17
+ const rightParts = right.split('.').map((part) => Number.parseInt(part, 10));
18
+ const length = Math.max(leftParts.length, rightParts.length);
19
+
20
+ for (let index = 0; index < length; index += 1) {
21
+ const leftValue = Number.isFinite(leftParts[index]) ? leftParts[index] : 0;
22
+ const rightValue = Number.isFinite(rightParts[index]) ? rightParts[index] : 0;
23
+ if (leftValue < rightValue) {
24
+ return -1;
25
+ }
26
+ if (leftValue > rightValue) {
27
+ return 1;
28
+ }
29
+ }
30
+
31
+ return 0;
32
+ }
33
+
34
+ export async function fetchLatestVersion(packageName = 'cowork-flow') {
35
+ const result = await execFileAsync('npm', ['view', packageName, 'version'], {
36
+ encoding: 'utf8'
37
+ });
38
+ return result.stdout.trim();
39
+ }
40
+
41
+ export async function runGlobalInstall(packageSpec = 'cowork-flow@latest') {
42
+ return new Promise((resolvePromise, rejectPromise) => {
43
+ const child = spawn('npm', ['install', '-g', packageSpec], {
44
+ stdio: 'inherit'
45
+ });
46
+ child.on('error', rejectPromise);
47
+ child.on('close', (code) => resolvePromise(code ?? 1));
48
+ });
49
+ }
@@ -0,0 +1,6 @@
1
+ import { dirname, resolve } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+
4
+ export const srcRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..');
5
+ export const packageRoot = resolve(srcRoot, '..');
6
+ export const templateRoot = resolve(packageRoot, 'template');
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: break-loop
3
+ description: Use when a bug has been fixed or repeated debugging attempts reveal a pattern that should be captured
4
+ ---
5
+
6
+ # Break the Loop - Deep Bug Analysis
7
+
8
+ When debug is complete, use this skill for deep analysis to break the "fix bug -> forget -> repeat" cycle.
9
+
10
+ ---
11
+
12
+ ## Analysis Framework
13
+
14
+ Analyze the bug you just fixed from these 5 dimensions:
15
+
16
+ ### 1. Root Cause Category
17
+
18
+ Which category does this bug belong to?
19
+
20
+ | Category | Characteristics | Example |
21
+ |----------|-----------------|---------|
22
+ | **A. Missing Spec** | No documentation on how to do it | New feature without checklist |
23
+ | **B. Cross-Layer Contract** | Interface between layers unclear | API returns different format than expected |
24
+ | **C. Change Propagation Failure** | Changed one place, missed others | Changed function signature, missed call sites |
25
+ | **D. Test Coverage Gap** | Unit test passes, integration fails | Works alone, breaks when combined |
26
+ | **E. Implicit Assumption** | Code relies on undocumented assumption | Timestamp seconds vs milliseconds |
27
+
28
+ ### 2. Why Fixes Failed (if applicable)
29
+
30
+ If you tried multiple fixes before succeeding, analyze each failure:
31
+
32
+ - **Surface Fix**: Fixed symptom, not root cause
33
+ - **Incomplete Scope**: Found root cause, didn't cover all cases
34
+ - **Tool Limitation**: grep missed it, type check wasn't strict
35
+ - **Mental Model**: Kept looking in same layer, didn't think cross-layer
36
+
37
+ ### 3. Prevention Mechanisms
38
+
39
+ What mechanisms would prevent this from happening again?
40
+
41
+ | Type | Description | Example |
42
+ |------|-------------|---------|
43
+ | **Documentation** | Write it down so people know | Update thinking guide |
44
+ | **Architecture** | Make the error impossible structurally | Type-safe wrappers |
45
+ | **Compile-time** | TypeScript strict, no any | Signature change causes compile error |
46
+ | **Runtime** | Monitoring, alerts, scans | Detect orphan entities |
47
+ | **Test Coverage** | E2E tests, integration tests | Verify full flow |
48
+ | **Code Review** | Checklist, PR template | "Did you check X?" |
49
+
50
+ ### 4. Systematic Expansion
51
+
52
+ What broader problems does this bug reveal?
53
+
54
+ - **Similar Issues**: Where else might this problem exist?
55
+ - **Design Flaw**: Is there a fundamental architecture issue?
56
+ - **Process Flaw**: Is there a development process improvement?
57
+ - **Knowledge Gap**: Is the team missing some understanding?
58
+
59
+ ### 5. Knowledge Capture
60
+
61
+ Solidify insights into the system:
62
+
63
+ - [ ] Update `.cowork-flow/spec/guides/` thinking guides
64
+ - [ ] Update `.cowork-flow/spec/backend/` or `frontend/` docs
65
+ - [ ] Create issue record (if applicable)
66
+ - [ ] Create feature ticket for root fix
67
+ - [ ] Update `.cowork-flow/spec/` or workflow gates if needed
68
+
69
+ ---
70
+
71
+ ## Output Format
72
+
73
+ Please output analysis in this format:
74
+
75
+ ```markdown
76
+ ## Bug Analysis: [Short Description]
77
+
78
+ ### 1. Root Cause Category
79
+ - **Category**: [A/B/C/D/E] - [Category Name]
80
+ - **Specific Cause**: [Detailed description]
81
+
82
+ ### 2. Why Fixes Failed (if applicable)
83
+ 1. [First attempt]: [Why it failed]
84
+ 2. [Second attempt]: [Why it failed]
85
+ ...
86
+
87
+ ### 3. Prevention Mechanisms
88
+ | Priority | Mechanism | Specific Action | Status |
89
+ |----------|-----------|-----------------|--------|
90
+ | P0 | ... | ... | TODO/DONE |
91
+
92
+ ### 4. Systematic Expansion
93
+ - **Similar Issues**: [List places with similar problems]
94
+ - **Design Improvement**: [Architecture-level suggestions]
95
+ - **Process Improvement**: [Development process suggestions]
96
+
97
+ ### 5. Knowledge Capture
98
+ - [ ] [Documents to update / tickets to create]
99
+ ```
100
+
101
+ ---
102
+
103
+ ## Core Philosophy
104
+
105
+ > **The value of debugging is not in fixing the bug, but in making this class of bugs never happen again.**
106
+
107
+ Three levels of insight:
108
+ 1. **Tactical**: How to fix THIS bug
109
+ 2. **Strategic**: How to prevent THIS CLASS of bugs
110
+ 3. **Philosophical**: How to expand thinking patterns
111
+
112
+ 30 minutes of analysis saves 30 hours of future debugging.
113
+
114
+ ---
115
+
116
+ ## After Analysis: Immediate Actions
117
+
118
+ **IMPORTANT**: After completing the analysis above, you MUST immediately:
119
+
120
+ 1. **Update spec/guides** - Don't just list TODOs, actually update the relevant files:
121
+ - If it's a cross-platform issue → update `cross-platform-thinking-guide.md`
122
+ - If it's a cross-layer issue → update `cross-layer-thinking-guide.md`
123
+ - If it's a code reuse issue → update `code-reuse-thinking-guide.md`
124
+ - If it's domain-specific → update `backend/*.md` or `frontend/*.md`
125
+ - If it's project-specific policy or commands → update `AGENTS.md`, `.cowork-flow/workflow.md`, or `.cowork-flow/config.yaml`
126
+
127
+ 2. **Do not edit reusable skills for project-specific lessons** - Skills should stay generic. Capture project facts in specs, config, workflow, or AGENTS instead.
128
+
129
+ 3. **Follow the project commit policy for the spec updates** - This is the primary output, not just the analysis text
130
+
131
+ > **The analysis is worthless if it stays in chat. The value is in the updated specs.**
@@ -0,0 +1,158 @@
1
+ ---
2
+ name: check-cross-layer
3
+ description: Use when reviewing changes that span layers, contracts, repeated patterns, or shared utilities
4
+ ---
5
+
6
+ # Cross-Layer Check
7
+
8
+ Check if your changes considered all dimensions. Most bugs come from "didn't think of it", not lack of technical skill.
9
+
10
+ > **Note**: This is a **post-implementation** safety net. Ideally, read the [Pre-Implementation Checklist](.cowork-flow/spec/guides/pre-implementation-checklist.md) **before** writing code.
11
+
12
+ ---
13
+
14
+ ## Related Documents
15
+
16
+ | Document | Purpose | Timing |
17
+ |----------|---------|--------|
18
+ | [Pre-Implementation Checklist](.cowork-flow/spec/guides/pre-implementation-checklist.md) | Questions before coding | **Before** writing code |
19
+ | [Code Reuse Thinking Guide](.cowork-flow/spec/guides/code-reuse-thinking-guide.md) | Pattern recognition | During implementation |
20
+ | **`$check-cross-layer`** (this skill) | Verification check | **After** implementation |
21
+
22
+ ---
23
+
24
+ ## Execution Steps
25
+
26
+ ### 1. Identify Change Scope
27
+
28
+ ```bash
29
+ git status
30
+ git diff --name-only
31
+ ```
32
+
33
+ ### 2. Select Applicable Check Dimensions
34
+
35
+ Based on your change type, execute relevant checks below:
36
+
37
+ ---
38
+
39
+ ## Dimension A: Cross-Layer Data Flow (Required when 3+ layers)
40
+
41
+ **Trigger**: Changes involve 3 or more layers
42
+
43
+ | Layer | Common Locations |
44
+ |-------|------------------|
45
+ | API/Routes | `routes/`, `api/`, `handlers/`, `controllers/` |
46
+ | Service/Business Logic | `services/`, `lib/`, `core/`, `domain/` |
47
+ | Database/Storage | `db/`, `models/`, `repositories/`, `schema/` |
48
+ | UI/Presentation | `components/`, `views/`, `templates/`, `pages/` |
49
+ | Utility | `utils/`, `helpers/`, `common/` |
50
+
51
+ **Checklist**:
52
+ - [ ] Read flow: Database -> Service -> API -> UI
53
+ - [ ] Write flow: UI -> API -> Service -> Database
54
+ - [ ] Types/schemas correctly passed between layers?
55
+ - [ ] Errors properly propagated to caller?
56
+ - [ ] Loading/pending states handled at each layer?
57
+
58
+ **Detailed Guide**: `.cowork-flow/spec/guides/cross-layer-thinking-guide.md`
59
+
60
+ ---
61
+
62
+ ## Dimension B: Code Reuse (Required when modifying constants/config)
63
+
64
+ **Trigger**:
65
+ - Modifying UI constants (label, icon, color)
66
+ - Modifying any hardcoded value
67
+ - Seeing similar code in multiple places
68
+ - Creating a new utility/helper function
69
+ - Just finished batch modifications across files
70
+
71
+ **Checklist**:
72
+ - [ ] Search first: How many places define this value?
73
+ ```bash
74
+ # Search in source files (adjust extensions for your project)
75
+ grep -r "value-to-change" src/
76
+ ```
77
+ - [ ] If 2+ places define same value -> Should extract to shared constant
78
+ - [ ] After modification, all usage sites updated?
79
+ - [ ] If creating utility: Does similar utility already exist?
80
+
81
+ **Detailed Guide**: `.cowork-flow/spec/guides/code-reuse-thinking-guide.md`
82
+
83
+ ---
84
+
85
+ ## Dimension B2: New Utility Functions
86
+
87
+ **Trigger**: About to create a new utility/helper function
88
+
89
+ **Checklist**:
90
+ - [ ] Search for existing similar utilities first
91
+ ```bash
92
+ grep -r "functionNamePattern" src/
93
+ ```
94
+ - [ ] If similar exists, can you extend it instead?
95
+ - [ ] If creating new, is it in the right location (shared vs domain-specific)?
96
+
97
+ ---
98
+
99
+ ## Dimension B3: After Batch Modifications
100
+
101
+ **Trigger**: Just modified similar patterns in multiple files
102
+
103
+ **Checklist**:
104
+ - [ ] Did you check ALL files with similar patterns?
105
+ ```bash
106
+ grep -r "patternYouChanged" src/
107
+ ```
108
+ - [ ] Any files missed that should also be updated?
109
+ - [ ] Should this pattern be abstracted to prevent future duplication?
110
+
111
+ ---
112
+
113
+ ## Dimension C: Import/Dependency Paths (Required when creating new files)
114
+
115
+ **Trigger**: Creating new source files
116
+
117
+ **Checklist**:
118
+ - [ ] Using correct import paths (relative vs absolute)?
119
+ - [ ] No circular dependencies?
120
+ - [ ] Consistent with project's module organization?
121
+
122
+ ---
123
+
124
+ ## Dimension D: Same-Layer Consistency
125
+
126
+ **Trigger**:
127
+ - Modifying display logic or formatting
128
+ - Same domain concept used in multiple places
129
+
130
+ **Checklist**:
131
+ - [ ] Search for other places using same concept
132
+ ```bash
133
+ grep -r "ConceptName" src/
134
+ ```
135
+ - [ ] Are these usages consistent?
136
+ - [ ] Should they share configuration/constants?
137
+
138
+ ---
139
+
140
+ ## Common Issues Quick Reference
141
+
142
+ | Issue | Root Cause | Prevention |
143
+ |-------|------------|------------|
144
+ | Changed one place, missed others | Didn't search impact scope | `grep` before changing |
145
+ | Data lost at some layer | Didn't check data flow | Trace data source to destination |
146
+ | Type/schema mismatch | Cross-layer types inconsistent | Use shared type definitions |
147
+ | UI/output inconsistent | Same concept in multiple places | Extract shared constants |
148
+ | Similar utility exists | Didn't search first | Search before creating |
149
+ | Batch fix incomplete | Didn't verify all occurrences | grep after fixing |
150
+
151
+ ---
152
+
153
+ ## Output
154
+
155
+ Report:
156
+ 1. Which dimensions your changes involve
157
+ 2. Check results for each dimension
158
+ 3. Issues found and fix suggestions
@@ -0,0 +1,163 @@
1
+ ---
2
+ name: finish-work
3
+ description: Use when finishing implementation work before handoff, submission, or project-defined commit
4
+ ---
5
+
6
+ # Finish Work - Pre-Commit Checklist
7
+
8
+ Before handoff, submission, or commit according to the project's policy, use this checklist to ensure work completeness.
9
+
10
+ **Timing**: After code is written and tested, before final handoff or commit.
11
+
12
+ ---
13
+
14
+ ## Project Facts Source
15
+
16
+ Do not edit this skill to replace commands or policy. Read project-specific facts from:
17
+
18
+ 1. `AGENTS.md` - test commands, commit policy, language and collaboration rules
19
+ 2. `.cowork-flow/workflow.md` - workflow gates and completion definition
20
+ 3. `.cowork-flow/config.yaml` - optional verification command lists
21
+ 4. `.cowork-flow/spec/` - project-specific implementation contracts
22
+
23
+ If verification commands are listed in `.cowork-flow/config.yaml`, run them. If not, use the commands defined in `AGENTS.md` or infer the smallest relevant checks from the project files, then state the assumption.
24
+
25
+ ---
26
+
27
+ ## Checklist
28
+
29
+ ### 1. Code Quality
30
+
31
+ - [ ] Read `AGENTS.md` and `.cowork-flow/config.yaml` for verification commands?
32
+ - [ ] Static checks pass, if configured?
33
+ - [ ] Build / type check pass, if configured?
34
+ - [ ] Tests pass, if configured?
35
+ - [ ] Temporary debug output removed?
36
+ - [ ] Unsafe bypasses / force assertions reviewed?
37
+
38
+ ### 2. Code-Spec Sync
39
+
40
+ **Code-Spec Docs**:
41
+ - [ ] Does `.cowork-flow/spec/backend/` need updates?
42
+ - New patterns, new modules, new conventions, if backend specs exist
43
+ - [ ] Does `.cowork-flow/spec/frontend/` need updates?
44
+ - New components, new hooks, new patterns, if frontend specs exist
45
+ - [ ] Does `.cowork-flow/spec/guides/` need updates?
46
+ - New cross-layer flows, lessons from bugs, if guide specs exist
47
+
48
+ **Key Question**:
49
+ > "If I fixed a bug or discovered something non-obvious, should I document it so future me (or others) won't hit the same issue?"
50
+
51
+ If YES -> Update the relevant code-spec doc.
52
+
53
+ ### 2.5. Code-Spec Hard Block (Infra/Cross-Layer)
54
+
55
+ If this change touches infra or cross-layer contracts, this is a blocking checklist:
56
+
57
+ - [ ] Spec content is executable (real signatures/contracts), not principle-only text
58
+ - [ ] Includes file path + command/API name + payload field names
59
+ - [ ] Includes validation and error matrix
60
+ - [ ] Includes Good/Base/Bad cases
61
+ - [ ] Includes required tests and assertion points
62
+
63
+ **Block Rule**:
64
+ If infra/cross-layer changed but the related spec is still abstract, do NOT finish. Run `$update-spec` manually first.
65
+
66
+ ### 2.6. Plan Sync
67
+
68
+ If this task has a plan file in `.cowork-flow/plans/`:
69
+
70
+ - [ ] Completed and verified plan steps are checked (`- [x]`)
71
+ - [ ] Incomplete or blocked steps remain unchecked and are not falsely marked done
72
+ - [ ] The plan's `Current Execution Status` (or equivalent section) reflects the latest verification / review / blocker state
73
+ - [ ] Plan status matches the real task state before commit, archive, or completion claims
74
+
75
+ ### 3. API Changes
76
+
77
+ If you modified API endpoints:
78
+
79
+ - [ ] Input schema updated?
80
+ - [ ] Output schema updated?
81
+ - [ ] API documentation updated?
82
+ - [ ] Client code updated to match?
83
+
84
+ ### 4. Database Changes
85
+
86
+ If you modified database schema:
87
+
88
+ - [ ] Migration file created?
89
+ - [ ] Schema file updated?
90
+ - [ ] Related queries updated?
91
+ - [ ] Seed data updated (if applicable)?
92
+
93
+ ### 5. Cross-Layer Verification
94
+
95
+ If the change spans multiple layers:
96
+
97
+ - [ ] Data flows correctly through all layers?
98
+ - [ ] Error handling works at each boundary?
99
+ - [ ] Types are consistent across layers?
100
+ - [ ] Loading states handled?
101
+
102
+ ### 6. Manual Testing
103
+
104
+ - [ ] Feature works in browser/app?
105
+ - [ ] Edge cases tested?
106
+ - [ ] Error states tested?
107
+ - [ ] Works after page refresh?
108
+
109
+ ---
110
+
111
+ ## Quick Check Flow
112
+
113
+ ```bash
114
+ # 1. View changes
115
+ git status
116
+ git diff --name-only
117
+
118
+ # 2. Run project verification commands from AGENTS.md or .cowork-flow/config.yaml
119
+
120
+ # 3. Based on changed files, check relevant items above
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Common Oversights
126
+
127
+ | Oversight | Consequence | Check |
128
+ |-----------|-------------|-------|
129
+ | Code-spec docs not updated | Others don't know the change | Check .cowork-flow/spec/ |
130
+ | Spec text is abstract only | Easy regressions in infra/cross-layer changes | Require signature/contract/matrix/cases/tests |
131
+ | Migration not created | Schema out of sync | Check migration directory |
132
+ | Types/contracts not synced | Runtime errors | Check shared contract definitions |
133
+ | Tests not updated | False confidence | Run full test suite |
134
+ | Console.log left in | Noisy production logs | Search for console.log |
135
+ | Plan checkboxes not synced | Docs drift from real progress | Check `.cowork-flow/plans/` before finishing |
136
+
137
+ ---
138
+
139
+ ## Relationship to Other Commands
140
+
141
+ ```
142
+ Development Flow:
143
+ Write code -> Test -> $finish-work -> project commit/handoff policy -> $record-session
144
+ | |
145
+ Ensure completeness Record progress
146
+
147
+ Debug Flow:
148
+ Hit bug -> Fix -> $break-loop -> Knowledge capture
149
+ |
150
+ Deep analysis
151
+ ```
152
+
153
+ - `$finish-work` - Check work completeness (this skill)
154
+ - `$record-session` - Record session and completed work
155
+ - `$break-loop` - Deep analysis after debugging
156
+
157
+ ---
158
+
159
+ ## Core Principle
160
+
161
+ > **Delivery includes not just code, but also documentation, verification, and knowledge capture.**
162
+
163
+ Complete work = Code + Docs + Tests + Verification
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: record-session
3
+ description: Use when recording completed work after verification and project commit or handoff policy has been satisfied
4
+ ---
5
+
6
+ [!] **Prerequisite**: This skill should only be used AFTER verification is complete and business changes have been handled according to the project's commit / handoff policy, or when this is a planning / documentation-only session.
7
+
8
+ Read `AGENTS.md` and `.cowork-flow/workflow.md` for the project's commit policy. The scripts below handle their own commits for `.cowork-flow/` metadata when git is available; do not use this skill to decide who commits business code.
9
+
10
+ ---
11
+
12
+ ## Record Work Progress
13
+
14
+ ### Step 0: Sync Plan Status First
15
+
16
+ If the current task uses a plan file in `.cowork-flow/plans/`, update it before recording the session:
17
+
18
+ - Check every completed and verified step as `- [x]`
19
+ - Keep incomplete / blocked steps unchecked
20
+ - Update the plan's current execution status with the latest review, verification, blocker, or handoff result
21
+
22
+ Do not archive a task while the plan file still shows stale progress.
23
+
24
+ ### Step 1: Get Context & Check Tasks
25
+
26
+ ```bash
27
+ python3 ./.cowork-flow/scripts/get_context.py --mode record
28
+ ```
29
+
30
+ [!] Archive tasks whose work is **actually done** — judge by work status, not the `status` field in task.json:
31
+ - Business changes handled per project policy? → Archive it
32
+ - All acceptance criteria met? → Archive it
33
+ - Don't skip archiving just because `status` still says `planning` or `in_progress`
34
+
35
+ ```bash
36
+ python3 ./.cowork-flow/scripts/task.py archive <task-name>
37
+ ```
38
+
39
+ ### Step 2: One-Click Add Session
40
+
41
+ ```bash
42
+ # Method 1: Simple parameters
43
+ python3 ./.cowork-flow/scripts/add_session.py \
44
+ --title "Session Title" \
45
+ --commit "hash1,hash2" \
46
+ --summary "Brief summary of what was done"
47
+
48
+ # Method 2: Pass detailed content via stdin
49
+ cat << 'EOF' | python3 ./.cowork-flow/scripts/add_session.py --title "Title" --commit "hash"
50
+ | Feature | Description |
51
+ |---------|-------------|
52
+ | Change | Description |
53
+ |--------|-------------|
54
+ | API | Updated endpoint contract |
55
+ | UI | Synced client interaction |
56
+
57
+ **Updated Files**:
58
+ - `src/module/example-file.ext`
59
+ - `docs/spec/example.md`
60
+ EOF
61
+ ```
62
+
63
+ **Auto-completes**:
64
+ - [OK] Appends session to journal-N.md
65
+ - [OK] Auto-detects line count, creates new file if >2000 lines
66
+ - [OK] Updates index.md (Total Sessions +1, Last Active, line stats, history)
67
+ - [OK] Auto-commits .cowork-flow/workspace and .cowork-flow/tasks changes when git is available
68
+
69
+ ---
70
+
71
+ ## Script Command Reference
72
+
73
+ | Command | Purpose |
74
+ |---------|---------|
75
+ | `python3 ./.cowork-flow/scripts/get_context.py --mode record` | Get context for record-session |
76
+ | `python3 ./.cowork-flow/scripts/add_session.py --title "..." --commit "..."` | **One-click add session (recommended)** |
77
+ | `python3 ./.cowork-flow/scripts/task.py archive <name>` | Archive completed task (auto-commits) |
78
+ | `python3 ./.cowork-flow/scripts/task.py list` | List active tasks |