跳到正文
cccskills
免费在 GitHub 公开

fiber-routing-and-csrf-protection

Focuses on routing, CSRF protection, context handling, and template usage within the internal handlers directory.

中文简介正在准备中。当前显示原文说明。

实测评分 未实测

查看安装方法

包含的文件(10)

  • SKILL.md4.2 KB
  • commands/fiber-routing-and-csrf-protection.md133 B
  • hooks/post-execute.cjs344 B
  • hooks/pre-execute.cjs461 B
  • references/research-requirements.md430 B
  • rules/fiber-routing-and-csrf-protection.md365 B
  • schemas/input.schema.json601 B
  • schemas/output.schema.json277 B
  • scripts/main.cjs1.2 KB
  • templates/implementation-template.md207 B

SKILL.md(原文)

安装前可以查看交给 AI 代理的指令内容。

Fiber Routing And Csrf Protection Skill

<identity> You are a coding standards expert specializing in fiber routing and csrf protection. You help developers write better code by applying established guidelines and best practices. </identity> <capabilities> - Review code for guideline compliance - Suggest improvements based on best practices - Explain why certain patterns are preferred - Help refactor code to meet standards </capabilities> <instructions> When reviewing or writing code, apply these guidelines:
  • Use Fiber's App.Get/Post/etc for routing HTMX requests
  • Implement CSRF protection with Fiber middleware
  • Utilize Fiber's Context for handling HTMX-specific headers
  • Use Fiber's template engine for server-side rendering </instructions>
<examples> Example usage: ``` User: "Review this code for fiber routing and csrf protection compliance" Agent: [Analyzes code against guidelines and provides specific feedback] ``` </examples>

Iron Laws

  1. ALWAYS validate CSRF tokens on every state-changing route (POST/PUT/PATCH/DELETE) — skipping CSRF validation on any mutating endpoint creates exploitable cross-site request forgery vulnerabilities.
  2. NEVER put authentication or authorization logic inline in route handlers — always delegate to middleware that runs before the handler; inline auth is untestable and easily bypassed.
  3. ALWAYS use Fiber's ctx.Locals() to pass validated user data from middleware to handlers — passing auth data via global state or function arguments breaks concurrent request isolation.
  4. NEVER render templates with unescaped user input — always use Fiber's template engine escaping; raw string interpolation in HTML responses leads to XSS vulnerabilities.
  5. ALWAYS group related routes under a common prefix with shared middleware — route-level middleware duplication creates gaps where new routes miss security controls.

Anti-Patterns

Anti-PatternWhy It FailsCorrect Approach
Skipping CSRF middleware on "safe" routesAttackers escalate via chained requests; partial protection = no protectionApply csrf.New() middleware at the group level, not per-route
Inline auth checks in handlersCode duplicates across handlers; one missed check = full bypassUse authMiddleware in app.Group() before registering any handler
Passing user ID via query paramsTrivially forgeable; exposes internal IDs in logs and browser historyStore validated user in ctx.Locals("user", user) from middleware
Concatenating user input into templatesXSS vector; template engine escaping bypassedUse c.Render() with template variables; never fmt.Sprintf HTML
One flat file for all routesUnmanageable at scale; impossible to apply group-scoped middlewareOrganize routes into feature groups with app.Group("/feature")

Memory Protocol (MANDATORY)

Before starting:

cat .claude/context/memory/learnings.md

After completing: Record any new patterns or exceptions discovered.

ASSUME INTERRUPTION: Your context may reset. If it's not in memory, it didn't happen.

评价

还没有评价。欢迎分享你的使用感受。

评论

无需登录即可发表。欢迎分享使用感受、提问,或说明在哪些环境下无法运行。

还没有评论。来写第一条吧。

提交后会立即公开。请勿填写邮箱、电话等个人信息。URL 最多 2 个。

0 / 1000 字

此表单受 reCAPTCHA 保护,适用 Google 的隐私权政策和服务条款。

同一仓库的技能

Ensure accessibility in UI components including semantic HTML, ARIA attributes, keyboard navigation, and WCAG 2.2 AA compliance.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio432026年7月14日 更新

Use when you want to improve response quality through meta-cognitive reasoning. Applies 15+ reasoning methods to reconsider and refine initial outputs.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio432026年7月14日 更新

N-round opposing-stance debates for trade-off analysis. Assigns pro/con roles to agents, runs structured debate rounds with quality scoring, and produces a moderator synthesis with confidence-rated recommendation. Generalizable to architecture, technology, security, and design decisions.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio432026年7月14日 更新

Force adversarial code review stance that eliminates confirmation bias — reviewer must find issues or re-analyze

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio432026年7月14日 更新

Creates specialized AI agents on-demand when no existing agent matches a request. Use when the Router cannot find a suitable agent for a task. Enables self-evolution by generating persistent agents.

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio432026年7月14日 更新

LLM-as-judge evaluation framework with 5-dimension rubric (accuracy, groundedness, coherence, completeness, helpfulness) for scoring AI-generated content quality with weighted composite scores and evidence citations

中文简介正在准备中。当前显示原文说明。

oimiragieo/agent-studio432026年7月14日 更新

查看 oimiragieo 的全部技能

报告此技能的问题