@nextsparkjs/ai-workflow 0.1.0-beta.100
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/LICENSE +21 -0
- package/README.md +115 -0
- package/claude/_docs/workflows-optimizations.md +359 -0
- package/claude/agents/api-tester.md +634 -0
- package/claude/agents/architecture-supervisor.md +1351 -0
- package/claude/agents/backend-developer.md +997 -0
- package/claude/agents/backend-validator.md +417 -0
- package/claude/agents/bdd-docs-writer.md +737 -0
- package/claude/agents/block-developer.md +677 -0
- package/claude/agents/code-reviewer.md +1432 -0
- package/claude/agents/db-developer.md +721 -0
- package/claude/agents/db-validator.md +407 -0
- package/claude/agents/demo-video-generator.md +493 -0
- package/claude/agents/documentation-writer.md +1268 -0
- package/claude/agents/frontend-developer.md +1234 -0
- package/claude/agents/frontend-validator.md +777 -0
- package/claude/agents/functional-validator.md +630 -0
- package/claude/agents/mock-analyst.md +387 -0
- package/claude/agents/product-manager.md +963 -0
- package/claude/agents/qa-automation.md +1762 -0
- package/claude/agents/release-manager.md +634 -0
- package/claude/agents/selectors-translator.md +262 -0
- package/claude/agents/unit-test-writer.md +785 -0
- package/claude/agents/visual-comparator.md +329 -0
- package/claude/agents/workflow-maintainer.md +352 -0
- package/claude/commands/do/README.md +88 -0
- package/claude/commands/do/create-api.md +64 -0
- package/claude/commands/do/create-entity.md +66 -0
- package/claude/commands/do/create-migration.md +64 -0
- package/claude/commands/do/create-plugin.md +56 -0
- package/claude/commands/do/create-theme.md +70 -0
- package/claude/commands/do/mock-data.md +67 -0
- package/claude/commands/do/reset-db.md +71 -0
- package/claude/commands/do/setup-scheduled-action.md +75 -0
- package/claude/commands/do/sync-code-review.md +117 -0
- package/claude/commands/do/update-selectors.md +112 -0
- package/claude/commands/do/use-skills.md +90 -0
- package/claude/commands/do/validate-blocks.md +69 -0
- package/claude/commands/how-to/README.md +261 -0
- package/claude/commands/how-to/add-metadata.md +692 -0
- package/claude/commands/how-to/add-taxonomies.md +806 -0
- package/claude/commands/how-to/add-translations.md +571 -0
- package/claude/commands/how-to/create-api.md +577 -0
- package/claude/commands/how-to/create-block.md +575 -0
- package/claude/commands/how-to/create-child-entities.md +771 -0
- package/claude/commands/how-to/create-entity.md +597 -0
- package/claude/commands/how-to/create-migrations.md +605 -0
- package/claude/commands/how-to/create-plugin.md +654 -0
- package/claude/commands/how-to/customize-app.md +481 -0
- package/claude/commands/how-to/customize-dashboard.md +553 -0
- package/claude/commands/how-to/customize-theme.md +438 -0
- package/claude/commands/how-to/define-features-flows.md +632 -0
- package/claude/commands/how-to/deploy.md +507 -0
- package/claude/commands/how-to/handle-file-uploads.md +746 -0
- package/claude/commands/how-to/implement-search.md +1001 -0
- package/claude/commands/how-to/install-plugins.md +352 -0
- package/claude/commands/how-to/manage-test-coverage.md +984 -0
- package/claude/commands/how-to/run-tests.md +400 -0
- package/claude/commands/how-to/set-app-languages.md +601 -0
- package/claude/commands/how-to/set-plans-and-permissions.md +575 -0
- package/claude/commands/how-to/set-scheduled-actions.md +527 -0
- package/claude/commands/how-to/set-user-roles-and-permissions.md +550 -0
- package/claude/commands/how-to/setup-authentication.md +388 -0
- package/claude/commands/how-to/setup-claude-code.md +440 -0
- package/claude/commands/how-to/setup-database.md +274 -0
- package/claude/commands/how-to/setup-email-providers.md +598 -0
- package/claude/commands/how-to/setup-mobile-dev.md +627 -0
- package/claude/commands/how-to/start.md +500 -0
- package/claude/commands/how-to/use-devtools.md +639 -0
- package/claude/commands/how-to/use-superadmin.md +622 -0
- package/claude/commands/session/README.md +193 -0
- package/claude/commands/session/block-create.md +190 -0
- package/claude/commands/session/block-list.md +203 -0
- package/claude/commands/session/block-update.md +192 -0
- package/claude/commands/session/block-validate.md +218 -0
- package/claude/commands/session/changelog.md +115 -0
- package/claude/commands/session/close.md +225 -0
- package/claude/commands/session/commit.md +174 -0
- package/claude/commands/session/db-entity.md +206 -0
- package/claude/commands/session/db-fix.md +212 -0
- package/claude/commands/session/db-sample.md +206 -0
- package/claude/commands/session/demo.md +178 -0
- package/claude/commands/session/doc-bdd.md +207 -0
- package/claude/commands/session/doc-feature.md +218 -0
- package/claude/commands/session/doc-read.md +225 -0
- package/claude/commands/session/execute.md +204 -0
- package/claude/commands/session/explain.md +202 -0
- package/claude/commands/session/fix-bug.md +210 -0
- package/claude/commands/session/fix-build.md +182 -0
- package/claude/commands/session/fix-test.md +189 -0
- package/claude/commands/session/pending.md +232 -0
- package/claude/commands/session/refine.md +188 -0
- package/claude/commands/session/resume.md +192 -0
- package/claude/commands/session/review.md +192 -0
- package/claude/commands/session/scope-change.md +181 -0
- package/claude/commands/session/start-blocks.md +347 -0
- package/claude/commands/session/start.md +604 -0
- package/claude/commands/session/status.md +169 -0
- package/claude/commands/session/test-fix.md +221 -0
- package/claude/commands/session/test-run.md +203 -0
- package/claude/commands/session/test-write.md +242 -0
- package/claude/commands/session/validate.md +162 -0
- package/claude/config/context.json +40 -0
- package/claude/config/github.json +69 -0
- package/claude/config/github.schema.json +106 -0
- package/claude/config/team.json +46 -0
- package/claude/config/team.schema.json +106 -0
- package/claude/config/workspace.json +43 -0
- package/claude/config/workspace.schema.json +75 -0
- package/claude/skills/README.md +228 -0
- package/claude/skills/accessibility/SKILL.md +573 -0
- package/claude/skills/api-bypass-layers/SKILL.md +550 -0
- package/claude/skills/asana-integration/SKILL.md +499 -0
- package/claude/skills/better-auth/SKILL.md +666 -0
- package/claude/skills/billing-subscriptions/SKILL.md +660 -0
- package/claude/skills/block-decision-matrix/SKILL.md +359 -0
- package/claude/skills/clickup-integration/SKILL.md +434 -0
- package/claude/skills/core-theme-responsibilities/SKILL.md +485 -0
- package/claude/skills/create-plugin/SKILL.md +425 -0
- package/claude/skills/create-theme/SKILL.md +331 -0
- package/claude/skills/cypress-api/SKILL.md +511 -0
- package/claude/skills/cypress-api/scripts/generate-api-controller.py +329 -0
- package/claude/skills/cypress-api/scripts/generate-api-test.py +930 -0
- package/claude/skills/cypress-e2e/SKILL.md +526 -0
- package/claude/skills/cypress-e2e/scripts/extract-selectors.py +383 -0
- package/claude/skills/cypress-e2e/scripts/generate-uat-test.py +788 -0
- package/claude/skills/cypress-selectors/SKILL.md +309 -0
- package/claude/skills/cypress-selectors/scripts/extract-missing.py +243 -0
- package/claude/skills/cypress-selectors/scripts/generate-block-selectors.py +283 -0
- package/claude/skills/cypress-selectors/scripts/validate-selectors.py +145 -0
- package/claude/skills/database-migrations/SKILL.md +335 -0
- package/claude/skills/database-migrations/scripts/generate-sample-data.py +284 -0
- package/claude/skills/database-migrations/scripts/validate-migration.py +323 -0
- package/claude/skills/design-system/SKILL.md +682 -0
- package/claude/skills/documentation/SKILL.md +540 -0
- package/claude/skills/entity-api/SKILL.md +482 -0
- package/claude/skills/entity-system/SKILL.md +635 -0
- package/claude/skills/entity-system/scripts/generate-child-migration.py +298 -0
- package/claude/skills/entity-system/scripts/generate-metas-migration.py +233 -0
- package/claude/skills/entity-system/scripts/generate-migration.py +382 -0
- package/claude/skills/entity-system/scripts/generate-sample-data.py +418 -0
- package/claude/skills/entity-system/scripts/scaffold-entity.py +661 -0
- package/claude/skills/github/SKILL.md +467 -0
- package/claude/skills/i18n-nextintl/SKILL.md +302 -0
- package/claude/skills/i18n-nextintl/scripts/add-translation.py +243 -0
- package/claude/skills/i18n-nextintl/scripts/extract-hardcoded.py +246 -0
- package/claude/skills/i18n-nextintl/scripts/validate-translations.py +260 -0
- package/claude/skills/impact-analysis/SKILL.md +203 -0
- package/claude/skills/jest-unit/SKILL.md +306 -0
- package/claude/skills/jest-unit/references/component-testing.md +371 -0
- package/claude/skills/jest-unit/references/mocking-patterns.md +380 -0
- package/claude/skills/jest-unit/references/service-hook-testing.md +454 -0
- package/claude/skills/jira-integration/SKILL.md +539 -0
- package/claude/skills/media-library/SKILL.md +743 -0
- package/claude/skills/mock-analysis/SKILL.md +276 -0
- package/claude/skills/monorepo-architecture/SKILL.md +162 -0
- package/claude/skills/nextjs-api-development/SKILL.md +364 -0
- package/claude/skills/nextjs-api-development/scripts/generate-crud-tests.py +456 -0
- package/claude/skills/nextjs-api-development/scripts/scaffold-endpoint.py +481 -0
- package/claude/skills/nextjs-api-development/scripts/validate-api.py +283 -0
- package/claude/skills/notion-integration/SKILL.md +641 -0
- package/claude/skills/npm-development-workflow/SKILL.md +480 -0
- package/claude/skills/page-builder-blocks/SKILL.md +530 -0
- package/claude/skills/page-builder-blocks/scripts/scaffold-block.py +444 -0
- package/claude/skills/permissions-system/SKILL.md +619 -0
- package/claude/skills/plugins/SKILL.md +340 -0
- package/claude/skills/plugins/references/plugin-templates.md +414 -0
- package/claude/skills/plugins/references/plugin-testing.md +353 -0
- package/claude/skills/plugins/references/plugin-types.md +198 -0
- package/claude/skills/plugins/scripts/scaffold-plugin.py +443 -0
- package/claude/skills/pom-patterns/SKILL.md +452 -0
- package/claude/skills/pom-patterns/scripts/generate-pom.py +392 -0
- package/claude/skills/rate-limiting/SKILL.md +342 -0
- package/claude/skills/react-best-practices/AGENTS.md +2410 -0
- package/claude/skills/react-best-practices/README.md +123 -0
- package/claude/skills/react-best-practices/SKILL.md +125 -0
- package/claude/skills/react-best-practices/metadata.json +15 -0
- package/claude/skills/react-best-practices/rules/_sections.md +46 -0
- package/claude/skills/react-best-practices/rules/_template.md +28 -0
- package/claude/skills/react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/claude/skills/react-best-practices/rules/advanced-use-latest.md +49 -0
- package/claude/skills/react-best-practices/rules/async-api-routes.md +38 -0
- package/claude/skills/react-best-practices/rules/async-defer-await.md +80 -0
- package/claude/skills/react-best-practices/rules/async-dependencies.md +36 -0
- package/claude/skills/react-best-practices/rules/async-parallel.md +28 -0
- package/claude/skills/react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/claude/skills/react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/claude/skills/react-best-practices/rules/bundle-conditional.md +31 -0
- package/claude/skills/react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/claude/skills/react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/claude/skills/react-best-practices/rules/bundle-preload.md +50 -0
- package/claude/skills/react-best-practices/rules/client-event-listeners.md +74 -0
- package/claude/skills/react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/claude/skills/react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/claude/skills/react-best-practices/rules/client-swr-dedup.md +56 -0
- package/claude/skills/react-best-practices/rules/js-batch-dom-css.md +82 -0
- package/claude/skills/react-best-practices/rules/js-cache-function-results.md +80 -0
- package/claude/skills/react-best-practices/rules/js-cache-property-access.md +28 -0
- package/claude/skills/react-best-practices/rules/js-cache-storage.md +70 -0
- package/claude/skills/react-best-practices/rules/js-combine-iterations.md +32 -0
- package/claude/skills/react-best-practices/rules/js-early-exit.md +50 -0
- package/claude/skills/react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/claude/skills/react-best-practices/rules/js-index-maps.md +37 -0
- package/claude/skills/react-best-practices/rules/js-length-check-first.md +49 -0
- package/claude/skills/react-best-practices/rules/js-min-max-loop.md +82 -0
- package/claude/skills/react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/claude/skills/react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/claude/skills/react-best-practices/rules/rendering-activity.md +26 -0
- package/claude/skills/react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/claude/skills/react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/claude/skills/react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/claude/skills/react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/claude/skills/react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/claude/skills/react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/claude/skills/react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/claude/skills/react-best-practices/rules/rerender-dependencies.md +45 -0
- package/claude/skills/react-best-practices/rules/rerender-derived-state.md +29 -0
- package/claude/skills/react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/claude/skills/react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/claude/skills/react-best-practices/rules/rerender-memo.md +44 -0
- package/claude/skills/react-best-practices/rules/rerender-transitions.md +40 -0
- package/claude/skills/react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/claude/skills/react-best-practices/rules/server-cache-lru.md +41 -0
- package/claude/skills/react-best-practices/rules/server-cache-react.md +76 -0
- package/claude/skills/react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/claude/skills/react-best-practices/rules/server-serialization.md +38 -0
- package/claude/skills/react-patterns/SKILL.md +688 -0
- package/claude/skills/registry-system/SKILL.md +331 -0
- package/claude/skills/scheduled-actions/SKILL.md +671 -0
- package/claude/skills/scope-enforcement/SKILL.md +542 -0
- package/claude/skills/scope-enforcement/scripts/validate-scope.py +357 -0
- package/claude/skills/server-actions/SKILL.md +493 -0
- package/claude/skills/service-layer/SKILL.md +587 -0
- package/claude/skills/session-management/SKILL.md +266 -0
- package/claude/skills/session-management/scripts/create-session.py +166 -0
- package/claude/skills/session-management/scripts/iteration-close.sh +105 -0
- package/claude/skills/session-management/scripts/iteration-init.sh +180 -0
- package/claude/skills/session-management/scripts/session-archive.sh +87 -0
- package/claude/skills/session-management/scripts/session-close.sh +133 -0
- package/claude/skills/session-management/scripts/session-init.sh +225 -0
- package/claude/skills/session-management/scripts/session-list.sh +163 -0
- package/claude/skills/session-management/scripts/split-plan.sh +116 -0
- package/claude/skills/shadcn-components/SKILL.md +586 -0
- package/claude/skills/shadcn-theming/SKILL.md +446 -0
- package/claude/skills/suspense-loading/SKILL.md +280 -0
- package/claude/skills/tailwind-theming/SKILL.md +507 -0
- package/claude/skills/tanstack-query/SKILL.md +608 -0
- package/claude/skills/test-coverage/SKILL.md +239 -0
- package/claude/skills/web-design-guidelines/SKILL.md +39 -0
- package/claude/skills/zod-validation/SKILL.md +537 -0
- package/claude/templates/blocks/progress.md +86 -0
- package/claude/templates/iteration/changes.md +61 -0
- package/claude/templates/iteration/progress.md +55 -0
- package/claude/templates/log.md +31 -0
- package/claude/templates/story/context.md +77 -0
- package/claude/templates/story/pendings.md +37 -0
- package/claude/templates/story/plan.md +299 -0
- package/claude/templates/story/requirements.md +109 -0
- package/claude/templates/story/scope.json +10 -0
- package/claude/templates/story/tests.md +91 -0
- package/claude/templates/task/progress.md +58 -0
- package/claude/templates/task/requirements.md +54 -0
- package/claude/workflows/README.md +154 -0
- package/claude/workflows/blocks.md +614 -0
- package/claude/workflows/story.md +1207 -0
- package/claude/workflows/task.md +927 -0
- package/claude/workflows/tweak.md +527 -0
- package/cursor/.gitkeep +0 -0
- package/package.json +35 -0
- package/scripts/postinstall.mjs +198 -0
- package/scripts/setup.mjs +282 -0
- package/scripts/sync.mjs +209 -0
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scope-enforcement
|
|
3
|
+
description: |
|
|
4
|
+
Scope enforcement system for Claude Code workflow in this application.
|
|
5
|
+
Covers scope.json configuration, path validation, violation handling, and scope change workflow.
|
|
6
|
+
Use this skill when validating file modifications against session scope.
|
|
7
|
+
allowed-tools: Read, Glob, Grep, Bash
|
|
8
|
+
version: 1.0.0
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Scope Enforcement Skill
|
|
12
|
+
|
|
13
|
+
Patterns for enforcing session scope in Claude Code development sessions.
|
|
14
|
+
|
|
15
|
+
## Architecture Overview
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
SCOPE ENFORCEMENT SYSTEM:
|
|
19
|
+
|
|
20
|
+
Scope Configuration:
|
|
21
|
+
.claude/sessions/{session-name}/scope.json
|
|
22
|
+
├── scope.core # boolean - Core/app/scripts/migrations access
|
|
23
|
+
├── scope.theme # string|false - Theme name or disabled
|
|
24
|
+
├── scope.plugins # array|false - Plugin names or disabled
|
|
25
|
+
└── exceptions # array - Override paths
|
|
26
|
+
|
|
27
|
+
Path Mapping:
|
|
28
|
+
scope.core = true → core/**/* + app/**/* + scripts/**/* + migrations/**/*
|
|
29
|
+
scope.theme = "x" → contents/themes/x/**/*
|
|
30
|
+
scope.plugins = [] → contents/plugins/{name}/**/*
|
|
31
|
+
|
|
32
|
+
Always Allowed:
|
|
33
|
+
.claude/sessions/**/* # Session files always accessible
|
|
34
|
+
|
|
35
|
+
Validation Flow:
|
|
36
|
+
1. Read scope.json from session
|
|
37
|
+
2. Build allowed paths list
|
|
38
|
+
3. Check modified files against scope
|
|
39
|
+
4. If violation → BLOCK until resolved
|
|
40
|
+
5. If compliant → PROCEED
|
|
41
|
+
|
|
42
|
+
Integration Points:
|
|
43
|
+
├── code-reviewer (Layer 0 check)
|
|
44
|
+
├── /task:scope-change (scope modification)
|
|
45
|
+
├── product-manager (scope definition)
|
|
46
|
+
└── All development agents (scope respect)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## When to Use This Skill
|
|
50
|
+
|
|
51
|
+
- Validating file modifications against scope
|
|
52
|
+
- Understanding scope.json format
|
|
53
|
+
- Handling scope violations
|
|
54
|
+
- Requesting scope changes
|
|
55
|
+
- Implementing scope checks in agents
|
|
56
|
+
|
|
57
|
+
## scope.json Format
|
|
58
|
+
|
|
59
|
+
### Template Structure
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"$schema": "Session Scope Configuration",
|
|
64
|
+
"definedBy": "product-manager",
|
|
65
|
+
"date": "YYYY-MM-DD",
|
|
66
|
+
"scope": {
|
|
67
|
+
"core": false,
|
|
68
|
+
"theme": "theme-name",
|
|
69
|
+
"plugins": false
|
|
70
|
+
},
|
|
71
|
+
"exceptions": [],
|
|
72
|
+
"confirmedBy": "user",
|
|
73
|
+
"confirmedAt": "YYYY-MM-DD"
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Scope Fields
|
|
78
|
+
|
|
79
|
+
| Field | Type | Description |
|
|
80
|
+
|-------|------|-------------|
|
|
81
|
+
| `scope.core` | `boolean` | Access to core/, app/, scripts/, migrations/ |
|
|
82
|
+
| `scope.theme` | `string\|false` | Theme name or disabled |
|
|
83
|
+
| `scope.plugins` | `array\|false` | Array of plugin names or disabled |
|
|
84
|
+
| `exceptions` | `array` | Specific paths to allow/deny |
|
|
85
|
+
|
|
86
|
+
### Path Mapping
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
// scope.core = true
|
|
90
|
+
const corePaths = [
|
|
91
|
+
'core/**/*',
|
|
92
|
+
'app/**/*',
|
|
93
|
+
'scripts/**/*',
|
|
94
|
+
'migrations/**/*'
|
|
95
|
+
]
|
|
96
|
+
|
|
97
|
+
// scope.theme = "default"
|
|
98
|
+
const themePaths = [
|
|
99
|
+
'contents/themes/default/**/*'
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
// scope.plugins = ["analytics", "payment"]
|
|
103
|
+
const pluginPaths = [
|
|
104
|
+
'contents/plugins/analytics/**/*',
|
|
105
|
+
'contents/plugins/payment/**/*'
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
// Always allowed
|
|
109
|
+
const alwaysAllowed = [
|
|
110
|
+
'.claude/sessions/**/*'
|
|
111
|
+
]
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Common Scope Patterns
|
|
115
|
+
|
|
116
|
+
### 1. Feature in Existing Theme
|
|
117
|
+
|
|
118
|
+
Most common: Adding a feature to an existing theme.
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"scope": {
|
|
123
|
+
"core": false,
|
|
124
|
+
"theme": "default",
|
|
125
|
+
"plugins": false
|
|
126
|
+
},
|
|
127
|
+
"exceptions": []
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Allowed paths:**
|
|
132
|
+
- `.claude/sessions/**/*`
|
|
133
|
+
- `contents/themes/default/**/*`
|
|
134
|
+
|
|
135
|
+
### 2. Core Framework Change
|
|
136
|
+
|
|
137
|
+
Modifying core framework, migrations, or app routes.
|
|
138
|
+
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"scope": {
|
|
142
|
+
"core": true,
|
|
143
|
+
"theme": false,
|
|
144
|
+
"plugins": false
|
|
145
|
+
},
|
|
146
|
+
"exceptions": []
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Allowed paths:**
|
|
151
|
+
- `.claude/sessions/**/*`
|
|
152
|
+
- `core/**/*`
|
|
153
|
+
- `app/**/*`
|
|
154
|
+
- `scripts/**/*`
|
|
155
|
+
- `migrations/**/*`
|
|
156
|
+
|
|
157
|
+
### 3. Core + Theme Development
|
|
158
|
+
|
|
159
|
+
Full feature requiring both core changes and theme UI.
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"scope": {
|
|
164
|
+
"core": true,
|
|
165
|
+
"theme": "default",
|
|
166
|
+
"plugins": false
|
|
167
|
+
},
|
|
168
|
+
"exceptions": []
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**Allowed paths:**
|
|
173
|
+
- `.claude/sessions/**/*`
|
|
174
|
+
- `core/**/*`
|
|
175
|
+
- `app/**/*`
|
|
176
|
+
- `scripts/**/*`
|
|
177
|
+
- `migrations/**/*`
|
|
178
|
+
- `contents/themes/default/**/*`
|
|
179
|
+
|
|
180
|
+
### 4. Plugin Development
|
|
181
|
+
|
|
182
|
+
Creating or modifying a specific plugin.
|
|
183
|
+
|
|
184
|
+
```json
|
|
185
|
+
{
|
|
186
|
+
"scope": {
|
|
187
|
+
"core": false,
|
|
188
|
+
"theme": "plugin-sandbox",
|
|
189
|
+
"plugins": ["my-plugin"]
|
|
190
|
+
},
|
|
191
|
+
"exceptions": []
|
|
192
|
+
}
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
**Allowed paths:**
|
|
196
|
+
- `.claude/sessions/**/*`
|
|
197
|
+
- `contents/themes/plugin-sandbox/**/*`
|
|
198
|
+
- `contents/plugins/my-plugin/**/*`
|
|
199
|
+
|
|
200
|
+
### 5. Full Access (Rare)
|
|
201
|
+
|
|
202
|
+
Maximum access for complex multi-area features.
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"scope": {
|
|
207
|
+
"core": true,
|
|
208
|
+
"theme": "default",
|
|
209
|
+
"plugins": ["analytics", "payment"]
|
|
210
|
+
},
|
|
211
|
+
"exceptions": []
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### 6. Theme + Plugins (No Core)
|
|
216
|
+
|
|
217
|
+
Theme feature that uses plugins but doesn't modify core.
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"scope": {
|
|
222
|
+
"core": false,
|
|
223
|
+
"theme": "default",
|
|
224
|
+
"plugins": ["ai", "social-media-publisher"]
|
|
225
|
+
},
|
|
226
|
+
"exceptions": []
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Scope Validation Algorithm
|
|
231
|
+
|
|
232
|
+
```typescript
|
|
233
|
+
function validateScope(
|
|
234
|
+
modifiedFiles: string[],
|
|
235
|
+
scopeConfig: ScopeConfig
|
|
236
|
+
): ValidationResult {
|
|
237
|
+
// Build allowed paths
|
|
238
|
+
const allowedPaths: string[] = ['.claude/sessions/**/*']
|
|
239
|
+
|
|
240
|
+
if (scopeConfig.scope.core) {
|
|
241
|
+
allowedPaths.push(
|
|
242
|
+
'core/**/*',
|
|
243
|
+
'app/**/*',
|
|
244
|
+
'scripts/**/*',
|
|
245
|
+
'migrations/**/*'
|
|
246
|
+
)
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (scopeConfig.scope.theme) {
|
|
250
|
+
allowedPaths.push(
|
|
251
|
+
`contents/themes/${scopeConfig.scope.theme}/**/*`
|
|
252
|
+
)
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
if (Array.isArray(scopeConfig.scope.plugins)) {
|
|
256
|
+
scopeConfig.scope.plugins.forEach(plugin => {
|
|
257
|
+
allowedPaths.push(`contents/plugins/${plugin}/**/*`)
|
|
258
|
+
})
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Add exceptions
|
|
262
|
+
allowedPaths.push(...(scopeConfig.exceptions || []))
|
|
263
|
+
|
|
264
|
+
// Check each file
|
|
265
|
+
const violations: string[] = []
|
|
266
|
+
|
|
267
|
+
for (const file of modifiedFiles) {
|
|
268
|
+
const isAllowed = allowedPaths.some(pattern =>
|
|
269
|
+
matchGlob(file, pattern)
|
|
270
|
+
)
|
|
271
|
+
|
|
272
|
+
if (!isAllowed) {
|
|
273
|
+
violations.push(file)
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return {
|
|
278
|
+
valid: violations.length === 0,
|
|
279
|
+
violations,
|
|
280
|
+
allowedPaths
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## code-reviewer Layer 0 Check
|
|
286
|
+
|
|
287
|
+
The code-reviewer agent performs scope validation as "Layer 0":
|
|
288
|
+
|
|
289
|
+
```typescript
|
|
290
|
+
// Layer 0: Session Scope Compliance (FIRST CHECK)
|
|
291
|
+
|
|
292
|
+
// 1. Read scope.json from session folder
|
|
293
|
+
const sessionPath = getSessionPathFromTaskContext()
|
|
294
|
+
const scopeConfig = JSON.parse(await Read(`${sessionPath}/scope.json`))
|
|
295
|
+
|
|
296
|
+
// 2. Build allowed paths
|
|
297
|
+
const allowedPaths = buildAllowedPaths(scopeConfig)
|
|
298
|
+
|
|
299
|
+
// 3. Check all modified files
|
|
300
|
+
const changedFiles = await getChangedFilesFromBranch()
|
|
301
|
+
const violations = []
|
|
302
|
+
|
|
303
|
+
for (const file of changedFiles) {
|
|
304
|
+
const isAllowed = allowedPaths.some(pattern =>
|
|
305
|
+
matchesGlob(file, pattern)
|
|
306
|
+
)
|
|
307
|
+
if (!isAllowed) {
|
|
308
|
+
violations.push(file)
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
// 4. If violations found, REJECT immediately
|
|
313
|
+
if (violations.length > 0) {
|
|
314
|
+
console.log(`
|
|
315
|
+
🚨 SCOPE VIOLATION DETECTED 🚨
|
|
316
|
+
|
|
317
|
+
Session: ${sessionPath}
|
|
318
|
+
Scope Configuration:
|
|
319
|
+
- Core: ${scopeConfig.scope.core ? 'ALLOWED' : 'DENIED'}
|
|
320
|
+
- Theme: ${scopeConfig.scope.theme || 'NONE'}
|
|
321
|
+
- Plugins: ${JSON.stringify(scopeConfig.scope.plugins) || 'NONE'}
|
|
322
|
+
|
|
323
|
+
Files Outside Scope:
|
|
324
|
+
${violations.map(f => '- ' + f).join('\n')}
|
|
325
|
+
|
|
326
|
+
Required Action:
|
|
327
|
+
1. Revert modifications to files outside scope
|
|
328
|
+
2. OR request scope expansion via /task:scope-change
|
|
329
|
+
3. OR move logic to an allowed path
|
|
330
|
+
|
|
331
|
+
Review BLOCKED until scope violations are resolved.
|
|
332
|
+
`)
|
|
333
|
+
throw new Error('SCOPE_VIOLATION')
|
|
334
|
+
}
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
## Handling Scope Violations
|
|
338
|
+
|
|
339
|
+
### Option 1: Revert Changes
|
|
340
|
+
|
|
341
|
+
Remove modifications to files outside scope.
|
|
342
|
+
|
|
343
|
+
```bash
|
|
344
|
+
# Revert specific file
|
|
345
|
+
git checkout HEAD -- path/to/file
|
|
346
|
+
|
|
347
|
+
# Revert all out-of-scope changes
|
|
348
|
+
git checkout HEAD -- core/ # if core not allowed
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### Option 2: Request Scope Change
|
|
352
|
+
|
|
353
|
+
Use `/task:scope-change` to expand scope.
|
|
354
|
+
|
|
355
|
+
```markdown
|
|
356
|
+
/task:scope-change .claude/sessions/2025-12-30-my-feature-v1/
|
|
357
|
+
|
|
358
|
+
I need to also modify:
|
|
359
|
+
- core/lib/services/my-service.ts (new service)
|
|
360
|
+
- migrations/020_new_table.sql (database change)
|
|
361
|
+
|
|
362
|
+
Reason: The feature requires core service layer changes
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
### Option 3: Move Logic
|
|
366
|
+
|
|
367
|
+
Refactor to place logic in allowed paths.
|
|
368
|
+
|
|
369
|
+
```typescript
|
|
370
|
+
// Instead of modifying core/lib/utils.ts
|
|
371
|
+
// Create theme-specific utility:
|
|
372
|
+
// contents/themes/default/lib/utils/my-utility.ts
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
## /task:scope-change Workflow
|
|
376
|
+
|
|
377
|
+
When scope needs to change mid-development:
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
1. Verify session has started development
|
|
381
|
+
2. Read ALL session files
|
|
382
|
+
3. Analyze scope change request vs progress
|
|
383
|
+
4. Identify rework implications
|
|
384
|
+
5. Ask user to confirm rework
|
|
385
|
+
6. Launch PM agent to update requirements
|
|
386
|
+
7. Launch Architect to update plan
|
|
387
|
+
8. Update progress.md with rework markers
|
|
388
|
+
9. Trigger code review if needed
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Scope Change Request Format
|
|
392
|
+
|
|
393
|
+
```markdown
|
|
394
|
+
/task:scope-change .claude/sessions/{session-name}/
|
|
395
|
+
|
|
396
|
+
Requested changes:
|
|
397
|
+
- Add core access for [reason]
|
|
398
|
+
- Add plugin "x" for [reason]
|
|
399
|
+
|
|
400
|
+
Impact analysis:
|
|
401
|
+
- Current progress: [phase X]
|
|
402
|
+
- Affected items: [list]
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
## Exceptions Usage
|
|
406
|
+
|
|
407
|
+
Exceptions allow specific paths regardless of scope rules:
|
|
408
|
+
|
|
409
|
+
```json
|
|
410
|
+
{
|
|
411
|
+
"scope": {
|
|
412
|
+
"core": false,
|
|
413
|
+
"theme": "default",
|
|
414
|
+
"plugins": false
|
|
415
|
+
},
|
|
416
|
+
"exceptions": [
|
|
417
|
+
"core/lib/constants.ts",
|
|
418
|
+
"app/api/v1/custom-endpoint/**/*"
|
|
419
|
+
]
|
|
420
|
+
}
|
|
421
|
+
```
|
|
422
|
+
|
|
423
|
+
**Use exceptions for:**
|
|
424
|
+
- Single files that need modification
|
|
425
|
+
- Specific endpoints outside normal scope
|
|
426
|
+
- Configuration files
|
|
427
|
+
|
|
428
|
+
**Avoid exceptions for:**
|
|
429
|
+
- Broad access (use scope.core instead)
|
|
430
|
+
- Multiple related files (expand scope)
|
|
431
|
+
|
|
432
|
+
## Scope Validation Script
|
|
433
|
+
|
|
434
|
+
```bash
|
|
435
|
+
# Validate files against session scope
|
|
436
|
+
python .claude/skills/scope-enforcement/scripts/validate-scope.py \
|
|
437
|
+
--session ".claude/sessions/2025-12-30-feature-v1" \
|
|
438
|
+
--files "core/lib/services/x.ts,contents/themes/default/lib/y.ts"
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
## Why Scope Enforcement Matters
|
|
442
|
+
|
|
443
|
+
1. **Prevents Accidental Modifications**
|
|
444
|
+
- Core framework stays stable
|
|
445
|
+
- Theme isolation maintained
|
|
446
|
+
- Plugin boundaries respected
|
|
447
|
+
|
|
448
|
+
2. **Architectural Integrity**
|
|
449
|
+
- Clear separation of concerns
|
|
450
|
+
- Predictable code organization
|
|
451
|
+
- Easier maintenance
|
|
452
|
+
|
|
453
|
+
3. **Multi-Theme/Plugin Safety**
|
|
454
|
+
- Changes don't leak across themes
|
|
455
|
+
- Plugins remain independent
|
|
456
|
+
- No cross-contamination
|
|
457
|
+
|
|
458
|
+
4. **Future Updates**
|
|
459
|
+
- Core updates can apply cleanly
|
|
460
|
+
- Theme upgrades isolated
|
|
461
|
+
- Plugin updates predictable
|
|
462
|
+
|
|
463
|
+
## Development Types
|
|
464
|
+
|
|
465
|
+
Scope is typically set based on development type:
|
|
466
|
+
|
|
467
|
+
| Development Type | core | theme | plugins |
|
|
468
|
+
|-----------------|------|-------|---------|
|
|
469
|
+
| Theme Feature | false | "name" | false |
|
|
470
|
+
| Core Feature | true | false | false |
|
|
471
|
+
| Core + Theme | true | "name" | false |
|
|
472
|
+
| Plugin Only | false | "sandbox" | ["name"] |
|
|
473
|
+
| Full Feature | true | "name" | [...] |
|
|
474
|
+
|
|
475
|
+
## Best Practices
|
|
476
|
+
|
|
477
|
+
### DO:
|
|
478
|
+
- Define scope at session start (product-manager)
|
|
479
|
+
- Validate scope before development begins
|
|
480
|
+
- Use smallest scope necessary
|
|
481
|
+
- Request scope change via official command
|
|
482
|
+
- Document scope decisions in context.md
|
|
483
|
+
|
|
484
|
+
### DON'T:
|
|
485
|
+
- Modify files outside scope
|
|
486
|
+
- Bypass scope validation
|
|
487
|
+
- Add exceptions for broad access
|
|
488
|
+
- Ignore scope violations
|
|
489
|
+
- Change scope.json directly (use /task:scope-change)
|
|
490
|
+
|
|
491
|
+
## Anti-Patterns
|
|
492
|
+
|
|
493
|
+
```typescript
|
|
494
|
+
// NEVER: Modify scope.json directly
|
|
495
|
+
fs.writeFileSync('scope.json', newScope) // Use /task:scope-change
|
|
496
|
+
|
|
497
|
+
// NEVER: Ignore scope violations
|
|
498
|
+
if (scopeViolation) {
|
|
499
|
+
continue // WRONG - Must resolve violations
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// NEVER: Use exceptions for broad access
|
|
503
|
+
{
|
|
504
|
+
"exceptions": ["core/**/*"] // WRONG - Use scope.core = true
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
// NEVER: Modify files then check scope
|
|
508
|
+
await modifyFile('core/lib/x.ts') // Check BEFORE modifying
|
|
509
|
+
validateScope()
|
|
510
|
+
|
|
511
|
+
// NEVER: Skip scope check in code-reviewer
|
|
512
|
+
// Layer 0 is MANDATORY and FIRST
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
## Checklist
|
|
516
|
+
|
|
517
|
+
Before starting session development:
|
|
518
|
+
|
|
519
|
+
- [ ] scope.json exists in session folder
|
|
520
|
+
- [ ] scope.json has been reviewed
|
|
521
|
+
- [ ] User confirmed scope settings
|
|
522
|
+
- [ ] Allowed paths cover all planned modifications
|
|
523
|
+
|
|
524
|
+
During development:
|
|
525
|
+
|
|
526
|
+
- [ ] Verify file is in scope BEFORE modifying
|
|
527
|
+
- [ ] If out of scope, request change first
|
|
528
|
+
- [ ] Document scope decisions in context.md
|
|
529
|
+
|
|
530
|
+
If scope violation detected:
|
|
531
|
+
|
|
532
|
+
- [ ] STOP current work
|
|
533
|
+
- [ ] Identify all out-of-scope files
|
|
534
|
+
- [ ] Choose resolution (revert/change/move)
|
|
535
|
+
- [ ] Resolve BEFORE continuing
|
|
536
|
+
|
|
537
|
+
## Related Skills
|
|
538
|
+
|
|
539
|
+
- `session-management` - Session file structure including scope.json
|
|
540
|
+
- `plugins` - Plugin scope patterns
|
|
541
|
+
- `registry-system` - Registry paths and scope
|
|
542
|
+
- `documentation` - Scope documentation patterns
|