Agent Skillsnetalertx/NetAlertX › api-development

api-development

GitHub

指导开发NetAlertX Flask REST API,涵盖入口点、现有路由、Bearer令牌认证及统一响应格式规范,用于创建或修改API端点。

.github/skills/api-development/SKILL.md netalertx/NetAlertX

Trigger Scenarios

创建新API端点 添加API路由 实现API功能 修改API响应

Install

npx skills add netalertx/NetAlertX --skill api-development -g -y
More Options

Non-standard path

npx skills add https://github.com/netalertx/NetAlertX/tree/main/.github/skills/api-development -g -y

Use without installing

npx skills use netalertx/NetAlertX@api-development

指定 Agent (Claude Code)

npx skills add netalertx/NetAlertX --skill api-development -a claude-code -g -y

安装 repo 全部 skill

npx skills add netalertx/NetAlertX --all -g -y

预览 repo 内 skill

npx skills add netalertx/NetAlertX --list

SKILL.md

Frontmatter
{
    "name": "api-development",
    "description": "Develop and extend NetAlertX REST API endpoints. Use this when asked to create endpoint, add API route, implement API, or modify API responses."
}

API Development

Entry Point

Flask app: server/api_server/api_server_start.py

Existing Routes

  • /device/<mac> - Single device operations
  • /devices - Device list
  • /devices/export/{csv,json} - Export devices
  • /devices/import - Import devices
  • /devices/totals - Device counts
  • /devices/by-status - Devices grouped by status
  • /nettools - Network utilities
  • /events - Event log
  • /sessions - Session management
  • /dbquery - Database queries
  • /metrics - Prometheus metrics
  • /sync - Synchronization

Authorization

All routes require header:

Authorization: Bearer <API_TOKEN>

Retrieve token via get_setting_value('API_TOKEN').

Response Contract

MANDATORY: All responses must include "success": true|false

return {"success": False, "error": "Description of what went wrong"}

On success:

return {"success": True, "data": result}
return {"success": False, "error": "Description of what went wrong"}

On success:

return {"success": True, "data": result}

Exception: The legacy /device/<mac> GET endpoint does not follow this contract to maintain backward compatibility with the UI.

Adding New Endpoints

  1. Add route in server/api_server/ directory
  2. Follow authorization pattern
  3. Return proper response contract
  4. Update UI to read/write JSON cache (don't bypass pipeline)

Version History

  • 8aec57b Current 2026-07-24 22:14

Same Skill Collection

.gemini/skills/devcontainer-management/SKILL.md
.gemini/skills/mcp-activation/SKILL.md
.gemini/skills/project-navigation/SKILL.md
.gemini/skills/settings/SKILL.md
.gemini/skills/skills-index/SKILL.md
.gemini/skills/testing-workflow/SKILL.md
.github/skills/authentication/SKILL.md
.github/skills/code-standards/SKILL.md
.github/skills/database-patterns/SKILL.md
.github/skills/database-reset/SKILL.md
.github/skills/devcontainer-configs/SKILL.md
.github/skills/devcontainer-services/SKILL.md
.github/skills/devcontainer-setup/SKILL.md
.github/skills/docker-build/SKILL.md
.github/skills/docker-prune/SKILL.md
.github/skills/mcp-activation/SKILL.md
.github/skills/plugin-run-development/SKILL.md
.github/skills/project-navigation/SKILL.md
.github/skills/sample-data/SKILL.md
.github/skills/settings-management/SKILL.md
.github/skills/skills-overview/SKILL.md
.github/skills/testing-workflow/SKILL.md

Metadata

Files
0
Version
548d698
Hash
e95e9037
Indexed
2026-07-24 22:14

- 위키
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 18:28
浙ICP备14020137号-1 $방문자$