Compress instructions
This commit is contained in:
parent
602fbe196f
commit
1390ed51e8
1 changed files with 15 additions and 99 deletions
114
AGENT.md
114
AGENT.md
|
|
@ -1,106 +1,22 @@
|
|||
# PnP Development Guidelines
|
||||
|
||||
## Philosophy
|
||||
Minimal PHP for modern conveniences. Prioritize longevity (decade-scale maintainability) by avoiding volatile dependencies. Strictly add only what's essential—readable, simple, and future-proof.
|
||||
|
||||
**Just enough, nothing more.** This framework applies minimal PHP to enable modern conveniences while remaining maintainable for years or decades. Avoid rapidly changing components and dependencies. The code should be readable, simple, and only add what is strictly necessary.
|
||||
## Core Constraints
|
||||
**Minimalism:** Only essential tech (HTML, PHP 8.4+, CSS). No JS, frameworks, build tools, or package managers. Comments only for major sections.
|
||||
|
||||
## Core Principles
|
||||
**Frontend:**
|
||||
- Classless, semantic HTML5
|
||||
- Modern CSS: nesting, `oklch()`, grid, `clamp()`, logical props
|
||||
- Responsive via fluid typography + flexible layouts
|
||||
|
||||
### Minimalism
|
||||
- Use only what is strictly necessary to achieve the goal
|
||||
- No frameworks, no build tools, no package managers for frontend code
|
||||
- Avoid abstractions unless they provide clear, lasting value
|
||||
- Sparse commenting—only mark main sections
|
||||
**Security:**
|
||||
- Path validation blocks traversal
|
||||
- Files restricted to document root
|
||||
- Strict MIME types + no direct user-input execution
|
||||
|
||||
### Technology Stack
|
||||
- **Allowed:** HTML, PHP (8.4+), CSS
|
||||
- **Not allowed:** JavaScript
|
||||
- Use modern PHP features when they improve readability or performance
|
||||
- Leverage modern CSS features for smart, efficient styling
|
||||
## Code Style
|
||||
**PHP:** Modern syntax (arrow functions, null coalescing, match). Type hints where practical. Ternary for simple conditionals. Single-purpose functions.
|
||||
|
||||
### File-Based Routing
|
||||
- Folder hierarchy dictates URL structure
|
||||
- Drop a file (`.md`, `.php`, `.html`) in a folder and it renders immediately
|
||||
- Assets placed in content directories are automatically accessible
|
||||
- Directories with subfolders trigger list views
|
||||
**CSS:** Variables, native nesting, grid layouts. `clamp()` over `@media`. Relative units > pixels.
|
||||
|
||||
### Template System
|
||||
- Custom templates override defaults (never modify defaults)
|
||||
- Custom templates live in `/app/custom/`
|
||||
- Default templates provide fallback behavior
|
||||
- Templates use PHP includes—simple and straightforward
|
||||
|
||||
### Content Conventions
|
||||
|
||||
#### File Naming
|
||||
- Cover images: `cover.jpg`, `cover.webp`, etc.
|
||||
|
||||
#### Date Formatting
|
||||
- Folder names can include dates: `YYYY-MM-DD-title`
|
||||
- Dates are automatically extracted and formatted (Norwegian format: "23. oktober 2025")
|
||||
- Metadata can override automatic date detection
|
||||
|
||||
#### Metadata
|
||||
- Use `metadata.ini` files for structured data
|
||||
- Common fields: `title`, `date`, `summary`
|
||||
- Metadata overrides automatic title/date extraction
|
||||
|
||||
### HTML & CSS Standards
|
||||
- Classless CSS where possible
|
||||
- HTML should be highly compliant with best practices
|
||||
- Use semantic HTML5 elements
|
||||
- Modern CSS features: custom properties, nesting, `oklch()` colors, grid, clamp, logical properties
|
||||
- Responsive by default using fluid typography and flexible layouts
|
||||
|
||||
### Security
|
||||
- Path validation prevents directory traversal
|
||||
- Files must be within document root
|
||||
- MIME types properly set for all served content
|
||||
- No direct execution of arbitrary user input
|
||||
|
||||
### Code Style
|
||||
|
||||
#### PHP
|
||||
- Modern syntax: arrow functions, null coalescing, match expressions
|
||||
- Use type hints when practical
|
||||
- Ternary operators for simple conditionals
|
||||
- Keep functions focused and single-purpose
|
||||
|
||||
#### CSS
|
||||
- Use CSS variables for theming
|
||||
- Nesting for component-scoped styles
|
||||
- Grid for layout, not tables or excessive flexbox
|
||||
- `clamp()` for responsive sizing
|
||||
- Avoid pixel values where relative units work better
|
||||
|
||||
#### Templates
|
||||
- Escape output: `htmlspecialchars()` for user-generated content
|
||||
- Short echo tags: `<?= $var ?>`
|
||||
- Minimize logic in templates—prepare data beforehand
|
||||
|
||||
### Performance Considerations
|
||||
- Page load time displayed in footer (transparency and pride in performance)
|
||||
- CSS versioned with MD5 hash for cache busting
|
||||
- Minimal HTTP requests through direct includes
|
||||
- No JavaScript means no parsing delay
|
||||
|
||||
### Extensibility Patterns
|
||||
- Third-party code goes in `/app/vendor/`
|
||||
- Custom code goes in `/app/custom/`
|
||||
|
||||
### List Views
|
||||
When a directory contains subdirectories:
|
||||
- Default list template generates automatic listings
|
||||
- Each item shows title, date, optional cover image, optional summary
|
||||
- Override with custom list template for specialized presentation
|
||||
|
||||
## What This Framework Is Not
|
||||
|
||||
- Not a CMS with an admin panel
|
||||
- Not a single-page application
|
||||
- Not a JavaScript framework
|
||||
|
||||
## What This Framework Is
|
||||
|
||||
- A simple, intuitive way to publish content
|
||||
- A foundation that will work for decades
|
||||
**Templates:** Escape output (`htmlspecialchars()` for UGC). Short echo tags (`<?= $var ?>`).
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue