@leing2021/super-pi 0.17.0 → 0.18.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 +122 -9
- package/package.json +2 -1
- package/rules/README.md +111 -0
- package/rules/common/agents.md +50 -0
- package/rules/common/code-review.md +124 -0
- package/rules/common/coding-style.md +90 -0
- package/rules/common/development-workflow.md +44 -0
- package/rules/common/git-workflow.md +24 -0
- package/rules/common/hooks.md +30 -0
- package/rules/common/patterns.md +31 -0
- package/rules/common/performance.md +55 -0
- package/rules/common/security.md +29 -0
- package/rules/common/testing.md +57 -0
- package/rules/cpp/coding-style.md +44 -0
- package/rules/cpp/hooks.md +39 -0
- package/rules/cpp/patterns.md +51 -0
- package/rules/cpp/security.md +51 -0
- package/rules/cpp/testing.md +44 -0
- package/rules/csharp/coding-style.md +72 -0
- package/rules/csharp/hooks.md +25 -0
- package/rules/csharp/patterns.md +50 -0
- package/rules/csharp/security.md +58 -0
- package/rules/csharp/testing.md +46 -0
- package/rules/dart/coding-style.md +159 -0
- package/rules/dart/hooks.md +66 -0
- package/rules/dart/patterns.md +261 -0
- package/rules/dart/security.md +135 -0
- package/rules/dart/testing.md +215 -0
- package/rules/golang/coding-style.md +32 -0
- package/rules/golang/hooks.md +17 -0
- package/rules/golang/patterns.md +45 -0
- package/rules/golang/security.md +34 -0
- package/rules/golang/testing.md +31 -0
- package/rules/java/coding-style.md +114 -0
- package/rules/java/hooks.md +18 -0
- package/rules/java/patterns.md +146 -0
- package/rules/java/security.md +100 -0
- package/rules/java/testing.md +131 -0
- package/rules/kotlin/coding-style.md +86 -0
- package/rules/kotlin/hooks.md +17 -0
- package/rules/kotlin/patterns.md +146 -0
- package/rules/kotlin/security.md +82 -0
- package/rules/kotlin/testing.md +128 -0
- package/rules/perl/coding-style.md +46 -0
- package/rules/perl/hooks.md +22 -0
- package/rules/perl/patterns.md +76 -0
- package/rules/perl/security.md +69 -0
- package/rules/perl/testing.md +54 -0
- package/rules/php/coding-style.md +40 -0
- package/rules/php/hooks.md +24 -0
- package/rules/php/patterns.md +33 -0
- package/rules/php/security.md +37 -0
- package/rules/php/testing.md +39 -0
- package/rules/python/coding-style.md +42 -0
- package/rules/python/hooks.md +19 -0
- package/rules/python/patterns.md +39 -0
- package/rules/python/security.md +30 -0
- package/rules/python/testing.md +38 -0
- package/rules/rust/coding-style.md +151 -0
- package/rules/rust/hooks.md +16 -0
- package/rules/rust/patterns.md +168 -0
- package/rules/rust/security.md +141 -0
- package/rules/rust/testing.md +154 -0
- package/rules/swift/coding-style.md +47 -0
- package/rules/swift/hooks.md +20 -0
- package/rules/swift/patterns.md +66 -0
- package/rules/swift/security.md +33 -0
- package/rules/swift/testing.md +45 -0
- package/rules/typescript/coding-style.md +199 -0
- package/rules/typescript/hooks.md +22 -0
- package/rules/typescript/patterns.md +52 -0
- package/rules/typescript/security.md +28 -0
- package/rules/typescript/testing.md +18 -0
- package/rules/web/coding-style.md +96 -0
- package/rules/web/design-quality.md +63 -0
- package/rules/web/hooks.md +120 -0
- package/rules/web/patterns.md +79 -0
- package/rules/web/performance.md +64 -0
- package/rules/web/security.md +57 -0
- package/rules/web/testing.md +55 -0
- package/skills/02-plan/SKILL.md +1 -0
- package/skills/03-work/SKILL.md +1 -0
- package/skills/04-review/SKILL.md +1 -0
- package/skills/10-rules/SKILL.md +68 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
> This file extends [common/hooks.md](../common/hooks.md) with web-specific hook recommendations.
|
|
2
|
+
|
|
3
|
+
# Web Hooks
|
|
4
|
+
|
|
5
|
+
## Recommended PostToolUse Hooks
|
|
6
|
+
|
|
7
|
+
Prefer project-local tooling. Do not wire hooks to remote one-off package execution.
|
|
8
|
+
|
|
9
|
+
### Format on Save
|
|
10
|
+
|
|
11
|
+
Use the project's existing formatter entrypoint after edits:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"hooks": {
|
|
16
|
+
"PostToolUse": [
|
|
17
|
+
{
|
|
18
|
+
"matcher": "Write|Edit",
|
|
19
|
+
"command": "pnpm prettier --write \"$FILE_PATH\"",
|
|
20
|
+
"description": "Format edited frontend files"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Equivalent local commands via `yarn prettier` or `npm exec prettier --` are fine when they use repo-owned dependencies.
|
|
28
|
+
|
|
29
|
+
### Lint Check
|
|
30
|
+
|
|
31
|
+
```json
|
|
32
|
+
{
|
|
33
|
+
"hooks": {
|
|
34
|
+
"PostToolUse": [
|
|
35
|
+
{
|
|
36
|
+
"matcher": "Write|Edit",
|
|
37
|
+
"command": "pnpm eslint --fix \"$FILE_PATH\"",
|
|
38
|
+
"description": "Run ESLint on edited frontend files"
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Type Check
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"hooks": {
|
|
50
|
+
"PostToolUse": [
|
|
51
|
+
{
|
|
52
|
+
"matcher": "Write|Edit",
|
|
53
|
+
"command": "pnpm tsc --noEmit --pretty false",
|
|
54
|
+
"description": "Type-check after frontend edits"
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### CSS Lint
|
|
62
|
+
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"hooks": {
|
|
66
|
+
"PostToolUse": [
|
|
67
|
+
{
|
|
68
|
+
"matcher": "Write|Edit",
|
|
69
|
+
"command": "pnpm stylelint --fix \"$FILE_PATH\"",
|
|
70
|
+
"description": "Lint edited stylesheets"
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## PreToolUse Hooks
|
|
78
|
+
|
|
79
|
+
### Guard File Size
|
|
80
|
+
|
|
81
|
+
Block oversized writes from tool input content, not from a file that may not exist yet:
|
|
82
|
+
|
|
83
|
+
```json
|
|
84
|
+
{
|
|
85
|
+
"hooks": {
|
|
86
|
+
"PreToolUse": [
|
|
87
|
+
{
|
|
88
|
+
"matcher": "Write",
|
|
89
|
+
"command": "node -e \"let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{const i=JSON.parse(d);const c=i.tool_input?.content||'';const lines=c.split('\\n').length;if(lines>800){console.error('[Hook] BLOCKED: File exceeds 800 lines ('+lines+' lines)');console.error('[Hook] Split into smaller modules');process.exit(2)}console.log(d)})\"",
|
|
90
|
+
"description": "Block writes that exceed 800 lines"
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Stop Hooks
|
|
98
|
+
|
|
99
|
+
### Final Build Verification
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
{
|
|
103
|
+
"hooks": {
|
|
104
|
+
"Stop": [
|
|
105
|
+
{
|
|
106
|
+
"command": "pnpm build",
|
|
107
|
+
"description": "Verify the production build at session end"
|
|
108
|
+
}
|
|
109
|
+
]
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Ordering
|
|
115
|
+
|
|
116
|
+
Recommended order:
|
|
117
|
+
1. format
|
|
118
|
+
2. lint
|
|
119
|
+
3. type check
|
|
120
|
+
4. build verification
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
> This file extends [common/patterns.md](../common/patterns.md) with web-specific patterns.
|
|
2
|
+
|
|
3
|
+
# Web Patterns
|
|
4
|
+
|
|
5
|
+
## Component Composition
|
|
6
|
+
|
|
7
|
+
### Compound Components
|
|
8
|
+
|
|
9
|
+
Use compound components when related UI shares state and interaction semantics:
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
<Tabs defaultValue="overview">
|
|
13
|
+
<Tabs.List>
|
|
14
|
+
<Tabs.Trigger value="overview">Overview</Tabs.Trigger>
|
|
15
|
+
<Tabs.Trigger value="settings">Settings</Tabs.Trigger>
|
|
16
|
+
</Tabs.List>
|
|
17
|
+
<Tabs.Content value="overview">...</Tabs.Content>
|
|
18
|
+
<Tabs.Content value="settings">...</Tabs.Content>
|
|
19
|
+
</Tabs>
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- Parent owns state
|
|
23
|
+
- Children consume via context
|
|
24
|
+
- Prefer this over prop drilling for complex widgets
|
|
25
|
+
|
|
26
|
+
### Render Props / Slots
|
|
27
|
+
|
|
28
|
+
- Use render props or slot patterns when behavior is shared but markup must vary
|
|
29
|
+
- Keep keyboard handling, ARIA, and focus logic in the headless layer
|
|
30
|
+
|
|
31
|
+
### Container / Presentational Split
|
|
32
|
+
|
|
33
|
+
- Container components own data loading and side effects
|
|
34
|
+
- Presentational components receive props and render UI
|
|
35
|
+
- Presentational components should stay pure
|
|
36
|
+
|
|
37
|
+
## State Management
|
|
38
|
+
|
|
39
|
+
Treat these separately:
|
|
40
|
+
|
|
41
|
+
| Concern | Tooling |
|
|
42
|
+
|---------|---------|
|
|
43
|
+
| Server state | TanStack Query, SWR, tRPC |
|
|
44
|
+
| Client state | Zustand, Jotai, signals |
|
|
45
|
+
| URL state | search params, route segments |
|
|
46
|
+
| Form state | React Hook Form or equivalent |
|
|
47
|
+
|
|
48
|
+
- Do not duplicate server state into client stores
|
|
49
|
+
- Derive values instead of storing redundant computed state
|
|
50
|
+
|
|
51
|
+
## URL As State
|
|
52
|
+
|
|
53
|
+
Persist shareable state in the URL:
|
|
54
|
+
- filters
|
|
55
|
+
- sort order
|
|
56
|
+
- pagination
|
|
57
|
+
- active tab
|
|
58
|
+
- search query
|
|
59
|
+
|
|
60
|
+
## Data Fetching
|
|
61
|
+
|
|
62
|
+
### Stale-While-Revalidate
|
|
63
|
+
|
|
64
|
+
- Return cached data immediately
|
|
65
|
+
- Revalidate in the background
|
|
66
|
+
- Prefer existing libraries instead of rolling this by hand
|
|
67
|
+
|
|
68
|
+
### Optimistic Updates
|
|
69
|
+
|
|
70
|
+
- Snapshot current state
|
|
71
|
+
- Apply optimistic update
|
|
72
|
+
- Roll back on failure
|
|
73
|
+
- Emit visible error feedback when rolling back
|
|
74
|
+
|
|
75
|
+
### Parallel Loading
|
|
76
|
+
|
|
77
|
+
- Fetch independent data in parallel
|
|
78
|
+
- Avoid parent-child request waterfalls
|
|
79
|
+
- Prefetch likely next routes or states when justified
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
> This file extends [common/performance.md](../common/performance.md) with web-specific performance content.
|
|
2
|
+
|
|
3
|
+
# Web Performance Rules
|
|
4
|
+
|
|
5
|
+
## Core Web Vitals Targets
|
|
6
|
+
|
|
7
|
+
| Metric | Target |
|
|
8
|
+
|--------|--------|
|
|
9
|
+
| LCP | < 2.5s |
|
|
10
|
+
| INP | < 200ms |
|
|
11
|
+
| CLS | < 0.1 |
|
|
12
|
+
| FCP | < 1.5s |
|
|
13
|
+
| TBT | < 200ms |
|
|
14
|
+
|
|
15
|
+
## Bundle Budget
|
|
16
|
+
|
|
17
|
+
| Page Type | JS Budget (gzipped) | CSS Budget |
|
|
18
|
+
|-----------|---------------------|------------|
|
|
19
|
+
| Landing page | < 150kb | < 30kb |
|
|
20
|
+
| App page | < 300kb | < 50kb |
|
|
21
|
+
| Microsite | < 80kb | < 15kb |
|
|
22
|
+
|
|
23
|
+
## Loading Strategy
|
|
24
|
+
|
|
25
|
+
1. Inline critical above-the-fold CSS where justified
|
|
26
|
+
2. Preload the hero image and primary font only
|
|
27
|
+
3. Defer non-critical CSS or JS
|
|
28
|
+
4. Dynamically import heavy libraries
|
|
29
|
+
|
|
30
|
+
```js
|
|
31
|
+
const gsapModule = await import('gsap');
|
|
32
|
+
const { ScrollTrigger } = await import('gsap/ScrollTrigger');
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Image Optimization
|
|
36
|
+
|
|
37
|
+
- Explicit `width` and `height`
|
|
38
|
+
- `loading="eager"` plus `fetchpriority="high"` for hero media only
|
|
39
|
+
- `loading="lazy"` for below-the-fold assets
|
|
40
|
+
- Prefer AVIF or WebP with fallbacks
|
|
41
|
+
- Never ship source images far beyond rendered size
|
|
42
|
+
|
|
43
|
+
## Font Loading
|
|
44
|
+
|
|
45
|
+
- Max two font families unless there is a clear exception
|
|
46
|
+
- `font-display: swap`
|
|
47
|
+
- Subset where possible
|
|
48
|
+
- Preload only the truly critical weight/style
|
|
49
|
+
|
|
50
|
+
## Animation Performance
|
|
51
|
+
|
|
52
|
+
- Animate compositor-friendly properties only
|
|
53
|
+
- Use `will-change` narrowly and remove it when done
|
|
54
|
+
- Prefer CSS for simple transitions
|
|
55
|
+
- Use `requestAnimationFrame` or established animation libraries for JS motion
|
|
56
|
+
- Avoid scroll handler churn; use IntersectionObserver or well-behaved libraries
|
|
57
|
+
|
|
58
|
+
## Performance Checklist
|
|
59
|
+
|
|
60
|
+
- [ ] All images have explicit dimensions
|
|
61
|
+
- [ ] No accidental render-blocking resources
|
|
62
|
+
- [ ] No layout shifts from dynamic content
|
|
63
|
+
- [ ] Motion stays on compositor-friendly properties
|
|
64
|
+
- [ ] Third-party scripts load async/defer and only when needed
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
> This file extends [common/security.md](../common/security.md) with web-specific security content.
|
|
2
|
+
|
|
3
|
+
# Web Security Rules
|
|
4
|
+
|
|
5
|
+
## Content Security Policy
|
|
6
|
+
|
|
7
|
+
Always configure a production CSP.
|
|
8
|
+
|
|
9
|
+
### Nonce-Based CSP
|
|
10
|
+
|
|
11
|
+
Use a per-request nonce for scripts instead of `'unsafe-inline'`.
|
|
12
|
+
|
|
13
|
+
```text
|
|
14
|
+
Content-Security-Policy:
|
|
15
|
+
default-src 'self';
|
|
16
|
+
script-src 'self' 'nonce-{RANDOM}' https://cdn.jsdelivr.net;
|
|
17
|
+
style-src 'self' 'unsafe-inline' https://fonts.googleapis.com;
|
|
18
|
+
img-src 'self' data: https:;
|
|
19
|
+
font-src 'self' https://fonts.gstatic.com;
|
|
20
|
+
connect-src 'self' https://*.example.com;
|
|
21
|
+
frame-src 'none';
|
|
22
|
+
object-src 'none';
|
|
23
|
+
base-uri 'self';
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Adjust origins to the project. Do not cargo-cult this block unchanged.
|
|
27
|
+
|
|
28
|
+
## XSS Prevention
|
|
29
|
+
|
|
30
|
+
- Never inject unsanitized HTML
|
|
31
|
+
- Avoid `innerHTML` / `dangerouslySetInnerHTML` unless sanitized first
|
|
32
|
+
- Escape dynamic template values
|
|
33
|
+
- Sanitize user HTML with a vetted local sanitizer when absolutely necessary
|
|
34
|
+
|
|
35
|
+
## Third-Party Scripts
|
|
36
|
+
|
|
37
|
+
- Load asynchronously
|
|
38
|
+
- Use SRI when serving from a CDN
|
|
39
|
+
- Audit quarterly
|
|
40
|
+
- Prefer self-hosting for critical dependencies when practical
|
|
41
|
+
|
|
42
|
+
## HTTPS and Headers
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
|
|
46
|
+
X-Content-Type-Options: nosniff
|
|
47
|
+
X-Frame-Options: DENY
|
|
48
|
+
Referrer-Policy: strict-origin-when-cross-origin
|
|
49
|
+
Permissions-Policy: camera=(), microphone=(), geolocation=()
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Forms
|
|
53
|
+
|
|
54
|
+
- CSRF protection on state-changing forms
|
|
55
|
+
- Rate limiting on submission endpoints
|
|
56
|
+
- Validate client and server side
|
|
57
|
+
- Prefer honeypots or light anti-abuse controls over heavy-handed CAPTCHA defaults
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
> This file extends [common/testing.md](../common/testing.md) with web-specific testing content.
|
|
2
|
+
|
|
3
|
+
# Web Testing Rules
|
|
4
|
+
|
|
5
|
+
## Priority Order
|
|
6
|
+
|
|
7
|
+
### 1. Visual Regression
|
|
8
|
+
|
|
9
|
+
- Screenshot key breakpoints: 320, 768, 1024, 1440
|
|
10
|
+
- Test hero sections, scrollytelling sections, and meaningful states
|
|
11
|
+
- Use Playwright screenshots for visual-heavy work
|
|
12
|
+
- If both themes exist, test both
|
|
13
|
+
|
|
14
|
+
### 2. Accessibility
|
|
15
|
+
|
|
16
|
+
- Run automated accessibility checks
|
|
17
|
+
- Test keyboard navigation
|
|
18
|
+
- Verify reduced-motion behavior
|
|
19
|
+
- Verify color contrast
|
|
20
|
+
|
|
21
|
+
### 3. Performance
|
|
22
|
+
|
|
23
|
+
- Run Lighthouse or equivalent against meaningful pages
|
|
24
|
+
- Keep CWV targets from [performance.md](performance.md)
|
|
25
|
+
|
|
26
|
+
### 4. Cross-Browser
|
|
27
|
+
|
|
28
|
+
- Minimum: Chrome, Firefox, Safari
|
|
29
|
+
- Test scrolling, motion, and fallback behavior
|
|
30
|
+
|
|
31
|
+
### 5. Responsive
|
|
32
|
+
|
|
33
|
+
- Test 320, 375, 768, 1024, 1440, 1920
|
|
34
|
+
- Verify no overflow
|
|
35
|
+
- Verify touch interactions
|
|
36
|
+
|
|
37
|
+
## E2E Shape
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { test, expect } from '@playwright/test';
|
|
41
|
+
|
|
42
|
+
test('landing hero loads', async ({ page }) => {
|
|
43
|
+
await page.goto('/');
|
|
44
|
+
await expect(page.locator('h1')).toBeVisible();
|
|
45
|
+
});
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
- Avoid flaky timeout-based assertions
|
|
49
|
+
- Prefer deterministic waits
|
|
50
|
+
|
|
51
|
+
## Unit Tests
|
|
52
|
+
|
|
53
|
+
- Test utilities, data transforms, and custom hooks
|
|
54
|
+
- For highly visual components, visual regression often carries more signal than brittle markup assertions
|
|
55
|
+
- Visual regression supplements coverage targets; it does not replace them
|
package/skills/02-plan/SKILL.md
CHANGED
|
@@ -9,6 +9,7 @@ Use this skill when requirements are ready to become an execution-ready plan.
|
|
|
9
9
|
|
|
10
10
|
## Core rules
|
|
11
11
|
|
|
12
|
+
- Before planning, read the `10-rules` skill and load `rules/common/development-workflow.md` and `rules/common/testing.md` for coding standards context.
|
|
12
13
|
- Search `docs/brainstorms/` for a relevant requirements artifact first.
|
|
13
14
|
- Search solutions with grep-first strategy: extract keywords from the task → `bash grep -rl "tags:.*keyword" docs/solutions/ ~/.pi/agent/docs/solutions/` → read only frontmatter (first 15 lines) of matching files → score by severity + tag relevance → fully read top 3. Search both project-level (`docs/solutions/`) and global-level (`~/.pi/agent/docs/solutions/`). If no matches, report "No relevant solutions found" and proceed.
|
|
14
15
|
- Write the final plan to `docs/plans/`.
|
package/skills/03-work/SKILL.md
CHANGED
|
@@ -9,6 +9,7 @@ Use this skill when there is a plan path or a tightly scoped bare prompt ready f
|
|
|
9
9
|
|
|
10
10
|
## Core rules
|
|
11
11
|
|
|
12
|
+
- Before execution, read the `10-rules` skill and load language-specific rules matching the active codebase (e.g. `rules/typescript/` for TS work).
|
|
12
13
|
- Distinguish between a **plan path** input and a **bare prompt** input before doing work.
|
|
13
14
|
- Prefer deriving execution tasks from plan **implementation units**.
|
|
14
15
|
- Use **serial subagents** for tasks with dependencies.
|
|
@@ -9,6 +9,7 @@ Use this skill after implementation to review changes against the diff, the rele
|
|
|
9
9
|
|
|
10
10
|
## Core rules
|
|
11
11
|
|
|
12
|
+
- Before reviewing, read the `10-rules` skill and load `rules/common/code-review.md` plus language-specific rules matching the changed files.
|
|
12
13
|
- Determine the **diff scope** before selecting reviewers.
|
|
13
14
|
- Use the **`review_router`** tool to automatically select reviewer personas based on diff metadata.
|
|
14
15
|
- Read the relevant **plan** artifact when one exists.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 10-rules
|
|
3
|
+
description: "Progressively load project coding rules on demand. Auto-triggered by plan, work, and review skills."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Rules
|
|
7
|
+
|
|
8
|
+
Project rules live under `rules/` in the super-pi package root (resolved as the skill directory's `../../rules/`).
|
|
9
|
+
|
|
10
|
+
## Core rule
|
|
11
|
+
|
|
12
|
+
Do not load the entire rules tree by default. Read only the files needed for the current task.
|
|
13
|
+
|
|
14
|
+
## Pre-flight: what to load by phase
|
|
15
|
+
|
|
16
|
+
### Before planning (02-plan)
|
|
17
|
+
|
|
18
|
+
Read at minimum:
|
|
19
|
+
- `rules/common/development-workflow.md`
|
|
20
|
+
- `rules/common/testing.md`
|
|
21
|
+
|
|
22
|
+
### Before implementation (03-work)
|
|
23
|
+
|
|
24
|
+
Read the common minimum above, plus:
|
|
25
|
+
- The language directory matching the active codebase (e.g. `rules/typescript/` for TS work)
|
|
26
|
+
- `rules/web/` files if the task involves frontend/browser concerns
|
|
27
|
+
|
|
28
|
+
### Before review (04-review)
|
|
29
|
+
|
|
30
|
+
Read at minimum:
|
|
31
|
+
- `rules/common/code-review.md`
|
|
32
|
+
- The language directory matching the changed files
|
|
33
|
+
|
|
34
|
+
## Progressive loading order
|
|
35
|
+
|
|
36
|
+
1. **Workflow** — `common/development-workflow.md`
|
|
37
|
+
2. **Testing/TDD** — `common/testing.md`
|
|
38
|
+
3. **Scenario** — `web/*` only if frontend is relevant
|
|
39
|
+
4. **Language** — matching language directory only
|
|
40
|
+
5. **Additional** — security, performance, patterns, hooks, coding-style — only when the task calls for it
|
|
41
|
+
|
|
42
|
+
## Rule precedence
|
|
43
|
+
|
|
44
|
+
When the same topic exists at multiple layers, higher priority wins:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
language-specific > web > common
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Override mapping by topic:
|
|
51
|
+
- `common/testing.md` ← `web/testing.md` ← `<lang>/testing.md`
|
|
52
|
+
- `common/coding-style.md` ← `web/coding-style.md` ← `<lang>/coding-style.md`
|
|
53
|
+
- `common/patterns.md` ← `web/patterns.md` ← `<lang>/patterns.md`
|
|
54
|
+
- `common/security.md` ← `web/security.md` ← `<lang>/security.md`
|
|
55
|
+
- `common/hooks.md` ← `web/hooks.md` ← `<lang>/hooks.md`
|
|
56
|
+
|
|
57
|
+
## Available layers
|
|
58
|
+
|
|
59
|
+
- `common/` — always relevant baseline (10 files)
|
|
60
|
+
- `typescript/`, `python/`, `cpp/`, `csharp/`, `dart/`, `golang/`, `java/`, `kotlin/`, `perl/`, `php/`, `rust/`, `swift/` — language-specific overrides (5 files each)
|
|
61
|
+
- `web/` — frontend/web scenario (7 files, includes additive-only `design-quality.md` and `performance.md`)
|
|
62
|
+
|
|
63
|
+
## Output expectation
|
|
64
|
+
|
|
65
|
+
When rules are loaded, state briefly:
|
|
66
|
+
- which rule files were loaded
|
|
67
|
+
- which are acting as overrides
|
|
68
|
+
- what constraints they impose on the current task
|