heymegabyte/agent-skills / 01-operating-system
operating-system
VerifiedSupreme policy layer governing all agent behavior. Autonomy, one-line prompt interpretation, speed standards, emphasis signal processing, cross-skill coordination, done definitions, conflict resolution. Loaded every prompt.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 6.4 KB |
| ai-native-coding.md | markdown | 4.3 KB |
| architecture-thought-loop.md | markdown | 8.3 KB |
| autonomous-orchestrator.md | markdown | 9.2 KB |
| context-engineering.md | markdown | 3.2 KB |
| one-line-saas.md | markdown | 3.0 KB |
| output-compression.md | markdown | 3.5 KB |
ai-native-coding.md
View on GitHub---
name: "AI-Native Coding"
description: "Code patterns optimized for AI agents, not human habits. Explicit over implicit, flat over nested, self-documenting names, co-located context. AI should build complete full-stack systems with tight integration across all docs (CLAUDE.md, MEMORY.md, skills). Pushes beyond human coding patterns that limit AI capability."
version: "2.0.0"
updated: "2026-04-23"
---
# AI-Native Coding
## Principles
### 1. Explicit Over Implicit
```typescript
// BAD: const u = await db.get(id);
// GOOD: const user = await database.getUserById(userId);
```
- Everything needed to understand code is IN the code
- Not in heads, Slack, or meetings
### 2. Flat Over Nested
- Early returns, flat structure
- AI reads linearly
- `if (!user) return notFound();` not nested ifs
### 3. Co-Located Context
```typescript
// BAD: const LIMIT = 10;
// GOOD: /** Max form submissions per IP per 60s (CF KV rate limiter) */ const RATE_LIMIT_MAX_REQUESTS = 10;
```
### 4. Complete Over Incremental
- AI writes 500 lines in one pass
- Every function: all error cases, edge cases, types, validation, docs
### 5. Connected Over Isolated
- **CLAUDE.md** — describes system
- **README** — describes product
- **Code comments** — link related code
- **JSDoc `@see`** — link to API docs
- **Skills** — reference each other
## Full-Stack Integration (one pass per feature)
1. Schema (D1)
2. Validation (Zod shared)
3. API (Hono + JSDoc)
4. UI (component)
5. Test (E2E)
6. SEO (meta + structured data)
7. Analytics (PostHog event)
8. Docs (CLAUDE.md)
9. Deploy (wrangler)
## Documentation as Code
- **CLAUDE.md** — update on every architecture change. Remove stale refs on delete/move.
- **MEMORY.md** — preferences, patterns, corrections, project decisions.
- **Skills** — new capability → update skill. Deprecated → remove + note why.
## File Structure
- Source files: <300 lines (split at 200)
- Test files: <200 lines
- Names for scanability: `api-checkout.ts`, `stripe-service.ts`, `queries-users.ts`
- Imports order:
1. External packages
2. Internal modules
3. Type-only imports
## AI Cost Management
| Use Case | API | Cost |
|----------|-----|------|
| Image gen | GPT Image 2 | ~$0.04 |
| Logo | Ideogram v3 | ~$0.03 |
| Video | Sora 2 | ~$0.10 |
| Alt text, translations, meta, keywords, a11y | Workers AI / Claude | $0 |
**Avoid:**
- AI background patterns (use CSS)
- AI icons (use Lucide)
- AI for simple text formatting
## Context Window Management
1. Use `_router.md` FIRST — load only needed skills
2. Reference `CONVENTIONS.md` (breakpoints, CSP, brand tokens, JSON-LD) — never duplicate
3. Prefer `file:line` pointers over pasting code blocks
4. Offload project decisions to `MEMORY.md`
5. **ToolSearch deferred tools** — bulk-load ALL at once (`query:"computer-use", max_results:30`); never one-by-one (each `select:` costs one full round-trip)
### Deduplication (canonical locations)
- Breakpoints, CSP, Hono starter, error envelope, Turnstile, deploy command, JSON-LD templates → `CONVENTIONS.md`
- Form test matrix, SEO audit, visual checklist → skill 07
## Research-Backed Patterns (2026)
- **AI-Native Development (InfoQ)** — Producer→Manager (review, don't write), Implementation→Intent (specs in markdown), Delivery→Discovery (multiple variants via worktrees), Content→Knowledge (knowledge bases from incidents)
- **CLAUDE.md Best Practices (HumanLayer)** — <200 lines (60 ideal). WHAT → WHY → HOW. Use `file:line` not snippets. Layer: global > team > personal.
- **Spec-Driven (Addy Osmani)** — Create `spec.md` before coding. Small single-purpose files. Commit after each task.
- **Code Comments for Agents** — Comment WHY not WHAT. Include gold standard reference. Show correct + incorrect examples.
- **Modern CSS (2026)** — `corner-shape: squircle`, Temporal API (replaces Moment.js), CSS scroll-driven animations (zero JS, 60fps)
- **llms.txt** — Add `/llms.txt` to every site with Quick Start + Architecture summary for AI discovery
## Ownership
- **Owns** — AI-native patterns, full-stack integration, docs-as-code, AI-optimized structure, creative AI cost management, context window strategy. See `STYLE_GUIDES.md` for Google TS + Node.js rules.
- **Never owns** — Implementation (→06), testing (→07), deployment (→08), design (→10), SEO (→28)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 470k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |