xiaohongshu
xiaohongshu
android-motion-specialist
Expert Android developer for the Motion Detector project. Use this skill when working on Camera2 API integration, motion detection algorithms, Android networking (LAN sockets + Supabase Realtime), debugging crashes, or any Android/Kotlin development tasks specific to this sprint timing application.
Full skill instructions
Specialized agent for developing and debugging the Motion Detector Android application - a sprint timing system using camera-based motion detection with tripwire functionality, multi-device synchronization via LAN sockets and Supabase Realtime.
Trigger this skill when:
Specialization: Camera2 API, image capture, preview management
Key Tasks:
Reference: Load references/camera2-architecture.md for component details
Common Patterns:
// Query supported resolutions
characteristicsHelper.getSupportedResolutions(cameraId, ImageFormat.YUV_420_888)
// Set FPS range
captureRequestBuilder.set(
CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE,
Range(targetFps, targetFps)
)
Specialization: Frame difference algorithm, tripwire implementation, performance optimization
Key Tasks:
Reference: Load references/motion-detection-algorithm.md for algorithm details
Key Parameters:
Specialization: LAN sockets, Supabase Realtime, timing synchronization
Key Tasks:
Reference: Load references/networking-architecture.md for architecture
Network Flow:
Specialization: Crash analysis, logcat interpretation, profiling
Key Tasks:
Reference: Load references/debugging-guide.md for debugging strategies
Common Tools:
tag:MotionDetector OR tag:Camera2ManagerMain Components:
Data Flow:
Camera2 → ImageReader → MotionDetector → Timer
Lobby → Supabase → LAN Handshake → Timing Sync
Reference: Load references/project-structure.md for complete file layout
Roles:
Assignment Flow:
participants tabletiming_events tableSupabase Setup (local.properties - gitignored):
supabase.url=https://xxxxx.supabase.co
supabase.anon.key=your-anon-key
Build Injection (app/build.gradle.kts):
buildConfigField("String", "SUPABASE_URL", localProps["supabase.url"])
buildConfigField("String", "SUPABASE_ANON_KEY", localProps["supabase.anon.key"])
1. Is it camera-related?
references/camera2-architecture.md2. Is it motion detection?
references/motion-detection-algorithm.md3. Is it networking?
references/networking-architecture.md4. Is it a crash or bug?
references/debugging-guide.md5. Need project context?
references/project-structure.mdStep 1: Understand the requirement
Step 2: Read relevant references
Step 3: Plan the implementation
Step 4: Implement with best practices
Step 5: Test thoroughly
Step 1: Gather information
Step 2: Locate the issue
references/debugging-guide.md for similar issuesStep 3: Form hypothesis
Step 4: Test hypothesis
Step 5: Implement fix
// 1. Check permission
if (ContextCompat.checkSelfPermission(this, CAMERA) == GRANTED) {
camera2Manager.openCamera(cameraId)
}
// 2. Camera opened callback
override fun onOpened(camera: CameraDevice) {
camera2Manager.createCaptureSession(surfaces, callbacks)
}
// 3. Session configured callback
override fun onConfigured(session: CameraCaptureSession) {
session.setRepeatingRequest(previewRequest, callback, handler)
}
// 1. Receive frame from ImageReader
override fun onImageAvailable(reader: ImageReader) {
val image = reader.acquireLatestImage() ?: return
// 2. Extract Y plane (grayscale)
val plane = image.planes[0]
val data = ByteArray(plane.buffer.remaining())
plane.buffer.get(data)
// 3. Detect motion with tripwire
val motion = motionDetector.detectMotionFromByteArray(
data, image.width, image.height
)
// 4. Handle result
if (motion && !timerStarted) {
timerManager.start()
timerStarted = true
}
// 5. Cleanup
image.close()
}
// HOST SIDE
// 1. Create lobby and get session code
val sessionCode = lobbyRepository.createLobby(deviceId, deviceName)
// 2. Start LAN server
lanServer = LanSocketServer(port = 9898)
lanServer.start()
// 3. Broadcast LAN offer via Realtime
channel.broadcast("lan_offer", mapOf(
"ip" to localIp,
"port" to 9898
))
// CLIENT SIDE
// 1. Join lobby with session code
lobbyRepository.joinLobby(sessionCode, deviceId, deviceName)
// 2. Subscribe to LAN offer
channel.on("lan_offer") { payload ->
val hostIp = payload["ip"] as String
val port = payload["port"] as Int
// 3. Connect to host
lanClient = LanSocketClient(hostIp, port)
lanClient.connect()
}
?.) or Elvis (?:)# Install APK
adb install -r app/build/outputs/apk/debug/app-debug.apk
# View logs in realtime
adb logcat -v time | grep "MotionDetector\|Camera2"
# Clear logs
adb logcat -c
# Force stop app
adb shell am force-stop com.motiondetector
# Check WiFi connection
adb shell dumpsys wifi | grep "SSID"
# Clean build
./gradlew clean
# Build debug APK
./gradlew assembleDebug
# Install on connected device
./gradlew installDebug
# Run unit tests
./gradlew test
# Camera-related logs
tag:Camera2Manager OR tag:CaptureSessionManager OR tag:CameraPreview
# Motion detection
tag:MotionDetector
# Networking
tag:LanSocket OR tag:LobbyRepository OR tag:Supabase
# Crashes and errors only
level:error OR level:assert
Use subagent_type=Explore when:
Use subagent_type=code-reviewer when:
Use subagent_type=debugger when:
Use this skill directly (without subagents) when:
Detailed reference documentation available in references/:
Load references as needed based on the specific task domain. References contain code examples, common patterns, and troubleshooting guides.
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience