Skip to content
Back to skills

Coding 2

ASecurity

Core engineering rules for implementation, refactors, and bug fixes, with indexed references for specialized workflows.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
developmentpythongoshellsqlreactnextjsdjangorailsgcptesting

Works with

  • cli
  • api

Security analysis

A92/100
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro scans all 20 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill coding-2 --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Coding 2?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Coding 2
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-coding-2/badge)](https://www.skillsdirectory.com/skills/david-li0406-coding-2)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: coding
description: Core engineering rules for implementation, refactors, and bug fixes, with indexed references for specialized workflows.
---

# Coding (Core + Indexed References)

Use this skill for most engineering work. When a task matches a reference trigger, open that reference immediately.

## Reference triggers (open the reference)

- UI/design/layout/components/motion -> `references/frontend-engineering/index.md`
- Infra/platform/ops/GCP/Cloud Run/secrets/storage/Supabase -> `references/platform-engineering/index.md`
- PR review/CI failures/gh -> `references/gh-pr-review-fix.md`
- JS/TS toolchain -> `references/bun.md`
- Auth/secrets/credentials -> `references/secrets-and-auth-guardrails.md`
- SolidJS -> `references/solidjs/index.md` (and `references/solidjs/`)
- React/Next.js -> `references/react/index.md`
- Tailwind -> `references/frontend-engineering/tailwindcss-full.md`

## Conflicts & precedence

- Security and secret guardrails override platform or tool-specific docs.
- Follow the repo’s established toolchain and lockfile when incompatible with general preferences.

## 1) Testing and bug fixes

- Every bug fix must include a test that fails before the fix and passes after.
- If a test is genuinely not feasible (rare), state why and how you verified the fix.
- Prefer minimal tests that reproduce the bug and lock in the expected behavior.

## 2) Async consistency

- If a function is async, all I/O inside it must be async.
- Avoid blocking calls in async code (`requests`, `open`, `psycopg2`, `time.sleep`).
- Sync is acceptable for CPU-bound or purely in-memory work.
- Use async equivalents: `httpx.AsyncClient`, `aiofiles`, `asyncpg`, `asyncio.sleep`.

## 3) Input validation at boundaries

- Validate all external input: request bodies, query params, path params, file uploads, webhooks, and external API responses.
- Prefer schema-based validation (Pydantic/Zod); keep validation at boundaries.

## 4) No code injection

- Never execute user-provided code or paths.
- No `eval`, `exec`, `new Function`, dynamic imports, or `shell=True` with user input.
- Sanitize paths; verify ownership before serving resources.

## 5) No secrets access

- Never read or print secrets in conversation context.
- Do not cat/grep `.env` files or secret stores.
- Refer to secret names only; check presence without echoing values.

## 6) Toolchain selection (must follow)

- If `uv.lock` or `pyproject.toml` exists, use `uv` for Python deps and tests (`uv sync`, `uv run pytest`).  
- Never use `pip install` or ad‑hoc venvs unless explicitly asked.  
- For JS/TS, prefer `bun` over npm/yarn/pnpm when possible.  

## 7) SQL safety and query limits

- Always use parameterized queries (no string concatenation or formatting).
- Every SELECT must be bounded (LIMIT, pagination, or a single-row predicate).
- Exceptions: `COUNT(*)`, aggregation with bounded cardinality, or `WHERE id = ?`.

## 8) Avoid race conditions

- Avoid check-then-act and read-modify-write without atomic guards.
- Use transactions, `ON CONFLICT`, `SELECT FOR UPDATE`, and constraints.

## 9) Error handling

- Never swallow exceptions. If you catch, log and re-raise or explain why continuing is safe.
- No empty or silent `except` blocks.

## 10) Configuration and constants

- Do not hardcode magic numbers, URLs, or config values.
- Centralize settings and use named constants.
- Avoid scattered `os.getenv()` calls outside the settings module.

## 11) Architecture and design

- Prefer composition over inheritance; inheritance only for true IS-A or framework requirements.
- Avoid circular imports; keep dependency direction one-way.
- Apply DRY and SOLID: small, focused functions and interfaces.

### DRY and SOLID quick reference

- **DRY**: Extract repeated logic into reusable functions
- **SRP**: One reason to change per function/class
- **OCP**: Extend via abstraction, don't modify existing code
- **LSP**: Subtypes must be substitutable for base types
- **ISP**: Small, focused interfaces - don't force unused methods
- **DIP**: Depend on abstractions, inject dependencies

Checklist:
1. Is this logic duplicated? → Extract it
2. Does this do one thing? → Split if not
3. Am I modifying existing code to extend? → Use abstraction
4. Could I use Protocol instead of ABC? → Prefer Protocol

### Composition over inheritance

Prefer composition (HAS-A) over inheritance (IS-A). Inject dependencies instead of extending classes.

Acceptable inheritance:
- ABCs for interface definition only
- Framework requirements (Django models, Exception subclasses)
- True IS-A relationships (rare)

Red flags:
- Hierarchy > 2 levels deep
- Overriding methods with different behavior
- Mixin classes
- `isinstance()` checks to determine behavior

### Core primitives first

- Prioritize fixes in core primitives (data models, invariants, core utilities, shared interfaces).
- Prefer additive, backward-compatible, reversible changes.
- Avoid patchwork (one-off conditionals, scattered flags, duplicated logic) unless no safe alternative exists.
- If a patch is required, say why the primitive-first path is blocked and propose a follow-up improvement.
- Always name the primitive being improved and how it reduces future patching.

## 12) Frontend safety

- No client-side console logging in production code.
- Frontend must not access databases or secrets; route privileged ops through a backend API.
- Do not use filesystem, process spawning, or dynamic code execution on the client.

## 13) Database changes

- Schema changes must update both schema and documentation.
- Avoid destructive migrations without explicit confirmation.
- Prefer reversible, incremental changes (add → migrate → remove).

## 14) Supabase local safety (if applicable)

- Never rename, delete, or edit applied migrations.
- Destructive commands (`db reset`, `db push --force`) require explicit confirmation.
- Create new migration files for changes instead of editing applied ones.

## 15) Type hints (Python)

- All Python functions require parameter and return type hints.
- Use modern syntax (`list[str]`, `dict[str, int]`, `X | None`).

## 16) Documentation hygiene

- Do not create unnecessary docs files.
- Necessary docs include user-requested docs, compliance/safety docs, spec-driven required specs for multi-step/exploratory work, and self-reporting logs when triggered.
- If spec-driven is active, the spec is required and does not violate this rule.

## References index (deep dives)

- `references/frontend-engineering/index.md` - UI craft, design system rules, components, SolidJS patterns
- `references/platform-engineering/index.md` - platform ops and data infra workflows (GCP, Supabase)
- `references/gh-pr-review-fix.md` - PR review triage + CI fix workflow
- `references/bun.md` - Bun runtime/tooling reference
- `references/secrets-and-auth-guardrails.md` - auth/secret handling and incident response
- `references/solidjs/index.md` and `references/solidjs/` - SolidJS performance and patterns
- `references/frontend-engineering/tailwindcss-full.md` - Tailwind CSS v4 reference

Files in this skill

  • SKILL.md6.9 KB
  • references/bun.md4.7 KB
  • references/frontend-engineering/components-and-motion.md14.7 KB
  • references/frontend-engineering/design-guidelines.md2.3 KB
  • references/frontend-engineering/index.md3.8 KB
  • references/frontend-engineering/tailwindcss-full.md25.4 KB
  • references/gh-pr-review-fix.md2.6 KB
  • references/platform-engineering/gcp-operations.md4.3 KB
  • references/platform-engineering/index.md333 B
  • references/platform-engineering/supabase.md9.9 KB
  • references/react/index.md1.1 KB
  • references/react/react-best-practices.md64 KB
  • references/react/rules/advanced-event-handler-refs.md1.4 KB
  • references/react/rules/advanced-use-latest.md1.2 KB
  • references/react/rules/async-api-routes.md1.1 KB
  • references/react/rules/async-defer-await.md2 KB
  • references/react/rules/async-dependencies.md942 B
  • references/react/rules/async-parallel.md654 B
  • references/react/rules/async-suspense-boundaries.md2.5 KB
  • references/react/rules/bundle-barrel-imports.md2.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…