xiaohongshu
xiaohongshu
justfile-quality-patterns
Level 1 patterns - test-watch, integration-test, complexity, loc, duplicates, slowtests
Full skill instructions
Add when CI matters. Fast feedback, test separation, complexity analysis, duplicate detection, test performance.
Continuous test execution on file changes.
# Run tests in watch mode
test-watch:
<continuous test execution on file changes>
Python:
test-watch:
uv run pytest-watch -v -m "not integration"
JavaScript:
test-watch:
pnpm vitest watch --project unit
Integration tests. No coverage threshold. Never blocks merge.
# Run integration tests with coverage report (no threshold)
integration-test:
<integration tests (marked/tagged), report only, never blocks>
Python:
integration-test:
uv run pytest -v -m "integration" --durations=10
JavaScript:
integration-test:
pnpm exec playwright test
Java:
integration-test:
mvn failsafe:integration-test
Key: Marked/tagged tests. Report coverage, no threshold. Never in check-all.
Detailed complexity report. Informational, not blocking.
# Detailed complexity report for refactoring decisions
complexity:
<per-function/class complexity, informational, does not block>
Python:
complexity:
uv run radon cc . -a -nc
JavaScript:
complexity:
pnpm exec eslint . --ext .ts,.tsx --format complexity
Java:
complexity:
mvn pmd:pmd
cat target/pmd.xml
Show N largest files by lines of code.
# Show N largest files by lines of code
loc N="20":
<show N largest files by LOC, sorted descending>
Universal (works all stacks):
loc N="20":
find . -name "*.py" -o -name "*.ts" -o -name "*.tsx" -o -name "*.java" | \
xargs wc -l | sort -rn | head -n {{N}}
Find duplicate code blocks. Informational, not blocking.
# Find duplicate code blocks
duplicates:
<detect copy-paste code, threshold 30%, informational>
Universal (requires jscpd):
duplicates:
jscpd . --threshold 30 --min-lines 5 --reporters console
Configuration: .jscpd.json
{
"threshold": 30,
"minLines": 5,
"minTokens": 50,
"ignore": [
"node_modules/**",
"dist/**",
"build/**",
"**/*.test.js",
"**/*.test.ts",
"**/*_test.py",
"**/*Test.java"
],
"reporters": ["console", "json"],
"format": ["javascript", "typescript", "python", "java"]
}
Install:
npm install -g jscpd (global)npx jscpd (no install)Key: Detects copy-paste opportunities. Used by /refactor analysis.
Show tests slower than threshold. Identifies optimization targets.
# Show tests slower than N milliseconds
slowtests N="50":
<run tests, filter by duration > N ms>
Python:
slowtests N="50":
pytest -v --durations=0 | python -c "import sys; [print(l) for l in sys.stdin if any(int(t.split('.')[0]) > int('{{N}}') for t in l.split() if t.endswith('s'))]"
JavaScript:
slowtests N="50":
vitest run --reporter=verbose --reporter=json --outputFile=.test-results.json && \
jq -r '.testResults[].assertionResults[] | select(.duration > {{N}}) | "\(.title): \(.duration)ms"' .test-results.json
Java:
slowtests N="50":
mvn test | grep "Time elapsed:" | awk -v n={{N}} '{ split($4,a,"."); if(a[1]*1000+a[2] > n) print $0 }'
Key: Identifies slow tests for optimization. Target: unit tests <50ms.
Run tests with detailed timing information.
# Profile all tests with detailed timing
test-profile:
<run all tests with comprehensive timing data>
Python:
test-profile:
pytest -v --durations=0 --cov=. --cov-report=term-missing
JavaScript:
test-profile:
vitest run --reporter=verbose --coverage
Java:
test-profile:
mvn test -X
Key: Full diagnostic timing. Use to analyze test suite performance.
Unit tests (unmarked):
Integration tests (marked/tagged):
Rationale: Quality gates must be fast. Integration tests validate but shouldn't slow feedback loop.
Python (pytest.ini):
[pytest]
markers =
integration: Integration tests requiring external services
unit: Fast unit tests (default, unmarked)
JavaScript (file naming):
src/lib/**/*.test.ts # Unit tests
src/components/**/*.test.tsx # Component tests
tests/integration/**/*.spec.ts # Integration tests (Playwright)
Java (JUnit tags):
@Tag("integration")
@Test
void testDatabaseConnection() { }
Unit tests: 96% (blocks merge) Integration tests: Report only (no threshold)
Why 96%?
Add when:
Skip when:
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