compact-agent 1.1.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 +394 -0
- package/bin/anycode.js +2 -0
- package/bin/crowcoder.js +19 -0
- package/bin/ecc-hooks.cjs +138 -0
- package/dist/agents.d.ts +17 -0
- package/dist/agents.js +1603 -0
- package/dist/agents.js.map +1 -0
- package/dist/api.d.ts +16 -0
- package/dist/api.js +115 -0
- package/dist/api.js.map +1 -0
- package/dist/autonomous-loops.d.ts +108 -0
- package/dist/autonomous-loops.js +526 -0
- package/dist/autonomous-loops.js.map +1 -0
- package/dist/codemaps.d.ts +53 -0
- package/dist/codemaps.js +325 -0
- package/dist/codemaps.js.map +1 -0
- package/dist/compaction.d.ts +30 -0
- package/dist/compaction.js +125 -0
- package/dist/compaction.js.map +1 -0
- package/dist/config.d.ts +5 -0
- package/dist/config.js +79 -0
- package/dist/config.js.map +1 -0
- package/dist/content-engine.d.ts +97 -0
- package/dist/content-engine.js +721 -0
- package/dist/content-engine.js.map +1 -0
- package/dist/cost-tracker.d.ts +49 -0
- package/dist/cost-tracker.js +150 -0
- package/dist/cost-tracker.js.map +1 -0
- package/dist/counter-button.d.ts +35 -0
- package/dist/counter-button.js +48 -0
- package/dist/counter-button.js.map +1 -0
- package/dist/counter.d.ts +21 -0
- package/dist/counter.js +31 -0
- package/dist/counter.js.map +1 -0
- package/dist/coverage.d.ts +23 -0
- package/dist/coverage.js +215 -0
- package/dist/coverage.js.map +1 -0
- package/dist/docs-sync.d.ts +23 -0
- package/dist/docs-sync.js +266 -0
- package/dist/docs-sync.js.map +1 -0
- package/dist/ecc.d.ts +41 -0
- package/dist/ecc.js +644 -0
- package/dist/ecc.js.map +1 -0
- package/dist/evaluation.d.ts +24 -0
- package/dist/evaluation.js +412 -0
- package/dist/evaluation.js.map +1 -0
- package/dist/export.d.ts +22 -0
- package/dist/export.js +109 -0
- package/dist/export.js.map +1 -0
- package/dist/git-workflow.d.ts +22 -0
- package/dist/git-workflow.js +197 -0
- package/dist/git-workflow.js.map +1 -0
- package/dist/hook-controls.d.ts +34 -0
- package/dist/hook-controls.js +90 -0
- package/dist/hook-controls.js.map +1 -0
- package/dist/hooks.d.ts +30 -0
- package/dist/hooks.js +130 -0
- package/dist/hooks.js.map +1 -0
- package/dist/html-parser.d.ts +18 -0
- package/dist/html-parser.js +101 -0
- package/dist/html-parser.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +1230 -0
- package/dist/index.js.map +1 -0
- package/dist/learning.d.ts +35 -0
- package/dist/learning.js +238 -0
- package/dist/learning.js.map +1 -0
- package/dist/login.d.ts +37 -0
- package/dist/login.js +191 -0
- package/dist/login.js.map +1 -0
- package/dist/memory.d.ts +39 -0
- package/dist/memory.js +183 -0
- package/dist/memory.js.map +1 -0
- package/dist/model-router.d.ts +23 -0
- package/dist/model-router.js +145 -0
- package/dist/model-router.js.map +1 -0
- package/dist/modes.d.ts +17 -0
- package/dist/modes.js +217 -0
- package/dist/modes.js.map +1 -0
- package/dist/orchestration.d.ts +37 -0
- package/dist/orchestration.js +139 -0
- package/dist/orchestration.js.map +1 -0
- package/dist/package-detect.d.ts +36 -0
- package/dist/package-detect.js +529 -0
- package/dist/package-detect.js.map +1 -0
- package/dist/permissions.d.ts +25 -0
- package/dist/permissions.js +50 -0
- package/dist/permissions.js.map +1 -0
- package/dist/pm2-manager.d.ts +40 -0
- package/dist/pm2-manager.js +127 -0
- package/dist/pm2-manager.js.map +1 -0
- package/dist/query.d.ts +15 -0
- package/dist/query.js +278 -0
- package/dist/query.js.map +1 -0
- package/dist/refactor.d.ts +22 -0
- package/dist/refactor.js +226 -0
- package/dist/refactor.js.map +1 -0
- package/dist/retry.d.ts +20 -0
- package/dist/retry.js +88 -0
- package/dist/retry.js.map +1 -0
- package/dist/rules.d.ts +34 -0
- package/dist/rules.js +942 -0
- package/dist/rules.js.map +1 -0
- package/dist/schema.d.ts +23 -0
- package/dist/schema.js +12 -0
- package/dist/schema.js.map +1 -0
- package/dist/search-first.d.ts +17 -0
- package/dist/search-first.js +301 -0
- package/dist/search-first.js.map +1 -0
- package/dist/security.d.ts +10 -0
- package/dist/security.js +145 -0
- package/dist/security.js.map +1 -0
- package/dist/sessions.d.ts +21 -0
- package/dist/sessions.js +112 -0
- package/dist/sessions.js.map +1 -0
- package/dist/skill-create.d.ts +38 -0
- package/dist/skill-create.js +389 -0
- package/dist/skill-create.js.map +1 -0
- package/dist/skills.d.ts +34 -0
- package/dist/skills.js +161 -0
- package/dist/skills.js.map +1 -0
- package/dist/strategic-compaction.d.ts +24 -0
- package/dist/strategic-compaction.js +144 -0
- package/dist/strategic-compaction.js.map +1 -0
- package/dist/system-prompt.d.ts +3 -0
- package/dist/system-prompt.js +101 -0
- package/dist/system-prompt.js.map +1 -0
- package/dist/theme.d.ts +60 -0
- package/dist/theme.js +220 -0
- package/dist/theme.js.map +1 -0
- package/dist/tools/bash.d.ts +2 -0
- package/dist/tools/bash.js +49 -0
- package/dist/tools/bash.js.map +1 -0
- package/dist/tools/edit.d.ts +2 -0
- package/dist/tools/edit.js +76 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/glob.d.ts +2 -0
- package/dist/tools/glob.js +54 -0
- package/dist/tools/glob.js.map +1 -0
- package/dist/tools/grep.d.ts +2 -0
- package/dist/tools/grep.js +64 -0
- package/dist/tools/grep.js.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.js +27 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-dir.d.ts +2 -0
- package/dist/tools/list-dir.js +51 -0
- package/dist/tools/list-dir.js.map +1 -0
- package/dist/tools/read.d.ts +2 -0
- package/dist/tools/read.js +56 -0
- package/dist/tools/read.js.map +1 -0
- package/dist/tools/types.d.ts +45 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/web-fetch.d.ts +2 -0
- package/dist/tools/web-fetch.js +41 -0
- package/dist/tools/web-fetch.js.map +1 -0
- package/dist/tools/web-search.d.ts +27 -0
- package/dist/tools/web-search.js +139 -0
- package/dist/tools/web-search.js.map +1 -0
- package/dist/tools/write.d.ts +2 -0
- package/dist/tools/write.js +36 -0
- package/dist/tools/write.js.map +1 -0
- package/dist/types.d.ts +28 -0
- package/dist/types.js +57 -0
- package/dist/types.js.map +1 -0
- package/dist/users.d.ts +51 -0
- package/dist/users.js +193 -0
- package/dist/users.js.map +1 -0
- package/dist/verification.d.ts +73 -0
- package/dist/verification.js +269 -0
- package/dist/verification.js.map +1 -0
- package/dist/walkthrough.d.ts +10 -0
- package/dist/walkthrough.js +121 -0
- package/dist/walkthrough.js.map +1 -0
- package/package.json +58 -0
- package/resources/ecc/agents/architect.json +16 -0
- package/resources/ecc/agents/architect.md +212 -0
- package/resources/ecc/agents/build-error-resolver.json +17 -0
- package/resources/ecc/agents/build-error-resolver.md +116 -0
- package/resources/ecc/agents/chief-of-staff.json +17 -0
- package/resources/ecc/agents/chief-of-staff.md +153 -0
- package/resources/ecc/agents/code-reviewer.json +16 -0
- package/resources/ecc/agents/code-reviewer.md +238 -0
- package/resources/ecc/agents/database-reviewer.json +16 -0
- package/resources/ecc/agents/database-reviewer.md +92 -0
- package/resources/ecc/agents/doc-updater.json +16 -0
- package/resources/ecc/agents/doc-updater.md +108 -0
- package/resources/ecc/agents/e2e-runner.json +17 -0
- package/resources/ecc/agents/e2e-runner.md +109 -0
- package/resources/ecc/agents/go-build-resolver.json +17 -0
- package/resources/ecc/agents/go-build-resolver.md +96 -0
- package/resources/ecc/agents/go-reviewer.json +16 -0
- package/resources/ecc/agents/go-reviewer.md +77 -0
- package/resources/ecc/agents/harness-optimizer.json +15 -0
- package/resources/ecc/agents/harness-optimizer.md +34 -0
- package/resources/ecc/agents/loop-operator.json +16 -0
- package/resources/ecc/agents/loop-operator.md +36 -0
- package/resources/ecc/agents/planner.json +15 -0
- package/resources/ecc/agents/planner.md +212 -0
- package/resources/ecc/agents/python-reviewer.json +16 -0
- package/resources/ecc/agents/python-reviewer.md +99 -0
- package/resources/ecc/agents/refactor-cleaner.json +17 -0
- package/resources/ecc/agents/refactor-cleaner.md +87 -0
- package/resources/ecc/agents/security-reviewer.json +16 -0
- package/resources/ecc/agents/security-reviewer.md +109 -0
- package/resources/ecc/agents/tdd-guide.json +17 -0
- package/resources/ecc/agents/tdd-guide.md +93 -0
- package/resources/ecc/commands/add-language-rules.md +39 -0
- package/resources/ecc/commands/database-migration.md +36 -0
- package/resources/ecc/commands/feature-development.md +38 -0
- package/resources/ecc/prompts/build-fix.prompt.md +47 -0
- package/resources/ecc/prompts/code-review.prompt.md +56 -0
- package/resources/ecc/prompts/plan.prompt.md +52 -0
- package/resources/ecc/prompts/refactor.prompt.md +50 -0
- package/resources/ecc/prompts/security-review.prompt.md +70 -0
- package/resources/ecc/prompts/tdd.prompt.md +47 -0
- package/resources/ecc/rules/common-agents.md +53 -0
- package/resources/ecc/rules/common-coding-style.md +52 -0
- package/resources/ecc/rules/common-development-workflow.md +33 -0
- package/resources/ecc/rules/common-git-workflow.md +28 -0
- package/resources/ecc/rules/common-hooks.md +34 -0
- package/resources/ecc/rules/common-patterns.md +35 -0
- package/resources/ecc/rules/common-performance.md +59 -0
- package/resources/ecc/rules/common-security.md +33 -0
- package/resources/ecc/rules/common-testing.md +33 -0
- package/resources/ecc/rules/golang-coding-style.md +31 -0
- package/resources/ecc/rules/golang-hooks.md +16 -0
- package/resources/ecc/rules/golang-patterns.md +44 -0
- package/resources/ecc/rules/golang-security.md +33 -0
- package/resources/ecc/rules/golang-testing.md +30 -0
- package/resources/ecc/rules/kotlin-coding-style.md +39 -0
- package/resources/ecc/rules/kotlin-hooks.md +16 -0
- package/resources/ecc/rules/kotlin-patterns.md +50 -0
- package/resources/ecc/rules/kotlin-security.md +58 -0
- package/resources/ecc/rules/kotlin-testing.md +38 -0
- package/resources/ecc/rules/php-coding-style.md +25 -0
- package/resources/ecc/rules/php-hooks.md +21 -0
- package/resources/ecc/rules/php-patterns.md +23 -0
- package/resources/ecc/rules/php-security.md +24 -0
- package/resources/ecc/rules/php-testing.md +26 -0
- package/resources/ecc/rules/python-coding-style.md +42 -0
- package/resources/ecc/rules/python-hooks.md +19 -0
- package/resources/ecc/rules/python-patterns.md +39 -0
- package/resources/ecc/rules/python-security.md +30 -0
- package/resources/ecc/rules/python-testing.md +38 -0
- package/resources/ecc/rules/swift-coding-style.md +47 -0
- package/resources/ecc/rules/swift-hooks.md +20 -0
- package/resources/ecc/rules/swift-patterns.md +66 -0
- package/resources/ecc/rules/swift-security.md +33 -0
- package/resources/ecc/rules/swift-testing.md +45 -0
- package/resources/ecc/rules/typescript-coding-style.md +63 -0
- package/resources/ecc/rules/typescript-hooks.md +20 -0
- package/resources/ecc/rules/typescript-patterns.md +50 -0
- package/resources/ecc/rules/typescript-security.md +26 -0
- package/resources/ecc/rules/typescript-testing.md +16 -0
- package/resources/ecc/skills/agent-introspection-debugging/SKILL.md +152 -0
- package/resources/ecc/skills/agent-introspection-debugging/agents/openai.yaml +7 -0
- package/resources/ecc/skills/agent-sort/SKILL.md +214 -0
- package/resources/ecc/skills/agent-sort/agents/openai.yaml +7 -0
- package/resources/ecc/skills/api-design/SKILL.md +522 -0
- package/resources/ecc/skills/api-design/agents/openai.yaml +7 -0
- package/resources/ecc/skills/article-writing/SKILL.md +78 -0
- package/resources/ecc/skills/article-writing/agents/openai.yaml +7 -0
- package/resources/ecc/skills/backend-patterns/SKILL.md +597 -0
- package/resources/ecc/skills/backend-patterns/agents/openai.yaml +7 -0
- package/resources/ecc/skills/brand-voice/SKILL.md +96 -0
- package/resources/ecc/skills/brand-voice/agents/openai.yaml +7 -0
- package/resources/ecc/skills/brand-voice/references/voice-profile-schema.md +55 -0
- package/resources/ecc/skills/bun-runtime/SKILL.md +83 -0
- package/resources/ecc/skills/bun-runtime/agents/openai.yaml +7 -0
- package/resources/ecc/skills/coding-standards/SKILL.md +548 -0
- package/resources/ecc/skills/coding-standards/agents/openai.yaml +7 -0
- package/resources/ecc/skills/content-engine/SKILL.md +130 -0
- package/resources/ecc/skills/content-engine/agents/openai.yaml +7 -0
- package/resources/ecc/skills/crosspost/SKILL.md +110 -0
- package/resources/ecc/skills/crosspost/agents/openai.yaml +7 -0
- package/resources/ecc/skills/deep-research/SKILL.md +154 -0
- package/resources/ecc/skills/deep-research/agents/openai.yaml +7 -0
- package/resources/ecc/skills/dmux-workflows/SKILL.md +143 -0
- package/resources/ecc/skills/dmux-workflows/agents/openai.yaml +7 -0
- package/resources/ecc/skills/documentation-lookup/SKILL.md +89 -0
- package/resources/ecc/skills/documentation-lookup/agents/openai.yaml +7 -0
- package/resources/ecc/skills/e2e-testing/SKILL.md +325 -0
- package/resources/ecc/skills/e2e-testing/agents/openai.yaml +7 -0
- package/resources/ecc/skills/eval-harness/SKILL.md +235 -0
- package/resources/ecc/skills/eval-harness/agents/openai.yaml +7 -0
- package/resources/ecc/skills/everything-claude-code/SKILL.md +442 -0
- package/resources/ecc/skills/everything-claude-code/agents/openai.yaml +7 -0
- package/resources/ecc/skills/exa-search/SKILL.md +169 -0
- package/resources/ecc/skills/exa-search/agents/openai.yaml +7 -0
- package/resources/ecc/skills/fal-ai-media/SKILL.md +276 -0
- package/resources/ecc/skills/fal-ai-media/agents/openai.yaml +7 -0
- package/resources/ecc/skills/frontend-patterns/SKILL.md +647 -0
- package/resources/ecc/skills/frontend-patterns/agents/openai.yaml +7 -0
- package/resources/ecc/skills/frontend-slides/SKILL.md +183 -0
- package/resources/ecc/skills/frontend-slides/STYLE_PRESETS.md +330 -0
- package/resources/ecc/skills/frontend-slides/agents/openai.yaml +7 -0
- package/resources/ecc/skills/investor-materials/SKILL.md +95 -0
- package/resources/ecc/skills/investor-materials/agents/openai.yaml +7 -0
- package/resources/ecc/skills/investor-outreach/SKILL.md +90 -0
- package/resources/ecc/skills/investor-outreach/agents/openai.yaml +7 -0
- package/resources/ecc/skills/market-research/SKILL.md +74 -0
- package/resources/ecc/skills/market-research/agents/openai.yaml +7 -0
- package/resources/ecc/skills/mcp-server-patterns/SKILL.md +66 -0
- package/resources/ecc/skills/mcp-server-patterns/agents/openai.yaml +7 -0
- package/resources/ecc/skills/mle-workflow/SKILL.md +346 -0
- package/resources/ecc/skills/mle-workflow/agents/openai.yaml +7 -0
- package/resources/ecc/skills/nextjs-turbopack/SKILL.md +43 -0
- package/resources/ecc/skills/nextjs-turbopack/agents/openai.yaml +7 -0
- package/resources/ecc/skills/product-capability/SKILL.md +140 -0
- package/resources/ecc/skills/product-capability/agents/openai.yaml +7 -0
- package/resources/ecc/skills/security-review/SKILL.md +494 -0
- package/resources/ecc/skills/security-review/agents/openai.yaml +7 -0
- package/resources/ecc/skills/strategic-compact/SKILL.md +102 -0
- package/resources/ecc/skills/strategic-compact/agents/openai.yaml +7 -0
- package/resources/ecc/skills/tdd-workflow/SKILL.md +409 -0
- package/resources/ecc/skills/tdd-workflow/agents/openai.yaml +7 -0
- package/resources/ecc/skills/verification-loop/SKILL.md +125 -0
- package/resources/ecc/skills/verification-loop/agents/openai.yaml +7 -0
- package/resources/ecc/skills/video-editing/SKILL.md +307 -0
- package/resources/ecc/skills/video-editing/agents/openai.yaml +7 -0
- package/resources/ecc/skills/x-api/SKILL.md +229 -0
- package/resources/ecc/skills/x-api/agents/openai.yaml +7 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Git workflow: conventional commits, PR process"
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
# Git Workflow
|
|
6
|
+
|
|
7
|
+
## Commit Message Format
|
|
8
|
+
```
|
|
9
|
+
<type>: <description>
|
|
10
|
+
|
|
11
|
+
<optional body>
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Types: feat, fix, refactor, docs, test, chore, perf, ci
|
|
15
|
+
|
|
16
|
+
Note: Attribution disabled globally via ~/.claude/settings.json.
|
|
17
|
+
|
|
18
|
+
## Pull Request Workflow
|
|
19
|
+
|
|
20
|
+
When creating PRs:
|
|
21
|
+
1. Analyze full commit history (not just latest commit)
|
|
22
|
+
2. Use `git diff [base-branch]...HEAD` to see all changes
|
|
23
|
+
3. Draft comprehensive PR summary
|
|
24
|
+
4. Include test plan with TODOs
|
|
25
|
+
5. Push with `-u` flag if new branch
|
|
26
|
+
|
|
27
|
+
> For the full development process (planning, TDD, code review) before git operations,
|
|
28
|
+
> see the development workflow rule.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Hooks system: types, auto-accept permissions, TodoWrite best practices"
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
# Hooks System
|
|
6
|
+
|
|
7
|
+
## Hook Types
|
|
8
|
+
|
|
9
|
+
- **PreToolUse**: Before tool execution (validation, parameter modification)
|
|
10
|
+
- **PostToolUse**: After tool execution (auto-format, checks)
|
|
11
|
+
- **Stop**: When session ends (final verification)
|
|
12
|
+
|
|
13
|
+
## Auto-Accept Permissions
|
|
14
|
+
|
|
15
|
+
Use with caution:
|
|
16
|
+
- Enable for trusted, well-defined plans
|
|
17
|
+
- Disable for exploratory work
|
|
18
|
+
- Never use dangerously-skip-permissions flag
|
|
19
|
+
- Configure `allowedTools` in `~/.claude.json` instead
|
|
20
|
+
|
|
21
|
+
## TodoWrite Best Practices
|
|
22
|
+
|
|
23
|
+
Use TodoWrite tool to:
|
|
24
|
+
- Track progress on multi-step tasks
|
|
25
|
+
- Verify understanding of instructions
|
|
26
|
+
- Enable real-time steering
|
|
27
|
+
- Show granular implementation steps
|
|
28
|
+
|
|
29
|
+
Todo list reveals:
|
|
30
|
+
- Out of order steps
|
|
31
|
+
- Missing items
|
|
32
|
+
- Extra unnecessary items
|
|
33
|
+
- Wrong granularity
|
|
34
|
+
- Misinterpreted requirements
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Common patterns: repository, API response, skeleton projects"
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
# Common Patterns
|
|
6
|
+
|
|
7
|
+
## Skeleton Projects
|
|
8
|
+
|
|
9
|
+
When implementing new functionality:
|
|
10
|
+
1. Search for battle-tested skeleton projects
|
|
11
|
+
2. Use parallel agents to evaluate options:
|
|
12
|
+
- Security assessment
|
|
13
|
+
- Extensibility analysis
|
|
14
|
+
- Relevance scoring
|
|
15
|
+
- Implementation planning
|
|
16
|
+
3. Clone best match as foundation
|
|
17
|
+
4. Iterate within proven structure
|
|
18
|
+
|
|
19
|
+
## Design Patterns
|
|
20
|
+
|
|
21
|
+
### Repository Pattern
|
|
22
|
+
|
|
23
|
+
Encapsulate data access behind a consistent interface:
|
|
24
|
+
- Define standard operations: findAll, findById, create, update, delete
|
|
25
|
+
- Concrete implementations handle storage details (database, API, file, etc.)
|
|
26
|
+
- Business logic depends on the abstract interface, not the storage mechanism
|
|
27
|
+
- Enables easy swapping of data sources and simplifies testing with mocks
|
|
28
|
+
|
|
29
|
+
### API Response Format
|
|
30
|
+
|
|
31
|
+
Use a consistent envelope for all API responses:
|
|
32
|
+
- Include a success/status indicator
|
|
33
|
+
- Include the data payload (nullable on error)
|
|
34
|
+
- Include an error message field (nullable on success)
|
|
35
|
+
- Include metadata for paginated responses (total, page, limit)
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Performance: model selection, context management, build troubleshooting"
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
# Performance Optimization
|
|
6
|
+
|
|
7
|
+
## Model Selection Strategy
|
|
8
|
+
|
|
9
|
+
**Haiku 4.5** (90% of Sonnet capability, 3x cost savings):
|
|
10
|
+
- Lightweight agents with frequent invocation
|
|
11
|
+
- Pair programming and code generation
|
|
12
|
+
- Worker agents in multi-agent systems
|
|
13
|
+
|
|
14
|
+
**Sonnet 4.6** (Best coding model):
|
|
15
|
+
- Main development work
|
|
16
|
+
- Orchestrating multi-agent workflows
|
|
17
|
+
- Complex coding tasks
|
|
18
|
+
|
|
19
|
+
**Opus 4.5** (Deepest reasoning):
|
|
20
|
+
- Complex architectural decisions
|
|
21
|
+
- Maximum reasoning requirements
|
|
22
|
+
- Research and analysis tasks
|
|
23
|
+
|
|
24
|
+
## Context Window Management
|
|
25
|
+
|
|
26
|
+
Avoid last 20% of context window for:
|
|
27
|
+
- Large-scale refactoring
|
|
28
|
+
- Feature implementation spanning multiple files
|
|
29
|
+
- Debugging complex interactions
|
|
30
|
+
|
|
31
|
+
Lower context sensitivity tasks:
|
|
32
|
+
- Single-file edits
|
|
33
|
+
- Independent utility creation
|
|
34
|
+
- Documentation updates
|
|
35
|
+
- Simple bug fixes
|
|
36
|
+
|
|
37
|
+
## Extended Thinking + Plan Mode
|
|
38
|
+
|
|
39
|
+
Extended thinking is enabled by default, reserving up to 31,999 tokens for internal reasoning.
|
|
40
|
+
|
|
41
|
+
Control extended thinking via:
|
|
42
|
+
- **Toggle**: Option+T (macOS) / Alt+T (Windows/Linux)
|
|
43
|
+
- **Config**: Set `alwaysThinkingEnabled` in `~/.claude/settings.json`
|
|
44
|
+
- **Budget cap**: `export MAX_THINKING_TOKENS=10000`
|
|
45
|
+
- **Verbose mode**: Ctrl+O to see thinking output
|
|
46
|
+
|
|
47
|
+
For complex tasks requiring deep reasoning:
|
|
48
|
+
1. Ensure extended thinking is enabled (on by default)
|
|
49
|
+
2. Enable **Plan Mode** for structured approach
|
|
50
|
+
3. Use multiple critique rounds for thorough analysis
|
|
51
|
+
4. Use split role sub-agents for diverse perspectives
|
|
52
|
+
|
|
53
|
+
## Build Troubleshooting
|
|
54
|
+
|
|
55
|
+
If build fails:
|
|
56
|
+
1. Use **build-error-resolver** agent
|
|
57
|
+
2. Analyze error messages
|
|
58
|
+
3. Fix incrementally
|
|
59
|
+
4. Verify after each fix
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Security: mandatory checks, secret management, response protocol"
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
# Security Guidelines
|
|
6
|
+
|
|
7
|
+
## Mandatory Security Checks
|
|
8
|
+
|
|
9
|
+
Before ANY commit:
|
|
10
|
+
- [ ] No hardcoded secrets (API keys, passwords, tokens)
|
|
11
|
+
- [ ] All user inputs validated
|
|
12
|
+
- [ ] SQL injection prevention (parameterized queries)
|
|
13
|
+
- [ ] XSS prevention (sanitized HTML)
|
|
14
|
+
- [ ] CSRF protection enabled
|
|
15
|
+
- [ ] Authentication/authorization verified
|
|
16
|
+
- [ ] Rate limiting on all endpoints
|
|
17
|
+
- [ ] Error messages don't leak sensitive data
|
|
18
|
+
|
|
19
|
+
## Secret Management
|
|
20
|
+
|
|
21
|
+
- NEVER hardcode secrets in source code
|
|
22
|
+
- ALWAYS use environment variables or a secret manager
|
|
23
|
+
- Validate that required secrets are present at startup
|
|
24
|
+
- Rotate any secrets that may have been exposed
|
|
25
|
+
|
|
26
|
+
## Security Response Protocol
|
|
27
|
+
|
|
28
|
+
If security issue found:
|
|
29
|
+
1. STOP immediately
|
|
30
|
+
2. Use **security-reviewer** agent
|
|
31
|
+
3. Fix CRITICAL issues before continuing
|
|
32
|
+
4. Rotate any exposed secrets
|
|
33
|
+
5. Review entire codebase for similar issues
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Testing requirements: 80% coverage, TDD workflow, test types"
|
|
3
|
+
alwaysApply: true
|
|
4
|
+
---
|
|
5
|
+
# Testing Requirements
|
|
6
|
+
|
|
7
|
+
## Minimum Test Coverage: 80%
|
|
8
|
+
|
|
9
|
+
Test Types (ALL required):
|
|
10
|
+
1. **Unit Tests** - Individual functions, utilities, components
|
|
11
|
+
2. **Integration Tests** - API endpoints, database operations
|
|
12
|
+
3. **E2E Tests** - Critical user flows (framework chosen per language)
|
|
13
|
+
|
|
14
|
+
## Test-Driven Development
|
|
15
|
+
|
|
16
|
+
MANDATORY workflow:
|
|
17
|
+
1. Write test first (RED)
|
|
18
|
+
2. Run test - it should FAIL
|
|
19
|
+
3. Write minimal implementation (GREEN)
|
|
20
|
+
4. Run test - it should PASS
|
|
21
|
+
5. Refactor (IMPROVE)
|
|
22
|
+
6. Verify coverage (80%+)
|
|
23
|
+
|
|
24
|
+
## Troubleshooting Test Failures
|
|
25
|
+
|
|
26
|
+
1. Use **tdd-guide** agent
|
|
27
|
+
2. Check test isolation
|
|
28
|
+
3. Verify mocks are correct
|
|
29
|
+
4. Fix implementation, not tests (unless tests are wrong)
|
|
30
|
+
|
|
31
|
+
## Agent Support
|
|
32
|
+
|
|
33
|
+
- **tdd-guide** - Use PROACTIVELY for new features, enforces write-tests-first
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Go coding style extending common rules"
|
|
3
|
+
globs: ["**/*.go", "**/go.mod", "**/go.sum"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Go Coding Style
|
|
7
|
+
|
|
8
|
+
> This file extends the common coding style rule with Go specific content.
|
|
9
|
+
|
|
10
|
+
## Formatting
|
|
11
|
+
|
|
12
|
+
- **gofmt** and **goimports** are mandatory -- no style debates
|
|
13
|
+
|
|
14
|
+
## Design Principles
|
|
15
|
+
|
|
16
|
+
- Accept interfaces, return structs
|
|
17
|
+
- Keep interfaces small (1-3 methods)
|
|
18
|
+
|
|
19
|
+
## Error Handling
|
|
20
|
+
|
|
21
|
+
Always wrap errors with context:
|
|
22
|
+
|
|
23
|
+
```go
|
|
24
|
+
if err != nil {
|
|
25
|
+
return fmt.Errorf("failed to create user: %w", err)
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Reference
|
|
30
|
+
|
|
31
|
+
See skill: `golang-patterns` for comprehensive Go idioms and patterns.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Go hooks extending common rules"
|
|
3
|
+
globs: ["**/*.go", "**/go.mod", "**/go.sum"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Go Hooks
|
|
7
|
+
|
|
8
|
+
> This file extends the common hooks rule with Go specific content.
|
|
9
|
+
|
|
10
|
+
## PostToolUse Hooks
|
|
11
|
+
|
|
12
|
+
Configure in `~/.claude/settings.json`:
|
|
13
|
+
|
|
14
|
+
- **gofmt/goimports**: Auto-format `.go` files after edit
|
|
15
|
+
- **go vet**: Run static analysis after editing `.go` files
|
|
16
|
+
- **staticcheck**: Run extended static checks on modified packages
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Go patterns extending common rules"
|
|
3
|
+
globs: ["**/*.go", "**/go.mod", "**/go.sum"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Go Patterns
|
|
7
|
+
|
|
8
|
+
> This file extends the common patterns rule with Go specific content.
|
|
9
|
+
|
|
10
|
+
## Functional Options
|
|
11
|
+
|
|
12
|
+
```go
|
|
13
|
+
type Option func(*Server)
|
|
14
|
+
|
|
15
|
+
func WithPort(port int) Option {
|
|
16
|
+
return func(s *Server) { s.port = port }
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
func NewServer(opts ...Option) *Server {
|
|
20
|
+
s := &Server{port: 8080}
|
|
21
|
+
for _, opt := range opts {
|
|
22
|
+
opt(s)
|
|
23
|
+
}
|
|
24
|
+
return s
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Small Interfaces
|
|
29
|
+
|
|
30
|
+
Define interfaces where they are used, not where they are implemented.
|
|
31
|
+
|
|
32
|
+
## Dependency Injection
|
|
33
|
+
|
|
34
|
+
Use constructor functions to inject dependencies:
|
|
35
|
+
|
|
36
|
+
```go
|
|
37
|
+
func NewUserService(repo UserRepository, logger Logger) *UserService {
|
|
38
|
+
return &UserService{repo: repo, logger: logger}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Reference
|
|
43
|
+
|
|
44
|
+
See skill: `golang-patterns` for comprehensive Go patterns including concurrency, error handling, and package organization.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Go security extending common rules"
|
|
3
|
+
globs: ["**/*.go", "**/go.mod", "**/go.sum"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Go Security
|
|
7
|
+
|
|
8
|
+
> This file extends the common security rule with Go specific content.
|
|
9
|
+
|
|
10
|
+
## Secret Management
|
|
11
|
+
|
|
12
|
+
```go
|
|
13
|
+
apiKey := os.Getenv("OPENAI_API_KEY")
|
|
14
|
+
if apiKey == "" {
|
|
15
|
+
log.Fatal("OPENAI_API_KEY not configured")
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Security Scanning
|
|
20
|
+
|
|
21
|
+
- Use **gosec** for static security analysis:
|
|
22
|
+
```bash
|
|
23
|
+
gosec ./...
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Context & Timeouts
|
|
27
|
+
|
|
28
|
+
Always use `context.Context` for timeout control:
|
|
29
|
+
|
|
30
|
+
```go
|
|
31
|
+
ctx, cancel := context.WithTimeout(ctx, 5*time.Second)
|
|
32
|
+
defer cancel()
|
|
33
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Go testing extending common rules"
|
|
3
|
+
globs: ["**/*.go", "**/go.mod", "**/go.sum"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Go Testing
|
|
7
|
+
|
|
8
|
+
> This file extends the common testing rule with Go specific content.
|
|
9
|
+
|
|
10
|
+
## Framework
|
|
11
|
+
|
|
12
|
+
Use the standard `go test` with **table-driven tests**.
|
|
13
|
+
|
|
14
|
+
## Race Detection
|
|
15
|
+
|
|
16
|
+
Always run with the `-race` flag:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
go test -race ./...
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Coverage
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
go test -cover ./...
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Reference
|
|
29
|
+
|
|
30
|
+
See skill: `golang-testing` for detailed Go testing patterns and helpers.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Kotlin coding style extending common rules"
|
|
3
|
+
globs: ["**/*.kt", "**/*.kts", "**/build.gradle.kts"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Kotlin Coding Style
|
|
7
|
+
|
|
8
|
+
> This file extends the common coding style rule with Kotlin-specific content.
|
|
9
|
+
|
|
10
|
+
## Formatting
|
|
11
|
+
|
|
12
|
+
- Auto-formatting via **ktfmt** or **ktlint** (configured in `kotlin-hooks.md`)
|
|
13
|
+
- Use trailing commas in multiline declarations
|
|
14
|
+
|
|
15
|
+
## Immutability
|
|
16
|
+
|
|
17
|
+
The global immutability requirement is enforced in the common coding style rule.
|
|
18
|
+
For Kotlin specifically:
|
|
19
|
+
|
|
20
|
+
- Prefer `val` over `var`
|
|
21
|
+
- Use immutable collection types (`List`, `Map`, `Set`)
|
|
22
|
+
- Use `data class` with `copy()` for immutable updates
|
|
23
|
+
|
|
24
|
+
## Null Safety
|
|
25
|
+
|
|
26
|
+
- Avoid `!!` -- use `?.`, `?:`, `require`, or `checkNotNull`
|
|
27
|
+
- Handle platform types explicitly at Java interop boundaries
|
|
28
|
+
|
|
29
|
+
## Expression Bodies
|
|
30
|
+
|
|
31
|
+
Prefer expression bodies for single-expression functions:
|
|
32
|
+
|
|
33
|
+
```kotlin
|
|
34
|
+
fun isAdult(age: Int): Boolean = age >= 18
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Reference
|
|
38
|
+
|
|
39
|
+
See skill: `kotlin-patterns` for comprehensive Kotlin idioms and patterns.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Kotlin hooks extending common rules"
|
|
3
|
+
globs: ["**/*.kt", "**/*.kts", "**/build.gradle.kts"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Kotlin Hooks
|
|
7
|
+
|
|
8
|
+
> This file extends the common hooks rule with Kotlin-specific content.
|
|
9
|
+
|
|
10
|
+
## PostToolUse Hooks
|
|
11
|
+
|
|
12
|
+
Configure in `~/.claude/settings.json`:
|
|
13
|
+
|
|
14
|
+
- **ktfmt/ktlint**: Auto-format `.kt` and `.kts` files after edit
|
|
15
|
+
- **detekt**: Run static analysis after editing Kotlin files
|
|
16
|
+
- **./gradlew build**: Verify compilation after changes
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Kotlin patterns extending common rules"
|
|
3
|
+
globs: ["**/*.kt", "**/*.kts", "**/build.gradle.kts"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Kotlin Patterns
|
|
7
|
+
|
|
8
|
+
> This file extends the common patterns rule with Kotlin-specific content.
|
|
9
|
+
|
|
10
|
+
## Sealed Classes
|
|
11
|
+
|
|
12
|
+
Use sealed classes/interfaces for exhaustive type hierarchies:
|
|
13
|
+
|
|
14
|
+
```kotlin
|
|
15
|
+
sealed class Result<out T> {
|
|
16
|
+
data class Success<T>(val data: T) : Result<T>()
|
|
17
|
+
data class Failure(val error: AppError) : Result<Nothing>()
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Extension Functions
|
|
22
|
+
|
|
23
|
+
Add behavior without inheritance, scoped to where they're used:
|
|
24
|
+
|
|
25
|
+
```kotlin
|
|
26
|
+
fun String.toSlug(): String =
|
|
27
|
+
lowercase().replace(Regex("[^a-z0-9\\s-]"), "").replace(Regex("\\s+"), "-")
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Scope Functions
|
|
31
|
+
|
|
32
|
+
- `let`: Transform nullable or scoped result
|
|
33
|
+
- `apply`: Configure an object
|
|
34
|
+
- `also`: Side effects
|
|
35
|
+
- Avoid nesting scope functions
|
|
36
|
+
|
|
37
|
+
## Dependency Injection
|
|
38
|
+
|
|
39
|
+
Use Koin for DI in Ktor projects:
|
|
40
|
+
|
|
41
|
+
```kotlin
|
|
42
|
+
val appModule = module {
|
|
43
|
+
single<UserRepository> { ExposedUserRepository(get()) }
|
|
44
|
+
single { UserService(get()) }
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Reference
|
|
49
|
+
|
|
50
|
+
See skill: `kotlin-patterns` for comprehensive Kotlin patterns including coroutines, DSL builders, and delegation.
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Kotlin security extending common rules"
|
|
3
|
+
globs: ["**/*.kt", "**/*.kts", "**/build.gradle.kts"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Kotlin Security
|
|
7
|
+
|
|
8
|
+
> This file extends the common security rule with Kotlin-specific content.
|
|
9
|
+
|
|
10
|
+
## Secret Management
|
|
11
|
+
|
|
12
|
+
```kotlin
|
|
13
|
+
val apiKey = System.getenv("API_KEY")
|
|
14
|
+
?: throw IllegalStateException("API_KEY not configured")
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## SQL Injection Prevention
|
|
18
|
+
|
|
19
|
+
Always use Exposed's parameterized queries:
|
|
20
|
+
|
|
21
|
+
```kotlin
|
|
22
|
+
// Good: Parameterized via Exposed DSL
|
|
23
|
+
UsersTable.selectAll().where { UsersTable.email eq email }
|
|
24
|
+
|
|
25
|
+
// Bad: String interpolation in raw SQL
|
|
26
|
+
exec("SELECT * FROM users WHERE email = '$email'")
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Authentication
|
|
30
|
+
|
|
31
|
+
Use Ktor's Auth plugin with JWT:
|
|
32
|
+
|
|
33
|
+
```kotlin
|
|
34
|
+
install(Authentication) {
|
|
35
|
+
jwt("jwt") {
|
|
36
|
+
verifier(
|
|
37
|
+
JWT.require(Algorithm.HMAC256(secret))
|
|
38
|
+
.withAudience(audience)
|
|
39
|
+
.withIssuer(issuer)
|
|
40
|
+
.build()
|
|
41
|
+
)
|
|
42
|
+
validate { credential ->
|
|
43
|
+
val payload = credential.payload
|
|
44
|
+
if (payload.audience.contains(audience) &&
|
|
45
|
+
payload.issuer == issuer &&
|
|
46
|
+
payload.subject != null) {
|
|
47
|
+
JWTPrincipal(payload)
|
|
48
|
+
} else {
|
|
49
|
+
null
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Null Safety as Security
|
|
57
|
+
|
|
58
|
+
Kotlin's type system prevents null-related vulnerabilities -- avoid `!!` to maintain this guarantee.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Kotlin testing extending common rules"
|
|
3
|
+
globs: ["**/*.kt", "**/*.kts", "**/build.gradle.kts"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# Kotlin Testing
|
|
7
|
+
|
|
8
|
+
> This file extends the common testing rule with Kotlin-specific content.
|
|
9
|
+
|
|
10
|
+
## Framework
|
|
11
|
+
|
|
12
|
+
Use **Kotest** with spec styles (StringSpec, FunSpec, BehaviorSpec) and **MockK** for mocking.
|
|
13
|
+
|
|
14
|
+
## Coroutine Testing
|
|
15
|
+
|
|
16
|
+
Use `runTest` from `kotlinx-coroutines-test`:
|
|
17
|
+
|
|
18
|
+
```kotlin
|
|
19
|
+
test("async operation completes") {
|
|
20
|
+
runTest {
|
|
21
|
+
val result = service.fetchData()
|
|
22
|
+
result.shouldNotBeEmpty()
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Coverage
|
|
28
|
+
|
|
29
|
+
Use **Kover** for coverage reporting:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
./gradlew koverHtmlReport
|
|
33
|
+
./gradlew koverVerify
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Reference
|
|
37
|
+
|
|
38
|
+
See skill: `kotlin-testing` for detailed Kotest patterns, MockK usage, and property-based testing.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "PHP coding style extending common rules"
|
|
3
|
+
globs: ["**/*.php", "**/composer.json"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# PHP Coding Style
|
|
7
|
+
|
|
8
|
+
> This file extends the common coding style rule with PHP specific content.
|
|
9
|
+
|
|
10
|
+
## Standards
|
|
11
|
+
|
|
12
|
+
- Follow **PSR-12** formatting and naming conventions.
|
|
13
|
+
- Prefer `declare(strict_types=1);` in application code.
|
|
14
|
+
- Use scalar type hints, return types, and typed properties everywhere new code permits.
|
|
15
|
+
|
|
16
|
+
## Immutability
|
|
17
|
+
|
|
18
|
+
- Prefer immutable DTOs and value objects for data crossing service boundaries.
|
|
19
|
+
- Use `readonly` properties or immutable constructors for request/response payloads where possible.
|
|
20
|
+
- Keep arrays for simple maps; promote business-critical structures into explicit classes.
|
|
21
|
+
|
|
22
|
+
## Formatting
|
|
23
|
+
|
|
24
|
+
- Use **PHP-CS-Fixer** or **Laravel Pint** for formatting.
|
|
25
|
+
- Use **PHPStan** or **Psalm** for static analysis.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "PHP hooks extending common rules"
|
|
3
|
+
globs: ["**/*.php", "**/composer.json", "**/phpstan.neon", "**/phpstan.neon.dist", "**/psalm.xml"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# PHP Hooks
|
|
7
|
+
|
|
8
|
+
> This file extends the common hooks rule with PHP specific content.
|
|
9
|
+
|
|
10
|
+
## PostToolUse Hooks
|
|
11
|
+
|
|
12
|
+
Configure in `~/.claude/settings.json`:
|
|
13
|
+
|
|
14
|
+
- **Pint / PHP-CS-Fixer**: Auto-format edited `.php` files.
|
|
15
|
+
- **PHPStan / Psalm**: Run static analysis after PHP edits in typed codebases.
|
|
16
|
+
- **PHPUnit / Pest**: Run targeted tests for touched files or modules when edits affect behavior.
|
|
17
|
+
|
|
18
|
+
## Warnings
|
|
19
|
+
|
|
20
|
+
- Warn on `var_dump`, `dd`, `dump`, or `die()` left in edited files.
|
|
21
|
+
- Warn when edited PHP files add raw SQL or disable CSRF/session protections.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "PHP patterns extending common rules"
|
|
3
|
+
globs: ["**/*.php", "**/composer.json"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# PHP Patterns
|
|
7
|
+
|
|
8
|
+
> This file extends the common patterns rule with PHP specific content.
|
|
9
|
+
|
|
10
|
+
## Thin Controllers, Explicit Services
|
|
11
|
+
|
|
12
|
+
- Keep controllers focused on transport: auth, validation, serialization, status codes.
|
|
13
|
+
- Move business rules into application/domain services that are easy to test without HTTP bootstrapping.
|
|
14
|
+
|
|
15
|
+
## DTOs and Value Objects
|
|
16
|
+
|
|
17
|
+
- Replace shape-heavy associative arrays with DTOs for requests, commands, and external API payloads.
|
|
18
|
+
- Use value objects for money, identifiers, and constrained concepts.
|
|
19
|
+
|
|
20
|
+
## Dependency Injection
|
|
21
|
+
|
|
22
|
+
- Depend on interfaces or narrow service contracts, not framework globals.
|
|
23
|
+
- Pass collaborators through constructors so services are testable without service-locator lookups.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "PHP security extending common rules"
|
|
3
|
+
globs: ["**/*.php", "**/composer.lock", "**/composer.json"]
|
|
4
|
+
alwaysApply: false
|
|
5
|
+
---
|
|
6
|
+
# PHP Security
|
|
7
|
+
|
|
8
|
+
> This file extends the common security rule with PHP specific content.
|
|
9
|
+
|
|
10
|
+
## Database Safety
|
|
11
|
+
|
|
12
|
+
- Use prepared statements (`PDO`, Doctrine, Eloquent query builder) for all dynamic queries.
|
|
13
|
+
- Scope ORM mass-assignment carefully and whitelist writable fields.
|
|
14
|
+
|
|
15
|
+
## Secrets and Dependencies
|
|
16
|
+
|
|
17
|
+
- Load secrets from environment variables or a secret manager, never from committed config files.
|
|
18
|
+
- Run `composer audit` in CI and review package trust before adding dependencies.
|
|
19
|
+
|
|
20
|
+
## Auth and Session Safety
|
|
21
|
+
|
|
22
|
+
- Use `password_hash()` / `password_verify()` for password storage.
|
|
23
|
+
- Regenerate session identifiers after authentication and privilege changes.
|
|
24
|
+
- Enforce CSRF protection on state-changing web requests.
|