@kennethsolomon/shipkit 3.6.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.
- package/README.md +14 -15
- package/commands/sk/security-check.md +10 -4
- package/commands/sk/update-task.md +9 -0
- package/commands/sk/write-plan.md +5 -0
- package/package.json +1 -1
- package/skills/sk:context/SKILL.md +4 -0
- package/skills/sk:e2e/SKILL.md +19 -2
- package/skills/sk:fast-track/SKILL.md +80 -0
- package/skills/sk:frontend-design/SKILL.md +12 -5
- package/skills/sk:gates/SKILL.md +97 -0
- package/skills/sk:lint/SKILL.md +27 -6
- package/skills/sk:perf/SKILL.md +15 -4
- package/skills/sk:retro/SKILL.md +124 -0
- package/skills/sk:reverse-doc/SKILL.md +116 -0
- package/skills/sk:review/SKILL.md +19 -11
- package/skills/sk:schema-migrate/SKILL.md +22 -0
- package/skills/sk:scope-check/SKILL.md +93 -0
- package/skills/sk:setup-claude/SKILL.md +53 -0
- package/skills/sk:setup-claude/scripts/apply_setup_claude.py +206 -6
- package/skills/sk:setup-claude/templates/.claude/agents/e2e-tester.md +46 -0
- package/skills/sk:setup-claude/templates/.claude/agents/linter.md +53 -0
- package/skills/sk:setup-claude/templates/.claude/agents/perf-auditor.md +43 -0
- package/skills/sk:setup-claude/templates/.claude/agents/security-auditor.md +47 -0
- package/skills/sk:setup-claude/templates/.claude/agents/test-runner.md +42 -0
- package/skills/sk:setup-claude/templates/.claude/rules/api.md.template +14 -0
- package/skills/sk:setup-claude/templates/.claude/rules/frontend.md.template +15 -0
- package/skills/sk:setup-claude/templates/.claude/rules/laravel.md.template +15 -0
- package/skills/sk:setup-claude/templates/.claude/rules/react.md.template +14 -0
- package/skills/sk:setup-claude/templates/.claude/rules/tests.md.template +16 -0
- package/skills/sk:setup-claude/templates/.claude/settings.json.template +76 -0
- package/skills/sk:setup-claude/templates/.claude/statusline.sh +50 -0
- package/skills/sk:setup-claude/templates/CLAUDE.md.template +31 -42
- package/skills/sk:setup-claude/templates/commands/brainstorm.md.template +1 -1
- package/skills/sk:setup-claude/templates/commands/execute-plan.md.template +1 -1
- package/skills/sk:setup-claude/templates/commands/finish-feature.md.template +1 -1
- package/skills/sk:setup-claude/templates/commands/security-check.md.template +1 -1
- package/skills/sk:setup-claude/templates/commands/write-plan.md.template +1 -1
- package/skills/sk:setup-claude/templates/hooks/log-agent.sh +24 -0
- package/skills/sk:setup-claude/templates/hooks/pre-compact.sh +44 -0
- package/skills/sk:setup-claude/templates/hooks/session-start.sh +53 -0
- package/skills/sk:setup-claude/templates/hooks/session-stop.sh +33 -0
- package/skills/sk:setup-claude/templates/hooks/validate-commit.sh +81 -0
- package/skills/sk:setup-claude/templates/hooks/validate-push.sh +43 -0
- package/skills/sk:setup-claude/templates/tasks/workflow-status.md.template +10 -16
- package/skills/sk:setup-optimizer/SKILL.md +4 -4
- package/skills/sk:test/SKILL.md +6 -2
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: linter
|
|
3
|
+
model: haiku
|
|
4
|
+
description: Run all project linters and dependency audits. Auto-fix issues, auto-commit fixes, and re-run until clean.
|
|
5
|
+
allowed_tools: Bash, Read, Edit, Write, Glob, Grep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Linter Agent
|
|
9
|
+
|
|
10
|
+
You are a specialized linting agent. Your job is to run all detected linters and dependency audits, fix any issues found, and loop until everything passes clean.
|
|
11
|
+
|
|
12
|
+
## Behavior
|
|
13
|
+
|
|
14
|
+
1. **Detect linters**: Check for project linting tools:
|
|
15
|
+
- PHP: `vendor/bin/pint`, `vendor/bin/phpstan`, `vendor/bin/rector`
|
|
16
|
+
- JS/TS: `npx eslint`, `npx prettier`, eslint in package.json scripts
|
|
17
|
+
- Python: `ruff`, `black`, `flake8`, `mypy`
|
|
18
|
+
- Go: `gofmt`, `golangci-lint`
|
|
19
|
+
- Rust: `cargo fmt`, `cargo clippy`
|
|
20
|
+
- General: `npm run lint`, `composer lint` from package.json/composer.json scripts
|
|
21
|
+
|
|
22
|
+
2. **Detect dependency audits**: `npm audit`, `composer audit`, `pip-audit`, `cargo audit`
|
|
23
|
+
|
|
24
|
+
3. **Run formatters first** (sequential — order matters):
|
|
25
|
+
- Prettier/Pint/Black/gofmt/cargo fmt
|
|
26
|
+
|
|
27
|
+
4. **Run analyzers** (parallel where possible):
|
|
28
|
+
- ESLint/PHPStan/Rector/Ruff/Clippy
|
|
29
|
+
|
|
30
|
+
5. **Run dependency audits**
|
|
31
|
+
|
|
32
|
+
6. **Fix loop**: For each issue found:
|
|
33
|
+
- Fix the issue
|
|
34
|
+
- Stage the fix: `git add <files>`
|
|
35
|
+
- auto-commit with message: `fix(lint): resolve lint and dep audit issues`
|
|
36
|
+
- Re-run ALL linters from scratch
|
|
37
|
+
- Loop until clean — do not stop after one pass
|
|
38
|
+
|
|
39
|
+
7. **Pre-existing issues**: If an issue exists in a file NOT in `git diff main..HEAD --name-only`:
|
|
40
|
+
- Log to `tasks/tech-debt.md` using format:
|
|
41
|
+
```
|
|
42
|
+
### [YYYY-MM-DD] Found during: sk:lint
|
|
43
|
+
File: path/to/file.ext:line
|
|
44
|
+
Issue: description
|
|
45
|
+
Severity: low
|
|
46
|
+
```
|
|
47
|
+
- Do NOT fix it — it's out of scope
|
|
48
|
+
|
|
49
|
+
8. **Report** when clean:
|
|
50
|
+
```
|
|
51
|
+
Lint: clean (attempt N)
|
|
52
|
+
Dep audit: 0 vulnerabilities
|
|
53
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: perf-auditor
|
|
3
|
+
model: sonnet
|
|
4
|
+
description: Audit changed code for performance issues including bundle size, N+1 queries, Core Web Vitals, and memory leaks.
|
|
5
|
+
allowed_tools: Bash, Read, Edit, Write, Glob, Grep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Performance Auditor Agent
|
|
9
|
+
|
|
10
|
+
You are a specialized performance audit agent. Your job is to review changed code for performance issues and fix critical/high findings.
|
|
11
|
+
|
|
12
|
+
## Behavior
|
|
13
|
+
|
|
14
|
+
1. **Identify changed files**: `git diff main..HEAD --name-only`
|
|
15
|
+
|
|
16
|
+
2. **Audit categories** (check what's applicable based on file types):
|
|
17
|
+
- **N+1 queries**: Eloquent/ORM queries inside loops, missing eager loading
|
|
18
|
+
- **Bundle size**: Importing entire libraries when only a function is needed
|
|
19
|
+
- **Memory**: Unbounded arrays, missing cleanup in effects/listeners, leaked subscriptions
|
|
20
|
+
- **Core Web Vitals**: Layout shifts (missing width/height on images), blocking scripts, large DOM
|
|
21
|
+
- **Database**: Missing indexes on filtered/sorted columns, SELECT * instead of specific columns
|
|
22
|
+
- **Caching**: Repeated expensive computations that could be memoized or cached
|
|
23
|
+
- **Rendering**: Unnecessary re-renders, missing React.memo/useMemo where profiling shows need
|
|
24
|
+
|
|
25
|
+
3. **Classify findings**: critical, high, medium, low
|
|
26
|
+
|
|
27
|
+
4. **Fix critical/high** in-scope findings:
|
|
28
|
+
- Fix the issue
|
|
29
|
+
- Stage: `git add <files>`
|
|
30
|
+
- auto-commit: `fix(perf): resolve [severity] performance issue`
|
|
31
|
+
- Re-run audit
|
|
32
|
+
|
|
33
|
+
5. **Medium/low** findings: Log only, do not fix
|
|
34
|
+
|
|
35
|
+
6. **Pre-existing issues**: Log to `tasks/tech-debt.md`
|
|
36
|
+
|
|
37
|
+
7. **Generate report**: Write findings to `tasks/perf-findings.md`
|
|
38
|
+
|
|
39
|
+
8. **Report** when clean:
|
|
40
|
+
```
|
|
41
|
+
Performance: 0 critical/high findings (attempt [N])
|
|
42
|
+
Audited: [M] files
|
|
43
|
+
```
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-auditor
|
|
3
|
+
model: sonnet
|
|
4
|
+
description: Audit changed code for OWASP Top 10 and security best practices. Fix findings and auto-commit.
|
|
5
|
+
allowed_tools: Bash, Read, Edit, Write, Glob, Grep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Security Auditor Agent
|
|
9
|
+
|
|
10
|
+
You are a specialized security audit agent. Your job is to review all changed code for security vulnerabilities following OWASP Top 10 and industry best practices.
|
|
11
|
+
|
|
12
|
+
## Behavior
|
|
13
|
+
|
|
14
|
+
1. **Identify changed files**: `git diff main..HEAD --name-only`
|
|
15
|
+
|
|
16
|
+
2. **Read each changed file** and audit for:
|
|
17
|
+
- **Injection** (SQL, command, XSS, template): User input used in queries/commands without sanitization
|
|
18
|
+
- **Broken auth**: Hardcoded credentials, missing auth checks, weak token generation
|
|
19
|
+
- **Sensitive data exposure**: Secrets in code, missing encryption, verbose error messages
|
|
20
|
+
- **Broken access control**: Missing authorization checks, IDOR vulnerabilities
|
|
21
|
+
- **Security misconfiguration**: Debug mode in production, permissive CORS, missing security headers
|
|
22
|
+
- **Vulnerable dependencies**: Known CVEs in dependencies (check with `npm audit`, `composer audit`, etc.)
|
|
23
|
+
- **Input validation**: Missing or insufficient validation at system boundaries
|
|
24
|
+
|
|
25
|
+
3. **For each finding**:
|
|
26
|
+
- Classify severity: critical, high, medium, low
|
|
27
|
+
- If in scope (file in branch diff): Fix immediately
|
|
28
|
+
- Stage fix: `git add <files>`
|
|
29
|
+
- auto-commit: `fix(security): resolve [severity] [type] finding`
|
|
30
|
+
- Re-run audit on fixed files
|
|
31
|
+
|
|
32
|
+
4. **Pre-existing issues** (file NOT in branch diff):
|
|
33
|
+
- Log to `tasks/tech-debt.md`:
|
|
34
|
+
```
|
|
35
|
+
### [YYYY-MM-DD] Found during: sk:security-check
|
|
36
|
+
File: path/to/file.ext:line
|
|
37
|
+
Issue: [OWASP category] — description
|
|
38
|
+
Severity: [critical|high|medium|low]
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
5. **Generate report**: Append findings to `tasks/security-findings.md`
|
|
42
|
+
|
|
43
|
+
6. **Report** when clean:
|
|
44
|
+
```
|
|
45
|
+
Security: 0 findings (attempt [N])
|
|
46
|
+
Audited: [M] files
|
|
47
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-runner
|
|
3
|
+
model: sonnet
|
|
4
|
+
description: Run all project test suites, fix failures, ensure 100% coverage on new code.
|
|
5
|
+
allowed_tools: Bash, Read, Edit, Write, Glob, Grep
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Test Runner Agent
|
|
9
|
+
|
|
10
|
+
You are a specialized testing agent. Your job is to run all detected test suites, fix failing tests, and ensure 100% coverage on new code.
|
|
11
|
+
|
|
12
|
+
## Behavior
|
|
13
|
+
|
|
14
|
+
1. **Detect test frameworks**:
|
|
15
|
+
- PHP: `vendor/bin/pest`, `vendor/bin/phpunit`
|
|
16
|
+
- JS/TS: `npx vitest`, `npx jest`, `npm test`
|
|
17
|
+
- Python: `pytest`, `python -m unittest`
|
|
18
|
+
- Go: `go test ./...`
|
|
19
|
+
- Rust: `cargo test`
|
|
20
|
+
- Bash: `bash tests/verify-workflow.sh`
|
|
21
|
+
|
|
22
|
+
2. **Run all detected suites**
|
|
23
|
+
|
|
24
|
+
3. **If tests fail**:
|
|
25
|
+
- Analyze the failure output
|
|
26
|
+
- Fix the root cause (not just the test — fix the implementation if it's wrong)
|
|
27
|
+
- Stage fixes: `git add <files>`
|
|
28
|
+
- auto-commit: `fix(test): resolve failing tests`
|
|
29
|
+
- Re-run the failing suite
|
|
30
|
+
- Loop until all pass
|
|
31
|
+
|
|
32
|
+
4. **Coverage check**: If the test framework supports coverage:
|
|
33
|
+
- Run with coverage enabled
|
|
34
|
+
- Check that new code (files in `git diff main..HEAD --name-only`) has 100% coverage
|
|
35
|
+
- If coverage gaps exist, write additional tests
|
|
36
|
+
- auto-commit: `fix(test): add missing test coverage`
|
|
37
|
+
|
|
38
|
+
5. **Report** when passing:
|
|
39
|
+
```
|
|
40
|
+
Tests: [N] passed, 0 failed (attempt [M])
|
|
41
|
+
Coverage: 100% on new code
|
|
42
|
+
```
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!-- Generated by /setup-claude -->
|
|
2
|
+
# API Standards
|
|
3
|
+
|
|
4
|
+
Applies to: `routes/api/`, `app/Http/Controllers/Api/`, `src/api/`, `src/routes/`
|
|
5
|
+
|
|
6
|
+
## Conventions
|
|
7
|
+
|
|
8
|
+
- **Validation**: Validate all input at the boundary. Use form requests, schemas, or middleware — never trust raw input.
|
|
9
|
+
- **Error responses**: Return structured JSON errors with appropriate HTTP status codes. Include enough context to debug.
|
|
10
|
+
- **Authentication**: Every endpoint must explicitly declare its auth requirement (public, authenticated, admin).
|
|
11
|
+
- **Rate limiting**: Apply rate limits to public and authentication endpoints.
|
|
12
|
+
- **Versioning**: Use URL or header versioning for breaking changes.
|
|
13
|
+
- **Response shape**: Consistent response envelope — `{ data, meta, errors }` or framework convention.
|
|
14
|
+
- **Idempotency**: POST/PUT/PATCH operations should be idempotent where possible.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!-- Generated by /setup-claude -->
|
|
2
|
+
# Frontend Standards
|
|
3
|
+
|
|
4
|
+
Applies to: `resources/`, `src/components/`, `app/components/`, `src/pages/`, `src/views/`
|
|
5
|
+
|
|
6
|
+
## Conventions
|
|
7
|
+
|
|
8
|
+
- **Component structure**: One component per file. Name matches filename.
|
|
9
|
+
- **Props**: Type all props explicitly. No `any` types.
|
|
10
|
+
- **State**: Keep state as close to where it's used as possible. Lift only when necessary.
|
|
11
|
+
- **Side effects**: Isolate side effects in hooks/composables. Keep render functions pure.
|
|
12
|
+
- **Accessibility**: All interactive elements must be keyboard accessible. Use semantic HTML. Include ARIA labels where needed.
|
|
13
|
+
- **Loading states**: Handle loading, error, and empty states for every data-dependent component.
|
|
14
|
+
- **Event handlers**: Name handlers descriptively (`handleSubmitForm`, not `onClick`).
|
|
15
|
+
- **CSS**: Use utility classes or scoped styles. No global style modifications from components.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!-- Generated by /setup-claude -->
|
|
2
|
+
# Laravel Standards
|
|
3
|
+
|
|
4
|
+
Applies to: `app/`, `routes/`, `database/`, `config/`
|
|
5
|
+
|
|
6
|
+
## Conventions
|
|
7
|
+
|
|
8
|
+
- **Eloquent**: Use query scopes for reusable queries. Avoid raw SQL unless necessary for performance.
|
|
9
|
+
- **N+1**: Always eager-load relationships. Use `->with()` or `->load()`.
|
|
10
|
+
- **Form Requests**: Validate in Form Request classes, not in controllers.
|
|
11
|
+
- **Service Layer**: Business logic belongs in services, not controllers or models.
|
|
12
|
+
- **Resources**: Use API Resources for response transformation.
|
|
13
|
+
- **Migrations**: One logical change per migration. Never modify a published migration.
|
|
14
|
+
- **Config**: Access config via `config()` helper, never `env()` outside config files.
|
|
15
|
+
- **Strict mode**: Models use strict mode (prevent lazy loading, silently discarding attributes, accessing missing attributes).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<!-- Generated by /setup-claude -->
|
|
2
|
+
# React Standards
|
|
3
|
+
|
|
4
|
+
Applies to: `src/components/`, `src/hooks/`, `src/pages/`, `app/components/`
|
|
5
|
+
|
|
6
|
+
## Conventions
|
|
7
|
+
|
|
8
|
+
- **Hooks**: Follow Rules of Hooks. Custom hooks start with `use`. Extract complex logic into custom hooks.
|
|
9
|
+
- **Components**: Prefer function components. Use `React.memo()` only when profiling shows a need.
|
|
10
|
+
- **State**: Use `useState` for local state, context for shared state, external stores (Zustand/Redux) for complex state.
|
|
11
|
+
- **Effects**: Minimize `useEffect`. Prefer derived state and event handlers. Always specify dependency arrays.
|
|
12
|
+
- **Keys**: Use stable, unique keys for lists. Never use array index as key for dynamic lists.
|
|
13
|
+
- **Error boundaries**: Wrap route-level components in error boundaries.
|
|
14
|
+
- **TypeScript**: Type props interfaces, not inline. Export prop types for reusable components.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- Generated by /setup-claude -->
|
|
2
|
+
# Testing Standards
|
|
3
|
+
|
|
4
|
+
Applies to: `tests/`, `test/`, `__tests__/`, `spec/`
|
|
5
|
+
|
|
6
|
+
## Conventions
|
|
7
|
+
|
|
8
|
+
- **Naming**: `test_[system]_[scenario]_[expected_result]` or `describe > it` blocks with descriptive names
|
|
9
|
+
- **Structure**: Arrange / Act / Assert — every test must clearly separate setup, execution, and verification
|
|
10
|
+
- **Independence**: Unit tests must not depend on external state (filesystem, network, database)
|
|
11
|
+
- **Cleanup**: Integration tests must clean up artifacts after execution
|
|
12
|
+
- **Coverage**: All new code requires test coverage. Target 100% coverage on new code paths.
|
|
13
|
+
- **Regression**: Every bug fix requires a regression test that would have caught the original defect
|
|
14
|
+
- **Fixtures**: Test data belongs in the test itself or dedicated fixtures — never shared mutable state
|
|
15
|
+
- **Mocking**: Mock external dependencies, not the code under test. Test behavior, not implementation.
|
|
16
|
+
- **Performance**: Tests should run fast. Mock slow dependencies (network, disk, database) in unit tests.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/claude-code-settings.json",
|
|
3
|
+
"statusline": {
|
|
4
|
+
"command": "bash .claude/statusline.sh"
|
|
5
|
+
},
|
|
6
|
+
"permissions": {
|
|
7
|
+
"allow": [
|
|
8
|
+
"Bash(git status*)",
|
|
9
|
+
"Bash(git diff*)",
|
|
10
|
+
"Bash(git log*)",
|
|
11
|
+
"Bash(git branch*)",
|
|
12
|
+
"Bash(git rev-parse*)",
|
|
13
|
+
"Bash(ls*)",
|
|
14
|
+
"Bash(cat package.json)",
|
|
15
|
+
"Bash(cat composer.json)"
|
|
16
|
+
],
|
|
17
|
+
"deny": [
|
|
18
|
+
"Bash(rm -rf*)",
|
|
19
|
+
"Bash(git push --force*)",
|
|
20
|
+
"Bash(git reset --hard*)",
|
|
21
|
+
"Bash(sudo *)",
|
|
22
|
+
"Bash(chmod -R 777*)",
|
|
23
|
+
"Bash(cat .env*)"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"hooks": {
|
|
27
|
+
"SessionStart": [
|
|
28
|
+
{
|
|
29
|
+
"type": "command",
|
|
30
|
+
"command": "bash .claude/hooks/session-start.sh",
|
|
31
|
+
"timeout": 10000
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"PreCompact": [
|
|
35
|
+
{
|
|
36
|
+
"type": "command",
|
|
37
|
+
"command": "bash .claude/hooks/pre-compact.sh",
|
|
38
|
+
"timeout": 10000
|
|
39
|
+
}
|
|
40
|
+
],
|
|
41
|
+
"PreToolUse": [
|
|
42
|
+
{
|
|
43
|
+
"type": "command",
|
|
44
|
+
"command": "bash .claude/hooks/validate-commit.sh",
|
|
45
|
+
"timeout": 10000,
|
|
46
|
+
"matcher": {
|
|
47
|
+
"tool_name": "Bash",
|
|
48
|
+
"command_pattern": "git commit*"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"type": "command",
|
|
53
|
+
"command": "bash .claude/hooks/validate-push.sh",
|
|
54
|
+
"timeout": 5000,
|
|
55
|
+
"matcher": {
|
|
56
|
+
"tool_name": "Bash",
|
|
57
|
+
"command_pattern": "git push*"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
],
|
|
61
|
+
"SubagentStart": [
|
|
62
|
+
{
|
|
63
|
+
"type": "command",
|
|
64
|
+
"command": "bash .claude/hooks/log-agent.sh",
|
|
65
|
+
"timeout": 5000
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"Stop": [
|
|
69
|
+
{
|
|
70
|
+
"type": "command",
|
|
71
|
+
"command": "bash .claude/hooks/session-stop.sh",
|
|
72
|
+
"timeout": 10000
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Claude Code statusline: Shows persistent status in CLI
|
|
3
|
+
# Receives JSON on stdin with context_window, model info
|
|
4
|
+
# Outputs a single formatted line
|
|
5
|
+
|
|
6
|
+
INPUT=$(cat)
|
|
7
|
+
|
|
8
|
+
# Parse context and model — use jq if available
|
|
9
|
+
if command -v jq >/dev/null 2>&1; then
|
|
10
|
+
MODEL=$(echo "$INPUT" | jq -r '.model // "unknown"' 2>/dev/null)
|
|
11
|
+
CTX_USED=$(echo "$INPUT" | jq -r '.context_window.used // 0' 2>/dev/null)
|
|
12
|
+
CTX_TOTAL=$(echo "$INPUT" | jq -r '.context_window.total // 1' 2>/dev/null)
|
|
13
|
+
else
|
|
14
|
+
MODEL="unknown"
|
|
15
|
+
CTX_USED=0
|
|
16
|
+
CTX_TOTAL=1
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
# Calculate context percentage
|
|
20
|
+
if [ "$CTX_TOTAL" -gt 0 ] 2>/dev/null; then
|
|
21
|
+
CTX_PCT=$((CTX_USED * 100 / CTX_TOTAL))
|
|
22
|
+
else
|
|
23
|
+
CTX_PCT=0
|
|
24
|
+
fi
|
|
25
|
+
|
|
26
|
+
# Branch
|
|
27
|
+
BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "none")
|
|
28
|
+
|
|
29
|
+
# Current workflow step
|
|
30
|
+
STEP="—"
|
|
31
|
+
if [ -f "tasks/workflow-status.md" ]; then
|
|
32
|
+
NEXT_LINE=$(grep -E ">>\s*next\s*<<" "tasks/workflow-status.md" 2>/dev/null | head -1)
|
|
33
|
+
if [ -n "$NEXT_LINE" ]; then
|
|
34
|
+
# Extract step number and name from table row
|
|
35
|
+
STEP_NUM=$(echo "$NEXT_LINE" | grep -oE '^\|[[:space:]]*[0-9]+' | grep -oE '[0-9]+')
|
|
36
|
+
STEP_NAME=$(echo "$NEXT_LINE" | sed 's/.*| *>> next << *|.*//' | sed 's/|.*//;s/^ *//;s/ *$//')
|
|
37
|
+
if [ -n "$STEP_NUM" ]; then
|
|
38
|
+
STEP="Step ${STEP_NUM}"
|
|
39
|
+
fi
|
|
40
|
+
fi
|
|
41
|
+
fi
|
|
42
|
+
|
|
43
|
+
# Task name from todo.md
|
|
44
|
+
TASK="—"
|
|
45
|
+
if [ -f "tasks/todo.md" ]; then
|
|
46
|
+
TASK=$(head -1 "tasks/todo.md" 2>/dev/null | sed 's/^# TODO.*— //' | cut -c1-40)
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
# Output single line
|
|
50
|
+
echo "[${CTX_PCT}%] ${MODEL} | ${STEP} | ${BRANCH} | ${TASK}"
|
|
@@ -52,21 +52,15 @@ Progress is tracked in `tasks/workflow-status.md`. This file persists across con
|
|
|
52
52
|
| 10 | Implement | `/sk:execute-plan` | required | no |
|
|
53
53
|
| 11 | Commit | `/sk:smart-commit` | required | no |
|
|
54
54
|
| 12 | Lint + Dep Audit | `/sk:lint` | required | yes — must be clean |
|
|
55
|
-
| 13 |
|
|
56
|
-
| 14 |
|
|
57
|
-
| 15 |
|
|
58
|
-
| 16 |
|
|
59
|
-
| 17 |
|
|
60
|
-
| 18 |
|
|
61
|
-
| 19 |
|
|
62
|
-
| 20 |
|
|
63
|
-
| 21 |
|
|
64
|
-
| 22 | E2E Tests | `/sk:e2e` | required | yes — all scenarios must pass |
|
|
65
|
-
| 23 | Commit | `/sk:smart-commit` | conditional (skip if E2E was clean) | no |
|
|
66
|
-
| 24 | Update | `/sk:update-task` | required | no |
|
|
67
|
-
| 25 | Finalize | `/sk:finish-feature` | required | no |
|
|
68
|
-
| 26 | Sync Features | `/sk:features` | required | no |
|
|
69
|
-
| 27 | Release | `/sk:release` | optional (confirm to skip) | no |
|
|
55
|
+
| 13 | Verify Tests | `/sk:test` | required | yes — 100% coverage required |
|
|
56
|
+
| 14 | Security | `/sk:security-check` | required | yes — must reach 0 issues |
|
|
57
|
+
| 15 | Performance | `/sk:perf` | optional (confirm to skip) | yes — loop until critical/high = 0 |
|
|
58
|
+
| 16 | Review + Simplify | `/sk:review` | required | yes — must reach 0 issues |
|
|
59
|
+
| 17 | E2E Tests | `/sk:e2e` | required | yes — all scenarios must pass |
|
|
60
|
+
| 18 | Update | `/sk:update-task` | required | no |
|
|
61
|
+
| 19 | Finalize | `/sk:finish-feature` | required | no |
|
|
62
|
+
| 20 | Sync Features | `/sk:features` | required | no |
|
|
63
|
+
| 21 | Release | `/sk:release` | optional (confirm to skip) | no |
|
|
70
64
|
|
|
71
65
|
### Step Details
|
|
72
66
|
|
|
@@ -81,22 +75,16 @@ Progress is tracked in `tasks/workflow-status.md`. This file persists across con
|
|
|
81
75
|
9. **Write Tests** — run `/sk:write-tests` (TDD red phase). Write failing tests for all planned code. If modifying existing behavior, update existing tests first. Tests SHOULD fail — no implementation yet.
|
|
82
76
|
10. **Implement** — run `/sk:execute-plan` to execute `tasks/todo.md` checkboxes in small batches, making the failing tests pass (TDD green phase). Log progress to `tasks/progress.md`.
|
|
83
77
|
11. **Commit** — run `/sk:smart-commit` to commit tests + implementation
|
|
84
|
-
12. **Lint + Dep Audit** — run `/sk:lint` — auto-detects and runs all project linters plus dependency vulnerability audits. Fix all issues immediately, then re-run until clean. Do not ask to re-run — fix and re-run automatically.
|
|
85
|
-
13. **
|
|
86
|
-
14. **
|
|
87
|
-
15. **
|
|
88
|
-
16. **
|
|
89
|
-
17. **
|
|
90
|
-
18. **
|
|
91
|
-
19. **
|
|
92
|
-
20. **
|
|
93
|
-
21. **
|
|
94
|
-
22. **E2E Tests** — run `/sk:e2e`. Verifies the complete, reviewed, secure implementation works end-to-end from a user's perspective using agent-browser. All scenarios must pass. Cannot be skipped.
|
|
95
|
-
23. **Commit** — run `/sk:smart-commit` if E2E required fixes. Auto-skip if E2E was clean.
|
|
96
|
-
24. **Update** — run `/sk:update-task` to mark the task done in `tasks/todo.md` and log completion to `tasks/progress.md`.
|
|
97
|
-
25. **Finalize** — run `/sk:finish-feature` for changelog + PR
|
|
98
|
-
26. **Sync Features** — run `/sk:features` to sync `docs/sk:features/` specs with what was actually shipped.
|
|
99
|
-
27. **Release** — run `/sk:release` if deploying. Skip if not ready.
|
|
78
|
+
12. **Lint + Dep Audit** — run `/sk:lint` — auto-detects and runs all project linters plus dependency vulnerability audits. Fix all issues immediately, then re-run until clean. Do not ask to re-run — fix and re-run automatically. Gates own their commits — commit any fixes before moving on.
|
|
79
|
+
13. **Verify Tests** — run `/sk:test` — auto-detects and runs all project test suites. **100% test coverage required.** Fix failures immediately, then re-run. Do not ask to re-run — fix and re-run automatically. Gates own their commits — commit any fixes before moving on.
|
|
80
|
+
14. **Security** — run `/sk:security-check`. Must reach 0 issues across all severities. Fix issues immediately, commit, then re-run. Loop until clean. Gates own their commits — commit any fixes before moving on.
|
|
81
|
+
15. **Performance** — run `/sk:perf` to audit for performance issues. Produces `tasks/perf-findings.md`. Fix critical/high findings, commit, then re-run. Loop until critical/high = 0. Skip if confirmed with user. Gates own their commits — commit any fixes before moving on.
|
|
82
|
+
16. **Review + Simplify** — run `/sk:review`. First runs a simplify pre-pass on changed files, then performs full multi-dimensional review. Must reach 0 issues including nitpicks. Fix issues immediately, commit, then re-run. Loop until clean. Gates own their commits — commit any fixes before moving on.
|
|
83
|
+
17. **E2E Tests** — run `/sk:e2e`. Verifies the complete, reviewed, secure implementation works end-to-end from a user's perspective using agent-browser. All scenarios must pass. Cannot be skipped. Gates own their commits — commit any fixes before moving on.
|
|
84
|
+
18. **Update** — run `/sk:update-task` to mark the task done in `tasks/todo.md` and log completion to `tasks/progress.md`.
|
|
85
|
+
19. **Finalize** — run `/sk:finish-feature` for changelog + PR
|
|
86
|
+
20. **Sync Features** — run `/sk:features` to sync `docs/sk:features/` specs with what was actually shipped.
|
|
87
|
+
21. **Release** — run `/sk:release` if deploying. Skip if not ready.
|
|
100
88
|
|
|
101
89
|
### Workflow Tracker Rules
|
|
102
90
|
|
|
@@ -109,20 +97,20 @@ Progress is tracked in `tasks/workflow-status.md`. This file persists across con
|
|
|
109
97
|
- Add relevant Notes (e.g., "clean on attempt 2", "backend-only, no UI")
|
|
110
98
|
- Move `>> next <<` to the next pending step
|
|
111
99
|
|
|
112
|
-
3. **Optional steps** (4, 5, 8,
|
|
100
|
+
3. **Optional steps** (4, 5, 8, 15, 21): Ask the user "Skip [step]?" and require explicit confirmation. Record the reason in Notes.
|
|
113
101
|
|
|
114
|
-
4. **
|
|
102
|
+
4. **Gates own their commits.** Each hard gate (steps 12–17) is responsible for committing any fixes it produces before passing control to the next step. There are no separate conditional commit steps.
|
|
115
103
|
|
|
116
|
-
5. **Loop steps are HARD GATES** (12, 14, 16,
|
|
104
|
+
5. **Loop steps are HARD GATES** (12, 13, 14, 16, 17): These steps BLOCK all forward progress until they pass clean. Fix issues immediately and re-run. Do NOT ask the user to re-run — fix and re-run automatically. Track attempt number in Notes (e.g., "clean on attempt 3").
|
|
117
105
|
- **Step 12 (Lint)**: All detected linting tools must pass — every single one.
|
|
118
|
-
- **Step
|
|
119
|
-
- **Step
|
|
120
|
-
- **Step
|
|
121
|
-
- **Step
|
|
122
|
-
- **Step
|
|
106
|
+
- **Step 13 (Verify Tests)**: All detected test suites (BE + FE) must pass with 100% coverage on new code.
|
|
107
|
+
- **Step 14 (Security)**: 0 issues across all severities.
|
|
108
|
+
- **Step 16 (Review)**: 0 issues including nitpicks.
|
|
109
|
+
- **Step 17 (E2E Tests)**: All scenarios must pass. 0 failures allowed.
|
|
110
|
+
- **Step 15 (Performance)**: Optional gate — if run, loop until critical/high findings = 0. Can be skipped with explicit confirmation.
|
|
123
111
|
- **DO NOT mark these steps as `done` until every check passes.** If even one tool fails, the step is NOT done. Never proceed to the next step with errors remaining.
|
|
124
112
|
|
|
125
|
-
6. **Never skip steps without confirmation.** Steps cannot run out of order. Hard gate steps (12, 14, 16,
|
|
113
|
+
6. **Never skip steps without confirmation.** Steps cannot run out of order. Hard gate steps (12, 13, 14, 16, 17) can NEVER be skipped. Optional gate step (15) requires explicit confirmation to skip.
|
|
126
114
|
|
|
127
115
|
7. **Requirements change mid-workflow?** Stop the current step and run `/sk:change` immediately. It will classify the scope (behavior tweak / new requirements / scope shift) and tell you exactly where to re-enter the workflow. Never continue implementing stale requirements.
|
|
128
116
|
|
|
@@ -142,7 +130,7 @@ This tells the user exactly what happened and what to do next. Never finish a st
|
|
|
142
130
|
|
|
143
131
|
### Fix & Retest Protocol
|
|
144
132
|
|
|
145
|
-
**Applies to steps 12,
|
|
133
|
+
**Applies to steps 12, 13, 14, 15, 16, 17 — any step that can produce code changes.**
|
|
146
134
|
|
|
147
135
|
When any of these steps require a fix, classify the fix before committing:
|
|
148
136
|
|
|
@@ -290,6 +278,7 @@ Read these files at the start of every task:
|
|
|
290
278
|
- `tasks/findings.md` — key decisions and project constraints
|
|
291
279
|
- `tasks/lessons.md` — past mistakes and how to avoid them
|
|
292
280
|
- `tasks/todo.md` — current plan
|
|
281
|
+
- `tasks/tech-debt.md` — known shortcuts, deferred work, and areas to revisit
|
|
293
282
|
|
|
294
283
|
Write to these files continuously:
|
|
295
284
|
- `tasks/progress.md` — every attempt, error, and resolution
|
|
@@ -321,7 +310,7 @@ Tests are written **before** implementation (step 9) and verified **after** (ste
|
|
|
321
310
|
2. `/sk:execute-plan` — implement code to make tests pass (GREEN)
|
|
322
311
|
3. `/sk:test` — verify all tests pass with 100% coverage (VERIFY)
|
|
323
312
|
|
|
324
|
-
Every new function, endpoint, component, and module needs tests. No code proceeds past step
|
|
313
|
+
Every new function, endpoint, component, and module needs tests. No code proceeds past step 12 without 100% coverage on new code.
|
|
325
314
|
|
|
326
315
|
## 3-Strike Protocol
|
|
327
316
|
|
|
@@ -6,7 +6,7 @@ description: "Start with design questions before writing code."
|
|
|
6
6
|
|
|
7
7
|
# /brainstorm
|
|
8
8
|
|
|
9
|
-
**Workflow:** Read → **Explore** → Design → Accessibility → Plan → Branch → Migrate → Write Tests → Implement → Lint →
|
|
9
|
+
**Workflow:** Read → **Explore** → Design → Accessibility → Plan → Branch → Migrate → Write Tests → Implement → Lint → Tests → Security → Perf → Review → E2E Tests → Update → Finish → Sync → Release
|
|
10
10
|
|
|
11
11
|
Explore design and clarify requirements **before** any code is written.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ description: "Execute tasks/todo.md checkboxes in small batches; log to tasks/pr
|
|
|
6
6
|
|
|
7
7
|
# /execute-plan
|
|
8
8
|
|
|
9
|
-
**Workflow:** Read → Explore → Design → Accessibility → Plan → Branch → Migrate → Write Tests → **Implement** → Lint →
|
|
9
|
+
**Workflow:** Read → Explore → Design → Accessibility → Plan → Branch → Migrate → Write Tests → **Implement** → Lint → Tests → Security → Perf → Review → E2E Tests → Update → Finish → Sync → Release
|
|
10
10
|
|
|
11
11
|
Execute the plan in `tasks/todo.md` in small batches with clear checkpoints.
|
|
12
12
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# Finish Feature Command
|
|
4
4
|
|
|
5
|
-
**Workflow:** Read → Explore → Design → Accessibility → Plan → Branch → Migrate → Write Tests → Implement → Lint →
|
|
5
|
+
**Workflow:** Read → Explore → Design → Accessibility → Plan → Branch → Migrate → Write Tests → Implement → Lint → Tests → Security → Perf → Review → E2E Tests → Update → **Finish** → Sync → Release
|
|
6
6
|
|
|
7
7
|
Finalize a feature/bug-fix branch: changelog, arch log, security gate, verification, and PR creation.
|
|
8
8
|
|
|
@@ -6,7 +6,7 @@ description: "Audit changed code for security best practices, production-grade q
|
|
|
6
6
|
|
|
7
7
|
# /security-check
|
|
8
8
|
|
|
9
|
-
**Workflow:** Read → Explore → Design → Accessibility → Plan → Branch → Migrate → Write Tests → Implement → Lint →
|
|
9
|
+
**Workflow:** Read → Explore → Design → Accessibility → Plan → Branch → Migrate → Write Tests → Implement → Lint → Tests → **Security** → Perf → Review → E2E Tests → Update → Finish → Sync → Release
|
|
10
10
|
|
|
11
11
|
Audit code for security vulnerabilities, production-grade quality, and industry gold-standard compliance.
|
|
12
12
|
|
|
@@ -6,7 +6,7 @@ description: "Write a decision-complete plan into tasks/todo.md (no code yet)."
|
|
|
6
6
|
|
|
7
7
|
# /write-plan
|
|
8
8
|
|
|
9
|
-
**Workflow:** Read → Explore → Design → Accessibility → **Plan** → Branch → Migrate → Write Tests → Implement → Lint →
|
|
9
|
+
**Workflow:** Read → Explore → Design → Accessibility → **Plan** → Branch → Migrate → Write Tests → Implement → Lint → Tests → Security → Perf → Review → E2E Tests → Update → Finish → Sync → Release
|
|
10
10
|
|
|
11
11
|
Create a decision-complete plan **before** writing code.
|
|
12
12
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Claude Code SubagentStart hook: Log agent invocations for audit trail
|
|
3
|
+
# Tracks which agents are being used and when
|
|
4
|
+
#
|
|
5
|
+
# Input schema (SubagentStart):
|
|
6
|
+
# { "agent_id": "agent-abc123", "agent_name": "linter", ... }
|
|
7
|
+
|
|
8
|
+
INPUT=$(cat)
|
|
9
|
+
|
|
10
|
+
# Parse agent name
|
|
11
|
+
if command -v jq >/dev/null 2>&1; then
|
|
12
|
+
AGENT_NAME=$(echo "$INPUT" | jq -r '.agent_name // "unknown"' 2>/dev/null)
|
|
13
|
+
else
|
|
14
|
+
AGENT_NAME=$(echo "$INPUT" | grep -oE '"agent_name"[[:space:]]*:[[:space:]]*"[^"]*"' | sed 's/"agent_name"[[:space:]]*:[[:space:]]*"//;s/"$//')
|
|
15
|
+
[ -z "$AGENT_NAME" ] && AGENT_NAME="unknown"
|
|
16
|
+
fi
|
|
17
|
+
|
|
18
|
+
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
|
19
|
+
|
|
20
|
+
# Append to audit log (create tasks/ dir if needed)
|
|
21
|
+
mkdir -p tasks 2>/dev/null
|
|
22
|
+
echo "$TIMESTAMP | Agent invoked: $AGENT_NAME" >> "tasks/agent-audit.log" 2>/dev/null
|
|
23
|
+
|
|
24
|
+
exit 0
|