continuous-improvement 3.1.0 → 3.8.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.
Files changed (126) hide show
  1. package/.claude-plugin/marketplace.json +78 -0
  2. package/CHANGELOG.md +191 -0
  3. package/LICENSE +21 -21
  4. package/QUICKSTART.md +101 -81
  5. package/README.md +207 -359
  6. package/SKILL.md +87 -9
  7. package/action.yml +33 -33
  8. package/bin/analyze.sh +161 -153
  9. package/bin/backfill.mjs +172 -0
  10. package/bin/check-docs-substrings.mjs +333 -0
  11. package/bin/check-everything-mirror.mjs +145 -0
  12. package/bin/check-routing-targets.mjs +151 -0
  13. package/bin/check-skill-law-tag.mjs +128 -0
  14. package/bin/check-skill-mirror.mjs +119 -0
  15. package/bin/check-skill-tiers.mjs +116 -0
  16. package/bin/check-third-party-shape.mjs +202 -0
  17. package/bin/generate-plugin-manifests.mjs +169 -0
  18. package/bin/harvest-friction.mjs +279 -0
  19. package/bin/hook-stats.mjs +258 -0
  20. package/bin/install.mjs +417 -516
  21. package/bin/lint-transcript.mjs +182 -210
  22. package/bin/mcp-server.mjs +840 -617
  23. package/bin/observe.mjs +148 -0
  24. package/bin/pre-commit-block-strays.sh +49 -0
  25. package/bin/refresh-third-party.mjs +416 -0
  26. package/bin/unified-cli.mjs +533 -0
  27. package/commands/continuous-improvement.md +115 -74
  28. package/commands/dashboard.md +56 -56
  29. package/commands/discipline.md +51 -37
  30. package/commands/harvest.md +76 -0
  31. package/commands/learn-eval.md +117 -0
  32. package/commands/planning-with-files.md +66 -0
  33. package/commands/proceed-with-the-recommendation.md +62 -0
  34. package/commands/ralph.md +103 -0
  35. package/commands/release-train.md +81 -0
  36. package/commands/seven-laws.md +16 -0
  37. package/commands/superpowers.md +153 -0
  38. package/commands/swarm.md +101 -0
  39. package/commands/workspace-surface-audit.md +77 -0
  40. package/hooks/observe.sh +172 -134
  41. package/hooks/session.sh +106 -106
  42. package/hooks/three-section-close.mjs +181 -0
  43. package/instinct-packs/go.json +58 -58
  44. package/instinct-packs/meta.json +16 -0
  45. package/instinct-packs/python.json +58 -58
  46. package/instinct-packs/react.json +58 -58
  47. package/lib/cli-anything.mjs +401 -0
  48. package/lib/compound-engineering.mjs +831 -0
  49. package/lib/observe-event.mjs +128 -0
  50. package/lib/plugin-metadata.mjs +432 -0
  51. package/lib/pm-marketplace.mjs +61 -0
  52. package/lib/pm-skills.mjs +1274 -0
  53. package/lib/resolve-home-dir.mjs +43 -0
  54. package/lib/skill-tiers.mjs +137 -0
  55. package/lib/unified-plugin.mjs +924 -0
  56. package/llms.txt +68 -43
  57. package/package.json +28 -19
  58. package/plugins/beginner.json +17 -6
  59. package/plugins/continuous-improvement/.claude-plugin/marketplace.json +20 -0
  60. package/plugins/continuous-improvement/.claude-plugin/plugin.json +26 -0
  61. package/plugins/continuous-improvement/LICENSE +21 -0
  62. package/plugins/continuous-improvement/README.md +56 -0
  63. package/plugins/continuous-improvement/bin/backfill.mjs +172 -0
  64. package/plugins/continuous-improvement/bin/mcp-server.mjs +886 -0
  65. package/plugins/continuous-improvement/bin/observe.mjs +148 -0
  66. package/plugins/continuous-improvement/commands/continuous-improvement.md +115 -0
  67. package/plugins/continuous-improvement/commands/dashboard.md +56 -0
  68. package/plugins/continuous-improvement/commands/discipline.md +51 -0
  69. package/plugins/continuous-improvement/commands/harvest.md +76 -0
  70. package/plugins/continuous-improvement/commands/learn-eval.md +117 -0
  71. package/plugins/continuous-improvement/commands/planning-with-files.md +66 -0
  72. package/plugins/continuous-improvement/commands/proceed-with-the-recommendation.md +62 -0
  73. package/plugins/continuous-improvement/commands/ralph.md +103 -0
  74. package/plugins/continuous-improvement/commands/release-train.md +81 -0
  75. package/plugins/continuous-improvement/commands/seven-laws.md +16 -0
  76. package/plugins/continuous-improvement/commands/superpowers.md +153 -0
  77. package/plugins/continuous-improvement/commands/swarm.md +101 -0
  78. package/plugins/continuous-improvement/commands/workspace-surface-audit.md +77 -0
  79. package/plugins/continuous-improvement/hooks/hooks.json +60 -0
  80. package/plugins/continuous-improvement/hooks/observe.sh +172 -0
  81. package/plugins/continuous-improvement/hooks/session.sh +106 -0
  82. package/plugins/continuous-improvement/hooks/three-section-close.mjs +181 -0
  83. package/plugins/continuous-improvement/instinct-packs/go.json +58 -0
  84. package/plugins/continuous-improvement/instinct-packs/meta.json +16 -0
  85. package/plugins/continuous-improvement/instinct-packs/python.json +58 -0
  86. package/plugins/continuous-improvement/instinct-packs/react.json +58 -0
  87. package/plugins/continuous-improvement/lib/observe-event.mjs +128 -0
  88. package/plugins/continuous-improvement/lib/plugin-metadata.mjs +432 -0
  89. package/plugins/continuous-improvement/lib/resolve-home-dir.mjs +43 -0
  90. package/plugins/continuous-improvement/skills/README.md +34 -0
  91. package/plugins/continuous-improvement/skills/continuous-improvement/SKILL.md +249 -0
  92. package/plugins/continuous-improvement/skills/deploy-receipt/SKILL.md +131 -0
  93. package/plugins/continuous-improvement/skills/gateguard/SKILL.md +155 -0
  94. package/plugins/continuous-improvement/skills/para-memory-files/SKILL.md +108 -0
  95. package/plugins/continuous-improvement/skills/proceed-with-the-recommendation/SKILL.md +454 -0
  96. package/plugins/continuous-improvement/skills/ralph/SKILL.md +221 -0
  97. package/plugins/continuous-improvement/skills/safety-guard/SKILL.md +76 -0
  98. package/plugins/continuous-improvement/skills/strategic-compact/SKILL.md +104 -0
  99. package/plugins/continuous-improvement/skills/superpowers/SKILL.md +212 -0
  100. package/plugins/continuous-improvement/skills/tdd-workflow/SKILL.md +411 -0
  101. package/plugins/continuous-improvement/skills/token-budget-advisor/SKILL.md +136 -0
  102. package/plugins/continuous-improvement/skills/verification-loop/SKILL.md +192 -0
  103. package/plugins/continuous-improvement/skills/wild-risa-balance/SKILL.md +191 -0
  104. package/plugins/continuous-improvement/skills/workspace-surface-audit/SKILL.md +147 -0
  105. package/plugins/continuous-improvement/templates/planning-with-files/findings.md +8 -0
  106. package/plugins/continuous-improvement/templates/planning-with-files/progress.md +7 -0
  107. package/plugins/continuous-improvement/templates/planning-with-files/task_plan.md +23 -0
  108. package/plugins/expert.json +26 -5
  109. package/skills/README.md +79 -0
  110. package/skills/deploy-receipt.md +131 -0
  111. package/skills/gateguard.md +155 -0
  112. package/skills/para-memory-files.md +108 -0
  113. package/skills/proceed-with-the-recommendation.md +454 -0
  114. package/skills/ralph.md +221 -0
  115. package/skills/safety-guard.md +76 -0
  116. package/skills/strategic-compact.md +104 -0
  117. package/skills/superpowers.md +212 -0
  118. package/skills/tdd-workflow.md +411 -0
  119. package/skills/token-budget-advisor.md +136 -0
  120. package/skills/verification-loop.md +192 -0
  121. package/skills/wild-risa-balance.md +191 -0
  122. package/skills/workspace-surface-audit.md +147 -0
  123. package/templates/planning-with-files/findings.md +8 -0
  124. package/templates/planning-with-files/progress.md +7 -0
  125. package/templates/planning-with-files/task_plan.md +23 -0
  126. package/templates/verify-ladder.example.json +47 -0
@@ -0,0 +1,411 @@
1
+ ---
2
+ name: tdd-workflow
3
+ tier: "1"
4
+ description: Enforces Law 3 (One Thing at a Time) and Law 4 (Verify Before Reporting) of the 7 Laws of AI Agent Discipline. Use this skill when writing new features, fixing bugs, or refactoring code. Enforces test-driven development with 80%+ coverage including unit, integration, and E2E tests.
5
+ origin: continuous-improvement
6
+ ---
7
+
8
+ # Test-Driven Development Workflow
9
+
10
+ This skill ensures all code development follows TDD principles with comprehensive test coverage.
11
+
12
+ ## When to Activate
13
+
14
+ - Writing new features or functionality
15
+ - Fixing bugs or issues
16
+ - Refactoring existing code
17
+ - Adding API endpoints
18
+ - Creating new components
19
+
20
+ ## Core Principles
21
+
22
+ ### 1. Tests BEFORE Code
23
+ ALWAYS write tests first, then implement code to make tests pass.
24
+
25
+ ### 2. Coverage Requirements
26
+ - Minimum 80% coverage (unit + integration + E2E)
27
+ - All edge cases covered
28
+ - Error scenarios tested
29
+ - Boundary conditions verified
30
+
31
+ ### 3. Test Types
32
+
33
+ #### Unit Tests
34
+ - Individual functions and utilities
35
+ - Component logic
36
+ - Pure functions
37
+ - Helpers and utilities
38
+
39
+ #### Integration Tests
40
+ - API endpoints
41
+ - Database operations
42
+ - Service interactions
43
+ - External API calls
44
+
45
+ #### E2E Tests (Playwright)
46
+ - Critical user flows
47
+ - Complete workflows
48
+ - Browser automation
49
+ - UI interactions
50
+
51
+ ## TDD Workflow Steps
52
+
53
+ ### Step 1: Write User Journeys
54
+ ```
55
+ As a [role], I want to [action], so that [benefit]
56
+
57
+ Example:
58
+ As a user, I want to search for markets semantically,
59
+ so that I can find relevant markets even without exact keywords.
60
+ ```
61
+
62
+ ### Step 2: Generate Test Cases
63
+ For each user journey, create comprehensive test cases:
64
+
65
+ ```typescript
66
+ describe('Semantic Search', () => {
67
+ it('returns relevant markets for query', async () => {
68
+ // Test implementation
69
+ })
70
+
71
+ it('handles empty query gracefully', async () => {
72
+ // Test edge case
73
+ })
74
+
75
+ it('falls back to substring search when Redis unavailable', async () => {
76
+ // Test fallback behavior
77
+ })
78
+
79
+ it('sorts results by similarity score', async () => {
80
+ // Test sorting logic
81
+ })
82
+ })
83
+ ```
84
+
85
+ ### Step 3: Run Tests (They Should Fail)
86
+ ```bash
87
+ npm test
88
+ # Tests should fail - we haven't implemented yet
89
+ ```
90
+
91
+ ### Step 4: Implement Code
92
+ Write minimal code to make tests pass:
93
+
94
+ ```typescript
95
+ // Implementation guided by tests
96
+ export async function searchMarkets(query: string) {
97
+ // Implementation here
98
+ }
99
+ ```
100
+
101
+ ### Step 5: Run Tests Again
102
+ ```bash
103
+ npm test
104
+ # Tests should now pass
105
+ ```
106
+
107
+ ### Step 6: Refactor
108
+ Improve code quality while keeping tests green:
109
+ - Remove duplication
110
+ - Improve naming
111
+ - Optimize performance
112
+ - Enhance readability
113
+
114
+ ### Step 7: Verify Coverage
115
+ ```bash
116
+ npm run test:coverage
117
+ # Verify 80%+ coverage achieved
118
+ ```
119
+
120
+ ## Testing Patterns
121
+
122
+ ### Unit Test Pattern (Jest/Vitest)
123
+ ```typescript
124
+ import { render, screen, fireEvent } from '@testing-library/react'
125
+ import { Button } from './Button'
126
+
127
+ describe('Button Component', () => {
128
+ it('renders with correct text', () => {
129
+ render(<Button>Click me</Button>)
130
+ expect(screen.getByText('Click me')).toBeInTheDocument()
131
+ })
132
+
133
+ it('calls onClick when clicked', () => {
134
+ const handleClick = jest.fn()
135
+ render(<Button onClick={handleClick}>Click</Button>)
136
+
137
+ fireEvent.click(screen.getByRole('button'))
138
+
139
+ expect(handleClick).toHaveBeenCalledTimes(1)
140
+ })
141
+
142
+ it('is disabled when disabled prop is true', () => {
143
+ render(<Button disabled>Click</Button>)
144
+ expect(screen.getByRole('button')).toBeDisabled()
145
+ })
146
+ })
147
+ ```
148
+
149
+ ### API Integration Test Pattern
150
+ ```typescript
151
+ import { NextRequest } from 'next/server'
152
+ import { GET } from './route'
153
+
154
+ describe('GET /api/markets', () => {
155
+ it('returns markets successfully', async () => {
156
+ const request = new NextRequest('http://localhost/api/markets')
157
+ const response = await GET(request)
158
+ const data = await response.json()
159
+
160
+ expect(response.status).toBe(200)
161
+ expect(data.success).toBe(true)
162
+ expect(Array.isArray(data.data)).toBe(true)
163
+ })
164
+
165
+ it('validates query parameters', async () => {
166
+ const request = new NextRequest('http://localhost/api/markets?limit=invalid')
167
+ const response = await GET(request)
168
+
169
+ expect(response.status).toBe(400)
170
+ })
171
+
172
+ it('handles database errors gracefully', async () => {
173
+ // Mock database failure
174
+ const request = new NextRequest('http://localhost/api/markets')
175
+ // Test error handling
176
+ })
177
+ })
178
+ ```
179
+
180
+ ### E2E Test Pattern (Playwright)
181
+ ```typescript
182
+ import { test, expect } from '@playwright/test'
183
+
184
+ test('user can search and filter markets', async ({ page }) => {
185
+ // Navigate to markets page
186
+ await page.goto('/')
187
+ await page.click('a[href="/markets"]')
188
+
189
+ // Verify page loaded
190
+ await expect(page.locator('h1')).toContainText('Markets')
191
+
192
+ // Search for markets
193
+ await page.fill('input[placeholder="Search markets"]', 'election')
194
+
195
+ // Wait for debounce and results
196
+ await page.waitForTimeout(600)
197
+
198
+ // Verify search results displayed
199
+ const results = page.locator('[data-testid="market-card"]')
200
+ await expect(results).toHaveCount(5, { timeout: 5000 })
201
+
202
+ // Verify results contain search term
203
+ const firstResult = results.first()
204
+ await expect(firstResult).toContainText('election', { ignoreCase: true })
205
+
206
+ // Filter by status
207
+ await page.click('button:has-text("Active")')
208
+
209
+ // Verify filtered results
210
+ await expect(results).toHaveCount(3)
211
+ })
212
+
213
+ test('user can create a new market', async ({ page }) => {
214
+ // Login first
215
+ await page.goto('/creator-dashboard')
216
+
217
+ // Fill market creation form
218
+ await page.fill('input[name="name"]', 'Test Market')
219
+ await page.fill('textarea[name="description"]', 'Test description')
220
+ await page.fill('input[name="endDate"]', '2025-12-31')
221
+
222
+ // Submit form
223
+ await page.click('button[type="submit"]')
224
+
225
+ // Verify success message
226
+ await expect(page.locator('text=Market created successfully')).toBeVisible()
227
+
228
+ // Verify redirect to market page
229
+ await expect(page).toHaveURL(/\/markets\/test-market/)
230
+ })
231
+ ```
232
+
233
+ ## Test File Organization
234
+
235
+ ```
236
+ src/
237
+ ├── components/
238
+ │ ├── Button/
239
+ │ │ ├── Button.tsx
240
+ │ │ ├── Button.test.tsx # Unit tests
241
+ │ │ └── Button.stories.tsx # Storybook
242
+ │ └── MarketCard/
243
+ │ ├── MarketCard.tsx
244
+ │ └── MarketCard.test.tsx
245
+ ├── app/
246
+ │ └── api/
247
+ │ └── markets/
248
+ │ ├── route.ts
249
+ │ └── route.test.ts # Integration tests
250
+ └── e2e/
251
+ ├── markets.spec.ts # E2E tests
252
+ ├── trading.spec.ts
253
+ └── auth.spec.ts
254
+ ```
255
+
256
+ ## Mocking External Services
257
+
258
+ ### Supabase Mock
259
+ ```typescript
260
+ jest.mock('@/lib/supabase', () => ({
261
+ supabase: {
262
+ from: jest.fn(() => ({
263
+ select: jest.fn(() => ({
264
+ eq: jest.fn(() => Promise.resolve({
265
+ data: [{ id: 1, name: 'Test Market' }],
266
+ error: null
267
+ }))
268
+ }))
269
+ }))
270
+ }
271
+ }))
272
+ ```
273
+
274
+ ### Redis Mock
275
+ ```typescript
276
+ jest.mock('@/lib/redis', () => ({
277
+ searchMarketsByVector: jest.fn(() => Promise.resolve([
278
+ { slug: 'test-market', similarity_score: 0.95 }
279
+ ])),
280
+ checkRedisHealth: jest.fn(() => Promise.resolve({ connected: true }))
281
+ }))
282
+ ```
283
+
284
+ ### OpenAI Mock
285
+ ```typescript
286
+ jest.mock('@/lib/openai', () => ({
287
+ generateEmbedding: jest.fn(() => Promise.resolve(
288
+ new Array(1536).fill(0.1) // Mock 1536-dim embedding
289
+ ))
290
+ }))
291
+ ```
292
+
293
+ ## Test Coverage Verification
294
+
295
+ ### Run Coverage Report
296
+ ```bash
297
+ npm run test:coverage
298
+ ```
299
+
300
+ ### Coverage Thresholds
301
+ ```json
302
+ {
303
+ "jest": {
304
+ "coverageThresholds": {
305
+ "global": {
306
+ "branches": 80,
307
+ "functions": 80,
308
+ "lines": 80,
309
+ "statements": 80
310
+ }
311
+ }
312
+ }
313
+ }
314
+ ```
315
+
316
+ ## Common Testing Mistakes to Avoid
317
+
318
+ ### FAIL: WRONG: Testing Implementation Details
319
+ ```typescript
320
+ // Don't test internal state
321
+ expect(component.state.count).toBe(5)
322
+ ```
323
+
324
+ ### PASS: CORRECT: Test User-Visible Behavior
325
+ ```typescript
326
+ // Test what users see
327
+ expect(screen.getByText('Count: 5')).toBeInTheDocument()
328
+ ```
329
+
330
+ ### FAIL: WRONG: Brittle Selectors
331
+ ```typescript
332
+ // Breaks easily
333
+ await page.click('.css-class-xyz')
334
+ ```
335
+
336
+ ### PASS: CORRECT: Semantic Selectors
337
+ ```typescript
338
+ // Resilient to changes
339
+ await page.click('button:has-text("Submit")')
340
+ await page.click('[data-testid="submit-button"]')
341
+ ```
342
+
343
+ ### FAIL: WRONG: No Test Isolation
344
+ ```typescript
345
+ // Tests depend on each other
346
+ test('creates user', () => { /* ... */ })
347
+ test('updates same user', () => { /* depends on previous test */ })
348
+ ```
349
+
350
+ ### PASS: CORRECT: Independent Tests
351
+ ```typescript
352
+ // Each test sets up its own data
353
+ test('creates user', () => {
354
+ const user = createTestUser()
355
+ // Test logic
356
+ })
357
+
358
+ test('updates user', () => {
359
+ const user = createTestUser()
360
+ // Update logic
361
+ })
362
+ ```
363
+
364
+ ## Continuous Testing
365
+
366
+ ### Watch Mode During Development
367
+ ```bash
368
+ npm test -- --watch
369
+ # Tests run automatically on file changes
370
+ ```
371
+
372
+ ### Pre-Commit Hook
373
+ ```bash
374
+ # Runs before every commit
375
+ npm test && npm run lint
376
+ ```
377
+
378
+ ### CI/CD Integration
379
+ ```yaml
380
+ # GitHub Actions
381
+ - name: Run Tests
382
+ run: npm test -- --coverage
383
+ - name: Upload Coverage
384
+ uses: codecov/codecov-action@v3
385
+ ```
386
+
387
+ ## Best Practices
388
+
389
+ 1. **Write Tests First** - Always TDD
390
+ 2. **One Assert Per Test** - Focus on single behavior
391
+ 3. **Descriptive Test Names** - Explain what's tested
392
+ 4. **Arrange-Act-Assert** - Clear test structure
393
+ 5. **Mock External Dependencies** - Isolate unit tests
394
+ 6. **Test Edge Cases** - Null, undefined, empty, large
395
+ 7. **Test Error Paths** - Not just happy paths
396
+ 8. **Keep Tests Fast** - Unit tests < 50ms each
397
+ 9. **Clean Up After Tests** - No side effects
398
+ 10. **Review Coverage Reports** - Identify gaps
399
+
400
+ ## Success Metrics
401
+
402
+ - 80%+ code coverage achieved
403
+ - All tests passing (green)
404
+ - No skipped or disabled tests
405
+ - Fast test execution (< 30s for unit tests)
406
+ - E2E tests cover critical user flows
407
+ - Tests catch bugs before production
408
+
409
+ ---
410
+
411
+ **Remember**: Tests are not optional. They are the safety net that enables confident refactoring, rapid development, and production reliability.
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: token-budget-advisor
3
+ tier: "2"
4
+ description: >-
5
+ Enforces Law 2 (Plan Is Sacred) of the 7 Laws of AI Agent Discipline by
6
+ making token-budget tradeoffs explicit before the response is composed.
7
+ Offers the user an informed choice about how much response depth to
8
+ consume before answering. Use this skill when the user explicitly
9
+ wants to control response length, depth, or token budget.
10
+ TRIGGER when: "token budget", "token count", "token usage", "token limit",
11
+ "response length", "answer depth", "short version", "brief answer",
12
+ "detailed answer", "exhaustive answer", "respuesta corta vs larga",
13
+ "cuántos tokens", "ahorrar tokens", "responde al 50%", "dame la versión
14
+ corta", "quiero controlar cuánto usas", or clear variants where the
15
+ user is explicitly asking to control answer size or depth.
16
+ DO NOT TRIGGER when: user has already specified a level in the current
17
+ session (maintain it), the request is clearly a one-word answer, or
18
+ "token" refers to auth/session/payment tokens rather than response size.
19
+ origin: community
20
+ ---
21
+
22
+ # Token Budget Advisor (TBA)
23
+
24
+ Intercept the response flow to offer the user a choice about response depth **before** the agent answers.
25
+
26
+ ## When to Use
27
+
28
+ - User wants to control how long or detailed a response is
29
+ - User mentions tokens, budget, depth, or response length
30
+ - User says "short version", "tldr", "brief", "al 25%", "exhaustive", etc.
31
+ - Any time the user wants to choose depth/detail level upfront
32
+
33
+ **Do not trigger** when: user already set a level this session (maintain it silently), or the answer is trivially one line.
34
+
35
+ ## How It Works
36
+
37
+ ### Step 1 — Estimate input tokens
38
+
39
+ Use the repository's canonical context-budget heuristics to estimate the prompt's token count mentally.
40
+
41
+ Use the same calibration guidance as [context-budget](../context-budget/SKILL.md):
42
+
43
+ - prose: `words × 1.3`
44
+ - code-heavy or mixed/code blocks: `chars / 4`
45
+
46
+ For mixed content, use the dominant content type and keep the estimate heuristic.
47
+
48
+ ### Step 2 — Estimate response size by complexity
49
+
50
+ Classify the prompt, then apply the multiplier range to get the full response window:
51
+
52
+ | Complexity | Multiplier range | Example prompts |
53
+ |--------------|------------------|------------------------------------------------------|
54
+ | Simple | 3× – 8× | "What is X?", yes/no, single fact |
55
+ | Medium | 8× – 20× | "How does X work?" |
56
+ | Medium-High | 10× – 25× | Code request with context |
57
+ | Complex | 15× – 40× | Multi-part analysis, comparisons, architecture |
58
+ | Creative | 10× – 30× | Stories, essays, narrative writing |
59
+
60
+ Response window = `input_tokens × mult_min` to `input_tokens × mult_max` (but don’t exceed your model’s configured output-token limit).
61
+
62
+ ### Step 3 — Present depth options
63
+
64
+ Present this block **before** answering, using the actual estimated numbers:
65
+
66
+ ```
67
+ Analyzing your prompt...
68
+
69
+ Input: ~[N] tokens | Type: [type] | Complexity: [level] | Language: [lang]
70
+
71
+ Choose your depth level:
72
+
73
+ [1] Essential (25%) -> ~[tokens] Direct answer only, no preamble
74
+ [2] Moderate (50%) -> ~[tokens] Answer + context + 1 example
75
+ [3] Detailed (75%) -> ~[tokens] Full answer with alternatives
76
+ [4] Exhaustive (100%) -> ~[tokens] Everything, no limits
77
+
78
+ Which level? (1-4 or say "25% depth", "50% depth", "75% depth", "100% depth")
79
+
80
+ Precision: heuristic estimate ~85-90% accuracy (±15%).
81
+ ```
82
+
83
+ Level token estimates (within the response window):
84
+ - 25% → `min + (max - min) × 0.25`
85
+ - 50% → `min + (max - min) × 0.50`
86
+ - 75% → `min + (max - min) × 0.75`
87
+ - 100% → `max`
88
+
89
+ ### Step 4 — Respond at the chosen level
90
+
91
+ | Level | Target length | Include | Omit |
92
+ |------------------|---------------------|-----------------------------------------------------|---------------------------------------------------|
93
+ | 25% Essential | 2-4 sentences max | Direct answer, key conclusion | Context, examples, nuance, alternatives |
94
+ | 50% Moderate | 1-3 paragraphs | Answer + necessary context + 1 example | Deep analysis, edge cases, references |
95
+ | 75% Detailed | Structured response | Multiple examples, pros/cons, alternatives | Extreme edge cases, exhaustive references |
96
+ | 100% Exhaustive | No restriction | Everything — full analysis, all code, all perspectives | Nothing |
97
+
98
+ ## Shortcuts — skip the question
99
+
100
+ If the user already signals a level, respond at that level immediately without asking:
101
+
102
+ | What they say | Level |
103
+ |----------------------------------------------------|-------|
104
+ | "1" / "25% depth" / "short version" / "brief answer" / "tldr" | 25% |
105
+ | "2" / "50% depth" / "moderate depth" / "balanced answer" | 50% |
106
+ | "3" / "75% depth" / "detailed answer" / "thorough answer" | 75% |
107
+ | "4" / "100% depth" / "exhaustive answer" / "full deep dive" | 100% |
108
+
109
+ If the user set a level earlier in the session, **maintain it silently** for subsequent responses unless they change it.
110
+
111
+ ## Precision note
112
+
113
+ This skill uses heuristic estimation — no real tokenizer. Accuracy ~85-90%, variance ±15%. Always show the disclaimer.
114
+
115
+ ## Examples
116
+
117
+ ### Triggers
118
+
119
+ - "Give me the short version first."
120
+ - "How many tokens will your answer use?"
121
+ - "Respond at 50% depth."
122
+ - "I want the exhaustive answer, not the summary."
123
+ - "Dame la version corta y luego la detallada."
124
+
125
+ ### Does Not Trigger
126
+
127
+ - "What is a JWT token?"
128
+ - "The checkout flow uses a payment token."
129
+ - "Is this normal?"
130
+ - "Complete the refactor."
131
+ - Follow-up questions after the user already chose a depth for the session
132
+
133
+ ## Source
134
+
135
+ Standalone skill from [TBA — Token Budget Advisor for Claude Code](https://github.com/Xabilimon1/Token-Budget-Advisor-Claude-Code-).
136
+ Original project also ships a Python estimator script, but this repository keeps the skill self-contained and heuristic-only.