@thierrynakoa/fire-flow 10.0.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/.claude-plugin/plugin.json +64 -0
- package/ARCHITECTURE-DIAGRAM.md +440 -0
- package/COMMAND-REFERENCE.md +172 -0
- package/DOMINION-FLOW-OVERVIEW.md +421 -0
- package/LICENSE +21 -0
- package/QUICK-START.md +351 -0
- package/README.md +398 -0
- package/TROUBLESHOOTING.md +264 -0
- package/agents/fire-codebase-mapper.md +484 -0
- package/agents/fire-debugger.md +535 -0
- package/agents/fire-executor.md +949 -0
- package/agents/fire-fact-checker.md +276 -0
- package/agents/fire-learncoding-explainer.md +237 -0
- package/agents/fire-learncoding-walker.md +147 -0
- package/agents/fire-planner.md +675 -0
- package/agents/fire-project-researcher.md +155 -0
- package/agents/fire-research-synthesizer.md +166 -0
- package/agents/fire-researcher.md +723 -0
- package/agents/fire-reviewer.md +499 -0
- package/agents/fire-roadmapper.md +203 -0
- package/agents/fire-verifier.md +880 -0
- package/bin/cli.js +208 -0
- package/commands/fire-0-orient.md +476 -0
- package/commands/fire-1-new.md +281 -0
- package/commands/fire-1a-discuss.md +455 -0
- package/commands/fire-2-plan.md +527 -0
- package/commands/fire-3-execute.md +1303 -0
- package/commands/fire-4-verify.md +845 -0
- package/commands/fire-5-handoff.md +515 -0
- package/commands/fire-6-resume.md +501 -0
- package/commands/fire-7-review.md +409 -0
- package/commands/fire-add-new-skill.md +598 -0
- package/commands/fire-analytics.md +499 -0
- package/commands/fire-assumptions.md +78 -0
- package/commands/fire-autonomous.md +528 -0
- package/commands/fire-brainstorm.md +413 -0
- package/commands/fire-complete-milestone.md +270 -0
- package/commands/fire-dashboard.md +375 -0
- package/commands/fire-debug.md +663 -0
- package/commands/fire-discover.md +616 -0
- package/commands/fire-double-check.md +460 -0
- package/commands/fire-execute-plan.md +182 -0
- package/commands/fire-learncoding.md +242 -0
- package/commands/fire-loop-resume.md +272 -0
- package/commands/fire-loop-stop.md +198 -0
- package/commands/fire-loop.md +1168 -0
- package/commands/fire-map-codebase.md +313 -0
- package/commands/fire-new-milestone.md +356 -0
- package/commands/fire-reflect.md +235 -0
- package/commands/fire-research.md +246 -0
- package/commands/fire-search.md +330 -0
- package/commands/fire-security-audit-repo.md +293 -0
- package/commands/fire-security-scan.md +484 -0
- package/commands/fire-session-summary.md +252 -0
- package/commands/fire-skills-diff.md +506 -0
- package/commands/fire-skills-history.md +388 -0
- package/commands/fire-skills-rollback.md +408 -0
- package/commands/fire-skills-sync.md +470 -0
- package/commands/fire-test.md +520 -0
- package/commands/fire-todos.md +335 -0
- package/commands/fire-transition.md +186 -0
- package/commands/fire-update.md +312 -0
- package/commands/fire-verify-uat.md +146 -0
- package/commands/fire-vuln-scan.md +493 -0
- package/hooks/hooks.json +16 -0
- package/hooks/run-hook.cmd +69 -0
- package/hooks/run-hook.sh +8 -0
- package/hooks/run-session-end.cmd +49 -0
- package/hooks/run-session-end.sh +7 -0
- package/hooks/session-end.sh +90 -0
- package/hooks/session-start.sh +111 -0
- package/package.json +52 -0
- package/plugin.json +7 -0
- package/references/auto-skill-extraction.md +136 -0
- package/references/behavioral-directives.md +365 -0
- package/references/blocker-tracking.md +155 -0
- package/references/checkpoints.md +165 -0
- package/references/circuit-breaker.md +410 -0
- package/references/context-engineering.md +587 -0
- package/references/decision-time-guidance.md +289 -0
- package/references/error-classification.md +326 -0
- package/references/execution-mode-intelligence.md +242 -0
- package/references/git-integration.md +217 -0
- package/references/honesty-protocols.md +304 -0
- package/references/integration-architecture.md +470 -0
- package/references/issue-to-pr-pipeline.md +150 -0
- package/references/metrics-and-trends.md +234 -0
- package/references/playwright-e2e-testing.md +326 -0
- package/references/questioning.md +125 -0
- package/references/research-improvements.md +110 -0
- package/references/skills-usage-guide.md +429 -0
- package/references/tdd.md +131 -0
- package/references/testing-enforcement.md +192 -0
- package/references/ui-brand.md +383 -0
- package/references/validation-checklist.md +456 -0
- package/references/verification-patterns.md +187 -0
- package/references/warrior-principles.md +173 -0
- package/skills-library/SKILLS-INDEX.md +588 -0
- package/skills-library/_general/frontend/html-visual-reports.md +292 -0
- package/skills-library/_general/methodology/debug-swarm-researcher-escape-hatch.md +240 -0
- package/skills-library/_general/methodology/learncoding-agentic-pattern.md +114 -0
- package/skills-library/_general/methodology/shell-autonomous-loop-fixplan.md +238 -0
- package/skills-library/basics/api-rest-basics.md +162 -0
- package/skills-library/basics/env-variables.md +96 -0
- package/skills-library/basics/error-handling-basics.md +125 -0
- package/skills-library/basics/git-commit-conventions.md +106 -0
- package/skills-library/basics/readme-template.md +108 -0
- package/skills-library/common-tasks/async-await-patterns.md +157 -0
- package/skills-library/common-tasks/auth-jwt-basics.md +164 -0
- package/skills-library/common-tasks/database-schema-design.md +166 -0
- package/skills-library/common-tasks/file-upload-basics.md +166 -0
- package/skills-library/common-tasks/form-validation.md +159 -0
- package/skills-library/debugging/FAILURE_TAXONOMY_CLASSIFICATION.md +117 -0
- package/skills-library/debugging/THREE_AGENT_HYPOTHESIS_DEBUGGING.md +86 -0
- package/skills-library/methodology/BREATH_BASED_PARALLEL_EXECUTION.md +678 -0
- package/skills-library/methodology/CONFIDENCE_GATED_EXECUTION.md +243 -0
- package/skills-library/methodology/EVIDENCE_BASED_VALIDATION.md +308 -0
- package/skills-library/methodology/MULTI_PERSPECTIVE_CODE_REVIEW.md +330 -0
- package/skills-library/methodology/PATH_VERIFICATION_GATE.md +211 -0
- package/skills-library/methodology/REFLEXION_MEMORY_PATTERN.md +183 -0
- package/skills-library/methodology/RESEARCH_BACKED_WORKFLOW_UPGRADE.md +263 -0
- package/skills-library/methodology/SABBATH_REST_PATTERN.md +267 -0
- package/skills-library/methodology/STONE_AND_SCAFFOLD.md +220 -0
- package/skills-library/performance/cache-augmented-generation.md +172 -0
- package/skills-library/quality-safety/debugging-steps.md +147 -0
- package/skills-library/quality-safety/deployment-checklist.md +155 -0
- package/skills-library/quality-safety/security-checklist.md +204 -0
- package/skills-library/quality-safety/testing-basics.md +180 -0
- package/skills-library/security/agent-security-scanner.md +445 -0
- package/skills-library/specialists/api-architecture/api-designer.md +49 -0
- package/skills-library/specialists/api-architecture/graphql-architect.md +49 -0
- package/skills-library/specialists/api-architecture/mcp-developer.md +51 -0
- package/skills-library/specialists/api-architecture/microservices-architect.md +50 -0
- package/skills-library/specialists/api-architecture/websocket-engineer.md +48 -0
- package/skills-library/specialists/backend/django-expert.md +52 -0
- package/skills-library/specialists/backend/fastapi-expert.md +52 -0
- package/skills-library/specialists/backend/laravel-specialist.md +52 -0
- package/skills-library/specialists/backend/nestjs-expert.md +51 -0
- package/skills-library/specialists/backend/rails-expert.md +53 -0
- package/skills-library/specialists/backend/spring-boot-engineer.md +56 -0
- package/skills-library/specialists/data-ml/fine-tuning-expert.md +48 -0
- package/skills-library/specialists/data-ml/ml-pipeline.md +47 -0
- package/skills-library/specialists/data-ml/pandas-pro.md +47 -0
- package/skills-library/specialists/data-ml/rag-architect.md +51 -0
- package/skills-library/specialists/data-ml/spark-engineer.md +47 -0
- package/skills-library/specialists/frontend/angular-architect.md +52 -0
- package/skills-library/specialists/frontend/flutter-expert.md +51 -0
- package/skills-library/specialists/frontend/nextjs-developer.md +54 -0
- package/skills-library/specialists/frontend/react-native-expert.md +50 -0
- package/skills-library/specialists/frontend/vue-expert.md +51 -0
- package/skills-library/specialists/infrastructure/chaos-engineer.md +74 -0
- package/skills-library/specialists/infrastructure/cloud-architect.md +70 -0
- package/skills-library/specialists/infrastructure/database-optimizer.md +64 -0
- package/skills-library/specialists/infrastructure/devops-engineer.md +70 -0
- package/skills-library/specialists/infrastructure/kubernetes-specialist.md +52 -0
- package/skills-library/specialists/infrastructure/monitoring-expert.md +70 -0
- package/skills-library/specialists/infrastructure/sre-engineer.md +70 -0
- package/skills-library/specialists/infrastructure/terraform-engineer.md +51 -0
- package/skills-library/specialists/languages/cpp-pro.md +74 -0
- package/skills-library/specialists/languages/csharp-developer.md +69 -0
- package/skills-library/specialists/languages/dotnet-core-expert.md +54 -0
- package/skills-library/specialists/languages/golang-pro.md +51 -0
- package/skills-library/specialists/languages/java-architect.md +49 -0
- package/skills-library/specialists/languages/javascript-pro.md +68 -0
- package/skills-library/specialists/languages/kotlin-specialist.md +68 -0
- package/skills-library/specialists/languages/php-pro.md +49 -0
- package/skills-library/specialists/languages/python-pro.md +52 -0
- package/skills-library/specialists/languages/react-expert.md +51 -0
- package/skills-library/specialists/languages/rust-engineer.md +50 -0
- package/skills-library/specialists/languages/sql-pro.md +56 -0
- package/skills-library/specialists/languages/swift-expert.md +69 -0
- package/skills-library/specialists/languages/typescript-pro.md +51 -0
- package/skills-library/specialists/platform/atlassian-mcp.md +52 -0
- package/skills-library/specialists/platform/embedded-systems.md +53 -0
- package/skills-library/specialists/platform/game-developer.md +53 -0
- package/skills-library/specialists/platform/salesforce-developer.md +53 -0
- package/skills-library/specialists/platform/shopify-expert.md +49 -0
- package/skills-library/specialists/platform/wordpress-pro.md +49 -0
- package/skills-library/specialists/quality/code-documenter.md +51 -0
- package/skills-library/specialists/quality/code-reviewer.md +67 -0
- package/skills-library/specialists/quality/debugging-wizard.md +51 -0
- package/skills-library/specialists/quality/fullstack-guardian.md +51 -0
- package/skills-library/specialists/quality/legacy-modernizer.md +50 -0
- package/skills-library/specialists/quality/playwright-expert.md +65 -0
- package/skills-library/specialists/quality/spec-miner.md +56 -0
- package/skills-library/specialists/quality/test-master.md +65 -0
- package/skills-library/specialists/security/secure-code-guardian.md +55 -0
- package/skills-library/specialists/security/security-reviewer.md +53 -0
- package/skills-library/specialists/workflow/architecture-designer.md +53 -0
- package/skills-library/specialists/workflow/cli-developer.md +70 -0
- package/skills-library/specialists/workflow/feature-forge.md +65 -0
- package/skills-library/specialists/workflow/prompt-engineer.md +54 -0
- package/skills-library/specialists/workflow/the-fool.md +62 -0
- package/templates/ASSUMPTIONS.md +125 -0
- package/templates/BLOCKERS.md +73 -0
- package/templates/DECISION_LOG.md +116 -0
- package/templates/UAT.md +96 -0
- package/templates/blueprint.md +94 -0
- package/templates/brainstorm.md +185 -0
- package/templates/conscience.md +92 -0
- package/templates/fire-handoff.md +159 -0
- package/templates/metrics.md +67 -0
- package/templates/phase-prompt.md +142 -0
- package/templates/record.md +131 -0
- package/templates/review-report.md +117 -0
- package/templates/skills-index.md +157 -0
- package/templates/verification.md +149 -0
- package/templates/vision.md +79 -0
- package/validation-config.yml +793 -0
- package/version.json +7 -0
- package/workflows/execute-phase.md +732 -0
- package/workflows/handoff-session.md +678 -0
- package/workflows/new-project.md +578 -0
- package/workflows/plan-phase.md +592 -0
- package/workflows/verify-phase.md +874 -0
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# Skill: File Upload Basics
|
|
2
|
+
|
|
3
|
+
**Category:** Common Tasks
|
|
4
|
+
**Difficulty:** Beginner–Intermediate
|
|
5
|
+
**Applies to:** Node.js/Express
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The Problem
|
|
10
|
+
|
|
11
|
+
File uploads are one of the easiest ways to get hacked if handled carelessly. Users can upload scripts, oversized files, or files with misleading extensions. Done right, uploads are simple and safe.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install multer
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Pattern 1: Upload to Local Disk (Development)
|
|
24
|
+
|
|
25
|
+
```js
|
|
26
|
+
const multer = require('multer');
|
|
27
|
+
const path = require('path');
|
|
28
|
+
|
|
29
|
+
// Configure storage
|
|
30
|
+
const storage = multer.diskStorage({
|
|
31
|
+
destination: (req, file, cb) => {
|
|
32
|
+
cb(null, 'uploads/'); // folder must exist
|
|
33
|
+
},
|
|
34
|
+
filename: (req, file, cb) => {
|
|
35
|
+
// Use timestamp + random to avoid name collisions
|
|
36
|
+
const unique = Date.now() + '-' + Math.round(Math.random() * 1e9);
|
|
37
|
+
cb(null, unique + path.extname(file.originalname));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// Configure filters
|
|
42
|
+
const fileFilter = (req, file, cb) => {
|
|
43
|
+
const allowed = ['image/jpeg', 'image/png', 'image/webp'];
|
|
44
|
+
if (allowed.includes(file.mimetype)) {
|
|
45
|
+
cb(null, true); // accept
|
|
46
|
+
} else {
|
|
47
|
+
cb(new Error('Only JPG, PNG, and WebP images allowed'), false); // reject
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const upload = multer({
|
|
52
|
+
storage,
|
|
53
|
+
fileFilter,
|
|
54
|
+
limits: { fileSize: 5 * 1024 * 1024 } // 5MB max
|
|
55
|
+
});
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Pattern 2: Single File Upload Route
|
|
61
|
+
|
|
62
|
+
```js
|
|
63
|
+
// Single file upload — field name must match the form field
|
|
64
|
+
router.post('/upload/avatar', upload.single('avatar'), (req, res) => {
|
|
65
|
+
if (!req.file) {
|
|
66
|
+
return res.status(400).json({ error: 'No file uploaded' });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const fileUrl = `/uploads/${req.file.filename}`;
|
|
70
|
+
res.json({ url: fileUrl, filename: req.file.filename });
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
// Handle multer errors
|
|
74
|
+
router.use((err, req, res, next) => {
|
|
75
|
+
if (err instanceof multer.MulterError) {
|
|
76
|
+
if (err.code === 'LIMIT_FILE_SIZE')
|
|
77
|
+
return res.status(400).json({ error: 'File too large. Maximum 5MB.' });
|
|
78
|
+
return res.status(400).json({ error: err.message });
|
|
79
|
+
}
|
|
80
|
+
if (err) return res.status(400).json({ error: err.message });
|
|
81
|
+
next();
|
|
82
|
+
});
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Pattern 3: Frontend — Sending a File
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<form id="upload-form" enctype="multipart/form-data">
|
|
91
|
+
<input type="file" id="avatar" name="avatar" accept="image/*" />
|
|
92
|
+
<button type="submit">Upload</button>
|
|
93
|
+
</form>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
document.getElementById('upload-form').addEventListener('submit', async (e) => {
|
|
98
|
+
e.preventDefault();
|
|
99
|
+
|
|
100
|
+
const fileInput = document.getElementById('avatar');
|
|
101
|
+
if (!fileInput.files[0]) return alert('Please select a file');
|
|
102
|
+
|
|
103
|
+
// Client-side size check (convenience only — server also checks)
|
|
104
|
+
if (fileInput.files[0].size > 5 * 1024 * 1024) {
|
|
105
|
+
return alert('File must be under 5MB');
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const formData = new FormData();
|
|
109
|
+
formData.append('avatar', fileInput.files[0]);
|
|
110
|
+
|
|
111
|
+
const res = await fetch('/api/upload/avatar', {
|
|
112
|
+
method: 'POST',
|
|
113
|
+
headers: { 'Authorization': `Bearer ${localStorage.getItem('token')}` },
|
|
114
|
+
body: formData // Do NOT set Content-Type manually — browser sets it with boundary
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
const data = await res.json();
|
|
118
|
+
if (res.ok) {
|
|
119
|
+
document.getElementById('preview').src = data.url;
|
|
120
|
+
} else {
|
|
121
|
+
alert(data.error);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Serve Uploaded Files
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
// In app.js — make uploads folder publicly accessible
|
|
132
|
+
app.use('/uploads', express.static('uploads'));
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
|
|
137
|
+
## For Production: Use Cloud Storage
|
|
138
|
+
|
|
139
|
+
Local disk doesn't work when you have multiple servers or restart loses files. Use cloud storage instead:
|
|
140
|
+
|
|
141
|
+
| Service | Free Tier | Best For |
|
|
142
|
+
|---------|-----------|---------|
|
|
143
|
+
| Cloudinary | 25GB | Images with auto-resizing |
|
|
144
|
+
| AWS S3 | 5GB/month | Any file type |
|
|
145
|
+
| Supabase Storage | 1GB | Projects already on Supabase |
|
|
146
|
+
|
|
147
|
+
With Cloudinary (simplest for images):
|
|
148
|
+
```bash
|
|
149
|
+
npm install cloudinary multer-storage-cloudinary
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Security Checklist
|
|
155
|
+
|
|
156
|
+
| Check | Why |
|
|
157
|
+
|-------|-----|
|
|
158
|
+
| Validate MIME type server-side | Extensions can be faked |
|
|
159
|
+
| Set file size limit | Prevents server overload |
|
|
160
|
+
| Store outside web root (or in cloud) | Prevents direct script execution |
|
|
161
|
+
| Rename uploaded files | Prevents overwriting existing files |
|
|
162
|
+
| Require authentication for uploads | Prevents anonymous abuse |
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
*Fire Flow Skills Library — MIT License*
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# Skill: Form Validation
|
|
2
|
+
|
|
3
|
+
**Category:** Common Tasks
|
|
4
|
+
**Difficulty:** Beginner
|
|
5
|
+
**Applies to:** Any full-stack project
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## The Rule
|
|
10
|
+
|
|
11
|
+
**Always validate on the server. Frontend validation is convenience, not security.**
|
|
12
|
+
|
|
13
|
+
A user can bypass any frontend check by using curl or editing the browser. The server is your last line of defense.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Layer 1: Frontend Validation (User Experience)
|
|
18
|
+
|
|
19
|
+
Give instant feedback without a round-trip to the server:
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<form id="signup-form">
|
|
23
|
+
<input type="text" id="name" required minlength="2" maxlength="100" />
|
|
24
|
+
<input type="email" id="email" required />
|
|
25
|
+
<input type="password" id="password" required minlength="8" />
|
|
26
|
+
<button type="submit">Sign Up</button>
|
|
27
|
+
<p id="error-msg" style="color:red; display:none;"></p>
|
|
28
|
+
</form>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
```js
|
|
32
|
+
document.getElementById('signup-form').addEventListener('submit', async (e) => {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
const error = document.getElementById('error-msg');
|
|
35
|
+
error.style.display = 'none';
|
|
36
|
+
|
|
37
|
+
const name = document.getElementById('name').value.trim();
|
|
38
|
+
const email = document.getElementById('email').value.trim();
|
|
39
|
+
const password = document.getElementById('password').value;
|
|
40
|
+
|
|
41
|
+
// Client-side checks
|
|
42
|
+
if (name.length < 2) {
|
|
43
|
+
error.textContent = 'Name must be at least 2 characters';
|
|
44
|
+
error.style.display = 'block';
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (password.length < 8) {
|
|
48
|
+
error.textContent = 'Password must be at least 8 characters';
|
|
49
|
+
error.style.display = 'block';
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Send to server
|
|
54
|
+
const res = await fetch('/api/auth/register', {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
headers: { 'Content-Type': 'application/json' },
|
|
57
|
+
body: JSON.stringify({ name, email, password })
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
const data = await res.json();
|
|
61
|
+
if (!res.ok) {
|
|
62
|
+
error.textContent = data.error;
|
|
63
|
+
error.style.display = 'block';
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## Layer 2: Server Validation (Security)
|
|
71
|
+
|
|
72
|
+
```js
|
|
73
|
+
// Simple manual validation
|
|
74
|
+
router.post('/register', async (req, res) => {
|
|
75
|
+
const { name, email, password } = req.body;
|
|
76
|
+
const errors = [];
|
|
77
|
+
|
|
78
|
+
if (!name || name.trim().length < 2)
|
|
79
|
+
errors.push('Name must be at least 2 characters');
|
|
80
|
+
|
|
81
|
+
if (!email || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email))
|
|
82
|
+
errors.push('Valid email required');
|
|
83
|
+
|
|
84
|
+
if (!password || password.length < 8)
|
|
85
|
+
errors.push('Password must be at least 8 characters');
|
|
86
|
+
|
|
87
|
+
if (errors.length > 0)
|
|
88
|
+
return res.status(400).json({ error: errors[0] }); // or send all: errors
|
|
89
|
+
|
|
90
|
+
// Proceed with registration...
|
|
91
|
+
});
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## Layer 2 (Alternative): Using a Validation Library
|
|
97
|
+
|
|
98
|
+
For larger projects, use [Zod](https://zod.dev) (Node.js):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm install zod
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```js
|
|
105
|
+
const { z } = require('zod');
|
|
106
|
+
|
|
107
|
+
const registerSchema = z.object({
|
|
108
|
+
name: z.string().min(2).max(100),
|
|
109
|
+
email: z.string().email(),
|
|
110
|
+
password: z.string().min(8),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
router.post('/register', async (req, res) => {
|
|
114
|
+
const result = registerSchema.safeParse(req.body);
|
|
115
|
+
|
|
116
|
+
if (!result.success) {
|
|
117
|
+
const message = result.error.errors[0].message;
|
|
118
|
+
return res.status(400).json({ error: message });
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
const { name, email, password } = result.data;
|
|
122
|
+
// Proceed...
|
|
123
|
+
});
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Common Fields and Their Rules
|
|
129
|
+
|
|
130
|
+
| Field | Rules |
|
|
131
|
+
|-------|-------|
|
|
132
|
+
| Name | Min 2 chars, max 100, no HTML tags |
|
|
133
|
+
| Email | Valid format, lowercase, max 255 chars |
|
|
134
|
+
| Password | Min 8 chars, at least 1 number or symbol |
|
|
135
|
+
| Phone | Digits only after stripping spaces/dashes |
|
|
136
|
+
| URL | Must start with `http://` or `https://` |
|
|
137
|
+
| Price | Number, min 0, max 2 decimal places |
|
|
138
|
+
| Date | Valid date, not in the past (for future events) |
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## What NOT to Validate On
|
|
143
|
+
|
|
144
|
+
- **Never trust `Content-Type` headers alone** — read and validate the actual body
|
|
145
|
+
- **Never trust `req.params.id`** — always parse as integer: `parseInt(req.params.id, 10)`
|
|
146
|
+
- **Never trust file extensions** — check MIME type server-side for uploads
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Sanitization vs Validation
|
|
151
|
+
|
|
152
|
+
- **Validation** — reject bad input ("this email is invalid")
|
|
153
|
+
- **Sanitization** — clean input before using it (`name.trim()`, strip HTML tags)
|
|
154
|
+
|
|
155
|
+
Do both. Validate first, then sanitize before storing.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
*Fire Flow Skills Library — MIT License*
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: failure-taxonomy-classification
|
|
3
|
+
category: parallel-debug
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
contributed: 2026-02-24
|
|
6
|
+
contributor: dominion-flow
|
|
7
|
+
tags: [debugging, taxonomy, classification, failure-patterns, agentdebug]
|
|
8
|
+
difficulty: medium
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Failure Taxonomy Classification
|
|
12
|
+
|
|
13
|
+
## Problem
|
|
14
|
+
|
|
15
|
+
Debugging without classification leads to random investigation. Knowing the TYPE of failure immediately narrows the search space. A MEMORY failure needs different tools than a SYSTEM failure.
|
|
16
|
+
|
|
17
|
+
## Solution Pattern
|
|
18
|
+
|
|
19
|
+
Classify every failure into one of 5 categories from the AgentDebug taxonomy (2025). Each category has specific investigation steps and common root causes.
|
|
20
|
+
|
|
21
|
+
## The 5 Categories
|
|
22
|
+
|
|
23
|
+
### MEMORY — Agent forgets context
|
|
24
|
+
**Symptoms:**
|
|
25
|
+
- Repeats work already done
|
|
26
|
+
- Ignores previous findings
|
|
27
|
+
- Contradicts earlier decisions
|
|
28
|
+
- Loses track of file changes
|
|
29
|
+
|
|
30
|
+
**Investigation:**
|
|
31
|
+
- Check if context was compacted
|
|
32
|
+
- Look for conversation length > 100 turns
|
|
33
|
+
- Verify key files are in context window
|
|
34
|
+
- Check if WARRIOR handoff was read
|
|
35
|
+
|
|
36
|
+
**Common fixes:** Re-read handoff, use `/compact Focus on {topic}`, pin critical context
|
|
37
|
+
|
|
38
|
+
### REFLECTION — Agent doesn't learn from failures
|
|
39
|
+
**Symptoms:**
|
|
40
|
+
- Same error 3+ times in a row
|
|
41
|
+
- Applies same fix that already failed
|
|
42
|
+
- Doesn't adjust approach after failure
|
|
43
|
+
- Ignores test output
|
|
44
|
+
|
|
45
|
+
**Investigation:**
|
|
46
|
+
- Search debug history for this error pattern
|
|
47
|
+
- Check if behavioral directives exist for this pattern
|
|
48
|
+
- Verify error output is being read
|
|
49
|
+
|
|
50
|
+
**Common fixes:** Add behavioral directive (IF/THEN/BECAUSE), record failure pattern to Qdrant
|
|
51
|
+
|
|
52
|
+
### PLANNING — Wrong approach chosen
|
|
53
|
+
**Symptoms:**
|
|
54
|
+
- Editing wrong file
|
|
55
|
+
- Using wrong API/library
|
|
56
|
+
- Building wrong feature
|
|
57
|
+
- Missing requirements
|
|
58
|
+
|
|
59
|
+
**Investigation:**
|
|
60
|
+
- Re-read REQUIREMENTS.md or BLUEPRINT.md
|
|
61
|
+
- Check CONSCIENCE.md for project rules
|
|
62
|
+
- Verify understanding of the task
|
|
63
|
+
|
|
64
|
+
**Common fixes:** Re-plan with `/fire-2-plan`, check skills library for correct patterns
|
|
65
|
+
|
|
66
|
+
### ACTION — Correct plan, bad execution
|
|
67
|
+
**Symptoms:**
|
|
68
|
+
- Typos in code
|
|
69
|
+
- Wrong parameters
|
|
70
|
+
- Incomplete implementation
|
|
71
|
+
- Tests fail on edge cases
|
|
72
|
+
|
|
73
|
+
**Investigation:**
|
|
74
|
+
- Diff the actual code against the plan
|
|
75
|
+
- Check for copy-paste errors
|
|
76
|
+
- Verify API signatures match documentation
|
|
77
|
+
|
|
78
|
+
**Common fixes:** Fix the specific error, add test for the edge case
|
|
79
|
+
|
|
80
|
+
### SYSTEM — External failure
|
|
81
|
+
**Symptoms:**
|
|
82
|
+
- Database connection refused
|
|
83
|
+
- API rate limit hit
|
|
84
|
+
- Build tool crash
|
|
85
|
+
- Disk full, port in use
|
|
86
|
+
|
|
87
|
+
**Investigation:**
|
|
88
|
+
- Check if service is running
|
|
89
|
+
- Verify environment variables
|
|
90
|
+
- Check system resources (disk, memory, ports)
|
|
91
|
+
|
|
92
|
+
**Common fixes:** Restart service, rotate credentials, clear disk space, kill port-holding process
|
|
93
|
+
|
|
94
|
+
## Classification Flow
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
Error occurs
|
|
98
|
+
→ Can you reproduce it?
|
|
99
|
+
No → SYSTEM (intermittent external issue)
|
|
100
|
+
Yes → Has this exact error happened before?
|
|
101
|
+
Yes → REFLECTION (not learning from past)
|
|
102
|
+
No → Is the approach correct?
|
|
103
|
+
No → PLANNING (wrong approach)
|
|
104
|
+
Yes → Is the code correct?
|
|
105
|
+
No → ACTION (execution error)
|
|
106
|
+
Yes → Is context missing?
|
|
107
|
+
Yes → MEMORY (lost context)
|
|
108
|
+
No → SYSTEM (environment issue)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## When to Use
|
|
112
|
+
- First step of ANY debug session
|
|
113
|
+
- Before spawning parallel debug agents
|
|
114
|
+
- When recording failures to Qdrant
|
|
115
|
+
|
|
116
|
+
## When NOT to Use
|
|
117
|
+
- Not applicable — always classify before debugging
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: three-agent-hypothesis-debugging
|
|
3
|
+
category: parallel-debug
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
contributed: 2026-02-24
|
|
6
|
+
contributor: dominion-flow
|
|
7
|
+
tags: [debugging, parallel, hypothesis, agents, competing]
|
|
8
|
+
difficulty: hard
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Three-Agent Competing Hypothesis Debugging
|
|
12
|
+
|
|
13
|
+
## Problem
|
|
14
|
+
|
|
15
|
+
Single-agent debugging follows one hypothesis at a time. If the first hypothesis is wrong, the agent wastes time before trying alternatives. Complex bugs with multiple possible root causes need parallel investigation.
|
|
16
|
+
|
|
17
|
+
## Solution Pattern
|
|
18
|
+
|
|
19
|
+
Spawn 3 agents, each investigating a DIFFERENT hypothesis simultaneously. The first agent to find a confirmed root cause wins. Others are terminated. This is 2-3x faster than sequential debugging for complex issues.
|
|
20
|
+
|
|
21
|
+
## Workflow
|
|
22
|
+
|
|
23
|
+
### Step 1: Generate 3 Hypotheses
|
|
24
|
+
|
|
25
|
+
From symptoms, generate 3 distinct hypotheses:
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
Bug: "API returns 500 on course enrollment"
|
|
29
|
+
|
|
30
|
+
H1: Database constraint violation — enrollment table FK or unique constraint
|
|
31
|
+
H2: Middleware auth issue — token parsing fails silently, null user reaches handler
|
|
32
|
+
H3: Race condition — concurrent enrollments for same user/course
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Step 2: Spawn 3 Parallel Agents
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
Agent 1 (H1): "Investigate database constraints. Check enrollment table schema,
|
|
39
|
+
run the INSERT manually, check for FK violations, check for duplicate keys."
|
|
40
|
+
|
|
41
|
+
Agent 2 (H2): "Investigate auth middleware. Add logging to token parsing,
|
|
42
|
+
check if user object is null when reaching enrollment handler."
|
|
43
|
+
|
|
44
|
+
Agent 3 (H3): "Investigate race conditions. Check if enrollment INSERT has
|
|
45
|
+
ON CONFLICT handling, test with 2 concurrent requests."
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Step 3: Collect Results
|
|
49
|
+
|
|
50
|
+
Each agent returns:
|
|
51
|
+
```
|
|
52
|
+
{
|
|
53
|
+
hypothesis: "H1: Database constraint violation",
|
|
54
|
+
verdict: "CONFIRMED" | "ELIMINATED" | "INCONCLUSIVE",
|
|
55
|
+
evidence: ["FK on course_id references non-existent course 999"],
|
|
56
|
+
fix: "Validate course exists before INSERT" | null
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Step 4: Choose Winner
|
|
61
|
+
|
|
62
|
+
| Scenario | Action |
|
|
63
|
+
|----------|--------|
|
|
64
|
+
| 1 CONFIRMED | Apply that agent's fix |
|
|
65
|
+
| 0 CONFIRMED, 3 ELIMINATED | Generate 3 new hypotheses from new evidence |
|
|
66
|
+
| 1+ INCONCLUSIVE | Give inconclusive agent more time/context |
|
|
67
|
+
| 2+ CONFIRMED | Compound bug — apply both fixes |
|
|
68
|
+
|
|
69
|
+
## Key Rules
|
|
70
|
+
|
|
71
|
+
1. **Hypotheses must be independent** — Each agent investigates a different root cause
|
|
72
|
+
2. **No shared state** — Agents don't read each other's investigation
|
|
73
|
+
3. **Time-boxed** — If no agent confirms within 10 minutes, stop and reassess
|
|
74
|
+
4. **Evidence required** — CONFIRMED needs reproducible proof, not speculation
|
|
75
|
+
5. **Don't fix what isn't broken** — Only CONFIRMED hypotheses get fixes
|
|
76
|
+
|
|
77
|
+
## When to Use
|
|
78
|
+
- Bugs with 3+ plausible root causes
|
|
79
|
+
- Production incidents where speed matters
|
|
80
|
+
- Flaky tests with non-deterministic behavior
|
|
81
|
+
- Bugs that have resisted sequential debugging
|
|
82
|
+
|
|
83
|
+
## When NOT to Use
|
|
84
|
+
- Obvious bugs (typos, missing imports)
|
|
85
|
+
- Bugs with a single clear hypothesis
|
|
86
|
+
- Issues where file access would conflict between agents
|