Skip to content

Commit 4010da1

Browse files
authored
Feat/path traversal article (#34)
* feat: first draft of new article * chore: work in progress * chore: work in progress * chore: improve content style and instructions for LLMs * chore: progress on article * chore: good progress on article * chore: other improvements
1 parent 932c32f commit 4010da1

10 files changed

Lines changed: 1097 additions & 8 deletions

File tree

.claude/article-brief-template.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,17 @@ Use this template when planning new blog articles for Node.js Design Patterns.
6060

6161
---
6262

63+
### Writing Style Checklist
64+
65+
- [ ] No em dashes (—) used anywhere
66+
- [ ] Context provided before diving into implementation details
67+
- [ ] Explains "why" not just "how" for each concept
68+
- [ ] Friendly, conversational tone throughout
69+
- [ ] Sections connected with transitions (forward/backward references)
70+
- [ ] Technical explanations start with the problem/use case
71+
72+
---
73+
6374
### Internal Links
6475

6576
Link to related existing articles:

.claude/constitution.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,34 @@ We adhere to a set of coding standards to ensure code quality and maintainabilit
4141

4242
The repository uses well-defined formatting rules through [Prettier](https://prettier.io/) and linting through [ESLint](https://eslint.org/).
4343

44+
### Content Writing Style
45+
46+
When creating or editing written content (blog articles, documentation, tutorials), follow these style guidelines:
47+
48+
#### Tone and Readability
49+
- Use a **friendly, approachable tone** - almost colloquial, as if explaining to a colleague
50+
- Write in a conversational style while maintaining technical accuracy
51+
- Avoid overly formal or academic language
52+
53+
#### Punctuation and Formatting
54+
- **Never use em dashes (—)** - use commas, parentheses, or separate sentences instead
55+
- Use short paragraphs and clear sentence structure
56+
- Break up long explanations with code examples, lists, or callouts
57+
58+
#### Structure and Flow
59+
- **Always provide context first** - explain the "what" and "why" before diving into "how"
60+
- **Emphasize the "why"** - readers should understand not just how something works, but why it matters and why it works that way
61+
- **Connect sections smoothly** using:
62+
- Forward references: "In the next section, we'll see how to handle errors"
63+
- Backward references: "As we saw earlier, streams provide memory efficiency"
64+
- Brief previews of what's coming: "Before we implement this, let's understand the underlying concept"
65+
66+
#### Technical Explanations
67+
- Start with the problem or use case before introducing the solution
68+
- Explain concepts progressively - simple version first, then edge cases and advanced usage
69+
- Use real-world analogies when explaining abstract concepts
70+
- Include practical examples that readers can relate to their own projects
71+
4472
## Deployment
4573

4674
The website is automatically deployed to GitHub Pages through a GitHub Actions workflow. The deployment process is triggered on every push to the `main` branch. The workflow builds the static site and publishes it to GitHub Pages, making it accessible to users. Contributors do not need to manually handle deployment - focus on code quality and the automated pipeline will handle the rest.

.claude/content-calendar.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
1. **Node.js Core APIs & Built-ins** - High-volume foundational topics
1212
2. **Modern Node.js Features** - New capabilities (22+, 23+) with early-mover SEO advantage
1313
3. **Node.js Patterns & Architecture** - Advanced patterns (light connection to book)
14+
4. **Node.js Security** - Security best practices and vulnerability prevention
1415

1516
---
1617

@@ -52,12 +53,21 @@
5253
| 15 | NOT STARTED | Import maps in Node.js | "node js import maps" | 1,000+ | Modern |
5354
| 16 | NOT STARTED | Encrypting files with Node.js | "node js encrypt file" | 1,500+ | Core APIs |
5455

55-
### Month 9-12: Advanced & Experimental
56+
### Month 9-10: Security
57+
58+
| # | Status | Article | Primary Keyword | Est. Volume | Pillar |
59+
| --- | -------- | --------------------------------- | --------------------------------- | ----------- | -------- |
60+
| 17 | COMPLETE | **Path Traversal Security Guide** | "node js path traversal" | 1,000+ | Security |
61+
| 18 | NOT STARTED | Input Validation in Node.js | "node js input validation" | 2,000+ | Security |
62+
| 19 | NOT STARTED | Secure File Uploads | "node js secure file upload" | 1,500+ | Security |
63+
| 20 | NOT STARTED | OWASP Top 10 for Node.js | "node js security best practices" | 3,000+ | Security |
64+
65+
### Month 11-12: Advanced & Experimental
5666

5767
| # | Status | Article | Primary Keyword | Notes |
5868
| --- | ----------- | ------------------------------ | --------------- | --------------------- |
59-
| 17+ | NOT STARTED | Rust/Zig + Node.js integration | niche | Thought leadership |
60-
| 18+ | NOT STARTED | TBD based on analytics | TBD | Iterate based on data |
69+
| 21+ | NOT STARTED | Rust/Zig + Node.js integration | niche | Thought leadership |
70+
| 22+ | NOT STARTED | TBD based on analytics | TBD | Iterate based on data |
6171

6272
---
6373

@@ -69,6 +79,7 @@
6979
| Stream consumers | COMPLETE | /blog/node-js-stream-consumer |
7080
| Async iterators | COMPLETE | /blog/javascript-async-iterators |
7181
| Race conditions | COMPLETE | /blog/node-js-race-conditions |
82+
| Path traversal security | COMPLETE | /blog/nodejs-path-traversal-security |
7283
| Checking Node.js version | COMPLETE | /blog/checking-node-js-version |
7384
| Installing Node.js | UPDATED | /blog/5-ways-to-install-node-js |
7485
| Docker development | COMPLETE | /blog/node-js-development-with-docker-and-docker-compose |
@@ -88,6 +99,7 @@ Environment Variables
8899
Files & Paths
89100
└── links to → Reading/Writing Files (existing)
90101
└── links to → Hashing Files
102+
└── links to → Path Traversal Security (existing)
91103
└── links to → Encrypting Files
92104
93105
Streams Guide
@@ -102,6 +114,20 @@ Event Emitter
102114
Installing Node.js
103115
└── links to → Checking Node.js version (existing)
104116
└── links to → Docker development (existing)
117+
118+
Path Traversal Security (NEW)
119+
└── links to → Reading/Writing Files (existing)
120+
└── links to → Race Conditions (existing)
121+
└── links to → 5 Ways to Install Node.js (existing)
122+
└── links to → Input Validation (future)
123+
└── links to → Secure File Uploads (future)
124+
└── links to → OWASP Top 10 for Node.js (future)
125+
126+
Security Cluster (future)
127+
└── Path Traversal Security (hub for file security)
128+
└── Input Validation
129+
└── Secure File Uploads
130+
└── OWASP Top 10 for Node.js (potential hub)
105131
```
106132

107133
---
@@ -112,8 +138,11 @@ Installing Node.js
112138
- [x] Update "5 Ways to Install Node.js" with fnm, Volta, Docker
113139
- [x] Cross-link existing articles
114140
- [x] Add CTAs for free chapter download to all posts
141+
- [x] Publish path traversal security article (new security pillar)
142+
- [x] Add link to path traversal article from Reading/Writing Files guide
115143
- [ ] Monitor keyword rankings for existing content
116144
- [ ] A/B test CTA placements
145+
- [ ] Promote path traversal article on security forums (r/netsec, HN)
117146

118147
---
119148

@@ -123,3 +152,6 @@ Installing Node.js
123152
- Most competing articles still recommend axios/got first - opportunity to differentiate
124153
- New Node.js features (22+, 23+) have early-mover advantage
125154
- Light book excerpts where relevant (Ch 6 streams, Ch 10 testing)
155+
- **Security content** differentiates us from typical tutorial sites and builds trust/authority
156+
- Path traversal article targets developers building file servers, image handlers, and upload systems
157+
- Security topics have strong CVE/news hooks for promotion and backlinks

.claude/instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Key principles to remember:
99
- Maintain accessibility standards (semantic HTML, ARIA, keyboard navigation)
1010
- Use data-driven approach with strongly typed content collections
1111
- Follow established coding standards with ESLint and Prettier
12+
- Follow content writing style guidelines (friendly tone, context-first, explain the "why")
1213
- All changes are automatically deployed via GitHub Actions to GitHub Pages
1314

1415
Always read the constitution file when starting work to ensure alignment with project principles.

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@
4343
"mcp__playwright__browser_network_requests",
4444
"mcp__playwright__browser_close",
4545
"mcp__playwright__browser_resize",
46-
"mcp__playwright__browser_run_code"
46+
"mcp__playwright__browser_run_code",
47+
"Skill(marketing-skills:seo-audit)"
4748
]
4849
}
4950
}

AGENTS.md

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
# AGENTS.md
2+
3+
This file provides guidance to AI coding assistants when working with code in this repository.
4+
5+
## Project Overview
6+
7+
Official website for the book "Node.js Design Patterns" by Mario Casciaro and Luciano Mammino. Built with Astro as a minimal static site, deployed to GitHub Pages at https://nodejsdesignpatterns.com.
8+
9+
## Commands
10+
11+
```bash
12+
pnpm dev # Start dev server at localhost:4321
13+
pnpm build # Build production site to ./dist/
14+
pnpm preview # Preview production build locally
15+
pnpm lint # Run ESLint
16+
pnpm lint:fix # Fix auto-fixable ESLint issues
17+
pnpm format # Format with Prettier
18+
pnpm format:check # Check formatting
19+
pnpm typecheck # TypeScript type checking
20+
```
21+
22+
## Architecture
23+
24+
### Core Stack
25+
26+
- **Astro 5** - Static site generator (ESM, TypeScript)
27+
- **Tailwind CSS 4** - Styling via Vite plugin
28+
- **React** - Used sparingly for interactive components only
29+
- **pnpm** - Package manager
30+
31+
### Content Collections (`src/content/`)
32+
33+
Strongly typed via Zod schemas in `src/content.config.ts`:
34+
35+
- `authors/` - Author JSON files with profile pics
36+
- `blog/` - Blog posts (markdown with frontmatter, each in its own folder)
37+
- `chapters/` - Book chapter descriptions
38+
- `faq/` - FAQ entries
39+
- `quotes/` - Testimonials
40+
- `reviews/` - Book reviews
41+
42+
### Key Directories
43+
44+
- `src/components/` - Astro components (`.astro`) and React components (`.tsx`)
45+
- `src/components/blog/` - Blog-specific components including `BlogLayout.astro`
46+
- `src/components/ui/` - Reusable UI components (badge, button, card)
47+
- `src/pages/` - Astro routes (index, blog, RSS, 404)
48+
- `src/plugins/` - Remark plugins (admonitions for tip/note/warning/etc.)
49+
- `src/lib/` - Utilities, constants, theme configuration
50+
- `src/images/` - Images optimized by Astro
51+
52+
### Markdown Features
53+
54+
Blog posts support admonitions via remark-directive:
55+
56+
```markdown
57+
:::tip[Custom Title]
58+
Content here
59+
:::
60+
```
61+
62+
Types: `tip`, `note`, `important`, `caution`, `warning`
63+
64+
## Development Principles
65+
66+
1. **Astro-first**: Prefer Astro components over React. Use React only for interactive features that require client-side JS.
67+
68+
2. **Mobile-first responsive**: Use Tailwind breakpoint prefixes (`sm:`, `md:`, `lg:`) starting from mobile layouts.
69+
70+
3. **Accessibility required**: Semantic HTML, proper heading hierarchy, ARIA labels, keyboard navigation, WCAG AA contrast.
71+
72+
4. **Data-driven content**: Separate data from templates. Use content collections with Zod schemas.
73+
74+
5. **Lean and fast**: Optimize images, minimize JS, pre-build everything possible.
75+
76+
## Spec-Driven Development Workflow
77+
78+
This project uses a spec-driven development workflow:
79+
80+
1. **Specify** - Create feature branch and specification
81+
2. **Plan** - Generate implementation plan from spec
82+
3. **Tasks** - Break plan into executable tasks
83+
84+
Templates are in `templates/` and helper scripts in `scripts/`.
85+
86+
## Blog Article Creation
87+
88+
New blog articles should:
89+
90+
- Follow the template in `.claude/article-brief-template.md`
91+
- Use modern ESM syntax and async/await
92+
- Include FAQ section for schema markup
93+
- Place each article in its own folder under `src/content/blog/<slug>/`
94+
95+
### Content Writing Style
96+
97+
When writing or editing content, follow these guidelines:
98+
99+
**Tone and Readability**
100+
101+
- Use a friendly, approachable tone, almost colloquial, as if explaining to a colleague
102+
- Write conversationally while maintaining technical accuracy
103+
- Avoid overly formal or academic language
104+
105+
**Punctuation**
106+
107+
- Never use em dashes (—). Use commas, parentheses, or separate sentences instead
108+
109+
**Structure and Flow**
110+
111+
- Always provide context first: explain "what" and "why" before diving into "how"
112+
- Emphasize the "why": readers should understand not just how something works, but why it matters
113+
- Connect sections smoothly using:
114+
- Forward references: "In the next section, we'll see how to handle errors"
115+
- Backward references: "As we saw earlier, streams provide memory efficiency"
116+
- Previews: "Before we implement this, let's understand the underlying concept"
117+
118+
**Technical Explanations**
119+
120+
- Start with the problem or use case before the solution
121+
- Explain progressively: simple version first, then edge cases
122+
- Use real-world analogies for abstract concepts

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AGENTS.md

0 commit comments

Comments
 (0)