Borrowing it
Nothing to install: this file belongs to handsomejustin/mijia-control. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/handsomejustin/mijia-control/main/CLAUDE.mdgit clone --depth 1 https://github.com/handsomejustin/mijia-controlWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/handsomejustin/mijia-control/claude-md)<a href="https://agentmods.dev/instructions/handsomejustin/mijia-control/claude-md"><img src="https://agentmods.dev/badge/instructions/handsomejustin/mijia-control/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/handsomejustin/mijia-control/claude-md"><img src="https://agentmods.dev/badge/instructions/handsomejustin/mijia-control/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01151 | $0.01151 |
| Opus 5 | $0.00575 | $0.00575 |
| Sonnet 5 | $0.00230 | $0.00230 |
| Haiku 4.5 | $0.00115 | $0.00115 |
Grade A, and why
mijia-control CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
米家智能设备控制系统 — Flask + MySQL 应用,提供 Web UI、REST API(Flasgger 文档在 /api/docs/)、CLI、SocketIO 实时通信、MCP Server(AI Agent 工具)和 HomeKit 桥接。
底层依赖 mijiaAPI 包(v3.0+)与小米云端通信,通过 app/utils/mijia_pool.py 的 MijiaAPIAdapter 适配(从 DB 中的 auth_data 直接初始化,无文件 I/O)。
Build, Test & Lint
python run.py # 启动开发服务器(SocketIO,端口 5000)
python -m mcp_server # 启动 MCP Server(需 pip install -e ".[mcp]")
python -m app.homekit # 启动 HomeKit Bridge(需 pip install -e ".[homekit]")
pytest -v # 运行测试
pytest tests/test_services/ -v # 仅运行 service 层测试
ruff check . # Lint
ruff check --fix . # Lint 自动修复
ruff format . # 格式化
Database
- ORM: SQLAlchemy + Flask-Migrate(Alembic)
- MySQL(pymysql),测试库为
mijia_test - 迁移:
flask db migrate -m "描述"/flask db upgrade - 连接池配置:
pool_recycle=3600,pool_pre_ping=True
Architecture
app/
├── __init__.py # create_app() 工厂,注册扩展/蓝图/CLI/错误处理/安全头
├── extensions.py # 单例扩展(db, migrate, jwt, csrf, limiter, socketio)
├── api/ # REST API 蓝图(url_prefix=/api),JWT 认证
├── web/ # Web UI 蓝图,Session+CSRF 认证
│ ├── routes.py # 前端路由
│ ├── admin.py # 管理后台
│ └── socketio.py # SocketIO 事件
├── services/ # 业务逻辑层(不直接操作 HTTP request/response)
├── models/ # SQLAlchemy 模型
├── schemas/ # Marshmallow 序列化/校验
├── utils/ # MijiaAPIAdapter、统一响应格式、装饰器
├── cli/ # Click CLI 命令
└── homekit/ # HomeKit Bridge(pyhap,设备映射 + 桥接启动)
mcp_server/ # MCP Server(FastMCP,通过 httpx 调用 Flask API)
config/ # Flask 配置类(development/testing/production)
migrations/ # Alembic 迁移脚本
tests/ # pytest 测试
Key Conventions
- API 层只做参数校验和响应构造,业务逻辑放
services/ - 统一响应使用
app/utils/response.py的success()/error()辅助函数 - API 认证:JWT(
@jwt_required());Web 认证:Session + CSRF(Flask-Login + Flask-WTF) - 限流:Flask-Limiter,默认 200/day、50/hour
- Ruff 配置:
line-length=120,规则E, F, W, I,目标 Python 3.9+
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 9d ago First seen · 84 lines · 1,151 tokens per session scan A 25c0c9ea23b9
mijia-control CLAUDE.md is an instructions file published in the GitHub repository handsomejustin/mijia-control (64 stars, last pushed 3mo ago), licensed MIT. It adds 1,151 tokens to every session, about $0.0058 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
deepseek-harness AGENTS.md
AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.