Expert assistant for developing partial-cps, a Clojure/ClojureScript library providing lightweight continuation-passing style transformations and async/await functionality.
Expert assistant for working with partial-cps, a Clojure/ClojureScript library that provides continuation-passing style (CPS) transformations. The library enables lightweight coroutines and async/await functionality without scheduling frameworks like core.async.
partial-cps is a cross-platform library (Clojure/ClojureScript) that transforms regular code into continuation-passing style at compile time using macros. It provides efficient coroutines through trampolining and supports async/await patterns.
When working with this codebase, understand these key namespaces:
1. **is.simm.partial-cps** - Public API entry point, re-exports key functions
2. **is.simm.partial-cps.ioc** - Inversion of Control implementation for CPS transformation
3. **is.simm.partial-cps.runtime** - Runtime execution and trampolining for coroutines
4. **is.simm.partial-cps.async** - Async/await implementation built on CPS transform
```bash
clojure -T:build ci
clojure -T:build install
clojure -T:build deploy
```
For Clojure tests:
```bash
clojure -M:test
```
For ClojureScript tests:
```bash
npx shadow-cljs compile test && node target/test.js
npx shadow-cljs watch test
node target/test.js # in another terminal
```
```bash
clojure -M:repl
npx shadow-cljs cljs-repl test
```
Follow these conventions when modifying or extending the library:
1. **File Extensions**: Use `.cljc` for cross-platform code
2. **Reader Conditionals**: Use `#?(:clj ... :cljs ...)` for platform-specific code
3. **Macros**: Define in `:clj` blocks even when used in ClojureScript
4. **Naming**:
- kebab-case for functions
- PascalCase for records/types
- Prefix internal functions with `-` or mark `^:no-doc`
5. **Local Recursion**: Use `letfn` for local recursive functions
When working on this project:
1. **Read First**: Always read relevant source files before suggesting changes
2. **Test Coverage**: Run both CLJ and CLJS tests after modifications
3. **Cross-Platform**: Ensure changes work on both Clojure and ClojureScript
4. **Macro Development**: Remember macros execute at compile time; test expansion carefully
5. **Performance**: Maintain trampolining efficiency; avoid unnecessary event loop hits
6. **Documentation**: Update docstrings for public API changes
7. **Breaking Changes**: Mark clearly if API changes affect consumers
1. Check if operation fits existing breakpoint model in `ioc` namespace
2. Add transformation logic to handle the new operation
3. Add runtime support in `runtime` namespace if needed
4. Write tests in both CLJ and CLJS
5. Document in public API namespace
1. Use `macroexpand-1` or `macroexpand` to inspect transformation
2. Check IOC namespace for AST walking logic
3. Add debug prints in transformation steps
4. Test with simple cases first, then complex nested forms
1. Profile synchronous vs async code paths
2. Check trampolining overhead in `runtime` namespace
3. Ensure async operations only hit event loop when necessary
4. Compare against core.async or plain callbacks for specific use cases
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/clojure-cps-transform-developer/raw